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/JobsPart/Common/StationTask.cs      |    2 
 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/新文件夹/GetLocation.cs |    9 +++-
 代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs                    |   60 ++++++++++++++++--------------
 代码管理/PCS/WCS_Server/WIDESEA_WebApi/appsettings.json                 |    4 +-
 4 files changed, 41 insertions(+), 34 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;
 
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs"
index c2f4dce..141e4f6 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs"
@@ -408,7 +408,7 @@
             if (!Pipeline_client.IsConnected) throw new Exception("涓庨摼鏉℃満杩炴帴瓒呮椂锛�");
             foreach (var item in target)
             {
-                TargetLocation = stationinfoRepository.Find(x => x.stationCode == item && x.location_state == "Empty" /*LocationStateEnum.Empty.ToString()*/ && x.enable).FirstOrDefault();
+                TargetLocation = stationinfoRepository.Find(x => x.stationCode == item && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).FirstOrDefault();
 
                 var PalletSignal = Pipeline_client.ReadByOrder<Int16>("R_PalletSignal", item);//璇诲彇鎵樼洏淇″彿:1:鏈�,2鏃�
                 var MaterialSignal = Pipeline_client.ReadByOrder<Int16>("R_MaterialSignal", item);//璇诲彇璐х墿淇″彿:1:鏈�,2鏃�
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/\346\226\260\346\226\207\344\273\266\345\244\271/GetLocation.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/\346\226\260\346\226\207\344\273\266\345\244\271/GetLocation.cs"
index 730c670..72992aa 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/\346\226\260\346\226\207\344\273\266\345\244\271/GetLocation.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/\346\226\260\346\226\207\344\273\266\345\244\271/GetLocation.cs"
@@ -47,7 +47,10 @@
                     if (inventory != null)
                     {
                         var station = stationinfoRepository.FindFirst(x => x.stationCode == inventory.stationCode);
-                        if (!string.IsNullOrEmpty(area1) && station.area != area1)//鍏ュぇ鎵樼洏搴撳尯
+
+                        #region 鍏ュぇ鎵樼洏搴撳尯
+                        //if (!string.IsNullOrEmpty(area1) && station.area != area1)
+                        if (area1 == "4")
                         {
                             #region 瀵绘壘宸插垎閰嶅悓鍥惧彿鍏ュ簱浠诲姟搴撲綅
                             TargetLocation = stationinfoRepository.Find(x => x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.InBusy.ToString() && x.area == area1).FirstOrDefault();
@@ -69,9 +72,9 @@
                                 if (!stationinfoRepository.Find(x => x.line == Location.line && x.area == Location.area && x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.OutBusy.ToString()).Any()) return Location;
                             }
                             #endregion
-
-
                         }
+                        #endregion
+
                         if (station.area == "1")
                         {
                             TargetLocation = stationinfoRepository.Find(x => x.line == station.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == station.area).OrderBy(x => x.column).FirstOrDefault();//鎸夎瀛樻斁
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WebApi/appsettings.json" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WebApi/appsettings.json"
index 1d06fa1..1ecb410 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WebApi/appsettings.json"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WebApi/appsettings.json"
@@ -16,8 +16,8 @@
   "Connection": {
     "DBType": "MsSql", //MySql/MsSql/PgSql  //鏁版嵁搴撶被鍨嬶紝濡傛灉浣跨敤鐨勬槸sqlserver姝ゅ搴旇缃负MsSql
     //sqlserver杩炴帴瀛楃涓睵@ssw0rd
-    //"DbConnectionString": "Data Source=192.168.12.101;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=123456;Connect Timeout=500;",
-    "DbConnectionString": "Data Source=.;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=P@ssw0rd;Connect Timeout=500;",
+    "DbConnectionString": "Data Source=192.168.12.101;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=123456;Connect Timeout=500;",
+    //"DbConnectionString": "Data Source=.;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=P@ssw0rd;Connect Timeout=500;",
 
     //mysql杩炴帴瀛楃涓�(鍗囩骇EFCore3.1鍒版椂宸插皢mysql杩炴帴瀛楃涓蹭慨鏀�,2019-12-20)
     // "DbConnectionString": " Data Source=127.0.0.1;Database=netcoredev;AllowLoadLocalInfile=true;User ID=root;Password=123456;allowPublicKeyRetrieval=true;pooling=true;CharSet=utf8;port=3306;sslmode=none;",

--
Gitblit v1.9.3