From f7e178128b7d66967db9517a20de54265ae4e5f4 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期二, 24 十二月 2024 16:15:01 +0800 Subject: [PATCH] 批量修改 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/00-core/03-calcu/02-label/SimulationCalcuResultLabelHelper.cs | 143 +++++++++++++++++++++++++++++++++-------------- 1 files changed, 101 insertions(+), 42 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..6a2765e 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,67 +41,129 @@ 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 workingInfo = JsonHelper.Json2Object<HydroWorkingInfoViewModel>(_calcuResultHelper.Working.WorkingInfo); var allCalcuResultVisualDict = _calcuResultHelper.GetVisualDict(); - var allCalcuLabels = new List<LogicCalcuCustomLabel>(); - 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 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=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); - } - } + var allCalcuLabels = new List<LogicCalcuCustomLabel>(); + + #region 姘存睜 + + _calcuResultHelper.HydroInfo.GetAllTanks()?.ForEach(x => + { + var calcuTankResult = allCalcuResultVisualDict.GetValue(x.Code) as HydroCalcuTankResult; + var customLabel = new LogicCalcuCustomLabel(); + customLabel.Id = x.Code; + customLabel.Distance = 50000; + customLabel.Data = new List<LogicCalcuCustomLabelItem>() + { + new LogicCalcuCustomLabelItem(){ Name="姘翠綅",Value=Math.Round(calcuTankResult.CalcuL.Value,2).ToString(),Unit="m"}, + }; + allCalcuLabels.Add(customLabel); }); - hydroInfo.GetAllEmitters()?.ForEach(x => + #endregion + + #region 姘存车 + + _calcuResultHelper.HydroInfo.Pumps?.ForEach(x => { - var calcuEmitter = allCalcuResultVisualDict.GetValue(x.Code) as HydroCalcuNodeResult; + var hz = Math.Round(x.RatedHz * x.SpeedRatio); + var calcuPumpResult = allCalcuResultVisualDict.GetValue(x.Code) as HydroCalcuPumpResult; + if (calcuPumpResult != null) + { + var pumpCustomLabel = new LogicCalcuCustomLabel(); + pumpCustomLabel.Id = x.Code; + pumpCustomLabel.Distance = 50000; + pumpCustomLabel.Data = new List<LogicCalcuCustomLabelItem>() + { + 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.CalcuQ.Value,1).ToString(),Unit="m鲁/h"}, + new LogicCalcuCustomLabelItem(){ Name="杩涘彛鍘嬪姏",Value=Math.Round(calcuPumpResult.CalcuPr1.Value,2).ToString(),Unit="m"}, + new LogicCalcuCustomLabelItem(){ Name="鍑哄彛鍘嬪姏",Value=Math.Round(calcuPumpResult.CalcuPr2.Value,2).ToString(),Unit="m"}, + }; + allCalcuLabels.Add(pumpCustomLabel); + } + }); + + #endregion + + #region 闃�闂� + + //_calcuResultHelper.HydroInfo.Valves?.ForEach(x => + //{ + // var calcuResult = allCalcuResultVisualDict.GetValue(x.Code) as HydroCalcuValveResult; + // var customLabel = new LogicCalcuCustomLabel(); + // customLabel.Id = x.Code; + // customLabel.Distance = 50000; + // customLabel.Data = new List<LogicCalcuCustomLabelItem>() + // { + // new LogicCalcuCustomLabelItem(){ Name="娴侀噺",Value=Math.Round(calcuResult.CalcuQ.Value,1).ToString(),Unit="m鲁/h"}, + // new LogicCalcuCustomLabelItem(){ Name="杩涘彛鍘嬪姏",Value=Math.Round(calcuResult.CalcuPr1.Value,2).ToString(),Unit="m"}, + // new LogicCalcuCustomLabelItem(){ Name="鍑哄彛鍘嬪姏",Value=Math.Round(calcuResult.CalcuPr2.Value,2).ToString(),Unit="m"}, + // new LogicCalcuCustomLabelItem(){ Name="闃�闂ㄥ紑搴�",Value=Math.Round(x.OpeningDegree,0).ToString(),Unit="掳"} + // }; + // allCalcuLabels.Add(customLabel); + //}); + + #endregion + + #region 鎵╂暎鍣� + + _calcuResultHelper.HydroInfo.GetAllEmitters()?.ForEach(x => + { + var calcuEmitter = allCalcuResultVisualDict.GetValue(x.Code) as HydroCalcuEmitterResult; var emitterCustomLabel = new LogicCalcuCustomLabel(); emitterCustomLabel.Id = x.Code; - emitterCustomLabel.Distance = 30000; + emitterCustomLabel.Distance = 50000; emitterCustomLabel.Data = new List<LogicCalcuCustomLabelItem>() { - new LogicCalcuCustomLabelItem(){ Name="娴侀噺",Value=Math.Round(calcuEmitter.CalcuDemand.Value,1).ToString(),Unit="m鲁/h"}, - new LogicCalcuCustomLabelItem(){ Name="鍘嬪姏",Value=Math.Round(calcuEmitter.CalcuDemand.Value,4).ToString(),Unit="m"} + new LogicCalcuCustomLabelItem(){ Name="娴侀噺",Value=Math.Round(calcuEmitter.CalcuQ.Value,1).ToString(),Unit="m鲁/h"}, + new LogicCalcuCustomLabelItem(){ Name="鍘嬪姏",Value=Math.Round(calcuEmitter.CalcuPr.Value,2).ToString(),Unit="m"} }; allCalcuLabels.Add(emitterCustomLabel); }); + + #endregion + + #region 姘村姏闃讳欢 + + //_calcuResultHelper.HydroInfo.GetAllResistances()?.ForEach(x => + //{ + // var calcuResistanceResult = allCalcuResultVisualDict.GetValue(x.Code) as HydroCalcuResistanceResult; + // var resistanceCustomLabel = new LogicCalcuCustomLabel(); + // resistanceCustomLabel.Id = x.Code; + // resistanceCustomLabel.Distance = 50000; + // resistanceCustomLabel.Data = new List<LogicCalcuCustomLabelItem>() + // { + // new LogicCalcuCustomLabelItem(){ Name="娴侀噺",Value=Math.Round(calcuResistanceResult.CalcuQ.Value,1).ToString(),Unit="m鲁/h"}, + // new LogicCalcuCustomLabelItem(){ Name="杩涘彛鍘嬪姏",Value=Math.Round(calcuResistanceResult.CalcuPr1.Value,2).ToString(),Unit="m"}, + // new LogicCalcuCustomLabelItem(){ Name="鍑哄彛鍘嬪姏",Value=Math.Round(calcuResistanceResult.CalcuPr2.Value,2).ToString(),Unit="m"} + // }; + // allCalcuLabels.Add(resistanceCustomLabel); + //}); + + #endregion + + return allCalcuLabels; + + } -- Gitblit v1.9.3