From b544d5cccd76735e034c8055918a50927b437474 Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期二, 10 十一月 2026 08:29:04 +0800
Subject: [PATCH] fix: 维护模式重复进入失败与按钮灰死 + Broker 并发验证用例

---
 SimpleUtil/HMI.Simple.Util/MSMQHelper.cs |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/SimpleUtil/HMI.Simple.Util/MSMQHelper.cs b/SimpleUtil/HMI.Simple.Util/MSMQHelper.cs
index 3232d7e..06d9f04 100644
--- a/SimpleUtil/HMI.Simple.Util/MSMQHelper.cs
+++ b/SimpleUtil/HMI.Simple.Util/MSMQHelper.cs
@@ -3,6 +3,15 @@
 
 namespace HMI.Simple.Util
 {
+
+    public class MQAlarm
+    {
+        public string Source { get; set; }
+        public string Content { get; set; }
+        public int Level { get; set; }
+    }
+
+
     public class MSMQHelper : IDisposable
     {
         /// <summary>
@@ -40,7 +49,7 @@
                     // 濡傛灉娑堟伅闃熷垪涓嶅瓨鍦紝鍒欏垱寤烘秷鎭鍨�
                     this.msgQueue = MessageQueue.Create(this.msmqPath);
                 }
-                this.msgQueue.Formatter = new XmlMessageFormatter(new Type[] { typeof(string) });
+                this.msgQueue.Formatter = new XmlMessageFormatter(new Type[] { typeof(MQAlarm) });
             }
             catch (Exception ex)
             {
@@ -53,11 +62,11 @@
         /// </summary>
         /// <param name="MessageID">娑堟伅ID</param>
         /// <param name="MsgString">瑕佸彂閫佺殑瀛楃涓�</param>
-        public void Send(string MessageID, string MsgString)
+        public void Send(string MessageID, string source, string MsgString, int level)
         {
             try
             {
-                this.msgQueue.Send(MsgString, MessageID);
+                this.msgQueue.Send(new MQAlarm { Source = source, Content = MsgString, Level = level }, MessageID);
             }
             catch (Exception ex)
             {
@@ -71,12 +80,12 @@
         /// <param name="TimeOut">瓒呮椂鏃堕棿(ms)</param>
         /// <param name="MessageID">娑堟伅ID</param>
         /// <param name="MsgString">娑堟伅鍐呭</param>
-        public void Receive(long TimeOut, out string MessageID, out string MsgString)
+        public void Receive(long TimeOut, out string MessageID, out MQAlarm alarm)
         {
             try
             {
                 MessageID = string.Empty;
-                MsgString = string.Empty;
+                alarm = null;
                 TimeSpan Time = new TimeSpan(TimeOut);
                 Message MsgReceived = null;
                 try
@@ -91,7 +100,7 @@
                 if (MsgReceived != null)
                 {
                     MessageID = MsgReceived.Label;
-                    MsgString = MsgReceived.Body.ToString();
+                    alarm = (MQAlarm)MsgReceived.Body;
                 }
             }
             catch (Exception ex)

--
Gitblit v1.9.1