From 0fd4a678c2218c42d383e964a6b4aca975aa7b7a Mon Sep 17 00:00:00 2001
From: Shuxia Ning <NingShuxia0927@outlook.com>
Date: 星期一, 02 十二月 2024 14:32:51 +0800
Subject: [PATCH] 图表修改

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/03-calcu/02-label/SimulationCalcuResultLabelHelper.cs |   51 +++++++++++++++++++++------------------------------
 1 files changed, 21 insertions(+), 30 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 1698437..83ec023 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,54 +41,48 @@
             if (this.Visible)
             {
                 var labels = GetLabels();
-                _views.ForEach(x => x.SetLogicCalcuCustomLabels(labels));
+                if (labels != null && labels.Count > 0)
+                {
+                    _views.ForEach(x => x.SetLogicCalcuCustomLabels(labels));
+                    return;
+                }
             }
-            else
-            {
-                _views.ForEach(x => x.ClearLogicCalcuCustomLabels());
-            }
+            _views.ForEach(x => x.ClearLogicCalcuCustomLabels());
         }
 
         //鑾峰彇璁$畻鏍囩
         private List<LogicCalcuCustomLabel> GetLabels()
         {
-            var hydroInfo = _visualListHelper.HydroInfo;
-            if (hydroInfo == null)
+            if (!_calcuResultHelper.Initialized)
             {
                 return default;
             }
-            var workingInfo = JsonHelper.Json2Object<HydroWorkingInfoViewModel>(_calcuResultHelper.Working.WorkingInfo);
             var allCalcuResultVisualDict = _calcuResultHelper.GetVisualDict();
             var allCalcuLabels = new List<LogicCalcuCustomLabel>();
-            hydroInfo.Pumps?.ForEach(x =>
+            _calcuResultHelper.HydroInfo.Pumps?.ForEach(x =>
             {
-                var workingPump = workingInfo?.Pumps?.Find(t => t.Code == x.Code);
-                if (workingPump != null)
+                var hz = Math.Round(x.RatedHz * x.SpeedRatio);
+                var calcuPumpResult = allCalcuResultVisualDict.GetValue(x.Code) as HydroCalcuLinkResult;
+                if (calcuPumpResult != null)
                 {
-                    var hz = Math.Round(x.RatedHz * x.SpeedRatio);
-                    var calcuPumpResult = allCalcuResultVisualDict.GetValue(x.Code) as HydroCalcuLinkResult;
-                    if (calcuPumpResult != null)
-                    {
-                        var calcuPumpStartResult = allCalcuResultVisualDict.GetValue(x.StartCode) as HydroCalcuNodeResult;
-                        var calcuPumpEndResult = allCalcuResultVisualDict.GetValue(x.EndCode) as HydroCalcuNodeResult;
-                        var pumpCustomLabel = new LogicCalcuCustomLabel();
-                        pumpCustomLabel.Id = x.Code;
-                        pumpCustomLabel.Distance = 20000;
-                        pumpCustomLabel.Data = new List<LogicCalcuCustomLabelItem>()
+                    var calcuPumpStartResult = allCalcuResultVisualDict.GetValue(x.StartCode) as HydroCalcuNodeResult;
+                    var calcuPumpEndResult = allCalcuResultVisualDict.GetValue(x.EndCode) as HydroCalcuNodeResult;
+                    var pumpCustomLabel = new LogicCalcuCustomLabel();
+                    pumpCustomLabel.Id = x.Code;
+                    pumpCustomLabel.Distance = 20000;
+                    pumpCustomLabel.Data = new List<LogicCalcuCustomLabelItem>()
                         {
-                            new LogicCalcuCustomLabelItem(){ Name="鐘舵��",Value=HydroLinkStatusHelper.GetStatusName(workingPump.LinkStatus),Unit=string.Empty},
-                            new LogicCalcuCustomLabelItem(){ Name="棰戠巼",Value=workingPump.CurrentHz.ToString(),Unit=string.Empty},
+                            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);
-                    }
+                    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