From 95cd9faab13b3c5447a8ae3d658de7296de5fc52 Mon Sep 17 00:00:00 2001
From: czw <selecti@yeah.net>
Date: 星期三, 25 六月 2025 13:42:17 +0800
Subject: [PATCH] 1

---
 2025年6月12日/AuxAllWCS/Build/Project/代码/VS自定义类/AutoThread.cs |   52 +++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 35 insertions(+), 17 deletions(-)

diff --git "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs" "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs"
index b9d7a95..63c610a 100644
--- "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs"
+++ "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs"
@@ -237,7 +237,8 @@
                         LogHelper.Info($"{VERX.location[0]}鐢宠mes浠诲姟缁撴灉{str}");
                         if (str.Contains("true"))
                         {
-                            tag.wxr1.R44_LAST = true;
+                            //tag.wxr1.R44_LAST = true;
+                            RedisHelper.Add($"缁村笇灏旀姄鑷�.R44_LAST", "true", out string msg);
                         }
                     }
                     else
@@ -252,7 +253,8 @@
                     {
                         if (tag.wxr1.R10)
                         {
-                            tag.wxr1.R10_LAST = false;
+                            //tag.wxr1.R10_LAST = false;
+                            RedisHelper.Add($"缁村笇灏旀姄鑷�.R10_LAST", "false", out string msg);
                         }
                         else
                         if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode))
@@ -268,7 +270,8 @@
                             {
                                 //Conn.榛樿Redis.SetValue("缁村笇灏旀姄鑷�.R10", "true", "缁村笇灏旀姄鑷�Queue");
                                 tag.wxr1.R10 = true;
-                                tag.wxr1.R44_LAST = false;
+                                //tag.wxr1.R44_LAST = false;
+                                RedisHelper.Add($"缁村笇灏旀姄鑷�.R44_LAST", "false", out string msg);
                             }
                             else
                             {
@@ -306,7 +309,8 @@
                         LogHelper.Info($"{VERX.location[1]}鐢宠mes浠诲姟缁撴灉{str}");
                         if (str.Contains("true"))
                         {
-                            tag.wxr1.R46_LAST = true;
+                            //tag.wxr1.R46_LAST = true;
+                            RedisHelper.Add($"缁村笇灏旀姄鑷�.R46_LAST", "true", out string msg);
                         }
                     }
                     else
@@ -320,7 +324,8 @@
                     {
                         if (tag.wxr1.R11)
                         {
-                            tag.wxr1.R11_LAST = false;
+                            //tag.wxr1.R11_LAST = false;
+                            RedisHelper.Add($"缁村笇灏旀姄鑷�.R11_LAST", "false", out string msg);
                         }
                         else
                         if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode))
@@ -336,7 +341,8 @@
                             {
                                 //Conn.榛樿Redis.SetValue("缁村笇灏旀姄鑷�.R10", "true", "缁村笇灏旀姄鑷�Queue");
                                 tag.wxr1.R11 = true;
-                                tag.wxr1.R46_LAST = false;
+                                //tag.wxr1.R46_LAST = false;
+                                RedisHelper.Add($"缁村笇灏旀姄鑷�.R46_LAST", "false", out string msg);
                             }
                             else
                             {
@@ -374,7 +380,8 @@
                         LogHelper.Info($"{VERX.location[0]}鐢宠mes浠诲姟缁撴灉{str}");
                         if (str.Contains("true"))
                         {
-                            tag.wxr2.R44_LAST = true;
+                            //tag.wxr2.R44_LAST = true;
+                            RedisHelper.Add($"缁村笇灏旀姄鑷�.R44_LAST", "true", out string msg);
                         }
                     }
                     else
@@ -388,7 +395,8 @@
                     {
                         if (tag.wxr2.R10)
                         {
-                            tag.wxr2.R10_LAST = false;
+                            //tag.wxr2.R10_LAST = false;
+                            RedisHelper.Add($"缁村笇灏旀姄鑷�.R10_LAST", "false", out string msg);
                         }
                         else
                         if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode))
@@ -404,7 +412,8 @@
                             {
                                 //Conn.榛樿Redis.SetValue("缁村笇灏旀姄鑷�.R10", "true", "缁村笇灏旀姄鑷�Queue");
                                 tag.wxr2.R10 = true;
-                                tag.wxr2.R44_LAST = false;
+                                //tag.wxr2.R44_LAST = false;
+                                RedisHelper.Add($"缁村笇灏旀姄鑷�.R44_LAST", "false", out string msg);
                             }
                             else
                             {
@@ -443,7 +452,8 @@
                         LogHelper.Info($"{VERX.location[1]}鐢宠mes浠诲姟缁撴灉{str}");
                         if (str.Contains("true"))
                         {
-                            tag.wxr2.R46_LAST = true;
+                            //tag.wxr2.R46_LAST = true;
+                            RedisHelper.Add($"缁村笇灏旀姄鑷�.R46_LAST", "true", out string msg);
                         }
                     }
                     else
@@ -457,7 +467,8 @@
                     {
                         if (tag.wxr2.R11)
                         {
-                            tag.wxr2.R11_LAST = false;
+                            //tag.wxr2.R11_LAST = false;
+                            RedisHelper.Add($"缁村笇灏旀姄鑷�.R11_LAST", "false", out string msg);
                         }
                         else
                         if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode))
@@ -473,7 +484,8 @@
                             {
                                 //Conn.榛樿Redis.SetValue("缁村笇灏旀姄鑷�.R10", "true", "缁村笇灏旀姄鑷�Queue");
                                 tag.wxr2.R11 = true;
-                                tag.wxr2.R46_LAST = false;
+                                //tag.wxr2.R46_LAST = false;
+                                RedisHelper.Add($"缁村笇灏旀姄鑷�.R46_LAST", "false", out string msg);
                             }
                             else
                             {
@@ -597,7 +609,7 @@
                     string tno = "TN" + (DateTime.Now.ToString("yy")) + ((taskno.ToString()).PadLeft(8, '0'));
                     task1 = taskservice.FindEntity(x => x.S_TASK_NO == tno);
 
-                    LogHelper.Info($"RGV 1宸ヤ綅浠诲姟{JsonConvert.SerializeObject(task1)}.bit1taskOver_LAST锛歿tag.RGV.bit1taskOver_LAST}");
+                    LogHelper.Info($"RGV 1宸ヤ綅浠诲姟{task1?.S_TASK_NO}.bit1taskOver_LAST锛歿tag.RGV.bit1taskOver_LAST}");
                     if (tag.RGV.bit1taskOver_LAST == 0 && task1 != null)
                     {
                         if (task1.S_B_STATE != "瀹屾垚")
@@ -882,6 +894,7 @@
         public void ThreadGrats(Tag tag, Action<HaiKangOrderInfo> continueTask)
         {
             Console.WriteLine($"ThreadGrats 鍏夋爡澶勭悊 =================> ");
+            
             var taskCOdes = new List<string> { "Sarrive", "Srelease", "Earrive", "Erelease" };
             TaskActRepository taskActRepository = new TaskActRepository();
             TaskRepository taskRepository = new TaskRepository();
@@ -895,7 +908,13 @@
                     taskActRepository.Update(item);
                     continue;
                 }
-                //var task = taskRepository.FindEntity(x => x.S_TASK_NO == item.S_TASK_NO);
+                var task = taskRepository.FindEntity(x => x.S_TASK_NO == item.S_TASK_NO);
+                if (task == null)
+                {
+                    item.N_CREATEMETHOD = -1;
+                    taskActRepository.Update(item);
+                    continue;
+                }
                 string loc = "";
                 if (tin < 2)
                 {
@@ -918,8 +937,7 @@
                         if (dev.deviceType == 1)
                         {
                             LogHelper.Info($"{dev.deviceName}{(V ? "宸� : "鍙�)} 鍏夋爡{(goin ? "鍏抽棴" : "寮�惎")} 鐢宠銆� + string.Format("{0}{1}{2}", dev.deviceName + "." + (V ? "R02" : "R04"), "true", dev.deviceName + "Queue"));
-                            Conn.榛樿Redis.SetValue(dev.deviceName + "." + (V ? "R02" : "R04"), "true", dev.deviceName + "Queue");
-
+                            Conn.榛樿Redis.SetValue(dev.deviceName + "." + (V ? "R02" : "R04"), "true", dev.deviceName + "Queue", false);
                         }
                         else if (dev.deviceType == 2)
                         {
@@ -944,7 +962,7 @@
                             else
                             {
                                 LogHelper.Info($"{dev.deviceName}{(V ? "宸� : "鍙�)} 鍏夋爡{(goin ? "鍏抽棴" : "寮�惎")} 鐢宠銆� + string.Format("{0}{1}{2}", dev.deviceName + "." + (V ? "R01" : "R03"), "true", dev.deviceName + "Queue"));
-                                Conn.榛樿Redis.SetValue(dev.deviceName + "." + (V ? "R01" : "R03"), "true", dev.deviceName + "Queue");
+                                Conn.榛樿Redis.SetValue(dev.deviceName + "." + (V ? "R01" : "R03"), "true", dev.deviceName + "Queue", false);
                             }
 
                         }

--
Gitblit v1.9.1