From c469200a8f46df6ee518c3cb7226e8a8ad6217af Mon Sep 17 00:00:00 2001
From: quanzhou <quan.zhou@broconcentric.com>
Date: 星期一, 25 八月 2025 10:48:17 +0800
Subject: [PATCH] 给mes功能添加日志记录,优化Statistic.json的读写功能

---
 src/Bro.M141.Process/MyMQTT.cs |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/Bro.M141.Process/MyMQTT.cs b/src/Bro.M141.Process/MyMQTT.cs
index 84ea30a..dbab185 100644
--- a/src/Bro.M141.Process/MyMQTT.cs
+++ b/src/Bro.M141.Process/MyMQTT.cs
@@ -8,7 +8,6 @@
 using RabbitMQ.Client;
 using RabbitMQ.Client.Events;
 using SourceGrid.Cells.Editors;
-
 using Sunny.UI.Win32;
 using System;
 using System.Collections.Concurrent;
@@ -81,8 +80,6 @@
                 InitConsumer(_receiveChannel2, _queue2, HandleQueue2Message);
             }
 
-
-
             CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, "RabbitMQ 杩炴帴鎴愬姛");
         }
 
@@ -111,16 +108,19 @@
                 }
                 else
                 {
+
+                    CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"RabbitMQ 绡叿 鏀跺埌鏈尮閰� zbguid锛歿obj?.zbguid}");
+
                     if (MSGClasses.Any(u => u.zguid == obj?.zbguid))
                     {
                         var tem = MSGClasses.FirstOrDefault(u => u.zguid == obj?.zbguid);
                         if (!string.IsNullOrEmpty(tem.receive))
                         {
                             tem.receive = message;
+
+                            CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"RabbitMQ 绡叿鏈夎秴鏃跺姩浣滐紝鎴暀涓嬪尮閰嶄俊鎭細{message}");
                         }
                     }
-
-                    CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"RabbitMQ 绡叿 鏀跺埌鏈尮閰� zbguid锛歿obj?.zbguid}");
                 }
             }
             catch (Exception ex)
@@ -164,21 +164,23 @@
                 {
                     if (!string.IsNullOrEmpty(tem.receive))
                     {
+
+                        CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"RabbitMQ {keystr}浜屾鎺ユ敹 杩斿洖鍊兼甯� {tem.receive}");
+                        
                         return tem.receive;
                     }
                     Thread.Sleep(1000);
                 }
                 MSGClasses.RemoveAll(u => u.key == keystr);
-                return tem.receive;
+                CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"RabbitMQ {keystr}浜屾鎺ユ敹 杩斿洖鍊间负绌�");
+
+                return null;
             }
-
-
 
 
             var guid = Guid.NewGuid().ToString();
             var tcs = new TaskCompletionSource<string>(TaskCreationOptions.RunContinuationsAsynchronously);
             _pendingTask1[guid] = tcs;
-
 
             var msgObj = new AutoLineMacQueue
             {

--
Gitblit v1.8.0