From 9d1660270272180cd71147d6ddd53d1382643d2e Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期一, 02 十一月 2026 18:00:14 +0800
Subject: [PATCH] merge: 并入远程 Initial commit 作为历史根节点

---
 SimpleUtil/HMI.Simple.Util/AlarmUtil.cs |   62 +++++++++++++++++++++++++++++++
 1 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/SimpleUtil/HMI.Simple.Util/AlarmUtil.cs b/SimpleUtil/HMI.Simple.Util/AlarmUtil.cs
new file mode 100644
index 0000000..34c2ce9
--- /dev/null
+++ b/SimpleUtil/HMI.Simple.Util/AlarmUtil.cs
@@ -0,0 +1,62 @@
+锘縰sing System;
+
+namespace HMI.Simple.Util
+{
+    public class AlarmUtil
+    {
+
+        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", source, content, level);
+                    return true;
+                }
+            }
+            catch (Exception ex)
+            {
+                msg = ex.Message;
+                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