using DevExpress.XtraEditors; using NPOI.OpenXmlFormats.Dml; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Yw.EPAnet; namespace HStation.WinFrmUI { public partial class SimulationSingleWorkingEnergyCtrl : DevExpress.XtraEditors.XtraUserControl { public SimulationSingleWorkingEnergyCtrl() { InitializeComponent(); this.layoutControl1.SetupLayoutControl(); this.hydroPumpListStateViewCtrl1.SelectedChangedEvent += HydroPumpRunStatusListCtrl1_SelectedChangedEvent; } private Yw.Model.HydroModelInfo _hydroInfo = null;//水力信息 private Dictionary _allCalcuResultVisualDict = null;//所有计算结果可见字典 /// /// 绑定数据 /// public void SetBindingData(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); } /// /// 绑定数据 /// public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo, Dictionary allCalcuResultVisualDict) { if (hydroInfo == null) { return; } if (allCalcuResultVisualDict == null || allCalcuResultVisualDict.Count < 1) { return; } _hydroInfo = hydroInfo; _allCalcuResultVisualDict = allCalcuResultVisualDict; this.hydroEnergyTotalViewCtrl1.SetBindingData(hydroInfo, allCalcuResultVisualDict); this.hydroPumpListStateViewCtrl1.SetBindingData(hydroInfo); } //泵选择改变 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); } } } } }