From b4db153d2e28d451592811fea29c6d1bab71887b Mon Sep 17 00:00:00 2001
From: lixiaojun <1287241240@qq.com>
Date: 星期二, 30 四月 2024 13:52:53 +0800
Subject: [PATCH] 优化运行分析,运行记录结构更改,运行服务新增监测中断判断

---
 Yw.Server.Run/02-emws/02-single/EMWSRunAnalyChangeTimesHelper.cs |   36 +++++++++++++++++++++++++++++-------
 1 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/Yw.Server.Run/02-emws/02-single/EMWSRunAnalyChangeTimesHelper.cs b/Yw.Server.Run/02-emws/02-single/EMWSRunAnalyChangeTimesHelper.cs
index 5bc149b..20b8119 100644
--- a/Yw.Server.Run/02-emws/02-single/EMWSRunAnalyChangeTimesHelper.cs
+++ b/Yw.Server.Run/02-emws/02-single/EMWSRunAnalyChangeTimesHelper.cs
@@ -1,26 +1,48 @@
-锘縩amespace Yw.Server
+锘縰sing Yw.Service.Basic;
+using Yw.Service.Monitor;
+
+namespace Yw.Server
 {
     /// <summary>
     /// 
     /// </summary>
     public class EMWSRunAnalyChangeTimesHelper
     {
-        private static ConcurrentDictionary<long, List<Yw.Model.MonitorRealRecord>> _dict = new();//缂撳瓨
+        private static readonly ConcurrentDictionary<long, List<int>> _dict = new();//缂撳瓨
 
         /// <summary>
         /// 璁剧疆
         /// </summary>
-        public static void Set(long configureId, int changeTimes, Yw.Model.MonitorRealRecord record)
+        public static void Set(long configureId, int changeTimes, Yw.Model.MonitorPoint monitor, Yw.Model.MonitorRealRecord record)
         {
-            _dict.TryAdd(configureId, new List<Yw.Model.MonitorRealRecord>());
+            _dict.TryAdd(configureId, new List<int>());
             if (_dict[configureId].Count >= changeTimes)
             {
                 _dict[configureId].RemoveAt(0);
             }
-            if (record != null)
+            var rsa = Yw.Run.RunStatus.Shut;
+            if (monitor != null)
             {
-                _dict[configureId].Add(record);
+                if (record != null)
+                {
+                    if (int.TryParse(record.DataValue, out int intDataValue))
+                    {
+                        if (intDataValue > Yw.Monitor.RunStatus.Shut)
+                        {
+                            rsa = Yw.Run.RunStatus.Run;
+                        }
+                    }
+                }
+                var config_interrupt = Yw.Run.SysParas.EnableMonitorInterruptJudgement.GetPValue<bool?>();
+                if (config_interrupt.HasValue && config_interrupt.Value)
+                {
+                    if (monitor.IsInterrupt(record))
+                    {
+                        rsa = Yw.Run.RunStatus.Shut;
+                    }
+                }
             }
+            _dict[configureId].Add(rsa);
         }
 
         /// <summary>
@@ -36,7 +58,7 @@
             {
                 return false;
             }
-            if (_dict[configureId].Select(x => x.DataValue).Distinct().Count() > 1)
+            if (_dict[configureId].Distinct().Count() > 1)
             {
                 return false;
             }

--
Gitblit v1.9.3