duheng
2025-03-27 d2ccacb3317aa6310f1b1bb5eb19fbdecba39ff9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using Mapster;
using Yw.Vmo;
 
namespace HStation.WinFrmUI
{
    public partial class SimulationPumpAnalyWorkingCtrl : DevExpress.XtraEditors.XtraUserControl
    {
        public SimulationPumpAnalyWorkingCtrl()
        {
            InitializeComponent();
            this.layoutControl1.SetupLayoutControl();
            this.hydroPumpAnalyWorkingPumpListCtrl1.SelectedChangedEvent += HydroPumpListViewCtrl1_SelectedChangedEvent;
        }
 
        private Yw.Model.HydroModelInfo _hydroInfo = null;//水力信息
        private Yw.Model.HydroPumpInfo _pumpInfo = null;//水泵信息
        private List<HydroWorkingVmo> _allWorkingList = null;//所有工况列表
        private Dictionary<HydroWorkingVmo, HydroPumpAnalyViewModel> _allCalcuResultDict = null;//计算结果字典
 
        /// <summary>
        /// 绑定数据
        /// </summary>
        public void SetBindingData
            (
                Yw.Model.HydroModelInfo hydroInfo,
                List<HydroWorkingVmo> allWorkingList,
                bool isHead = false,
                List<HydroEvaluationVmo> allEvaluationList = null
            )
        {
            if (hydroInfo == null)
            {
                return;
            }
            if (allWorkingList == null || allWorkingList.Count < 1)
            {
                return;
            }
            _hydroInfo = hydroInfo.Adapt<Yw.Model.HydroModelInfo>();
            _allWorkingList = allWorkingList;
            _allCalcuResultDict = new Dictionary<HydroWorkingVmo, HydroPumpAnalyViewModel>();
            foreach (var working in allWorkingList)
            {
                _hydroInfo.UpdateWorkingInfo(working.WorkingInfo);
                var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss, isHead, allEvaluationList);
                if (calcuResult.Succeed)
                {
                    var vm = HydroPumpAnalyHelper.Create(_hydroInfo, working, calcuResult, isHead, allEvaluationList);
                    _allCalcuResultDict.Add(working, vm);
                }
            }
            this.hydroPumpAnalyWorkingPumpListCtrl1.SetBindingData(_hydroInfo, _allCalcuResultDict);
        }
 
        //水泵选择改变
        private void HydroPumpListViewCtrl1_SelectedChangedEvent(Yw.Model.HydroPumpInfo pumpInfo)
        {
            if (_hydroInfo == null)
            {
                return;
            }
            if (pumpInfo == null)
            {
                return;
            }
            _pumpInfo = pumpInfo;
            this.simulationPumpAnalyWorkingChartCtrl1.SetBindingData(_hydroInfo, pumpInfo, _allWorkingList, _allCalcuResultDict);
        }
 
 
 
    }
}