From 993e734be337d5acea34cba80c6f0de2db9fe1bc Mon Sep 17 00:00:00 2001
From: czw <selecti@yeah.net>
Date: 星期三, 09 七月 2025 11:29:04 +0800
Subject: [PATCH] 1

---
 2025年6月12日/AuxAllWCS/Build/Project/代码/VS自定义类/AutoThread.cs |  521 ++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 453 insertions(+), 68 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 ac5f315..eb835b9 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"
@@ -26,6 +26,8 @@
 using System.Net;
 using System.Threading;
 using System.IO;
+using GZ.Device.Agv;
+using System.Net.NetworkInformation;
 
 namespace GZ.Projects.AuxAllWCS
 {
@@ -125,6 +127,61 @@
             }
         }
 
+
+        public void ThreaTotal(Tag tag)
+        {
+            List<Task> tasks = new List<Task>();
+            tasks.Add(GetTask(ThreadMXC3, tag, 3000));
+            tasks.Add(GetTask(ThreadMXC4, tag, 3000));
+            tasks.Add(GetTask(ResetGats, tag, 3000));
+            
+
+
+
+
+            Task.WaitAll(tasks.ToArray());
+        }
+        public static bool IsMachineOnline(string hostNameOrIp, int timeout = 1000)
+        {
+            try
+            {
+                using (var ping = new Ping())
+                {
+                    var reply = ping.Send(hostNameOrIp, timeout);
+                    return reply.Status == IPStatus.Success;
+                }
+            }
+            catch (PingException)
+            {
+                return false;
+            }
+            catch (Exception)
+            {
+                // 鍏朵粬寮傚父澶勭悊
+                return false;
+            }
+        }
+
+        private Task GetTask(Action<Tag> action, Tag tag, int i = 2500)
+        {
+            var task = Task.Run(() =>
+            {
+                while (true)
+                {
+                    try
+                    {
+                        action(tag);
+                    }
+                    catch (Exception ex)
+                    {
+                        LogHelper.Error(ex.Message, ex);
+                    }
+                    Thread.Sleep(i);
+                }
+            });
+            return task;
+        }
+
         public string WriteLine(string value = "")
         {
 
@@ -166,6 +223,7 @@
                 {
                     //tag.Js1.D1212_LAST = 0; 
                     RedisHelper.Add($"Js鎹烽『1.D1202_LAST", "0", out string msg);
+                    //Conn.榛樿Redis.SetValue(VERX.deviceName + ".D1224", "0", VERX.deviceName + "Queue");
                 }
 
                 if (tag.Js1.D1213_LAST == 0 && TcpServer.GetBitdata(tag.Js1.D1212, 3) == 1)
@@ -187,6 +245,7 @@
                 {
                     //tag.Js1.D1213_LAST = 0;
                     RedisHelper.Add($"Js鎹烽『1.D1203_LAST", "0", out string msg);
+                    //Conn.榛樿Redis.SetValue(VERX.deviceName + ".D1225", "0", VERX.deviceName + "Queue");
                 }
             }
         }
@@ -255,6 +314,8 @@
 
             if (VERX != null)
             {
+                if (tag.wxr1.R44)
+                    LogHelper.Info($"{VERX.deviceName} R44>{tag.wxr1.R44} R44LAST>{tag.wxr1.R44_LAST} R10>{tag.wxr1.R10}");
                 if (tag.wxr1.R44 && !tag.wxr1.R44_LAST && tag.wxr1.R10)
                 {
                     if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode) && !string.IsNullOrEmpty(traycode.Trim()))
@@ -293,16 +354,21 @@
                         if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode) && !string.IsNullOrEmpty(traycode.Trim()))
                         {
                             //涓婃姤鏍¢獙銆�+                            LogHelper.Info($"{VERX.deviceNo[0]} 涓婃姤鏍¢獙>{traycode}");
+
                             ///var str = Settings.apiHelper.Post(Settings.MESbaseUrl + "mom-basic/dataTransmission/json/service/202", requestJson);
                             var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/202", JsonConvert.SerializeObject(new
                             {
                                 sceneType = 1,
                                 cntrCode = traycode,
                             }));
-                            if (str.Contains("true"))
+                            var strr = JsonConvert.DeserializeObject<Mesrespone>(str);
+                            if (strr != null && strr.success)
+                            //if (str.Contains("true"))
                             {
                                 //Conn.榛樿Redis.SetValue("缁村笇灏旀姄鑷�.R10", "true", "缁村笇灏旀姄鑷�Queue");
-                                tag.wxr1.R10 = true;
+                                //tag.wxr1.R10 = true;
+                                Conn.榛樿Redis.SetValue(VERX.deviceName + ".R10", "true", VERX.deviceName + "Queue");
                                 //tag.wxr1.R44_LAST = false;
                                 RedisHelper.Add($"缁村笇灏旀姄鑷�.R44_LAST", "false", out string msg);
                             }
@@ -312,6 +378,10 @@
                             }
                         }
                         else { TcpServer.TcpServerSend(VERX.deviceNo[0], GZ.Device.PLC.PlcHelper.Hex2Bin("544F4E")); }
+                    }
+                    else if (!tag.wxr1.R10)
+                    {
+                        TcpServer.TrayIps.Remove(VERX.deviceNo[0]);
                     }
                 }
             }
@@ -328,6 +398,8 @@
 
             if (VERX != null)
             {
+                if (tag.wxr1.R46)
+                    LogHelper.Info($"{VERX.deviceName} R44>{tag.wxr1.R46} R44LAST>{tag.wxr1.R46_LAST} R10>{tag.wxr1.R11}");
                 if (tag.wxr1.R46 && !tag.wxr1.R46_LAST && tag.wxr1.R11)
                 {
                     if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode) && !string.IsNullOrEmpty(traycode.Trim()))
@@ -365,16 +437,20 @@
                         if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode) && !string.IsNullOrEmpty(traycode.Trim()))
                         {
                             //涓婃姤鏍¢獙銆�+                            LogHelper.Info($"{VERX.deviceNo[1]} 涓婃姤鏍¢獙>{traycode}");
                             ///var str = Settings.apiHelper.Post(Settings.MESbaseUrl + "mom-basic/dataTransmission/json/service/202", requestJson);
                             var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/202", JsonConvert.SerializeObject(new
                             {
                                 sceneType = 1,
                                 cntrCode = traycode,
                             }));
-                            if (str.Contains("true"))
+                            var strr = JsonConvert.DeserializeObject<Mesrespone>(str);
+                            if (strr != null && strr.success)
+                            //if (str.Contains("true"))
                             {
                                 //Conn.榛樿Redis.SetValue("缁村笇灏旀姄鑷�.R10", "true", "缁村笇灏旀姄鑷�Queue");
-                                tag.wxr1.R11 = true;
+                                //tag.wxr1.R11 = true;
+                                Conn.榛樿Redis.SetValue(VERX.deviceName + ".R11", "true", VERX.deviceName + "Queue");
                                 //tag.wxr1.R46_LAST = false;
                                 RedisHelper.Add($"缁村笇灏旀姄鑷�.R46_LAST", "false", out string msg);
                             }
@@ -384,6 +460,10 @@
                             }
                         }
                         else { TcpServer.TcpServerSend(VERX.deviceNo[1], GZ.Device.PLC.PlcHelper.Hex2Bin("544F4E")); }
+                    }
+                    else if (!tag.wxr1.R11)
+                    {
+                        TcpServer.TrayIps.Remove(VERX.deviceNo[1]);
                     }
                 }
             }
@@ -400,6 +480,8 @@
 
             if (VERX != null)
             {
+                if (tag.wxr2.R44)
+                    LogHelper.Info($"{VERX.deviceName} R44>{tag.wxr2.R44} R44LAST>{tag.wxr2.R44_LAST} R10>{tag.wxr2.R10}");
                 if (tag.wxr2.R44 && !tag.wxr2.R44_LAST && tag.wxr2.R10)
                 {
                     if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode) && !string.IsNullOrEmpty(traycode.Trim()))
@@ -437,16 +519,20 @@
                         if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode) && !string.IsNullOrEmpty(traycode.Trim()))
                         {
                             //涓婃姤鏍¢獙銆�+                            LogHelper.Info($"{VERX.deviceNo[0]} 涓婃姤鏍¢獙>{traycode}");
                             ///var str = Settings.apiHelper.Post(Settings.MESbaseUrl + "mom-basic/dataTransmission/json/service/202", requestJson);
                             var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/202", JsonConvert.SerializeObject(new
                             {
                                 sceneType = 1,
                                 cntrCode = traycode,
                             }));
-                            if (str.Contains("true"))
+                            var strr = JsonConvert.DeserializeObject<Mesrespone>(str);
+                            if (strr != null && strr.success)
+                            //if (str.Contains("true"))
                             {
                                 //Conn.榛樿Redis.SetValue("缁村笇灏旀姄鑷�.R10", "true", "缁村笇灏旀姄鑷�Queue");
-                                tag.wxr2.R10 = true;
+                                //tag.wxr2.R10 = true;
+                                Conn.榛樿Redis.SetValue(VERX.deviceName + ".R10", "true", VERX.deviceName + "Queue");
                                 //tag.wxr2.R44_LAST = false;
                                 RedisHelper.Add($"缁村笇灏旀姄鑷�.R44_LAST", "false", out string msg);
                             }
@@ -456,6 +542,10 @@
                             }
                         }
                         else { TcpServer.TcpServerSend(VERX.deviceNo[0], GZ.Device.PLC.PlcHelper.Hex2Bin("544F4E")); }
+                    }
+                    else if (!tag.wxr2.R10)
+                    {
+                        TcpServer.TrayIps.Remove(VERX.deviceNo[0]);
                     }
                 }
             }
@@ -473,6 +563,8 @@
 
             if (VERX != null)
             {
+                if (tag.wxr2.R46)
+                    LogHelper.Info($"{VERX.deviceName} R44>{tag.wxr2.R46} R44LAST>{tag.wxr2.R46_LAST} R10>{tag.wxr2.R11}");
                 if (tag.wxr2.R46 && !tag.wxr2.R46_LAST && tag.wxr2.R11)
                 {
                     if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode) && !string.IsNullOrEmpty(traycode.Trim()))
@@ -511,7 +603,7 @@
                         else
                         if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode) && !string.IsNullOrEmpty(traycode.Trim()))
                         {
-                            LogHelper.Info($"Threadwxr2R 涓婃姤鏍¢獙>{traycode}");
+                            LogHelper.Info($"{VERX.deviceNo[1]} 涓婃姤鏍¢獙>{traycode}");
                             //涓婃姤鏍¢獙銆�                             ///var str = Settings.apiHelper.Post(Settings.MESbaseUrl + "mom-basic/dataTransmission/json/service/202", requestJson);
                             var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/202", JsonConvert.SerializeObject(new
@@ -519,12 +611,17 @@
                                 sceneType = 1,
                                 cntrCode = traycode,
                             }));
-                            if (str.Contains("true"))
+                            var strr = JsonConvert.DeserializeObject<Mesrespone>(str);
+                            if (strr != null && strr.success)
                             {
-                                //Conn.榛樿Redis.SetValue("缁村笇灏旀姄鑷�.R10", "true", "缁村笇灏旀姄鑷�Queue");
-                                tag.wxr2.R11 = true;
+                                //Conn.榛樿Redis.SetValue("缁村笇灏旀姄鑷�.R11", "true", "缁村笇灏旀姄鑷�Queue");
+                                //tag.wxr2.R11 = true;
+
+                                LogHelper.Info($"Threadwxr2R銆傘�  -鍐橰11 true");
+                                Conn.榛樿Redis.SetValue(VERX.deviceName + ".R11", "true", VERX.deviceName + "Queue");
                                 //tag.wxr2.R46_LAST = false;
                                 RedisHelper.Add($"缁村笇灏旀姄鑷�.R46_LAST", "false", out string msg);
+                                LogHelper.Info($"Threadwxr2R銆傘� 鏍¢獙涓嬫枡瀹屾垚銆�);
                             }
                             else
                             {
@@ -536,6 +633,10 @@
                             LogHelper.Info($"Threadwxr2R銆傘�  -鍙戦�鎵爜");
                             TcpServer.TcpServerSend(VERX.deviceNo[1], GZ.Device.PLC.PlcHelper.Hex2Bin("544F4E"));
                         }
+                    }
+                    else if (!tag.wxr2.R11)
+                    {
+                        TcpServer.TrayIps.Remove(VERX.deviceNo[1]);
                     }
                 }
             }
@@ -605,11 +706,18 @@
                 }
                 if (tag.RGV.taskend == 125)
                 {
-                    LogHelper.Info($"RGV 鏈�25鍛戒护鏈墽琛屻�");
+                    LogHelper.Info($"RGV 鏈�25鍛戒护鏈墽琛屻� ");
+                    LogHelper.Info($"RGV125鍛戒护鏈墽琛�浠诲姟鏁版嵁 workmode:{tag.RGV.workMod}\n taskmod{tag.RGV.taskmod} \n t1No:{tag.RGV.taskno1}\n t1do:{tag.RGV.task1do} \n t2No:{tag.RGV.taskno2}\n t2do:{tag.RGV.task2do}\n taskend:{tag.RGV.taskend} ");
+
+                    if (tag.RGV.workMod == 0 && tag.RGV.taskmod == 0 && tag.RGV.taskno1 == tag.RGV.ReadTask1No && tag.RGV.taskno2 == tag.RGV.ReadTask2No)
+                    {
+                        LogHelper.Info($"RGV125鍛戒护鏈墽琛�tag.RGV.workMod == 0 && tag.RGV.taskmod == 0 && tag.RGV.taskno1 == tag.RGV.ReadTask1No && tag.RGV.taskno2 == tag.RGV.ReadTask2No  鑷姩娓呴櫎125");
+                        Conn.榛樿Redis.SetValue("RGV.taskend", "0", "RGVQueue", false);
+                    }
                     System.Threading.Thread.Sleep(3000);
                     return;
                 }
-                LogHelper.Info($"浠诲姟涓嬪彂 Rgv 浠诲姟 杩涘叆 Rgv淇℃伅 W1鐘舵�{tag.RGV.w1status} ReadTask1No>{tag.RGV.ReadTask1No} bit1taskOver>{tag.RGV.bit1taskOver} W2鐘舵�{tag.RGV.w2status} ReadTask2No>{tag.RGV.ReadTask2No} bit2taskOver>{tag.RGV.bit2taskOver}");
+                LogHelper.Info($"浠诲姟涓嬪彂 Rgv 浠诲姟 杩涘叆 Rgv淇℃伅 W1鐘舵�{tag.RGV.w1status} ReadTask1No>{tag.RGV.ReadTask1No} 1宸ヤ綅鏉$爜:{tag.RGV.bit1Code} bit1taskOver>{tag.RGV.bit1taskOver} W2鐘舵�{tag.RGV.w2status} ReadTask2No>{tag.RGV.ReadTask2No} 2宸ヤ綅鏉$爜:{tag.RGV.bit2Code} bit2taskOver>{tag.RGV.bit2taskOver}");
                 TaskEntity task1 = null;
                 TaskEntity task2 = null;
                 var task1Isrun = false;
@@ -671,7 +779,7 @@
                                 task1.S_B_STATE = "鍙栬揣瀹屾垚";
                             }
                             //tag.RGV.bit1taskOver = 0;
-                            LogHelper.Info($"RGV 1宸ヤ綅浠诲姟{task1.S_TASK_NO} 鐘舵�鍒囨崲涓簕task1.S_B_STATE}");
+                            LogHelper.Info($"RGV 1宸ヤ綅浠诲姟{task1.S_TASK_NO} 鏉$爜锛歿tag.RGV.bit1Code} 鐘舵�鍒囨崲涓簕task1.S_B_STATE}");
                             //tag.RGV.bit1taskOver_LAST = 1;
                             RedisHelper.Add($"RGV.bit1taskOver_LAST", "1", out string msg);
                             LogHelper.Info($"RGV 1宸ヤ綅浠诲姟鍐欏鐞�);
@@ -713,7 +821,7 @@
                                 task2.S_B_STATE = "鍙栬揣瀹屾垚";
                             }
                             //tag.RGV.bit2taskOver = 0;
-                            LogHelper.Info($"RGV 2宸ヤ綅浠诲姟{task2.S_TASK_NO} 鐘舵�鍒囨崲涓簕task2.S_B_STATE}");
+                            LogHelper.Info($"RGV 2宸ヤ綅浠诲姟{task2.S_TASK_NO} 鏉$爜锛歿tag.RGV.bit2Code} 鐘舵�鍒囨崲涓簕task2.S_B_STATE}");
                             RedisHelper.Add($"RGV.bit2taskOver_LAST", "1", out string msg);
                             LogHelper.Info($"RGV 2宸ヤ綅浠诲姟鍐欏鐞�);
                             taskservice.Update(task2);
@@ -851,7 +959,7 @@
 
                             if (tag.RGV.bit1taskOver == 1)
                                 tag.RGV.bit1taskOver = 0;
-                            LogHelper.Info($"{task1.S_TASK_NO}> taskend 鍐�0");
+                            LogHelper.Info($"{task1.S_TASK_NO}> taskend 鍐�125");
                             Conn.榛樿Redis.SetValue("RGV.taskend", "125", "RGVQueue", false);
                             LogHelper.Info($"{task1.S_TASK_NO}> bit1taskOver_LAST 鍐�0");
                             RedisHelper.Add($"RGV.bit1taskOver_LAST", "0", out string msg);
@@ -954,7 +1062,18 @@
             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).OrderBy(x => x.T_CREATE);
+            var requires = taskActRepository.FindList(x => taskCOdes.Contains(x.S_ACTION_CODE) && x.N_CREATEMETHOD == 0).OrderBy(x => x.T_CREATE).ToList();
+            var timeMorhours = requires.FindAll(x => DateTime.Now.Subtract(x.T_CREATE).TotalHours > 1);
+            if (timeMorhours.Any())
+            {
+                foreach (var mor in timeMorhours)
+                {
+                    mor.N_CREATEMETHOD = 2;
+                    mor.S_REVIEW_COMMENT = "瓒呮椂涓嶅鐞�;
+                    taskActRepository.Update(mor);
+                }
+                requires = requires.Except(timeMorhours).ToList();
+            }
             foreach (var item in requires)
             {
                 LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE}鍏夋爡澶勭悊 =================> ");
@@ -962,6 +1081,7 @@
                 if (tin == -1)
                 {
                     item.N_CREATEMETHOD = -1;
+                    item.S_REVIEW_COMMENT = $"淇″彿鏈煡{item.S_ACTION_CODE}涓嶅鐞�;
                     taskActRepository.Update(item);
                     continue;
                 }
@@ -969,6 +1089,7 @@
                 if (task == null)
                 {
                     item.N_CREATEMETHOD = -1;
+                    item.S_REVIEW_COMMENT = $"浠诲姟涓㈠け涓嶅鐞�;
                     taskActRepository.Update(item);
                     continue;
                 }
@@ -1006,57 +1127,85 @@
                             Conn.榛樿Redis.SetValue(dev.deviceName + "." + (V ? "D1220" : "D1221"), "0", dev.deviceName + "Queue");
                             Conn.榛樿Redis.SetValue(dev.deviceName + "." + (V ? "D1222" : "D1223"), "1", dev.deviceName + "Queue");
                         }
+                        else if (dev.deviceType == 5)
+                        {
+                            LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} 璁惧鏄瘂dev.deviceName} 寮�惎鍏夋爡澶勭悊 =================> ");
+                            Conn.榛樿Redis.SetValue(dev.deviceName + "." + (V ? "D2211" : "D2216"), "1", dev.deviceName + "Queue");
+                            Conn.榛樿Redis.SetValue(dev.deviceName + "." + (V ? "D2212" : "D2217"), "0", dev.deviceName + "Queue");
+                        }
                         LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} 璁惧鏄瘂dev.deviceName} 寮�惎鍏夋爡澶勭悊瀹屾垚 =================> ");
 
                         item.N_CREATEMETHOD = 1;
+                        item.S_REVIEW_COMMENT = $"鍏夋爡寮�惎瀹屾垚";
                         taskActRepository.Update(item);
                     }
                     //杞﹁杩涘叆浜や簰銆�                     else
                     {
-                        if (dev.deviceType == 1)
+                        if (dev.deviceType == 4)
                         {
-                            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 ? "鍏抽棴" : "寮�惎")} 鐢宠銆�宸茬粡鍏抽棴锛�);
-                                continuuuuu = true;
-                            }
-                            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", false);
-                            }
-                            LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} 璁惧鏄瘂dev.deviceName} 鍏抽棴鍏夋爡澶勭悊瀹屾垚 =================> ");
+                            LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} 璁惧鏄瘂dev.deviceName} SSX AGV 浜や簰銆傘�銆�);
+                            //tag.SA1019.Sagverr
                         }
-                        else if (dev.deviceType == 2)
+                        else
                         {
                             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);
-                            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)
+                            if (dev.deviceType == 1)
                             {
-                                LogHelper.Info($"{dev.deviceName}{(V ? "宸� : "鍙�)} 鍏夋爡{(goin ? "鍏抽棴" : "寮�惎")} 鐢宠銆�宸茬粡鍏抽棴锛�);
-                                continuuuuu = true;
+                                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 ? "鍏抽棴" : "寮�惎")} 鐢宠銆�宸茬粡鍏抽棴锛�);
+                                    continuuuuu = true;
+                                }
+                                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", false);
+                                }
                             }
-                            else
+                            else if (dev.deviceType == 2)
                             {
-                                LogHelper.Info($"{dev.deviceName}{(V ? "宸� : "鍙�)} 鍏夋爡{(goin ? "鍏抽棴" : "寮�惎")} 鐢宠銆� + string.Format("{0}{1}{2}", dev.deviceName + "." + (V ? "D1220" : "D1221"), "1", dev.deviceName + "Queue"));
-                                Conn.榛樿Redis.SetValue(dev.deviceName + "." + (V ? "D1222" : "D1223"), "0", dev.deviceName + "Queue");
-                                Conn.榛樿Redis.SetValue(dev.deviceName + "." + (V ? "D1220" : "D1221"), "1", dev.deviceName + "Queue");
+                                var tf = Conn.榛樿Redis.GetValue(dev.deviceName + ".D1202");
+                                int numm = int.Parse(string.IsNullOrEmpty(tf) ? "0" : tf);
+                                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;
+                                }
+                                else
+                                {
+                                    LogHelper.Info($"{dev.deviceName}{(V ? "宸� : "鍙�)} 鍏夋爡{(goin ? "鍏抽棴" : "寮�惎")} 鐢宠銆� + string.Format("{0}{1}{2}", dev.deviceName + "." + (V ? "D1220" : "D1221"), "1", dev.deviceName + "Queue"));
+                                    Conn.榛樿Redis.SetValue(dev.deviceName + "." + (V ? "D1222" : "D1223"), "0", dev.deviceName + "Queue");
+                                    Conn.榛樿Redis.SetValue(dev.deviceName + "." + (V ? "D1220" : "D1221"), "1", dev.deviceName + "Queue");
 
-                                string d12201 = RedisHelper.Get<string>(dev.deviceName + "." + (V ? "D1220" : "D1221"), out string msg);
-                                LogHelper.Info($"ThreadGrats 鍐檣(dev.deviceName + "." + (V ? "D1220" : "D1221"))}涓�1 锛�鍚庤{d12201}");
+                                    string d12201 = RedisHelper.Get<string>(dev.deviceName + "." + (V ? "D1220" : "D1221"), out string msg);
+                                    LogHelper.Info($"ThreadGrats 鍐檣(dev.deviceName + "." + (V ? "D1220" : "D1221"))}涓�1 锛�鍚庤{d12201}");
+                                }
+                            }
+                            else if (dev.deviceType == 3)
+                            {
+
+                                var close = (System.UInt16)System.Convert.ChangeType(Conn.榛樿Redis.GetValue(dev.deviceName + "." + (V ? "D2220" : "D2225")), typeof(System.UInt16));
+                                if (close == 1)
+                                {
+                                    LogHelper.Info($"{dev.deviceName}{(V ? "宸� : "鍙�)} 鍏夋爡{(goin ? "鍏抽棴" : "寮�惎")} 鐢宠銆�宸茬粡鍏抽棴锛�);
+                                    continuuuuu = true;
+                                }
+                                else
+                                {
+                                    Conn.榛樿Redis.SetValue(dev.deviceName + "." + (V ? "D2212" : "D2217"), "1", dev.deviceName + "Queue");
+                                    Conn.榛樿Redis.SetValue(dev.deviceName + "." + (V ? "D2211" : "D2216"), "0", dev.deviceName + "Queue");
+                                }
                             }
                             LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} 璁惧鏄瘂dev.deviceName} 鍏抽棴鍏夋爡澶勭悊瀹屾垚 =================> ");
                         }
                     }
-
                 }
+
                 if (continuuuuu)
                 {
                     LogHelper.Info($"{item.S_TASK_NO}{item.S_ACTION_CODE} 杞﹁締鍙戦�缁х画浠诲姟锛�);
@@ -1066,10 +1215,14 @@
                         taskCode = item.S_TASK_NO
                     });
                     item.N_CREATEMETHOD = 1;
+                    item.S_REVIEW_COMMENT = $"杞﹀瓙缁х画浠诲姟OK";
                     taskActRepository.Update(item);
                 }
             }
             System.Threading.Thread.Sleep(3000);
+        }
+        public void ResetGats(Tag tag)
+        {
             LogHelper.Info($"ThreadGrats deviceType2鍏夋爡鍐欏叆浣嶉噸缃�=================> ");
             //閲嶇疆淇″彿
             foreach (var dev in Settings.deviceInfos.FindAll(x => x.deviceType == 2))
@@ -1099,6 +1252,20 @@
                 }
             }
             LogHelper.Info($"ThreadGrats deviceType2鍏夋爡鍐欏叆浣嶉噸缃畬鎴愩� =================> ");
+            LogHelper.Info($"ThreadGrats deviceType5鍏夋爡鍐欏叆浣嶉噸缃�=================> ");
+            //閲嶇疆淇″彿
+            //foreach (var dev in Settings.deviceInfos.FindAll(x => x.deviceType == 5))
+            {
+                if (tag.DZ1.D2211 == 1 && tag.DZ1.D2220 == 1)
+                    tag.DZ1.D2211 = 0;
+                if (tag.DZ1.D2216 == 1 && tag.DZ1.D2225 == 1)
+                    tag.DZ1.D2216 = 0;
+                if (tag.DZ2.D2211 == 1 && tag.DZ2.D2220 == 1)
+                    tag.DZ2.D2211 = 0;
+                if (tag.DZ2.D2216 == 1 && tag.DZ2.D2225 == 1)
+                    tag.DZ2.D2216 = 0;
+            }
+            LogHelper.Info($"ThreadGrats deviceType5鍏夋爡鍐欏叆浣嶉噸缃畬鎴愩� =================> ");
         }
         /// <summary>
         /// 1020  1023绌烘涓嬬嚎
@@ -1129,7 +1296,7 @@
                         var listtep = new List<string>();
                         if (Bssx == "1020")
                         {
-                            if (tag.SF涓嬫枡浣�RArrive1003 == 1)
+                            if (!string.IsNullOrEmpty(tag.SFT涓嬫枡鍙f墭鐩�R1003Barcode) && string.IsNullOrEmpty(tag.SFT涓嬫枡鍙f墭鐩�R1011Barcode))
                             {
                                 listtep = new List<string> { "1012", "1004" };
                             }
@@ -1140,7 +1307,8 @@
                         }
                         else
                         {
-                            if (tag.SF涓嬫枡浣�RArrive1005 == 1)
+                            //if (tag.SF涓嬫枡浣�RArrive1005 == 1)
+                            if (!string.IsNullOrEmpty(tag.SFT涓嬫枡鍙f墭鐩�R1005Barcode) && string.IsNullOrEmpty(tag.SFT涓嬫枡鍙f墭鐩�R1013Barcode))
                             {
                                 listtep = new List<string> { "1014", "1006" };
                             }
@@ -1576,7 +1744,7 @@
 
         }
 
-        public void ResolveMesTask()
+        public void ResolveMesTask(Tag tag)
         {
             TaskRepository taskservice = new TaskRepository();
             var tasks = taskservice.FindList(x => (x.S_B_STATE == "MES" || x.S_B_STATE == "People") && x.N_PRIORITY == -88);
@@ -1593,19 +1761,82 @@
                 LogHelper.Info($"瑙i噴MES浠诲姟 ->{task.S_TASK_NO} {(sx == null ? "闈� : "鏄�)}鎬昏鏈哄櫒浜轰换鍔�);
                 if (sx == null)
                 {
-                    LogHelper.Info($"瑙i噴MES浠诲姟 ->{task.S_TASK_NO} 鐩存帴鐢熸垚瀵瑰簲浠诲姟");
-                    //鐩存帴鐢熸垚瀵瑰簲浠诲姟銆�-                    var res = TaskProcess.CreateTask(task.S_TASK_NO, task.S_START_LOC, task.S_END_LOC, task.S_TYPE, 6, task.S_CNTRS?.Split(',').ToList() ?? new List<string>());
-
-                    LogHelper.Info($"瑙i噴MES浠诲姟 ->{task.S_TASK_NO} 鐩存帴鐢熸垚瀵瑰簲浠诲姟 缁撴灉锛歿res}");
-                    if (res)
+                    if (string.IsNullOrEmpty(task.S_CNTRS) && !string.IsNullOrEmpty(task.S_INDEX))
                     {
-                        LogHelper.Info($"瑙i噴MES浠诲姟 ->{task.S_TASK_NO} 淇敼鏍囪瘑");
-                        //task.N_PRIORITY = 0;
-                        taskservice.dbcontext.Set<TaskEntity>().Attach(task);
-                        taskservice.dbcontext.Entry(task).Property(x => x.N_PRIORITY).CurrentValue = 0;
-                        taskservice.dbcontext.Entry(task).Property(x => x.N_PRIORITY).IsModified = true;
-                        taskservice.dbcontext.SaveChanges();
+                        // 鍙枡浠诲姟銆�鎸囧畾鐗╂枡涓嶆寚瀹氭墭鐩橈紝闇�鍑哄簱
+                        switch (task.S_START_LOC)
+                        {
+                            case "2030":
+                                if (!string.IsNullOrEmpty(tag.SA2030.R鎵樼洏鐮�)
+                                {
+                                    var str = Settings.apiHelper.Post(Settings.MESbaseUrl + "mom-basic/dataTransmission/json/service/224", JsonConvert.SerializeObject(new
+                                    {
+                                        cntrCode = tag.SA2030.R鎵樼洏鐮�
+                                        type = 1
+                                    }));
+                                    var strr = JsonConvert.DeserializeObject<MES2234>(str);
+                                    if (strr.success && strr.data.materialCode == task.S_INDEX)
+                                    {
+                                        task.S_CNTRS = tag.SA2030.R鎵樼洏鐮�
+                                        taskservice.Update(task);
+                                    }
+                                    else
+                                    {
+                                        LogHelper.Info($"瑙i噴MES浠诲姟 ->{task.S_TASK_NO} 2030 鍑哄彛鐨勬墭鐩樼墿鏂欎笉绗﹀悎");
+                                    }
+                                }
+                                else
+                                {
+                                    //TODO------------------2027  2220   2013.. 璇嗗埆涓�笅锛屽紑濮嬪簱
+                                }
+                                break;
+                            case "1019":
+                                if (!string.IsNullOrEmpty(tag.SA1019.R鎵樼洏鐮�)
+                                {
+                                    var str = Settings.apiHelper.Post(Settings.MESbaseUrl + "mom-basic/dataTransmission/json/service/224", JsonConvert.SerializeObject(new
+                                    {
+                                        cntrCode = tag.SA1019.R鎵樼洏鐮�
+                                        type = 2
+                                    }));
+                                    var strr = JsonConvert.DeserializeObject<MES2234>(str);
+                                    if (strr.success && strr.data.materialCode == task.S_INDEX)
+                                    {
+                                        task.S_CNTRS = tag.SA2030.R鎵樼洏鐮�
+                                        taskservice.Update(task);
+                                    }
+                                    else
+                                    {
+                                        LogHelper.Info($"瑙i噴MES浠诲姟 ->{task.S_TASK_NO} 1019 鍑哄彛鐨勬墭鐩樼墿鏂欎笉绗﹀悎");
+                                    }
+                                }
+                                break;
+                        }
+                    }
+                    else
+                    {
+                        if (new List<string> { "2001", "1022", "1025", "3001", "3006" }.Contains(task.S_END_LOC))
+                        {
+                            //------------------
+                        }
+                        else if (new List<string> { "1019"/*, "1030"*/, "2030", "3005", "3010" }.Contains(task.S_START_LOC))  //1030 鏄富鍔ㄧ敵璇凤紝 涓嶇敤鍒ゆ柇銆�+                        {
+
+                        }
+
+                        LogHelper.Info($"瑙i噴MES浠诲姟 ->{task.S_TASK_NO} 鐩存帴鐢熸垚瀵瑰簲浠诲姟");
+                        //鐩存帴鐢熸垚瀵瑰簲浠诲姟銆�+                        var res = TaskProcess.CreateTask(task.S_TASK_NO, task.S_START_LOC, task.S_END_LOC, task.S_TYPE, 6, task.S_CNTRS?.Split(',').ToList() ?? new List<string>());
+
+                        LogHelper.Info($"瑙i噴MES浠诲姟 ->{task.S_TASK_NO} 鐩存帴鐢熸垚瀵瑰簲浠诲姟 缁撴灉锛歿res}");
+                        if (res)
+                        {
+                            LogHelper.Info($"瑙i噴MES浠诲姟 ->{task.S_TASK_NO} 淇敼鏍囪瘑");
+                            //task.N_PRIORITY = 0;
+                            taskservice.dbcontext.Set<TaskEntity>().Attach(task);
+                            taskservice.dbcontext.Entry(task).Property(x => x.N_PRIORITY).CurrentValue = 0;
+                            taskservice.dbcontext.Entry(task).Property(x => x.N_PRIORITY).IsModified = true;
+                            taskservice.dbcontext.SaveChanges();
+                        }
                     }
                 }
                 else
@@ -1865,12 +2096,12 @@
                                 {
                                     if (device2.deviceName.Contains("Js鎹烽『"))
                                     {
-                                        Task.Run(() =>
-                                        {
-                                            var inde = device2.location.ToList().FindIndex(x => x == wcsTask.S_END_LOC) == 0;
-                                            string V = inde ? "D1224" : "D1225";
-                                            Conn.榛樿Redis.SetValue(device2.deviceName + "." + V, "1", device2.deviceName + "Queue");
-                                        });
+                                        //Task.Run(() =>
+                                        //{
+                                        var inde = device2.location.ToList().FindIndex(x => x == wcsTask.S_END_LOC) == 0;
+                                        string V = inde ? "D1224" : "D1225";
+                                        Conn.榛樿Redis.SetValue(device2.deviceName + "." + V, "1", device2.deviceName + "Queue");
+                                        //});
 
                                         var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/202", JsonConvert.SerializeObject(new
                                         {
@@ -1899,6 +2130,31 @@
                                         }));
                                         LogHelper.Info($"{ssloc}鐢宠mes浠诲姟缁撴灉{str}");
                                     }
+                                }
+                                switch (device2.deviceType)
+                                {
+                                    case 4:
+                                        {
+                                            if (wcsTask.S_END_LOC == "2001")
+                                            {
+
+                                            }
+                                        }
+                                        break;
+                                    case 5:
+                                        {
+                                            var inde = device2.location.ToList().FindIndex(x => x == wcsTask.S_END_LOC) == 0;
+                                            string V = inde ? "D2210" : "D2215";
+                                            Conn.榛樿Redis.SetValue(device2.deviceName + "." + V, "1", device2.deviceName + "Queue");
+                                        }
+                                        break;
+                                    case 6:
+                                        {
+                                            //var inde = device2.location.ToList().FindIndex(x => x == wcsTask.S_END_LOC) == 0;
+                                            //string V = inde ? "D2210" : "D2215";
+                                            //Conn.榛樿Redis.SetValue(device2.deviceName + "." + V, "1", device2.deviceName + "Queue");
+                                        }
+                                        break;
                                 }
                             }
 
@@ -2022,16 +2278,127 @@
             }
         }
 
+        /// <summary>
+        /// 瀹氬瓙1鍙风嚎銆�+        /// 1.澧炲姞涓嬬嚎閫昏緫銆�  2. 鏈夊彇绛愪俊鍙峰氨鍐欙紝娌′俊鍙峰珣鍐�+        /// </summary>
+        /// <param name="tag"></param>
+        public void ThreadMXC3(Tag tag)
+        {
+            var VERX = Settings.deviceInfos.Find(x => x.deviceType == 5 && x.deviceName.Contains("1鍙�));
+            if (VERX == null)
+            {
+                LogHelper.Info("瀹氬瓙1鍙风嚎 deviceType 5 娌℃湁閰嶇疆銆�);
+                return;
+            }
+            LogHelper.Info($" {VERX.deviceName} D2221>{tag.DZ1.D2221} D2221_LAST>{tag.DZ1.D2221_LAST}  D2226>{tag.DZ1.D2226}  D2226_LAST>{tag.DZ1.D2226_LAST}");
+            if (tag.DZ1.D2221 == 1 && tag.DZ1.D2221_LAST == 0)
+            {
+                var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/200", JsonConvert.SerializeObject(new
+                {
+                    requestType = 7,
+                    startBit = VERX.location[0],
+                    unLockStartBitOutbin = true
+                }));
+                LogHelper.Info($"{VERX.location[0]}鐢宠mes浠诲姟缁撴灉{str}");
+                var strr = JsonConvert.DeserializeObject<Messss>(str);
+                if (strr != null && strr.success && strr.data?.state == 0)
+                    RedisHelper.Add($"D瀹氬瓙1鍙锋満姊版墜.D2221_LAST", "1", out string msg);
+            }
+            else if (tag.DZ1.D2221 == 0 && tag.DZ1.D2221_LAST == 1)
+            {
+                LogHelper.Info($"閲嶇疆 D瀹氬瓙1鍙锋満姊版墜.D2221_LAST > 0");
+                RedisHelper.Add($"D瀹氬瓙1鍙锋満姊版墜.D2221_LAST", "0", out string msg);
+
+                string V = 0 == 0 ? "D2210" : "D2215";
+                Conn.榛樿Redis.SetValue(VERX.deviceName + "." + V, "0", VERX.deviceName + "Queue");
+            }
 
 
+            if (tag.DZ1.D2226 == 1 && tag.DZ1.D2226_LAST == 0)
+            {
+                var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/200", JsonConvert.SerializeObject(new
+                {
+                    requestType = 7,
+                    startBit = VERX.location[1],
+                    unLockStartBitOutbin = true
+                }));
+                LogHelper.Info($"{VERX.location[0]}鐢宠mes浠诲姟缁撴灉{str}");
+                var strr = JsonConvert.DeserializeObject<Messss>(str);
+                if (strr != null && strr.success && strr.data?.state == 0)
+                    RedisHelper.Add($"D瀹氬瓙1鍙锋満姊版墜.D2226_LAST", "1", out string msg);
+            }
+            else if (tag.DZ1.D2226 == 0 && tag.DZ1.D2226_LAST == 1)
+            {
+                LogHelper.Info($"閲嶇疆 D瀹氬瓙1鍙锋満姊版墜.D2226_LAST > 0");
+                RedisHelper.Add($"D瀹氬瓙1鍙锋満姊版墜.D2226_LAST", "0", out string msg);
+                string V = 1 == 0 ? "D2210" : "D2215";
+                Conn.榛樿Redis.SetValue(VERX.deviceName + "." + V, "0", VERX.deviceName + "Queue");
+            }
 
 
+        }
+        /// <summary>
+        /// 瀹氬瓙2鍙风嚎銆�+        /// </summary>
+        /// <param name="tag"></param>
+        public void ThreadMXC4(Tag tag)
+        {
+            var VERX = Settings.deviceInfos.Find(x => x.deviceType == 5 && x.deviceName.Contains("2鍙�));
+            if (VERX == null)
+            {
+                LogHelper.Info("瀹氬瓙2鍙风嚎 deviceType 5 娌℃湁閰嶇疆銆�);
+                return;
+            }
+            LogHelper.Info($" {VERX.deviceName} D2221>{tag.DZ1.D2221} D2221_LAST>{tag.DZ1.D2221_LAST}  D2226>{tag.DZ1.D2226}  D2226_LAST>{tag.DZ1.D2226_LAST}");
+            if (tag.DZ2.D2221 == 1 && tag.DZ2.D2221_LAST == 0)
+            {
+                var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/200", JsonConvert.SerializeObject(new
+                {
+                    requestType = 7,
+                    startBit = VERX.location[0],
+                    unLockStartBitOutbin = true
+                }));
+                LogHelper.Info($"{VERX.location[0]}鐢宠mes浠诲姟缁撴灉{str}");
+                var strr = JsonConvert.DeserializeObject<Messss>(str);
+                if (strr != null && strr.success && strr.data?.state == 0)
+                    RedisHelper.Add($"D瀹氬瓙2鍙锋満姊版墜.D2221_LAST", "1", out string msg);
+            }
+            else if (tag.DZ2.D2221 == 0 && tag.DZ2.D2221_LAST == 1)
+            {
+                LogHelper.Info($"閲嶇疆 D瀹氬瓙2鍙锋満姊版墜.D2221_LAST > 0");
+                RedisHelper.Add($"D瀹氬瓙2鍙锋満姊版墜.D2221_LAST", "0", out string msg);
+                string V = 0 == 0 ? "D2210" : "D2215";
+                Conn.榛樿Redis.SetValue(VERX.deviceName + "." + V, "0", VERX.deviceName + "Queue");
+            }
 
 
+            if (tag.DZ2.D2226 == 1 && tag.DZ2.D2226_LAST == 0)
+            {
+                var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/200", JsonConvert.SerializeObject(new
+                {
+                    requestType = 7,
+                    startBit = VERX.location[1],
+                    unLockStartBitOutbin = true
+                }));
+                LogHelper.Info($"{VERX.location[0]}鐢宠mes浠诲姟缁撴灉{str}");
+                var strr = JsonConvert.DeserializeObject<Messss>(str);
+                if (strr != null && strr.success && strr.data?.state == 0)
+                    RedisHelper.Add($"D瀹氬瓙2鍙锋満姊版墜.D2226_LAST", "1", out string msg);
+            }
+            else if (tag.DZ2.D2226 == 0 && tag.DZ2.D2226_LAST == 1)
+            {
+                LogHelper.Info($"閲嶇疆 D瀹氬瓙2鍙锋満姊版墜.D2226_LAST > 0");
+                RedisHelper.Add($"D瀹氬瓙2鍙锋満姊版墜.D2226_LAST", "0", out string msg);
+                string V = 1 == 0 ? "D2210" : "D2215";
+                Conn.榛樿Redis.SetValue(VERX.deviceName + "." + V, "0", VERX.deviceName + "Queue");
+            }
 
-
+        }
 
     }
+
+
 
 
     public class HttpServer
@@ -2415,6 +2782,24 @@
         public Ddata data { get; set; }
         public object extra { get; set; }
     }
+    class Mesrespone
+    {
+        public bool success { get; set; }
+        public string msg { get; set; }
+        public object extra { get; set; }
+    }
+
+    class MES2234
+    {
+        public bool success { get; set; }
+        public ML data { get; set; }
+    }
+
+    public class ML
+    {
+        public string materialCode { get; set; }
+        public int lineNum { get; set; }
+    }
 
     public class Ddata
     {

--
Gitblit v1.9.1