From 803e01128820d51a9308d72f1c8e746f7f9f322a Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期五, 10 五月 2024 14:10:34 +0800
Subject: [PATCH] 优化桁架下料交互逻辑

---
 代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs |   60 ++++++++++++++++++++++++++++++++----------------------------
 1 files changed, 32 insertions(+), 28 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs"
index e5df10a..bffb2d7 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs"
@@ -444,14 +444,6 @@
                         }
                         #endregion
 
-                        var Stations = stationinfoRepository.Find(x => x.area == Pipeline.area_code(name)).OrderBy(x => x.lastUpdateTime).ToList();
-
-                        #region 涓嬫枡浣嶆槸鍚︿负绌虹姸鎬佸悓姝ョ粰妗佹灦
-                        foreach (var station in Stations)
-                        {
-                            client.WriteByOrder(station.stationCode, station.location_state != LocationStateEnum.Stroge.ToString(), name);
-                        }
-                        #endregion
 
                         if (finished && !updatefinished)
                         {
@@ -481,11 +473,11 @@
                             #endregion
 
                             var AreaNr = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "W_AreaNr").First(), client);
-                            if (AreaNr == 0)
-                            {
-                                client.WriteByOrder("W_Storage_update", true, name);//璐т綅鐘舵�佹洿鏂�
-                                continue;
-                            }
+                            //if (AreaNr == 0)
+                            //{
+                            //    client.WriteByOrder("W_Storage_update", true, name);//璐т綅鐘舵�佹洿鏂�
+                            //    continue;
+                            //}
 
                             #region 鍒ゆ柇鍖哄煙鍙锋槸鍚︿竴鑷�
                             var area = client.ReadByOrder<Int16>("place_prog", name);//鏀炬枡瀹屾垚鐨勫尯鍩熷彿
@@ -526,21 +518,6 @@
                                         throw new Exception($"{station.stationCode}宸插瓨鍦ㄨ溅杞甋N鍙凤細{Wheel_SN}");
                                 }
 
-                                station.bindSN = string.IsNullOrEmpty(station.bindSN) ? Wheel_SN : station.bindSN + "," + Wheel_SN;
-                                station.billetID = string.IsNullOrEmpty(station.billetID) ? Mes_Work.billetID.ToString() : station.billetID + "," + Mes_Work.billetID;
-                                station.quantity++;
-                                if (station.quantity == 1)
-                                {
-                                    station.stationType = Mes_Work.drawingNo;
-                                    station.Number = Mes_Work.workOrder;
-                                    station.heatNumber = Mes_Work.heatID;
-                                    station.tray_status = "StrogeTray";
-                                }
-
-                                var count = stationinfoRepository.Update(station, true);
-                                if (count < 1)
-                                    throw new Exception($"涓嬫枡浣嶄俊鎭洿鏂板け璐ワ紒涓嬫枡浣嶇紪鍙凤細{station.stationCode}");
-
                                 #region 娓呯┖缁欐鏋剁殑涓嬫枡淇℃伅
                                 client.WriteByOrder("W_IndexNr", (Int16)0, name);//鎵樼洏涓婄殑绗嚑涓溅杞�
                                 client.WriteByOrder("W_Storage_Type", (Int16)0, name);//鎵樼洏绫诲瀷1-妯斁;2-绔栨斁(鏆傛椂鍙湁妯斁鎵樼洏)
@@ -555,6 +532,24 @@
                                 //    $"澶勭悊鍐欏叆妗佹灦淇℃伅锛歕nW_AreaNr锛歿0}\nW_IndexNr锛歿0}\nW_Storage_Type锛歿0}\n\n" +
                                 //    $"鍐欏叆妗佹灦淇℃伅锛歕nW_Storage_update锛歿true}\nW_Enabl_Load锛歿false}", "PCS");
                                 #endregion
+
+                                #region 璐т綅鐘舵�佹洿鏂�
+                                station.bindSN = string.IsNullOrEmpty(station.bindSN) ? Wheel_SN : station.bindSN + "," + Wheel_SN;
+                                station.billetID = string.IsNullOrEmpty(station.billetID) ? Mes_Work.billetID.ToString() : station.billetID + "," + Mes_Work.billetID;
+                                station.quantity++;
+                                if (station.quantity == 1)
+                                {
+                                    station.stationType = Mes_Work.drawingNo;
+                                    station.Number = Mes_Work.workOrder;
+                                    station.heatNumber = Mes_Work.heatID;
+                                    station.tray_status = "StrogeTray";
+                                }
+
+                                var count = stationinfoRepository.Update(station, true);
+                                if (count < 1)
+                                    throw new Exception($"涓嬫枡浣嶄俊鎭洿鏂板け璐ワ紒涓嬫枡浣嶇紪鍙凤細{station.stationCode}"); 
+                                #endregion
+
 
                                 #region 淇敼宸ュ崟鐘舵��
                                 var Detail = mes_DetailRepository.FindFirst(x => x.jobID == Mes_Work.jobID && x.SN == Mes_Work.SN);
@@ -572,6 +567,15 @@
                             }
                         }
 
+                        var Stations = stationinfoRepository.Find(x => x.area == Pipeline.area_code(name)).OrderBy(x => x.lastUpdateTime).ToList();
+
+                        #region 涓嬫枡浣嶆槸鍚︿负绌虹姸鎬佸悓姝ョ粰妗佹灦
+                        foreach (var station in Stations)
+                        {
+                            client.WriteByOrder(station.stationCode, station.location_state != LocationStateEnum.Stroge.ToString(), name);
+                        }
+                        #endregion
+
                         var Request = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Request_Load").First(), client);
                         if (!Request) continue;
 

--
Gitblit v1.9.3