From cec8d92bdca1da0b2eafe6eb3130f4bf6f03028b Mon Sep 17 00:00:00 2001
From: duheng <2286773002@qq.com>
Date: 星期三, 12 三月 2025 10:21:09 +0800
Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/HStation/XHS.V1.0

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/04-monitor/02-value/SimulationMonitorValueHelper.cs |   71 ++++++++++++++++-------------------
 1 files changed, 33 insertions(+), 38 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/04-monitor/02-value/SimulationMonitorValueHelper.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/04-monitor/02-value/SimulationMonitorValueHelper.cs
index 7baca20..de69dcc 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/04-monitor/02-value/SimulationMonitorValueHelper.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/04-monitor/02-value/SimulationMonitorValueHelper.cs
@@ -1,4 +1,5 @@
-锘縰sing Yw.Vmo;
+锘縰sing Yw.Hydro;
+using static Yw.WinFrmUI.Q3d.EpanetEnum;
 
 namespace HStation.WinFrmUI
 {
@@ -10,75 +11,69 @@
         /// <summary>
         /// 
         /// </summary>
-        public SimulationMonitorValueHelper(SimulationVisualListHelper visualListHelper, SimulationMonitorHelper monitorHelper)
+        public SimulationMonitorValueHelper
+            (
+                SimulationVisualListHelper visualListHelper,
+                SimulationMonitorHelper monitorHelper
+            )
         {
             _visualListHelper = visualListHelper;
             _monitorHelper = monitorHelper;
         }
 
-        private SimulationVisualListHelper _visualListHelper = null;//鍙鍒楄〃杈呭姪绫�
-        private SimulationMonitorHelper _monitorHelper = null;//鐩戞祴鐐硅緟鍔╃被     
-        private List<HydroMonitorValueViewModel> _allMonitorValueList = null;//鎵�鏈夌洃娴嬪�煎垪琛�
+        private readonly SimulationVisualListHelper _visualListHelper = null;//鍙鍒楄〃杈呭姪绫�
+        private readonly SimulationMonitorHelper _monitorHelper = null;//鐩戞祴鐐硅緟鍔╃被     
+        private List<HydroMonitorValueViewModel> _allList = null;//鎵�鏈夌洃娴嬪�煎垪琛�
 
         /// <summary>
-        /// 鑾峰彇
+        /// 鑾峰彇鎵�鏈�
         /// </summary>
-        public async Task<List<HydroMonitorValueViewModel>> Get()
+        public async Task<List<HydroMonitorValueViewModel>> GetAll()
         {
-            if (_allMonitorValueList == null)
+            if (_allList == null)
             {
-                _allMonitorValueList = new List<HydroMonitorValueViewModel>();
+                _allList = new List<HydroMonitorValueViewModel>();
                 var allVisualDict = _visualListHelper.GetVisualDict();
                 if (allVisualDict != null && allVisualDict.Count > 0)
                 {
-                    var allMonitorList = await _monitorHelper.Get();
+                    var allMonitorList = await _monitorHelper.GetAll();
                     if (allMonitorList != null && allMonitorList.Count > 0)
                     {
                         foreach (var monitor in allMonitorList)
                         {
-                            if (allVisualDict.ContainsKey(monitor.Relation))
+                            if (allVisualDict.ContainsKey(monitor.Parter))
                             {
-                                var visual = allVisualDict[monitor.Relation];
-                                var vm = new HydroMonitorValueViewModel(monitor, visual);
-                                _allMonitorValueList.Add(vm);
+                                var visual = allVisualDict[monitor.Parter];
+                                var vm = new HydroMonitorValueViewModel(monitor, visual, null);
+                                _allList.Add(vm);
                             }
                         }
                     }
                 }
             }
-            return _allMonitorValueList;
+            return _allList;
         }
 
         /// <summary>
         /// 鏇存柊
         /// </summary>
-        public async void Update(string code, List<HydroMonitorVmo> monitorList)
+        public async Task Update(string code, List<HydroMonitorValueViewModel> valueList)
         {
-            var visual = _visualListHelper.GetVisual(code);
-            if (visual == null)
+            var all = await GetAll();
+            all.RemoveAll(x => x.Vmo.Parter == code);
+            if (valueList != null && valueList.Count > 0)
             {
-                return;
+                all.AddRange(valueList);
             }
+        }
 
-            var allMonitorValueList = await Get();
-            var monitorValueList = allMonitorValueList.Where(x => x.Vmo.Relation == code).ToList();
-            monitorValueList?.ForEach(x =>
-            {
-                var result = monitorList?.Exists(t => t.Relation == x.Vmo.Relation && t.PropName == x.Vmo.PropName);
-                if (!(result.HasValue && result.Value))
-                {
-                    allMonitorValueList.Remove(x);
-                }
-            });
-            monitorList?.ForEach(x =>
-            {
-                var result = monitorValueList?.Exists(t => t.Vmo.Relation == x.Relation && t.Vmo.PropName == x.PropName);
-                if (!(result.HasValue && result.Value))
-                {
-                    var vm = new HydroMonitorValueViewModel(x, visual);
-                    allMonitorValueList.Add(vm);
-                }
-            });
+        /// <summary>
+        /// 閲嶇疆
+        /// </summary>
+        public async void Reset(string monitorInfo)
+        {
+            var allMonitorValueList = await GetAll();
+            allMonitorValueList.UpdateMonitorValue(monitorInfo);
         }
 
 

--
Gitblit v1.9.3