From ef986338133c1e636fee455356f10d01e5f7b293 Mon Sep 17 00:00:00 2001
From: czw <selecti@yeah.net>
Date: 星期三, 25 六月 2025 15:18:20 +0800
Subject: [PATCH] 1

---
 2025年6月12日/AuxAllWCS/Build/Project/代码/VS自定义类/AutoThread.cs |  146 ++++++++++++++++++++++++++++++++++--------------
 1 files changed, 104 insertions(+), 42 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 a87884a..4d71280 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"
@@ -1,4 +1,5 @@
-锘縰sing Newtonsoft.Json;
+#region    [鑷畾涔夌被-VS][20250623083459471][AutoThread]
+using Newtonsoft.Json;
 using System;
 using System.Collections.Generic;
 using System.Collections.Concurrent;
@@ -14,6 +15,7 @@
 using static System.Windows.Forms.VisualStyles.VisualStyleElement;
 using System.Windows.Interop;
 using static System.Windows.Forms.VisualStyles.VisualStyleElement.TextBox;
+using System.Security.Cryptography;
 
 namespace GZ.Projects.AuxAllWCS
 {
@@ -102,6 +104,12 @@
             else if (Settings.deviceInfos.Count == 0)
             {
                 tag.Global.SettingsOver = 0;
+            }
+            else tag.Global.SettingsOver++;
+            if (tag.Global.SettingsOver > 999)
+            {
+                tag.Global.SettingsOver = 1;
+                Console.Clear();
             }
         }
 
@@ -236,7 +244,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
@@ -251,7 +260,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))
@@ -267,7 +277,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
                             {
@@ -305,7 +316,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
@@ -319,7 +331,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))
@@ -335,7 +348,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
                             {
@@ -373,7 +387,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
@@ -387,7 +402,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))
@@ -403,7 +419,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
                             {
@@ -442,7 +459,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
@@ -456,7 +474,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))
@@ -472,7 +491,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
                             {
@@ -537,26 +557,42 @@
             {
                 #region Rgv
 
-                LogHelper.Info($"鏌ョ湅RGV 鐢甸噺锛氥�{tag.RGV.R褰撳墠鐢甸噺}銆�鍏呯數鐘舵�锛氥�{tag.RGV.R鍏呯數鐘舵�}銆�鏁呴殰浠g爜锛氥�{tag.RGV.RgvrunError}銆�);
+                LogHelper.Info($"鏌ョ湅RGV 鐢甸噺锛氥�{tag.RGV.R褰撳墠鐢甸噺}銆�鍏呯數鐘舵�锛氥�{tag.RGV.R鍏呯數鐘舵�}銆�鏁呴殰浠g爜锛氥�{tag.RGV.RgvrunError}銆�鎵嬪姩1鑷姩2銆恵tag.RGV.R鎵嬪姩1鑷姩2}銆�);
 
+                if (tag.RGV.R鎵嬪姩1鑷姩2 == 1)
+                {
+                    LogHelper.Info($"RGV 鎵嬪姩妯″紡锛屼笉鐢ㄧ銆�);
+                    return;
+                }
                 if (tag.RGV.taskend == 125)
                 {
+                    LogHelper.Info($"RGV 鏈�25鍛戒护鏈墽琛屻�");
                     System.Threading.Thread.Sleep(3000);
                     return;
                 }
                 LogHelper.Info("浠诲姟涓嬪彂  Rgv 浠诲姟 杩涘叆");
 
+                TaskEntity task1 = null;
+                TaskEntity task2 = null;
                 var task1Isrun = false;
                 if (tag.RGV.ReadTask1No > 0 && tag.RGV.bit1taskOver != 1)
                 {
-                    task1Isrun = true;
+                    var taskno = tag.RGV.ReadTask1No;
+                    string tno = "TN" + (DateTime.Now.ToString("yy")) + ((taskno.ToString()).PadLeft(8, '0'));
+                    task1 = taskservice.FindEntity(x => x.S_TASK_NO == tno);
+                    if (task1 != null && task1.S_B_STATE != "瀹屾垚")
+                        task1Isrun = true;
                     //if (tag.RGV.bit1taskOver_LAST == 1)
                     //    RedisHelper.Add($"RGV.bit1taskOver_LAST", "0", out string msg);
                 }
                 var task2Isrun = false;
                 if (tag.RGV.ReadTask2No > 0 && tag.RGV.bit2taskOver != 1)
                 {
-                    task2Isrun = true;
+                    var taskno = tag.RGV.ReadTask2No;
+                    string tno = "TN" + (DateTime.Now.ToString("yy")) + ((taskno.ToString()).PadLeft(8, '0'));
+                    task2 = taskservice.FindEntity(x => x.S_TASK_NO == tno);
+                    if (task2 != null && task2.S_B_STATE != "瀹屾垚")
+                        task2Isrun = true;
                     //if (tag.RGV.bit2taskOver_LAST == 1)
                     //    RedisHelper.Add($"RGV.bit2taskOver_LAST", "0", out string msg);
                 }
@@ -569,12 +605,9 @@
                         mes += tag.RGV.ReadTask2No + "鎵ц涓�..";
                     LogHelper.Info($"{mes} 涓嶈兘涓嬪彂鏂颁换鍔°�");
                     System.Threading.Thread.Sleep(3000);
-                    return; 
+                    return;
                 }
                 var thisOver = 0;
-                TaskEntity task1 = null;
-                TaskEntity task2 = null;
-
                 LogHelper.Info($"鏌ョ湅RGV 1宸ヤ綅浠诲姟銆�);
                 if (tag.RGV.ReadTask1No > 0 && tag.RGV.bit1taskOver == 1)
                 {
@@ -583,7 +616,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 != "瀹屾垚")
@@ -592,13 +625,13 @@
                             if (task1.S_B_STATE == "鍙栬揣瀹屾垚")
                             {
                                 task1.S_B_STATE = "瀹屾垚";
-                                tag.RGV.ReadTask1No = 0;
+                                //tag.RGV.ReadTask1No = 0;
                             }
                             else
                             {
                                 task1.S_B_STATE = "鍙栬揣瀹屾垚";
                             }
-                            tag.RGV.bit1taskOver = 0;
+                            //tag.RGV.bit1taskOver = 0;
                             LogHelper.Info($"RGV 1宸ヤ綅浠诲姟{task1.S_TASK_NO} 鐘舵�鍒囨崲涓簕task1.S_B_STATE}");
                             //tag.RGV.bit1taskOver_LAST = 1;
                             RedisHelper.Add($"RGV.bit1taskOver_LAST", "1", out string msg);
@@ -634,13 +667,13 @@
                             if (task2.S_B_STATE == "鍙栬揣瀹屾垚")
                             {
                                 task2.S_B_STATE = "瀹屾垚";
-                                tag.RGV.ReadTask2No = 0;
+                                //tag.RGV.ReadTask2No = 0;
                             }
                             else
                             {
                                 task2.S_B_STATE = "鍙栬揣瀹屾垚";
                             }
-                            tag.RGV.bit2taskOver = 0;
+                            //tag.RGV.bit2taskOver = 0;
                             LogHelper.Info($"RGV 2宸ヤ綅浠诲姟{task2.S_TASK_NO} 鐘舵�鍒囨崲涓簕task2.S_B_STATE}");
                             RedisHelper.Add($"RGV.bit2taskOver_LAST", "1", out string msg);
                             LogHelper.Info($"RGV 2宸ヤ綅浠诲姟鍐欏鐞�);
@@ -657,8 +690,6 @@
                 {
                     LogHelper.Info($"RGV 2宸ヤ綅娌℃湁浠诲姟銆�);
                 }
-
-
 
                 //if (thisOver > 0)
                 //{
@@ -706,7 +737,9 @@
                         {
                             LogHelper.Info($"鏌ョ湅RGV1 鏈変换鍔task1.S_TASK_NO},宸ヤ綅2 娌′换鍔°� 鎵�020  1008  1016鍙栬揣浠诲姟{t2.S_TASK_NO}銆�);
                             tag.RGV.workMod = 2;
+                            LogHelper.Info($"{task1.S_TASK_NO}> workMod 2 銆�宸ヤ綅銆�);
                             tag.RGV.taskmod = 1;
+                            LogHelper.Info($"{task1.S_TASK_NO}> taskmod 1 銆婂彇璐с�");
                             tag.RGV.taskno2 = Convert.ToUInt32(t2.S_TASK_NO.Substring(4));
                             tag.RGV.task2do = Convert.ToUInt16(t2.S_START_LOC);
                             t2.S_B_STATE = "宸叉帹閫�;
@@ -767,7 +800,9 @@
                         {
                             LogHelper.Info($"鏌ョ湅RGV1 鏈変换鍔task1.S_TASK_NO},宸ヤ綅2 娌′换鍔°� 娌℃湁鍚屼晶鍙栬揣浠诲姟 1宸ヤ綅鍗歌揣銆�);
                             tag.RGV.workMod = 1;
+                            LogHelper.Info($"{task1.S_TASK_NO}> workMod 1 銆�宸ヤ綅銆�);
                             tag.RGV.taskmod = 2;
+                            LogHelper.Info($"{task1.S_TASK_NO}> taskmod 2 銆婂嵏璐с�");
                             tag.RGV.taskno1 = Convert.ToUInt32(task1.S_TASK_NO.Substring(4));
                             tag.RGV.task1do = Convert.ToUInt16(task1.S_END_LOC);
                             System.Threading.Thread.Sleep(750);
@@ -785,7 +820,9 @@
                         LogHelper.Info($"鏌ョ湅RGV 1宸ヤ綅娌′换鍔�宸ヤ綅2 鏈変换鍔task2.S_TASK_NO}銆傚伐浣�鍗歌揣銆傘�");
                         //2 鍗歌揣銆�                         tag.RGV.workMod = 2;
+                        LogHelper.Info($"{task2.S_TASK_NO}> workMod 2 銆�宸ヤ綅銆�);
                         tag.RGV.taskmod = 2;
+                        LogHelper.Info($"{task2.S_TASK_NO}> taskmod 2 銆婂嵏璐с�");
                         tag.RGV.taskno2 = Convert.ToUInt32(task2.S_TASK_NO.Substring(4));
                         tag.RGV.task2do = Convert.ToUInt16(task2.S_END_LOC);
                         System.Threading.Thread.Sleep(750);
@@ -807,9 +844,11 @@
                         //}
                         if (e1017first != null)
                         {
-                            LogHelper.Info($"鏌ョ湅RGV1 浠诲姟宸ヤ綅2 娌′换鍔°� 1002  1010  1023鍙栬揣浠诲姟{e1017first.S_TASK_NO}銆�);
+                            LogHelper.Info($"鏌ョ湅RGV娌′换鍔★紝 缁欏伐浣�绛涢�浠诲姟銆�1002  1010  1023鍙栬揣浠诲姟{e1017first.S_TASK_NO}銆�);
                             tag.RGV.workMod = 1;
+                            LogHelper.Info($"{e1017first.S_TASK_NO}> workMod 1 銆�宸ヤ綅銆�);
                             tag.RGV.taskmod = 1;
+                            LogHelper.Info($"{e1017first.S_TASK_NO}> taskmod 1 銆婂彇璐с�");
                             uint tno = Convert.ToUInt32(e1017first.S_TASK_NO.Substring(4));
                             LogHelper.Info($"{e1017first.S_TASK_NO}> 杞崲鍚庝换鍔″彿{tno} 寮�鍐欏叆銆�);
                             tag.RGV.taskno1 = tno;
@@ -830,10 +869,13 @@
                             var t2 = tklist.OrderBy(x => x.T_CREATE).ToList().Find(x => x.S_START_LOC == "1020" || x.S_START_LOC == "1008" || x.S_START_LOC == "1016");
                             if (tklist != null)
                             {
-                                LogHelper.Info($"鏌ョ湅RGV1 娌′换鍔″伐浣� 娌′换鍔°� 鎵�020  1008  1016鍙栬揣浠诲姟{t2.S_TASK_NO}銆�);
+                                LogHelper.Info($"鏌ョ湅RGV娌′换鍔�缁欏伐浣�绛涢�浠诲姟銆�鎵�020  1008  1016鍙栬揣浠诲姟{t2.S_TASK_NO}銆�);
                                 tag.RGV.workMod = 2;
+                                LogHelper.Info($"{t2.S_TASK_NO}> workMod 2 銆�宸ヤ綅銆�);
                                 tag.RGV.taskmod = 1;
+                                LogHelper.Info($"{t2.S_TASK_NO}> taskmod 1 銆婂彇璐с�");
                                 tag.RGV.taskno2 = Convert.ToUInt32(t2.S_TASK_NO.Substring(4));
+                                LogHelper.Info($"{t2.S_TASK_NO}> taskno2  {Convert.ToUInt32(t2.S_TASK_NO.Substring(4))}銆婁换鍔″彿銆�);
                                 tag.RGV.task2do = Convert.ToUInt16(t2.S_START_LOC);
                                 t2.S_B_STATE = "宸叉帹閫�;
                                 taskservice.Update(t2);
@@ -858,13 +900,15 @@
 
         public void ThreadGrats(Tag tag, Action<HaiKangOrderInfo> continueTask)
         {
-            Console.WriteLine($"ThreadGrats 鍏夋爡澶勭悊 =================> ");
+            LogHelper.Info($"ThreadGrats 鍏夋爡澶勭悊 =================> ");
+
             var taskCOdes = new List<string> { "Sarrive", "Srelease", "Earrive", "Erelease" };
             TaskActRepository taskActRepository = new TaskActRepository();
             TaskRepository taskRepository = new TaskRepository();
-            var requires = taskActRepository.FindList(x => taskCOdes.Contains(x.S_ACTION_CODE) && x.N_CREATEMETHOD == 0);
+            var requires = taskActRepository.FindList(x => taskCOdes.Contains(x.S_ACTION_CODE) && x.N_CREATEMETHOD == 0).OrderBy(x => x.T_CREATE);
             foreach (var item in requires)
             {
+                LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE}鍏夋爡澶勭悊 =================> ");
                 var tin = taskCOdes.IndexOf(item.S_ACTION_CODE);
                 if (tin == -1)
                 {
@@ -872,7 +916,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)
                 {
@@ -888,21 +938,24 @@
                 var dev = Settings.deviceInfos.Find(x => x.location.Contains(loc));
                 if (dev != null)
                 {
+                    LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} 璁惧鏄瘂dev.deviceName} 鍏夋爡澶勭悊 =================> ");
                     var V = dev.location.ToList().FindIndex(x => x == loc) == 0;
                     //杞﹁蛋浜� 寮�厜鏍�                     if (!goin)
                     {
                         if (dev.deviceType == 1)
                         {
+                            LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} 璁惧鏄瘂dev.deviceName} 寮�惎鍏夋爡澶勭悊 =================> ");
                             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)
                         {
+                            LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} 璁惧鏄瘂dev.deviceName} 寮�惎鍏夋爡澶勭悊 =================> ");
                             LogHelper.Info($"{dev.deviceName}{(V ? "宸� : "鍙�)} 鍏夋爡{(goin ? "鍏抽棴" : "寮�惎")} 鐢宠銆� + string.Format("{0}{1}{2}", dev.deviceName + "." + (V ? "D1222" : "D1223"), "1", dev.deviceName + "Queue"));
                             Conn.榛樿Redis.SetValue(dev.deviceName + "." + (V ? "D1222" : "D1223"), "1", dev.deviceName + "Queue");
                         }
+                        LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} 璁惧鏄瘂dev.deviceName} 寮�惎鍏夋爡澶勭悊瀹屾垚 =================> ");
 
                         item.N_CREATEMETHOD = 1;
                         taskActRepository.Update(item);
@@ -912,7 +965,9 @@
                     {
                         if (dev.deviceType == 1)
                         {
+                            LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} 璁惧鏄瘂dev.deviceName} 鍏抽棴鍏夋爡澶勭悊 =================> ");
                             var tf = Conn.榛樿Redis.GetValue(dev.deviceName + "." + (V ? "R50" : "R52"));//璇诲叧闂姸鎬�+                            LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} 璁惧鏄瘂dev.deviceName} 鍏夋爡鍏抽棴淇″彿{tf}");
                             if (tf?.ToLower() == "true")
                             {
                                 LogHelper.Info($"{dev.deviceName}{(V ? "宸� : "鍙�)} 鍏夋爡{(goin ? "鍏抽棴" : "寮�惎")} 鐢宠銆�宸茬粡鍏抽棴锛�);
@@ -921,15 +976,18 @@
                             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);
                             }
-
+                            LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} 璁惧鏄瘂dev.deviceName} 鍏抽棴鍏夋爡澶勭悊瀹屾垚 =================> ");
                         }
                         else if (dev.deviceType == 2)
                         {
+                            LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} 璁惧鏄瘂dev.deviceName} 鍏抽棴鍏夋爡澶勭悊 =================> ");
                             var tf = Conn.榛樿Redis.GetValue(dev.deviceName + ".D1202");
                             int numm = int.Parse(string.IsNullOrEmpty(tf) ? "0" : tf);
-                            if (TcpServer.GetBitdata(numm, (V ? 0 : 1)) == 1)
+                            int close = TcpServer.GetBitdata(numm, (V ? 0 : 1));
+                            LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} 璁惧鏄瘂dev.deviceName} 鍏夋爡鍏抽棴淇″彿{close}");
+                            if (close == 1)
                             {
                                 LogHelper.Info($"{dev.deviceName}{(V ? "宸� : "鍙�)} 鍏夋爡{(goin ? "鍏抽棴" : "寮�惎")} 鐢宠銆�宸茬粡鍏抽棴锛�);
                                 continuuuuu = true;
@@ -939,6 +997,7 @@
                                 LogHelper.Info($"{dev.deviceName}{(V ? "宸� : "鍙�)} 鍏夋爡{(goin ? "鍏抽棴" : "寮�惎")} 鐢宠銆� + string.Format("{0}{1}{2}", dev.deviceName + "." + (V ? "D1220" : "D1221"), dev.deviceName + "Queue"));
                                 Conn.榛樿Redis.SetValue(dev.deviceName + "." + (V ? "D1220" : "D1221"), "1", dev.deviceName + "Queue");
                             }
+                            LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} 璁惧鏄瘂dev.deviceName} 鍏抽棴鍏夋爡澶勭悊瀹屾垚 =================> ");
                         }
 
                     }
@@ -957,6 +1016,7 @@
                 }
             }
             System.Threading.Thread.Sleep(3000);
+            LogHelper.Info($"ThreadGrats deviceType2鍏夋爡鍐欏叆浣嶉噸缃�=================> ");
             //閲嶇疆淇″彿
             foreach (var dev in Settings.deviceInfos.FindAll(x => x.deviceType == 2))
             {
@@ -964,16 +1024,16 @@
                 int numm = int.Parse(string.IsNullOrEmpty(tf) ? "0" : tf);
                 if (TcpServer.GetBitdata(numm, 0) == 0)
                 {
-                    Conn.榛樿Redis.SetValue(dev.deviceName + ".D1220", "0", dev.deviceName + "Queue");
-                    Conn.榛樿Redis.SetValue(dev.deviceName + ".D1222", "0", dev.deviceName + "Queue");
+                    Conn.榛樿Redis.SetValue(dev.deviceName + ".D1220", "0", dev.deviceName + "Queue", false);
+                    Conn.榛樿Redis.SetValue(dev.deviceName + ".D1222", "0", dev.deviceName + "Queue", false);
                 }
                 else if (TcpServer.GetBitdata(numm, 1) == 0)
                 {
-                    Conn.榛樿Redis.SetValue(dev.deviceName + ".D1221", "0", dev.deviceName + "Queue");
-                    Conn.榛樿Redis.SetValue(dev.deviceName + ".D1223", "0", dev.deviceName + "Queue");
+                    Conn.榛樿Redis.SetValue(dev.deviceName + ".D1221", "0", dev.deviceName + "Queue", false);
+                    Conn.榛樿Redis.SetValue(dev.deviceName + ".D1223", "0", dev.deviceName + "Queue", false);
                 }
             }
-
+            LogHelper.Info($"ThreadGrats deviceType2鍏夋爡鍐欏叆浣嶉噸缃畬鎴愩� =================> ");
         }
         /// <summary>
         /// 1020  1023绌烘涓嬬嚎
@@ -1367,3 +1427,5 @@
 
     }
 }
+
+#endregion [鑷畾涔夌被-VS][20250623083459471][AutoThread]
\ No newline at end of file

--
Gitblit v1.9.1