From 513c72dd3c97787b0845bcc8526e004da9e50e64 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期二, 10 十二月 2024 12:02:47 +0800 Subject: [PATCH] 能耗分析整改 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs | 293 ++++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 190 insertions(+), 103 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs index 4759b3e..3daca48 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs @@ -32,6 +32,7 @@ private HStation.Vmo.XhsProjectVmo _project = null;//椤圭洰 private HStation.Vmo.XhsProjectSiteVmo _projectSite = null;//椤圭洰绔� + private HStation.Vmo.XhsSchemeVmo _scheme = null;//鏂规 private Yw.Model.HydroModelInfo _hydroInfo = null;//姘村姏淇℃伅 private Dictionary<HydroWorkingVmo, bool> _allWorkingCheckedListDict = null;//鎵�鏈夊伐鍐甸�夋嫨鍒楄〃瀛楀吀 @@ -42,14 +43,17 @@ ( XhsProjectVmo project, XhsProjectSiteVmo projectSite, + XhsSchemeVmo scheme, Yw.Model.HydroModelInfo hydroInfo, Dictionary<HydroWorkingVmo, bool> allWorkingCheckedListDict ) { _project = project; _projectSite = projectSite; + _scheme = scheme; _hydroInfo = hydroInfo; _allWorkingCheckedListDict = allWorkingCheckedListDict; + ResetMonitorValue(); } /// <summary> @@ -66,10 +70,10 @@ #region BIM鎺т欢 //bimface鎺т欢 - private XhsProjectSimulationBimfaceCtrl _bimfaceCtrl = null; + private SimulationBimfaceCtrl _bimfaceCtrl = null; //鑾峰彇 bimface 鎺т欢 - private async Task<XhsProjectSimulationBimfaceCtrl> GetBimfaceCtrl() + private async Task<SimulationBimfaceCtrl> GetBimfaceCtrl() { if (_hydroInfo == null) { @@ -78,7 +82,7 @@ if (_bimfaceCtrl == null) { var overlay = this.ShowOverlay(); - _bimfaceCtrl = new XhsProjectSimulationBimfaceCtrl(); + _bimfaceCtrl = new SimulationBimfaceCtrl(); _bimfaceCtrl.Dock = DockStyle.Fill; await _bimfaceCtrl.InitialData(_project, _projectSite); _bimfaceCtrl.LoadCompletedEvent += () => @@ -160,6 +164,7 @@ { _propertyCtrl = new SimulationPropertyCtrl(); _propertyCtrl.Dock = DockStyle.Fill; + _propertyCtrl.AllowEdit = true; _propertyCtrl.HydroViewEvent += (visual) => { SelectVisual(visual, eVisualSource.Property); @@ -278,21 +283,13 @@ var visualVmListHelper = GetVisualVmListHelper(); var vm = visualVmListHelper.GetVisual(visual); _propertyCtrl.SelectedObject = vm; + _propertyCtrl.UpdateRows(); } //鏇存柊灞炴�ф帶浠� private void UpdatePropertyCtrl() { _propertyCtrl?.UpdateRows(); - } - - //娓呯悊灞炴�ф帶浠� - private void ClearPropertyCtrl() - { - if (_propertyCtrl != null) - { - _propertyCtrl.SelectedObject = null; - } } #endregion @@ -403,6 +400,13 @@ } } + //閫夋嫨鏋勪欢 + private void SelectVisual(string code, eVisualSource source) + { + var visual = GetVisual(code); + SelectVisual(visual, source); + } + #endregion #region 鏋勪欢鏄庣粏 @@ -421,6 +425,28 @@ _visualListHelper.InitialData(_hydroInfo); } return _visualListHelper; + } + + //鑾峰彇鍙鏋勪欢 + private Yw.Model.HydroVisualInfo GetVisual(string code) + { + var helper = GetVisualListHelper(); + var visual = helper.GetVisual(code); + return visual; + } + + //鑾峰彇鍙鍒楄〃 + private List<Yw.Model.HydroVisualInfo> GetVisualList() + { + var helper = GetVisualListHelper(); + return helper.GetVisualList(); + } + + //鑾峰彇姘存簮鍒楄〃 + private List<Yw.Model.HydroSourceInfo> GetSourceList() + { + var helper = GetVisualListHelper(); + return helper.GetSourceList(); } #endregion @@ -444,6 +470,13 @@ _visualVmListHelper = new SimulationVisualVmListHelper(visualListHelper, calcuResultHelper); } return _visualVmListHelper; + } + + //鑾峰彇鍙瑙嗗浘鍒楄〃 + private List<HydroVisualViewModel> GetVisualViewModelList() + { + var helper = GetVisualVmListHelper(); + return helper.GetVisualList(); } #endregion @@ -662,12 +695,9 @@ //姘村簱 this.barBtnSetReservoirList.ItemClick += delegate { - if (_hydroInfo == null) - { - return; - } + var allVisualViewModelList = GetVisualViewModelList(); var dlg = new SetHydroReservoirListDlg(); - dlg.SetBindingData(_hydroInfo); + dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eVisualSource.Set); @@ -675,18 +705,16 @@ dlg.HydroChangedInfoEvent += visuals => { SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + UpdateVisualListCtrl(); }; dlg.ShowDialog(); }; //姘存睜 this.barBtnSetTankList.ItemClick += delegate { - if (_hydroInfo == null) - { - return; - } + var allVisualViewModelList = GetVisualViewModelList(); var dlg = new SetHydroTankListDlg(); - dlg.SetBindingData(_hydroInfo); + dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eVisualSource.Set); @@ -694,18 +722,16 @@ dlg.HydroChangedInfoEvent += visuals => { SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + UpdateVisualListCtrl(); }; dlg.ShowDialog(); }; //姘寸 this.barBtnSetWaterboxList.ItemClick += delegate { - if (_hydroInfo == null) - { - return; - } + var allVisualViewModelList = GetVisualViewModelList(); var dlg = new SetHydroWaterboxListDlg(); - dlg.SetBindingData(_hydroInfo); + dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eVisualSource.Set); @@ -713,18 +739,16 @@ dlg.HydroChangedInfoEvent += visuals => { SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + UpdateVisualListCtrl(); }; dlg.ShowDialog(); }; //杩炴帴鑺傜偣 this.barBtnSetJunctionList.ItemClick += delegate { - if (_hydroInfo == null) - { - return; - } + var allVisualViewModelList = GetVisualViewModelList(); var dlg = new SetHydroJunctionListDlg(); - dlg.SetBindingData(_hydroInfo); + dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eVisualSource.Set); @@ -732,18 +756,16 @@ dlg.HydroChangedInfoEvent += visuals => { SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + UpdateVisualListCtrl(); }; dlg.ShowDialog(); }; //闂峰ご this.barBtnSetBluntheadList.ItemClick += delegate { - if (_hydroInfo == null) - { - return; - } + var allVisualViewModelList = GetVisualViewModelList(); var dlg = new SetHydroBluntheadListDlg(); - dlg.SetBindingData(_hydroInfo); + dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eVisualSource.Set); @@ -751,18 +773,16 @@ dlg.HydroChangedInfoEvent += visuals => { SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + UpdateVisualListCtrl(); }; dlg.ShowDialog(); }; //寮ご this.barBtnSetElbowsList.ItemClick += delegate { - if (_hydroInfo == null) - { - return; - } + var allVisualVmList = GetVisualViewModelList(); var dlg = new SetHydroElbowListDlg(); - dlg.SetBindingData(_hydroInfo); + dlg.SetBindingData(allVisualVmList); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eVisualSource.Set); @@ -770,18 +790,16 @@ dlg.HydroChangedInfoEvent += visuals => { SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + UpdateVisualListCtrl(); }; dlg.ShowDialog(); }; //涓夐�� this.barBtnSetThreelinkList.ItemClick += delegate { - if (_hydroInfo == null) - { - return; - } + var allVisualViewModelList = GetVisualViewModelList(); var dlg = new SetHydroThreelinkListDlg(); - dlg.SetBindingData(_hydroInfo); + dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eVisualSource.Set); @@ -789,18 +807,16 @@ dlg.HydroChangedInfoEvent += visuals => { SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + UpdateVisualListCtrl(); }; dlg.ShowDialog(); }; //鍥涢�� this.barBtnSetFourlinkList.ItemClick += delegate { - if (_hydroInfo == null) - { - return; - } + var allVisualViewModelList = GetVisualViewModelList(); var dlg = new SetHydroFourlinkListDlg(); - dlg.SetBindingData(_hydroInfo); + dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eVisualSource.Set); @@ -808,18 +824,16 @@ dlg.HydroChangedInfoEvent += visuals => { SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + UpdateVisualListCtrl(); }; dlg.ShowDialog(); }; //姘磋〃 this.barBtnSetMeterList.ItemClick += delegate { - if (_hydroInfo == null) - { - return; - } + var allVisualViewModelList = GetVisualViewModelList(); var dlg = new SetHydroMeterListDlg(); - dlg.SetBindingData(_hydroInfo); + dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eVisualSource.Set); @@ -827,18 +841,16 @@ dlg.HydroChangedInfoEvent += visuals => { SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + UpdateVisualListCtrl(); }; dlg.ShowDialog(); }; //娴侀噺璁� this.barBtnSetFlowmeterList.ItemClick += delegate { - if (_hydroInfo == null) - { - return; - } + var allVisualViewModelList = GetVisualViewModelList(); var dlg = new SetHydroFlowmeterListDlg(); - dlg.SetBindingData(_hydroInfo); + dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eVisualSource.Set); @@ -846,18 +858,16 @@ dlg.HydroChangedInfoEvent += visuals => { SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + UpdateVisualListCtrl(); }; dlg.ShowDialog(); }; //鍘嬪姏琛� this.barBtnSetPressmeterList.ItemClick += delegate { - if (_hydroInfo == null) - { - return; - } + var allVisualViewModelList = GetVisualViewModelList(); var dlg = new SetHydroPressmeterListDlg(); - dlg.SetBindingData(_hydroInfo); + dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eVisualSource.Set); @@ -865,18 +875,16 @@ dlg.HydroChangedInfoEvent += visuals => { SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + UpdateVisualListCtrl(); }; dlg.ShowDialog(); }; //绠¢亾 this.barBtnSetPipeList.ItemClick += delegate { - if (_hydroInfo == null) - { - return; - } + var allVisualViewModelList = GetVisualViewModelList(); var dlg = new SetHydroPipeListDlg(); - dlg.SetBindingData(_hydroInfo); + dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eVisualSource.Set); @@ -884,18 +892,16 @@ dlg.HydroChangedInfoEvent += visuals => { SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + UpdateVisualListCtrl(); }; dlg.ShowDialog(); }; //杩囨浮浠� this.barBtnSetTranslationList.ItemClick += delegate { - if (_hydroInfo == null) - { - return; - } + var allVisualViewModelList = GetVisualViewModelList(); var dlg = new SetHydroTranslationListDlg(); - dlg.SetBindingData(_hydroInfo); + dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eVisualSource.Set); @@ -903,18 +909,16 @@ dlg.HydroChangedInfoEvent += visuals => { SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + UpdateVisualListCtrl(); }; dlg.ShowDialog(); }; //姘存车 this.barBtnSetPumpList.ItemClick += delegate { - if (_hydroInfo == null) - { - return; - } + var allVisualViewModelList = GetVisualViewModelList(); var dlg = new SetHydroPumpListDlg(); - dlg.SetBindingData(_hydroInfo); + dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eVisualSource.Set); @@ -922,18 +926,16 @@ dlg.HydroChangedInfoEvent += visuals => { SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + UpdateVisualListCtrl(); }; dlg.ShowDialog(); }; //闃�闂� this.barBtnSetValveList.ItemClick += delegate { - if (_hydroInfo == null) - { - return; - } + var allVisualViewModelList = GetVisualViewModelList(); var dlg = new SetHydroValveListDlg(); - dlg.SetBindingData(_hydroInfo); + dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eVisualSource.Set); @@ -941,18 +943,16 @@ dlg.HydroChangedInfoEvent += visuals => { SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + UpdateVisualListCtrl(); }; dlg.ShowDialog(); }; //鎹㈢儹鍣� this.barBtnSetExchangerList.ItemClick += delegate { - if (_hydroInfo == null) - { - return; - } + var allVisualViewModelList = GetVisualViewModelList(); var dlg = new SetHydroExchangerListDlg(); - dlg.SetBindingData(_hydroInfo); + dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eVisualSource.Set); @@ -960,18 +960,16 @@ dlg.HydroChangedInfoEvent += visuals => { SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + UpdateVisualListCtrl(); }; dlg.ShowDialog(); }; //鎹㈢儹鍣� this.barBtnSetCompressorList.ItemClick += delegate { - if (_hydroInfo == null) - { - return; - } + var allVisualViewModelList = GetVisualViewModelList(); var dlg = new SetHydroCompressorListDlg(); - dlg.SetBindingData(_hydroInfo); + dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eVisualSource.Set); @@ -979,6 +977,7 @@ dlg.HydroChangedInfoEvent += visuals => { SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + UpdateVisualListCtrl(); }; dlg.ShowDialog(); }; @@ -1564,6 +1563,19 @@ return _monitorValueHelper; } + //閲嶇疆 + private void ResetMonitorValue() + { + var allWorkingList = GetWorkingList(); + var working = allWorkingList?.Last(x => !string.IsNullOrEmpty(x.MonitorInfo)); + if (working != null) + { + var helper = GetMonitorValueHelper(); + helper.Reset(working.MonitorInfo); + } + + } + #endregion #region 鐩戞祴鍊兼帶浠� @@ -2142,7 +2154,7 @@ } WaitFormHelper.ShowWaitForm(this, "姝e湪璁$畻鍒嗘瀽涓紝璇风◢鍊�..."); - //await Task.Delay(3000); + await Task.Delay(3000); var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss); WaitFormHelper.HideWaitForm(); workingHelper.InitialData(hydroInfo, working, checkResult, calcuResult); @@ -2177,6 +2189,13 @@ #region 鏋勪欢鏄庣粏 UpdateVisualListCtrl(); + + #endregion + + #region 棰滆壊鍒嗙骇 + + var gradingHelper = await GetGradingHelper(); + gradingHelper.Set(); #endregion @@ -2283,11 +2302,32 @@ return _workingCheckedListHelper; } + //鑾峰彇宸ュ喌鍒楄〃 + private List<HydroWorkingVmo> GetWorkingList() + { + var helper = GetWorkingCheckedListHelper(); + return helper.GetWorkingList(); + } + + //鏇存柊宸ュ喌閫夋嫨鍒楄〃 + public void UpdateWorkingCheckedList(HydroWorkingVmo working) + { + var helper = GetWorkingCheckedListHelper(); + helper.Update(working); + } + //鏇存柊宸ュ喌閫夋嫨鍒楄〃 public void UpdateWorkingCheckedList(HydroWorkingVmo working, bool hasChecked) { var helper = GetWorkingCheckedListHelper(); helper.Update(working, hasChecked); + } + + //绉婚櫎宸ュ喌閫夋嫨鍒楄〃 + public void RemoveWorkingCheckedList(HydroWorkingVmo working) + { + var helper = GetWorkingCheckedListHelper(); + helper.Remove(working); } @@ -2362,11 +2402,12 @@ return; } var dlg = new SimulationSingleWorkingEnergyDlg(); - dlg.SetBindingData(workingHelper.HydroInfo, workingHelper.CalcuResult); + dlg.SetBindingData(workingHelper.Working, workingHelper.HydroInfo, workingHelper.CalcuResult); dlg.ShowDialog(); } else { + var dlg = new SimulationMultiWorkingEnergyDlg(); dlg.SetBindingData(_hydroInfo, allCheckedWorkingList); dlg.ShowDialog(); @@ -2378,8 +2419,27 @@ { if (_visual == null) { - TipFormHelper.ShowWarn("璇烽�夋嫨鏋勪欢鍚庨噸璇曪紒"); - return; + var sources = GetSourceList(); + if (sources != null) + { + if (sources.Count == 1) + { + SelectVisual(sources[0], eVisualSource.None); + } + else + { + var source = sources.FirstOrDefault(x => x.Flags.Contains(HStation.Xhs.Flags.杩涘彛)); + if (source != null) + { + SelectVisual(source, eVisualSource.None); + } + } + } + if (_visual == null) + { + TipFormHelper.ShowWarn("璇烽�夋嫨鏋勪欢鍚庨噸璇曪紒"); + return; + } } HydroVisualInfo visual = _visual; if (_visual is HydroLinkInfo linkInfo) @@ -2399,12 +2459,20 @@ return; } var dlg = new HydroSingleWorkingLossCurveDlg(); + dlg.HydroClickEvent += (code) => + { + SelectVisual(code, eVisualSource.None); + }; dlg.SetBindingData(workingHelper.HydroInfo, workingHelper.CalcuResult, visual); dlg.ShowDialog(); } else { var dlg = new HydroMultiWorkingLossCurveDlg(); + dlg.HydroClickEvent += (code) => + { + SelectVisual(code, eVisualSource.None); + }; dlg.SetBindingData(_hydroInfo, allCheckedWorkingList, visual); dlg.ShowDialog(); } @@ -2440,8 +2508,27 @@ { if (_visual == null) { - TipFormHelper.ShowWarn("璇烽�夋嫨鏋勪欢鍚庨噸璇曪紒"); - return; + var sources = GetSourceList(); + if (sources != null) + { + if (sources.Count == 1) + { + SelectVisual(sources[0], eVisualSource.None); + } + else + { + var source = sources.FirstOrDefault(x => x.Flags.Contains(HStation.Xhs.Flags.杩涘彛)); + if (source != null) + { + SelectVisual(source, eVisualSource.None); + } + } + } + if (_visual == null) + { + TipFormHelper.ShowWarn("璇烽�夋嫨鏋勪欢鍚庨噸璇曪紒"); + return; + } } HydroVisualInfo visual = _visual; if (_visual is HydroLinkInfo linkInfo) -- Gitblit v1.9.3