lixiaojun
2025-02-22 f4f45f8dff2768d257e65f01a6865def48206ce3
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
using DevExpress.Pdf.Native;
using Mapster;
using Yw.Model;
using Yw.Vmo;
 
namespace HStation.WinFrmUI
{
    public partial class SimulationMultiAnalyWorkingDlg : DevExpress.XtraBars.Ribbon.RibbonForm
    {
        public SimulationMultiAnalyWorkingDlg()
        {
            InitializeComponent();
            this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon;
            this.layoutControl1.SetupLayoutControl();
            this.hydroWorkingListViewCtrl1.SelectedChangedEvent += HydroWorkingListViewCtrl1_SelectedChangedEvent;
        }
 
        private Yw.Model.HydroModelInfo _hydroInfo = null;//水力信息
        private List<HydroWorkingVmo> _allWorkingList = null;//所有工况列表
        private Dictionary<HydroWorkingVmo, SimulationMultiAnalyViewModel> _allCalcuResultDict = null;//计算结果字典
 
        /// <summary>
        /// 绑定数据
        /// </summary>
        public void SetBindingData
            (
                Yw.Model.HydroModelInfo hydroInfo,
                List<HydroMonitorVmo> allMonitorList,
                List<HydroWorkingVmo> allWorkingList,
                HydroNodeInfo node,
                bool isHead = false,
                List<HydroEvaluationVmo> allEvaluationList = null
            )
        {
            if (hydroInfo == null)
            {
                return;
            }
            if (allWorkingList == null || allWorkingList.Count < 1)
            {
                return;
            }
            if (node == null)
            {
                return;
            }
            _hydroInfo = hydroInfo.Adapt<Yw.Model.HydroModelInfo>();
            _allWorkingList = allWorkingList;
            _allCalcuResultDict = new Dictionary<HydroWorkingVmo, SimulationMultiAnalyViewModel>();
            foreach (var working in allWorkingList)
            {
                _hydroInfo.UpdateWorkingInfo(working.WorkingInfo);
                var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss, isHead, allEvaluationList);
                if (calcuResult.Succeed)
                {
                    var vm = new SimulationMultiAnalyViewModel();
                    vm.HydroInfo = _hydroInfo;
                    vm.Working = working;
                    vm.Accuracy = HydroAccuracyHelper.Create(_hydroInfo, allMonitorList, working, calcuResult, isHead, allEvaluationList);
                    vm.EnergyAnaly = HydroEnergyAnalyHelper.Create(_hydroInfo, working, calcuResult, isHead, allEvaluationList);
                    vm.LossCurve = HydroLossCurveHelper.Create(_hydroInfo, working, node, calcuResult, isHead, allEvaluationList);
                    vm.LossStatistics = HydroLossStatisticsHelper.Create(_hydroInfo, working, calcuResult, isHead, allEvaluationList);
                    _allCalcuResultDict.Add(working, vm);
                }
            }
            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.groupForAnaly.GroupBordersVisible = false;
            }
            this.hydroWorkingListViewCtrl1.SetBindingData(allWorkingList);
        }
 
 
        //工况选择改变
        private void HydroWorkingListViewCtrl1_SelectedChangedEvent(HydroWorkingVmo working)
        {
            if (working == null)
            {
                return;
            }
            if (_allCalcuResultDict == null || _allCalcuResultDict.Count < 1)
            {
                return;
            }
            if (!_allCalcuResultDict.ContainsKey(working))
            {
                return;
            }
            this.simulationMultiAnalyCtrl1.SetBindingData(_allCalcuResultDict[working]);
        }
 
 
 
 
    }
}