duheng
2025-03-28 9be9ba4e159969fb5e32648c2c34e912ccc3ae6d
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
74
75
76
77
78
79
using Mapster;
 
namespace Yw.WinFrmUI
{
    public partial class HydroLossStatisticsWorkingDlg : DevExpress.XtraBars.Ribbon.RibbonForm
    {
        public HydroLossStatisticsWorkingDlg()
        {
            InitializeComponent();
            this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon;
            this.layoutControl1.SetupLayoutControl();
 
            this.hydroWorkingListViewCtrl1.SelectedChangedEvent += HydroWorkingListViewCtrl1_SelectedChangedEvent;
        }
 
        private Yw.Model.HydroModelInfo _hydroInfo = null;//水力信息
        private Dictionary<HydroWorkingVmo, HydroCalcuResult> _calcuWorkingDict = null;//工况计算字典
 
        /// <summary>
        /// 绑定数据
        /// 计算不会改变原有水力信息
        /// </summary>
        public void SetBindingData
            (
                Yw.Model.HydroModelInfo hydroInfo,
                List<HydroWorkingVmo> allWorkingList,
                bool isHead = false,
                List<HydroEvaluationVmo> allEvaluationList = null
            )
        {
            if (hydroInfo == null)
            {
                return;
            }
            _hydroInfo = hydroInfo.Adapt<Yw.Model.HydroModelInfo>();
            if (allWorkingList == null || allWorkingList.Count < 1)
            {
                return;
            }
            _calcuWorkingDict = new Dictionary<HydroWorkingVmo, HydroCalcuResult>();
            foreach (var working in allWorkingList)
            {
                _hydroInfo.UpdateWorkingInfo(working.WorkingInfo);
                var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss, isHead, allEvaluationList);
                _calcuWorkingDict.Add(working, calcuResult);
            }
            if (allWorkingList.Count < 2)
            {
                var working = allWorkingList[0];
                this.Text = $"损失统计({working.Name})";
                this.groupForWorkingList.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                this.splitter.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
            }
            this.hydroWorkingListViewCtrl1.SetBindingData(allWorkingList);
        }
 
 
        //工况选择改变
        private void HydroWorkingListViewCtrl1_SelectedChangedEvent(HydroWorkingVmo working)
        {
            if (working == null)
            {
                return;
            }
            if (_calcuWorkingDict == null || _calcuWorkingDict.Count < 1)
            {
                return;
            }
            if (!_calcuWorkingDict.ContainsKey(working))
            {
                return;
            }
            this.hydroLossStatisticsCtrl1.SetBindingData(_hydroInfo, working, _calcuWorkingDict[working]);
        }
 
 
 
    }
}