From 267ffc1263e9975adf0d3dcca9ccc5d7dbd239f6 Mon Sep 17 00:00:00 2001
From: zxx <zxx>
Date: 星期六, 31 五月 2025 17:54:14 +0800
Subject: [PATCH] jushi

---
 HH.WCS.Mobox3/HH.WCS.Mobox3.JuShi/process/TaskProcess.cs |   46 ++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 38 insertions(+), 8 deletions(-)

diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.JuShi/process/TaskProcess.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.JuShi/process/TaskProcess.cs
index 5f6880f..7687ea1 100644
--- a/HH.WCS.Mobox3/HH.WCS.Mobox3.JuShi/process/TaskProcess.cs
+++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.JuShi/process/TaskProcess.cs
@@ -824,21 +824,51 @@
                     {
                         list.RemoveAll(s => loca.Contains(s.S_CODE));
                     }
-                    //杩囨护涓�笅 鍏佽杩涘叆鐨勬墠鍒嗛厤
-                    var reservoirs = Settings.ReservoirAreas.Where(s => s.areaName == "绔嬪簱鍏ュ簱鍖�).FirstOrDefault();
-                    if (reservoirs.areaCode.Equals(area))
+                    // 3. 濡傛灉鏄珛搴撳叆搴撳尯锛屾鏌�PLC 鏄惁鍏佽鍗歌浇
+                    var reservoirs = Settings.ReservoirAreas.FirstOrDefault(s => s.areaName == "绔嬪簱鍏ュ簱鍖�);
+                    if (reservoirs != null && reservoirs.areaCode.Equals(area))
                     {
                         var plcDeviceTable = S7Helper.plcDeviceTables;
-                        foreach (var l in list)
+                        // 鍏堟敹闆嗚绉婚櫎鐨勮揣浣嶏紝閬垮厤鍦ㄩ亶鍘嗘椂淇敼闆嗗悎
+                        List<Location> locationsToRemove = new List<Location>();
+
+                        foreach (var location in list)
                         {
-                            var safeInteraction = Settings.SafeInteractions.Where(s => s.location == l.S_CODE).FirstOrDefault();
-                            var res = int.Parse(plcDeviceTable.RGVAllowUnload[safeInteraction.code].ToString().Substring(1, 1));
-                            if (res!=1)
+                            var safeInteraction = Settings.SafeInteractions.FirstOrDefault(s => s.location == location.S_CODE);
+                            if (safeInteraction != null)
                             {
-                                list.Remove(l);
+                                // 妫�煡 PLC 鏄惁鍏佽鍗歌浇锛堝彇绗簩浣嶆暟瀛楋紝鍒ゆ柇鏄惁涓�1锛�+                                string allowUnloadStr = plcDeviceTable.RGVAllowUnload[safeInteraction.code].ToString();
+                                int allowUnload = int.Parse(allowUnloadStr.Substring(1, 1));
+
+                                if (allowUnload != 1)
+                                {
+                                    locationsToRemove.Add(location); // 涓嶅厑璁稿嵏杞斤紝鍔犲叆寰呯Щ闄ゅ垪琛�+                                }
                             }
                         }
+
+                        // 閬嶅巻缁撴潫鍚庯紝鍐嶇粺涓�Щ闄や笉绗﹀悎鏉′欢鐨勮揣浣�+                        foreach (var locToRemove in locationsToRemove)
+                        {
+                            list.Remove(locToRemove);
+                        }
                     }
+                    ////杩囨护涓�笅 鍏佽杩涘叆鐨勬墠鍒嗛厤
+                    //var reservoirs = Settings.ReservoirAreas.Where(s => s.areaName == "绔嬪簱鍏ュ簱鍖�).FirstOrDefault();
+                    //if (reservoirs.areaCode.Equals(area))
+                    //{
+                    //    var plcDeviceTable = S7Helper.plcDeviceTables;
+                    //    foreach (var l in list)
+                    //    {
+                    //        var safeInteraction = Settings.SafeInteractions.Where(s => s.location == l.S_CODE).FirstOrDefault();
+                    //        var res = int.Parse(plcDeviceTable.RGVAllowUnload[safeInteraction.code].ToString().Substring(1, 1));
+                    //        if (res!=1)
+                    //        {
+                    //            list.Remove(l);
+                    //        }
+                    //    }
+                    //}
                     
 
                     //绗﹀悎鏉′欢鐨勬帓搴忛�绗竴涓� 鍏堟壘绗竴涓�
--
Gitblit v1.9.1