From bdbc8b1459c415f24c3a5da0d27a05e034f7ba08 Mon Sep 17 00:00:00 2001
From: kingno <30263@KINGNO>
Date: 星期六, 19 七月 2025 17:02:46 +0800
Subject: [PATCH] mes优化

---
 src/Bro.M141.Process/MyMQTT.cs |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/Bro.M141.Process/MyMQTT.cs b/src/Bro.M141.Process/MyMQTT.cs
index 78ce1c3..53a5f75 100644
--- a/src/Bro.M141.Process/MyMQTT.cs
+++ b/src/Bro.M141.Process/MyMQTT.cs
@@ -15,6 +15,7 @@
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using ZXing;
 
 namespace Bro.M141.Process
 {
@@ -167,12 +168,21 @@
             }
         }
 
-        public async Task<string> MESForProduceAsync(ProductModel pro, string zwoid, int znonum, string endtray = "N", string line = "NQ216", int timeoutMs = 3000)
+        public async Task<string> MESForProduceAsync(ProductModel pro, int znonum, string endtray = "N", string line = "NQ216", int timeoutMs = 3000)
         {
             var guid = Guid.NewGuid().ToString();
             var tcs = new TaskCompletionSource<string>(TaskCreationOptions.RunContinuationsAsynchronously);
             _pendingTask2[guid] = tcs;
 
+            string zresult = "OK";
+            if (string.IsNullOrWhiteSpace(pro.Result))
+            {
+                zresult = "NG";
+            }
+            else if (!"OK".Equals(pro.Result))
+            {
+                zresult = "NG";
+            }
 
             var msgObj = new AutoLineMacBarcodeQueue
             {
@@ -180,10 +190,10 @@
                 zdate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff"),
                 zline = line,
                 zbarcode = pro.SN,
-                zresult = string.IsNullOrWhiteSpace(pro.Result) ? "NG" : pro.Result,
+                zresult = zresult,
                 zreson = pro.Result == "OK" ? "" : "SZ2014",
                 zno = znonum.ToString(),
-                zwoid = zwoid,
+                zwoid = pro.Zword,
                 endtray = endtray
             };
 

--
Gitblit v1.8.0