From 8d7b513f8546ed1f48fe9f4586cf5b2ea2794a3e Mon Sep 17 00:00:00 2001
From: lixiaojun <1287241240@qq.com>
Date: 星期二, 10 十二月 2024 15:42:51 +0800
Subject: [PATCH] 修复可能报错

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/09-energy/SimulationSingleWorkingEnergyCtrl.cs |   73 ++++++++----------------------------
 1 files changed, 17 insertions(+), 56 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/09-energy/SimulationSingleWorkingEnergyCtrl.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/09-energy/SimulationSingleWorkingEnergyCtrl.cs
index c724738..a453f9e 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/09-energy/SimulationSingleWorkingEnergyCtrl.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/09-energy/SimulationSingleWorkingEnergyCtrl.cs
@@ -10,6 +10,10 @@
 using System.Threading.Tasks;
 using System.Windows.Forms;
 using Yw.EPAnet;
+using Yw.Geometry;
+using Yw.Pump;
+using Yw.Vmo;
+using Yw.WinFrmUI.Phart;
 
 namespace HStation.WinFrmUI
 {
@@ -19,38 +23,30 @@
         {
             InitializeComponent();
             this.layoutControl1.SetupLayoutControl();
-            this.hydroPumpListStateViewCtrl1.SelectedChangedEvent += HydroPumpRunStatusListCtrl1_SelectedChangedEvent;
         }
 
+        private HydroWorkingVmo _working = null;//宸ュ喌
         private Yw.Model.HydroModelInfo _hydroInfo = null;//姘村姏淇℃伅
         private Dictionary<string, HydroCalcuVisualResult> _allCalcuResultVisualDict = null;//鎵�鏈夎绠楃粨鏋滃彲瑙佸瓧鍏�
 
         /// <summary>
         /// 缁戝畾鏁版嵁
         /// </summary>
-        public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo, HydroCalcuResult calcuResult)
+        public void SetBindingData(HydroWorkingVmo working, Yw.Model.HydroModelInfo hydroInfo, HydroCalcuResult calcuResult)
         {
-            if (hydroInfo == null)
-            {
-                return;
-            }
-            if (calcuResult == null)
-            {
-                return;
-            }
-            if (!calcuResult.Succeed)
-            {
-                return;
-            }
-            var allCalcuResultVisualDict = calcuResult.GetVisualDict();
-            SetBindingData(hydroInfo, allCalcuResultVisualDict);
+            var allCalcuResultVisualDict = calcuResult?.GetVisualDict();
+            SetBindingData(working, hydroInfo, allCalcuResultVisualDict);
         }
 
         /// <summary>
         /// 缁戝畾鏁版嵁
         /// </summary>
-        public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo, Dictionary<string, HydroCalcuVisualResult> allCalcuResultVisualDict)
+        public void SetBindingData(HydroWorkingVmo working, Yw.Model.HydroModelInfo hydroInfo, Dictionary<string, HydroCalcuVisualResult> allCalcuResultVisualDict)
         {
+            if (working == null)
+            {
+                return;
+            }
             if (hydroInfo == null)
             {
                 return;
@@ -59,51 +55,16 @@
             {
                 return;
             }
+            _working = working;
             _hydroInfo = hydroInfo;
             _allCalcuResultVisualDict = allCalcuResultVisualDict;
-            this.hydroEnergyTotalViewCtrl1.SetBindingData(hydroInfo, allCalcuResultVisualDict);
-            this.hydroPumpListStateViewCtrl1.SetBindingData(hydroInfo);
+            this.hydroEnergyTotalHorizViewCtrl1.SetBindingData(_hydroInfo, _allCalcuResultVisualDict);
+            this.simulationSingleWorkingPumpCtrl1.SetBindingData(_working, _hydroInfo, null, _allCalcuResultVisualDict);
         }
 
-        //娉甸�夋嫨鏀瑰彉
-        private void HydroPumpRunStatusListCtrl1_SelectedChangedEvent(Yw.Model.HydroPumpInfo pump)
-        {
-            if (_hydroInfo == null)
-            {
-                return;
-            }
-            if (_allCalcuResultVisualDict == null || _allCalcuResultVisualDict.Count < 1)
-            {
-                return;
-            }
-            if (pump == null)
-            {
-                return;
-            }
-            this.groupForSinglePumpInfo.Text = pump.Name;
-            this.txtQ.EditValue = null;
-            this.txtH.EditValue = null;
-            this.txtP.EditValue = null;
-            this.txtE.EditValue = null;
-            if (_allCalcuResultVisualDict.ContainsKey(pump.Code))
-            {
-                var calcuResult = _allCalcuResultVisualDict[pump.Code] as HydroCalcuPumpResult;
-                if (calcuResult != null)
-                {
-                    if (pump.LinkStatus == Yw.Hydro.PumpStatus.Open)
-                    {
-                        this.txtQ.EditValue = calcuResult.CalcuQ.HasValue ? $"{Math.Round(calcuResult.CalcuQ.Value, 1)}m鲁/h" : null;
-                        this.txtH.EditValue = calcuResult.CalcuH.HasValue ? $"{Math.Round(calcuResult.CalcuH.Value, 2)}m" : null;
-                        this.txtP.EditValue = calcuResult.CalcuP.HasValue ? $"{Math.Round(calcuResult.CalcuP.Value, 1)}kW" : null;
-                        this.txtE.EditValue = calcuResult.CalcuE.HasValue ? $"{Math.Round(calcuResult.CalcuE.Value, 1)}%" : null;
-                    }
-                    var matching = AssetsMatchingParasHelper.Create(_hydroInfo, pump, _allCalcuResultVisualDict.Values.ToList());
-                    //this.singlePumpCalcCtrl1.SetBindindData(matching);
-                }
-            }
 
 
-        }
+
 
     }
 }

--
Gitblit v1.9.3