lixiaojun
2025-02-17 4bb44a9c6b32cf299f3103f66d720992ec4a89a2
WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/09-energy/SimulationSingleWorkingEnergyCtrl.cs
@@ -1,15 +1,4 @@
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;
using Yw.Vmo;
namespace HStation.WinFrmUI
{
@@ -19,38 +8,43 @@
        {
            InitializeComponent();
            this.layoutControl1.SetupLayoutControl();
            this.hydroPumpListStateViewCtrl1.SelectedChangedEvent += HydroPumpRunStatusListCtrl1_SelectedChangedEvent;
        }
        private HydroWorkingVmo _working = null;//工况
        private Yw.Model.HydroModelInfo _hydroInfo = null;//水力信息
        private List<HydroMonitorVmo> _allMonitorList = 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,
                 List<HydroMonitorVmo> allMonitorList,
                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, allMonitorList, allCalcuResultVisualDict);
        }
        /// <summary>
        /// 绑定数据
        /// </summary>
        public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo, Dictionary<string, HydroCalcuVisualResult> allCalcuResultVisualDict)
        public void SetBindingData
            (
                HydroWorkingVmo working,
                Yw.Model.HydroModelInfo hydroInfo,
                List<HydroMonitorVmo> allMonitorList,
                Dictionary<string, HydroCalcuVisualResult> allCalcuResultVisualDict
            )
        {
            if (working == null)
            {
                return;
            }
            if (hydroInfo == null)
            {
                return;
@@ -59,51 +53,22 @@
            {
                return;
            }
            _working = working;
            _hydroInfo = hydroInfo;
            _allMonitorList = allMonitorList;
            _allCalcuResultVisualDict = allCalcuResultVisualDict;
            this.hydroEnergyTotalViewCtrl1.SetBindingData(hydroInfo, allCalcuResultVisualDict);
            this.hydroPumpListStateViewCtrl1.SetBindingData(hydroInfo);
            this.hydroEnergyTotalHorizViewCtrl1.SetBindingData(_hydroInfo, _allCalcuResultVisualDict);
            this.simulationSingleWorkingPumpCtrl1.SetBindingData(_working, _hydroInfo, _allMonitorList, _allCalcuResultVisualDict);
        }
        //泵选择改变
        private void HydroPumpRunStatusListCtrl1_SelectedChangedEvent(Yw.Model.HydroPumpInfo pump)
        //明细列表
        private void btnEnergyList_Click(object sender, EventArgs e)
        {
            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);
                }
            }
            var dlg = new HydroPumpGroupEnergyListDlg();
            dlg.SetBindingData(_hydroInfo, _allCalcuResultVisualDict);
            dlg.ShowDialog();
        }
    }
}