From 046df0f7526575cfb8b4b8c045d864c498b5a46c Mon Sep 17 00:00:00 2001
From: lixiaojun <1287241240@qq.com>
Date: 星期五, 06 十二月 2024 17:06:46 +0800
Subject: [PATCH] 项目Service优化,可见视图列表优化

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/03-calcu/02-label/SimulationCalcuResultLabelHelper.cs |   36 ++++++++++++++++--------------------
 1 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/03-calcu/02-label/SimulationCalcuResultLabelHelper.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/03-calcu/02-label/SimulationCalcuResultLabelHelper.cs
index 3124855..78d9020 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/03-calcu/02-label/SimulationCalcuResultLabelHelper.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/03-calcu/02-label/SimulationCalcuResultLabelHelper.cs
@@ -12,17 +12,14 @@
         /// </summary>
         public SimulationCalcuResultLabelHelper
             (
-                SimulationVisualListHelper visualListHelper,
                 SimulationCalcuResultHelper calcuResultHelper,
                 ISimulationCalcuResultLabelView view
             )
         {
-            _visualListHelper = visualListHelper;
             _calcuResultHelper = calcuResultHelper;
             _views = new List<ISimulationCalcuResultLabelView>() { view };
         }
 
-        private SimulationVisualListHelper _visualListHelper = null;//鍙鍒楄〃杈呭姪绫�
         private SimulationCalcuResultHelper _calcuResultHelper = null;//璁$畻缁撴灉杈呭姪绫�
         private List<ISimulationCalcuResultLabelView> _views = null;//瑙嗗浘鍒楄〃
 
@@ -44,26 +41,25 @@
             if (this.Visible)
             {
                 var labels = GetLabels();
-                _views.ForEach(x => x.SetLogicCalcuCustomLabels(labels));
+                if (labels != null && labels.Count > 0)
+                {
+                    _views.ForEach(async x => await x.SetLogicCalcuCustomLabels(labels));
+                    return;
+                }
             }
-            else
-            {
-                _views.ForEach(x => x.ClearLogicCalcuCustomLabels());
-            }
+            _views.ForEach(async x => await x.ClearLogicCalcuCustomLabels());
         }
-
 
         //鑾峰彇璁$畻鏍囩
         private List<LogicCalcuCustomLabel> GetLabels()
         {
-            var hydroInfo = _visualListHelper.HydroInfo;
-            if (hydroInfo == null)
+            if (!_calcuResultHelper.Initialized)
             {
                 return default;
             }
             var allCalcuResultVisualDict = _calcuResultHelper.GetVisualDict();
             var allCalcuLabels = new List<LogicCalcuCustomLabel>();
-            hydroInfo.Pumps?.ForEach(x =>
+            _calcuResultHelper.HydroInfo.Pumps?.ForEach(x =>
             {
                 var hz = Math.Round(x.RatedHz * x.SpeedRatio);
                 var calcuPumpResult = allCalcuResultVisualDict.GetValue(x.Code) as HydroCalcuLinkResult;
@@ -75,18 +71,18 @@
                     pumpCustomLabel.Id = x.Code;
                     pumpCustomLabel.Distance = 20000;
                     pumpCustomLabel.Data = new List<LogicCalcuCustomLabelItem>()
-                    {
-                        new LogicCalcuCustomLabelItem(){ Name="鐘舵��",Value=HydroLinkStatusHelper.GetStatusName(x.LinkStatus),Unit=string.Empty},
-                        new LogicCalcuCustomLabelItem(){ Name="棰戠巼",Value=hz.ToString(),Unit=string.Empty},
-                        new LogicCalcuCustomLabelItem(){ Name="娴侀噺",Value=Math.Round(calcuPumpResult.CalcuFlow.Value,1).ToString(),Unit="m鲁/h"},
-                        new LogicCalcuCustomLabelItem(){ Name="杩涘彛鍘嬪姏",Value=Math.Round(calcuPumpStartResult.CalcuHead.Value,4).ToString(),Unit="m"},
-                        new LogicCalcuCustomLabelItem(){ Name="鍑哄彛鍘嬪姏",Value=Math.Round(calcuPumpEndResult.CalcuHead.Value,4).ToString(),Unit="m"},
-                    };
+                        {
+                            new LogicCalcuCustomLabelItem(){ Name="鐘舵��",Value=HydroLinkStatusHelper.GetStatusName(x.LinkStatus),Unit=string.Empty},
+                            new LogicCalcuCustomLabelItem(){ Name="棰戠巼",Value=x.LinkStatus==Yw.Hydro.PumpStatus.Open?hz.ToString():"0",Unit="hz"},
+                            new LogicCalcuCustomLabelItem(){ Name="娴侀噺",Value=Math.Round(calcuPumpResult.CalcuFlow.Value,1).ToString(),Unit="m鲁/h"},
+                            new LogicCalcuCustomLabelItem(){ Name="杩涘彛鍘嬪姏",Value=Math.Round(calcuPumpStartResult.CalcuHead.Value,4).ToString(),Unit="m"},
+                            new LogicCalcuCustomLabelItem(){ Name="鍑哄彛鍘嬪姏",Value=Math.Round(calcuPumpEndResult.CalcuHead.Value,4).ToString(),Unit="m"},
+                        };
                     allCalcuLabels.Add(pumpCustomLabel);
                 }
             });
 
-            hydroInfo.GetAllEmitters()?.ForEach(x =>
+            _calcuResultHelper.HydroInfo.GetAllEmitters()?.ForEach(x =>
             {
                 var calcuEmitter = allCalcuResultVisualDict.GetValue(x.Code) as HydroCalcuNodeResult;
                 var emitterCustomLabel = new LogicCalcuCustomLabel();

--
Gitblit v1.9.3