From 01503b2809977ecdab703695c8e4bd70324f3c62 Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期二, 25 三月 2025 08:07:04 +0800
Subject: [PATCH] LED屏幕增加实时显示称重重量

---
 Admin.NET/WCS.Application/PLC/PLCService.cs    |   40 ++++++++++++++++++++++++++++++++++++++++
 Admin.NET/WCS.Application/PLC/PLCTaskAction.cs |    2 +-
 2 files changed, 41 insertions(+), 1 deletions(-)

diff --git a/Admin.NET/WCS.Application/PLC/PLCService.cs b/Admin.NET/WCS.Application/PLC/PLCService.cs
index 65e42b1..0632770 100644
--- a/Admin.NET/WCS.Application/PLC/PLCService.cs
+++ b/Admin.NET/WCS.Application/PLC/PLCService.cs
@@ -23,6 +23,9 @@
     private static readonly object OLock = new object();
 
     private static readonly ISqlSugarClient _db = SqlSugarSetup.ITenant.GetConnectionScope(SqlSugarConst.MainConfigId);
+    private static decimal weight94 = 0;
+    private static decimal weight160 = 0;
+    private static decimal weight155 = 0;
 
     public static void OnChangeEvent(object sender, EventArgs e)
     {
@@ -1192,6 +1195,43 @@
         {
             return;
         }
+
+        #region#瀹炴椂鏄剧ず閲嶉噺鍒癓ED灞忓箷
+        var modPosPalletWeightIng = modDevice.listStation.FirstOrDefault(m => m.Text == "瀹為檯閲嶉噺");
+        var (resPalletWeightIng, palletWeightValIng) = plcConn.GetPlcDBValue(modPosPalletWeightIng.PosType, modDevice.DbNumber, modPosPalletWeightIng.PlcPos);
+        switch (modDevice.StationNum)
+        {
+            case "094":
+                {
+                    if (Convert.ToDecimal(palletWeightValIng) != weight94)
+                    {
+                        LedDisplay(modDevice.LedIP, $"褰撳墠閲嶉噺(KG)锛歿Convert.ToDecimal(palletWeightValIng)}");
+                        weight94 = Convert.ToDecimal(palletWeightValIng);
+                    }
+                }
+                break;
+            case "160":
+                {
+                    if (Convert.ToDecimal(palletWeightValIng) != weight160)
+                    {
+                        LedDisplay(modDevice.LedIP, $"褰撳墠閲嶉噺(KG)锛歿Convert.ToDecimal(palletWeightValIng)}");
+                        weight160 = Convert.ToDecimal(palletWeightValIng);
+                    }
+                }
+                break;
+            case "155":
+                {
+                    if (Convert.ToDecimal(palletWeightValIng) != weight155)
+                    {
+                        LedDisplay(modDevice.LedIP, $"褰撳墠閲嶉噺(KG)锛歿Convert.ToDecimal(palletWeightValIng)}");
+                        weight155 = Convert.ToDecimal(palletWeightValIng);
+                    }
+                }
+                break;
+        }
+        #endregion
+
+
         var ledText = "";
         switch (modDevice.Value.ToString())
         {
diff --git a/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs b/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs
index 1805add..7d927d2 100644
--- a/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs
+++ b/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs
@@ -166,7 +166,7 @@
                             {
                                 //Console.WriteLine($"{modPlc.IP}璇诲彇{modDevice.DbNumber}.{modDevice.PlcPos}鐨勫�间负锛歿value}");
                                 //鏃犳祦绋嬭烦鍑�
-                                if (value == 0 && modPlc.Type != PLCTypeEnum.BoxConveyorLine)// 
+                                if (value == 0 && modPlc.Type != PLCTypeEnum.BoxConveyorLine && modDevice.StationNum != "094" && modDevice.StationNum != "160" && modDevice.StationNum != "155")// 
                                     continue;
                                 var dto = modDevice.Adapt<WcsDeviceDto>();
                                 dto.Value = value;

--
Gitblit v1.8.0