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/AlarmUtil.cs |   41 +++++++++++++++++++++++++++++++++++++++--
 1 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/SimpleUtil/HMI.Simple.Util/AlarmUtil.cs b/SimpleUtil/HMI.Simple.Util/AlarmUtil.cs
index 1a752ee..34c2ce9 100644
--- a/SimpleUtil/HMI.Simple.Util/AlarmUtil.cs
+++ b/SimpleUtil/HMI.Simple.Util/AlarmUtil.cs
@@ -4,14 +4,15 @@
 {
     public class AlarmUtil
     {
-        public static bool CreateAlarm(string alarmContent, out string msg)
+
+        public static bool CreateAlarm(string source, string content, int level, out string msg)
         {
             msg = string.Empty;
             try
             {
                 using (var helper = new MSMQHelper("HMI_Alarm"))
                 {
-                    helper.Send("Alarm", alarmContent);
+                    helper.Send("Alarm", source, content, level);
                     return true;
                 }
             }
@@ -21,5 +22,41 @@
                 return false;
             }
         }
+
+        /// <summary>
+        /// 鍒涘缓鎶ヨ
+        /// </summary>
+        /// <param name="source">鎶ヨ鏉ユ簮</param>
+        /// <param name="contents">鎶ヨ鍐呭锛屽悓涓�鏉ユ簮鐨勬姤璀﹀彲浠ュ鏉″悓鏃跺垱寤�</param>
+        /// <param name="msg">鍒涘缓澶辫触鏃朵负寮傚父淇℃伅</param>
+        /// <returns>鍒涘缓澶辫触鏃朵负寮傚父淇℃伅</returns>
+        public static bool CreateAlarm(string source, string[] contents, int[] levels, out string msg)
+        {
+            msg = string.Empty;
+            try
+            {
+                using (var helper = new MSMQHelper("HMI_Alarm"))
+                {
+                    for (int i = 0; i < contents.Length; i++)
+                    {
+                        helper.Send("Alarm", source, contents[i], levels[i]);
+                    }
+                    return true;
+                }
+            }
+            catch (Exception ex)
+            {
+                msg = ex.Message;
+                return false;
+            }
+        }
+        //private static string ConcatAlarm(string source, string content)
+        //{
+        //    return $"{source},{content}";
+        //}
+        //public static bool CreateAlarm(string content, int level, out string msg)
+        //{
+        //    return CreateAlarm("PC", content, level, out msg);
+        //}
     }
 }

--
Gitblit v1.9.1