From c9f926d24416de35c19558d2c0a67216693f3510 Mon Sep 17 00:00:00 2001
From: quanzhou <quan.zhou@broconcentric.com>
Date: 星期一, 23 三月 2026 13:46:09 +0800
Subject: [PATCH] 修改篮具上传超时时间,修改产品条码上传逻辑由一次性上传50片产品变成两片单独上传

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

diff --git a/src/Bro.M141.Process/MyMQTT.cs b/src/Bro.M141.Process/MyMQTT.cs
index e458671..86192f9 100644
--- a/src/Bro.M141.Process/MyMQTT.cs
+++ b/src/Bro.M141.Process/MyMQTT.cs
@@ -61,7 +61,6 @@
             _connection = _factory.CreateConnection();
             _sendChannel = _connection.CreateModel();
 
-
             if (channel == 0)
             {
                 _receiveChannel1 = _connection.CreateModel();
@@ -159,7 +158,7 @@
         }
 
         int num = 0;
-        public async Task<string> MESForBasketAsync(string ztype, string zlsn, string zlpn, string zstatus, string zversion, int timeoutMes = 30000)
+        public async Task<string> MESForBasketAsync(string ztype, string zlsn, string zlpn, string zstatus, string zversion, int timeoutMes = 60000)
         {
 
             string keystr = ztype + "_" + zlsn + "_" + zlpn + "_" + zstatus;
@@ -168,29 +167,28 @@
             {
                 CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"{keystr}鍖归厤鎴愬姛");
                 num++;
-                //var tem = MSGClasses.FirstOrDefault(u => u.key == keystr);
-                var tem = MSGClasses.Where(u => u.key == "1" && !string.IsNullOrEmpty(u.receive)).ToList();
-                //DateTime dt = DateTime.Now;
+                var tem = MSGClasses.Where(u => u.key == keystr && !string.IsNullOrEmpty(u.receive)).ToList();
                 if (num < 10)
                 {
-                    //while ((DateTime.Now - dt).TotalMilliseconds < timeoutMes)
-                    //{
-                        if (!string.IsNullOrEmpty(tem[0].receive))
+                    if (tem!=null)
+                    {
+                        if (tem.Count()>0)
                         {
-                            CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"RabbitMQ {keystr}浜屾鎺ユ敹 杩斿洖鍊兼甯� {tem[0].receive}");
-                            return tem[0].receive;
-                        }
-                        Thread.Sleep(1000);
-                    //}
+                            if (!string.IsNullOrEmpty(tem[0].receive))
+                            {
+                                CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"RabbitMQ {keystr}浜屾鎺ユ敹 杩斿洖鍊兼甯� {tem[0].receive}");
+                                return tem[0].receive;
+                            }
+                            Thread.Sleep(1000);
+                        }                       
+                    }               
                 }
                 else 
                 {
                     num = 0;
                     CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"RabbitMQ瓒呮椂澶勭悊娆℃暟瓒呰繃鍗佹");
-                    //return null;
                 }
                 CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"RabbitMQ浜屾鎺ユ敹鏁版嵁鎺ユ敹涓虹┖");
-                //return null;
             }
 
             var guid = Guid.NewGuid().ToString();
@@ -215,7 +213,6 @@
             _sendChannel.BasicPublish("", "auto_line_mac_queue", null, body);
 
             var completed = await Task.WhenAny(tcs.Task, Task.Delay(timeoutMes));
-
 
             _pendingTask1.TryRemove(guid, out _);
             if (completed == tcs.Task)
@@ -272,8 +269,6 @@
 
             string zr = DefectCodeMap.TryGetValue(pro.Result, out var code) ? code : DefaultErrorCode;
 
-
-
             var msgObj = new AutoLineMacBarcodeQueue
             {
                 zbguid = guid,
@@ -317,11 +312,8 @@
     public class MSGClass
     {
         public string key { get; set; }
-
         public string zguid { get; set; }
-
         public string receive { get; set; }
-
     }
 
 

--
Gitblit v1.8.0