From 4cca6af72fa2288f433a7c4d604f9639d3fbfc63 Mon Sep 17 00:00:00 2001
From: czw <selecti@yeah.net>
Date: 星期三, 02 七月 2025 18:47:44 +0800
Subject: [PATCH] 1

---
 2025年6月12日/AuxAllWCS/Build/Project/代码/VS自定义类/AutoThread.cs |   31 +++++++++++++++++++++----------
 1 files changed, 21 insertions(+), 10 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 9708c0d..b2e5286 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"
@@ -122,7 +122,7 @@
         public string WriteLine(string value = "")
         {
 
-            
+
 
 
             // 鍦ㄨ繖閲屾嫤鎴鐞嗚緭鍑�@@ -251,7 +251,7 @@
             {
                 if (tag.wxr1.R44 && !tag.wxr1.R44_LAST && tag.wxr1.R10)
                 {
-                    if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode))
+                    if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode) && !string.IsNullOrEmpty(traycode.Trim()))
                     {
                         var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/200", JsonConvert.SerializeObject(new
                         {
@@ -284,7 +284,7 @@
                             RedisHelper.Add($"缁村笇灏旀姄鑷�.R10_LAST", "false", out string msg);
                         }
                         else
-                        if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode))
+                        if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode) && !string.IsNullOrEmpty(traycode.Trim()))
                         {
                             //涓婃姤鏍¢獙銆�                             ///var str = Settings.apiHelper.Post(Settings.MESbaseUrl + "mom-basic/dataTransmission/json/service/202", requestJson);
@@ -324,7 +324,7 @@
             {
                 if (tag.wxr1.R46 && !tag.wxr1.R46_LAST && tag.wxr1.R11)
                 {
-                    if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode))
+                    if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode) && !string.IsNullOrEmpty(traycode.Trim()))
                     {
                         var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/200", JsonConvert.SerializeObject(new
                         {
@@ -356,7 +356,7 @@
                             RedisHelper.Add($"缁村笇灏旀姄鑷�.R11_LAST", "false", out string msg);
                         }
                         else
-                        if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode))
+                        if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode) && !string.IsNullOrEmpty(traycode.Trim()))
                         {
                             //涓婃姤鏍¢獙銆�                             ///var str = Settings.apiHelper.Post(Settings.MESbaseUrl + "mom-basic/dataTransmission/json/service/202", requestJson);
@@ -396,7 +396,7 @@
             {
                 if (tag.wxr2.R44 && !tag.wxr2.R44_LAST && tag.wxr2.R10)
                 {
-                    if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode))
+                    if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode) && !string.IsNullOrEmpty(traycode.Trim()))
                     {
                         var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/200", JsonConvert.SerializeObject(new
                         {
@@ -428,7 +428,7 @@
                             RedisHelper.Add($"缁村笇灏旀姄鑷�.R10_LAST", "false", out string msg);
                         }
                         else
-                        if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode))
+                        if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode) && !string.IsNullOrEmpty(traycode.Trim()))
                         {
                             //涓婃姤鏍¢獙銆�                             ///var str = Settings.apiHelper.Post(Settings.MESbaseUrl + "mom-basic/dataTransmission/json/service/202", requestJson);
@@ -469,7 +469,7 @@
             {
                 if (tag.wxr2.R46 && !tag.wxr2.R46_LAST && tag.wxr2.R11)
                 {
-                    if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode))
+                    if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode) && !string.IsNullOrEmpty(traycode.Trim()))
                     {
                         var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/200", JsonConvert.SerializeObject(new
                         {
@@ -493,16 +493,19 @@
                 }
                 else
                 {
+                    //LogHelper.Info($"Threadwxr2R 鎵樼洏鏀剧疆淇″彿1銆傘�  -{tag.wxr2.R11_LAST}");
                     if (tag.wxr2.R11_LAST) //鎵樼洏鏀剧疆淇″彿銆傘�
                     {
+                        //LogHelper.Info($"Threadwxr2R 鎵樼洏鏀剧疆淇″彿1銆傘�  -{tag.wxr2.R11}");
                         if (tag.wxr2.R11)
                         {
                             //tag.wxr2.R11_LAST = false;
                             RedisHelper.Add($"缁村笇灏旀姄鑷�.R11_LAST", "false", out string msg);
                         }
                         else
-                        if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode))
+                        if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode) && !string.IsNullOrEmpty(traycode.Trim()))
                         {
+                            LogHelper.Info($"Threadwxr2R 涓婃姤鏍¢獙>{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
@@ -522,10 +525,18 @@
                                 //鎶ヨ銆�                             }
                         }
-                        else { TcpServer.TcpServerSend(VERX.deviceNo[1], GZ.Device.PLC.PlcHelper.Hex2Bin("544F4E")); }
+                        else
+                        {
+                            LogHelper.Info($"Threadwxr2R銆傘�  -鍙戦�鎵爜"); 
+                            TcpServer.TcpServerSend(VERX.deviceNo[1], GZ.Device.PLC.PlcHelper.Hex2Bin("544F4E"));
+                        }
                     }
                 }
             }
+            else
+            {
+                Console.WriteLine($"Threadwxr2R 缁村笇灏� 鍙� 璁惧鏈壘鍒般� =================> ");
+            }
         }
 
         public void ThreadTaskRun(Tag tag, Func<TaskEntity, bool> action)

--
Gitblit v1.9.1