From d2cef0150abe6d14cbfa60c8845795b91a1f5f97 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期六, 20 四月 2024 19:50:53 +0800
Subject: [PATCH] 添加入库触发条件,修改上料区任务逻辑

---
 代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs |   44 +++-----------------------------------------
 1 files changed, 3 insertions(+), 41 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs"
index 3f299ad..eed63b1 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs"
@@ -79,12 +79,6 @@
 
                 ///鏌ユ壘涓婃枡鍖虹殑璐т綅
                 var Stations = stationinfoRepository.Find(x => x.area == area_code(number)).OrderBy(x => x.lastUpdateTime);//鏍规嵁鏃堕棿鍏堝悗鎺掑簭
-                //缂撳瓨鏋舵湭鍚敤绂佹妗佹灦杩涘叆
-                //foreach (var station in Stations)
-                //{
-                //    if (!station.enable || station.location_state != LocationStateEnum.Stroge.ToString())
-                //        Gantry_client.WriteByOrder("W_RequestUnload", false, number);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆
-                //}
 
                 var Station = Stations?.Where(x => x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderBy(x => x.quantity).FirstOrDefault();
                 if (Station != null)
@@ -107,7 +101,6 @@
                         WriteDBLog.Error("涓婃枡鍖�", $"鍐欏叆妗佹灦淇℃伅锛歕nW_RequestUnload锛歠alse\n\n{Station.stationCode}杞﹁疆鏁伴噺涓嶴N鍙锋暟閲忎笉涓�鑷�", "PCS");
                         #endregion
                         return;
-                        //throw new Exception("涓婃枡浣嶈溅杞暟閲忎笌SN鍙锋暟閲忎笉涓�鑷达紝涓婃枡浣嶇紪鍙凤細" + Station.stationCode);
                     }
                     var details = plcRepository.Find(x => x.plcdetail_iotype == plc.plcinfo_iotyep && x.plcdetail_number == Station.stationCode).ToList();
                     var PalletSignal = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_PalletSignal").First(), client);//璇诲彇鎵樼洏淇″彿:1:鏈�,2鏃�
@@ -150,7 +143,6 @@
                             Station.location_state = LocationStateEnum.Abnormal.ToString();
                             Station.remark = $"鏈煡璇㈠埌SN鍙凤細{SNS[SNS.Length - 1]}鐨勮鍗�";
                             stationinfoRepository.Update(Station, true);
-                            //throw new Exception($"鏈煡璇㈠埌SN鍙凤細{SNS[SNS.Length - 1]}鐨勮鍗曪紝涓婃枡浣嶇紪鍙凤細{Station.stationCode}");
                             WriteDBLog.Error("涓婃枡鍖轰俊鎭煡璇�", $"鍐欏叆妗佹灦淇℃伅锛歕nW_RequestUnload锛歠alse\n\n{Station.stationCode}鏈煡璇㈠埌SN鍙凤細{SNS[SNS.Length - 1]}鐨勮鍗�", "PCS");
                             return;
                         }
@@ -168,7 +160,6 @@
                         if (Station.quantity <= 0)
                         {
                             Station.stationType = string.Empty;
-                            //Station.location_state = LocationStateEnum.Empty.ToString();
                             Station.Number = string.Empty;
                             Station.heatNumber = string.Empty;
                             Station.tray_status = "EmptyTray";
@@ -177,7 +168,6 @@
                         if (count < 1)
                         {
                             WriteDBLog.Error("鍙栨枡瀹屾垚", $"涓婃枡浣嶄俊鎭洿鏂板け璐ワ紒涓婃枡浣嶇紪鍙凤細{Station.stationCode}", "PCS");
-                            //throw new Exception($"涓婃枡浣嶄俊鎭洿鏂板け璐ワ紒涓婃枡浣嶇紪鍙凤細{Station.stationCode}");
                             return;
                         }
 
@@ -186,7 +176,6 @@
                         Gantry_client.WriteByOrder("W_IndexNr", (Int16)0, number);//鎵樼洏涓婄殑绗嚑涓溅杞�
                         Gantry_client.WriteByOrder("W_Storage_Type", (Int16)0, number); //鎵樼洏绫诲瀷1-妯斁;2-绔栨斁
                         Gantry_client.WriteByOrder("W_Wheel_Type", (Int16)0, number);//杞﹁疆绫诲瀷
-                        //Gantry_client.WriteByOrder("W_Wheel_id", SNS[SNS.Length - 1], number);//杞﹁疆SN鍙�
                         #endregion
 
                         Gantry_client.WriteByOrder("W_Storage_update", true, number);//璐т綅鐘舵�佹洿鏂�
@@ -220,7 +209,6 @@
             catch (Exception ex)
             {
                 WriteDBLog.Error("涓婃枡鍖�", $"閿欒淇℃伅锛歿ex.Message}", "PCS");
-                //WritePCSLog.LogAdd(requestin.AreaNr.ToString(), respone.success == 1 ? "鎴愬姛 " : "澶辫触", "WMS", "AGV", json, JsonConvert.SerializeObject(respone), remark, "妫�娴嬬嚎涓婃枡鍖�", ex.Message);
             }
         }
         /// <summary>
@@ -240,13 +228,13 @@
                 List<string> stationCodes = new List<string>() { "S01001001", "S01001002", "W01001001", "W01001002", "W01001003" };
                 foreach (var stationCode in stationCodes)
                 {
-                    if (agvtaskService.Find(x => x.agv_fromaddress == stationCode || x.agv_toaddress == stationCode).Any())
+                    if (agvtaskService.Find(x => x.agv_fromaddress == stationCode /*|| x.agv_toaddress == stationCode*/).Any())
                         continue;
+                    var station = stationinfoRepository.Find(x => x.stationCode == stationCode && x.enable).FirstOrDefault();
+                    if (station == null) continue;
                     var details = plcRepository.Find(x => x.plcdetail_iotype == plc.plcinfo_iotyep && x.plcdetail_number == stationCode).ToList();
                     var PalletSignal = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_PalletSignal").First(), client);//璇诲彇鎵樼洏淇″彿:1:鏈�,2鏃�
                     var MaterialSignal = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_MaterialSignal").First(), client);//璇诲彇璐х墿淇″彿:1:鏈�,2鏃�
-                    var station = stationinfoRepository.Find(x => x.stationCode == stationCode && x.enable).FirstOrDefault();
-                    if (station == null) continue;
                     if (PalletSignal == 1 && MaterialSignal == 2 && (station.stationCode.Contains("S0100100") ? station.tray_status == "EmptyTray" : true))
                     {
                         var area = station.tray_type == "SmallTray" ? "11" : "10";
@@ -275,32 +263,6 @@
                         if (EmptyStation == null)//鏌ユ壘搴撳唴绌烘墭鐩�
                             EmptyStation = GetStation.EmptyPalletStation(area);
 
-                        #region 鏌ユ壘搴撳尯涓�绌烘墭鐩樼┖璐т綅
-                        // EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains("A") && x.location_state != LocationStateEnum.Busy.ToString() && x.enable)
-                        //.OrderBy(x => x.column).ThenByDescending(x => x.line).FirstOrDefault();//鏌ユ壘娌℃湁浠诲姟鐨勭┖鎵樼洏璐т綅
-
-                        // if (EmptyStation != null)
-                        // {
-                        //     if (stationinfoRepository.Find(x => x.area == EmptyStation.area && x.stationCode.Contains("A") && x.column == EmptyStation.column && x.location_state.Contains("Busy")).Any())
-                        //     {
-                        //         EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains("A") && x.column != EmptyStation.column && x.location_state != LocationStateEnum.Busy.ToString() && x.enable).OrderBy(x => x.column).ThenByDescending(x => x.line).FirstOrDefault();//鎺掗櫎褰撳垪瀛樺湪浠诲姟鐨勮揣浣�
-                        //     }
-                        //     if (EmptyStation != null && EmptyStation.line == 2)//濡傛灉浠诲姟瀛樺湪绗簩琛�,鎺掓煡绗竴琛屾槸鍚︽湁璐�
-                        //     {
-                        //         if (stationinfoRepository.Find(x => x.area == EmptyStation.area && x.stationCode.Contains("A") && x.column == EmptyStation.column && x.line == 1 && x.location_state != LocationStateEnum.Empty.ToString()).Any()) EmptyStation = null;
-                        //     }
-                        // }
-
-                        // if (EmptyStation == null)
-                        // {
-                        //     EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains(area == "10" ? "D" : "C") && x.location_state == LocationStateEnum.Busy.ToString() && x.enable).OrderByDescending(x => x.column).FirstOrDefault();//鏈�鍚庝竴涓揣浣嶆湁浠诲姟鍒欎笉鑳界敓鎴愬叆搴撲换鍔�
-                        //     if (EmptyStation != null) continue;
-                        //     EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains(area == "10" ? "D" : "C") && x.location_state == LocationStateEnum.Stroge.ToString() && x.enable).OrderByDescending(x => x.column).FirstOrDefault();//鎵炬渶澶栭潰娌″爢婊�5涓殑璐т綅
-                        //     if (EmptyStation == null)
-                        //         EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains(area == "10" ? "D" : "C") && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.column).FirstOrDefault();
-                        // }
-
-                        #endregion
 
                         if (EmptyStation != null)
                         {

--
Gitblit v1.9.3