From 533a8ac04b44038dc88deb07093bcdd81a8cbc57 Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期六, 22 三月 2025 15:42:07 +0800
Subject: [PATCH] 修改LED显示异常入库信息问题

---
 Admin.NET/WCS.Application/PLC/PLCService.cs |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/Admin.NET/WCS.Application/PLC/PLCService.cs b/Admin.NET/WCS.Application/PLC/PLCService.cs
index 42ac0e4..65e42b1 100644
--- a/Admin.NET/WCS.Application/PLC/PLCService.cs
+++ b/Admin.NET/WCS.Application/PLC/PLCService.cs
@@ -1236,7 +1236,7 @@
                             break;
                     }
 
-                    string errorStr = "寮傚父淇℃伅锛�";
+                    string errorStr = string.Empty;
                     //灏嗗紓甯镐俊鎭樉绀哄埌LED灞忓箷涓�
                     var (errorRes0, errorVal0) = plcConn.GetPlcDBValue(PLCDataTypeEnum.Bit, $"M{dbStr}.0", "");
                     if (errorRes0.IsSucceed && errorVal0 == true)
@@ -1283,9 +1283,15 @@
                     {
                         errorStr += " 鎵爜浠�氳鎶ヨ";
                     }
-                    ledText += $"鐢宠鍏ュ簱澶辫触\n\n";
-                    ledText += $"{errorStr}";
-                    LedDisplay(modDevice.LedIP, ledText);                    
+
+                    if (!string.IsNullOrEmpty(errorStr))
+                    {
+                        errorStr = "寮傚父淇℃伅锛�" + errorStr;
+
+                        ledText += $"鐢宠鍏ュ簱澶辫触\n\n";
+                        ledText += $"{errorStr}";
+                        LedDisplay(modDevice.LedIP, ledText);
+                    }                                    
                 }
                 break;
             case "320":
@@ -2882,12 +2888,20 @@
         }
     }
 
-    private static void LedDisplay(string ip,string text) 
+    private static void LedDisplay(string ip,string text,int type=0) 
     {
         try
         {
             LedDll Led = new LedDll();
-            Led.ConsoleLeds(ip, text);
+            if (type == 0)
+            {
+                Led.ConsoleLeds(ip, text);
+            }
+            else
+            { 
+                Led.LEDstr(ip, text);
+            }
+            
             // 璁剧疆瀹炰緥
             //Led.ConsoleLeds("10.18.51.238", $"浠诲姟绫诲瀷:{TaskTypeEnum.Move.GetDescription()}\n\n浠诲姟鍙�:TK2024102100001\n鎵樼洏鍙�:LN000145\n\n璧峰浣�:033\n鐩爣浣�:R01-02010102");
         }

--
Gitblit v1.8.0