From eb3ec7dfafe071de899112c918851db18bde6109 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期二, 10 十二月 2024 13:36:23 +0800 Subject: [PATCH] 核心界面优化 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs | 537 +++++++++++++++++++++++++++++++++------------------------- 1 files changed, 305 insertions(+), 232 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 30329d5..311d22c 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 @@ -4,6 +4,7 @@ using DevExpress.XtraMap; using HStation.WinFrmUI.PhartRelation; using Mapster; +using NPOI.OpenXmlFormats.Dml; using NPOI.SS.Formula.Functions; using System.Diagnostics; using Yw.EPAnet; @@ -29,9 +30,28 @@ /// 鏂板宸ュ喌浜嬩欢 /// </summary> public event Action<HydroWorkingVmo> AppendWorkingEvent; + /// <summary> + /// 淇濆瓨妯″瀷浜嬩欢 + /// </summary> + public event Func<Yw.Model.HydroModelInfo, Task<Yw.Model.HydroModelInfo>> SaveModelEvent; + /// <summary> + /// 鍒锋柊妯″瀷浜嬩欢 + /// </summary> + public event Func<Task<Yw.Model.HydroModelInfo>> RefreshModelEvent; + /// <summary> + /// 鏇存柊鏂规浜嬩欢 + /// </summary> + public event Action<XhsSchemeVmo> UpdateSchemeEvent; + /// <summary> + /// 绉婚櫎鏂规浜嬩欢 + /// </summary> + public event Action<XhsSchemeVmo> RemoveSchemeEvent; + + 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 +62,27 @@ ( 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(); + if (_scheme == null) + { + this.ribPageGroupForScheme.Visible = false; + this.PageTitle.Caption = $"姘村姏妯℃嫙"; + } + else + { + this.ribPageGroupForScheme.Visible = true; + this.PageTitle.Caption = $"姘村姏鏂规\r\n{_scheme.Name}"; + } } /// <summary> @@ -66,10 +99,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 +111,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 += () => @@ -147,10 +180,10 @@ #region 灞炴�ф帶浠� //灞炴�ф帶浠� - private XhsProjectSimulationPropertyCtrl _propertyCtrl = null; + private SimulationPropertyCtrl _propertyCtrl = null; //鑾峰彇灞炴�ф帶浠� - private XhsProjectSimulationPropertyCtrl GetPropertyCtrl() + private SimulationPropertyCtrl GetPropertyCtrl() { if (_hydroInfo == null) { @@ -158,8 +191,9 @@ } if (_propertyCtrl == null) { - _propertyCtrl = new XhsProjectSimulationPropertyCtrl(); + _propertyCtrl = new SimulationPropertyCtrl(); _propertyCtrl.Dock = DockStyle.Fill; + _propertyCtrl.AllowEdit = true; _propertyCtrl.HydroViewEvent += (visual) => { SelectVisual(visual, eVisualSource.Property); @@ -246,7 +280,7 @@ { if (this.controlContainerRight.Controls.Count > 0) { - if (this.controlContainerRight.Controls[0] is XhsProjectSimulationPropertyCtrl) + if (this.controlContainerRight.Controls[0] is SimulationPropertyCtrl) { return true; } @@ -278,21 +312,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 +429,13 @@ } } + //閫夋嫨鏋勪欢 + private void SelectVisual(string code, eVisualSource source) + { + var visual = GetVisual(code); + SelectVisual(visual, source); + } + #endregion #region 鏋勪欢鏄庣粏 @@ -421,6 +454,35 @@ _visualListHelper.InitialData(_hydroInfo); } return _visualListHelper; + } + + //閲嶇疆鍙鍒楄〃 + private void ResetVisualList() + { + var helper = GetVisualListHelper(); + helper.InitialData(_hydroInfo); + } + + //鑾峰彇鍙鏋勪欢 + 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 +506,13 @@ _visualVmListHelper = new SimulationVisualVmListHelper(visualListHelper, calcuResultHelper); } return _visualVmListHelper; + } + + //鑾峰彇鍙瑙嗗浘鍒楄〃 + private List<HydroVisualViewModel> GetVisualViewModelList() + { + var helper = GetVisualVmListHelper(); + return helper.GetVisualList(); } #endregion @@ -632,24 +701,27 @@ { return; } - Stopwatch sw = new Stopwatch(); - sw.Start(); - - - var id = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.Save(_hydroInfo); - - //鑰楁椂宸ㄥぇ鐨勪唬鐮� - - sw.Stop(); - TimeSpan ts2 = sw.Elapsed; - Console.WriteLine("Stopwatch鎬诲叡鑺辫垂{0}ms.", ts2.TotalMilliseconds); - if (id < 1) + if (this.SaveModelEvent == null) + { + return; + } + var hydroInfo = await this.SaveModelEvent.Invoke(_hydroInfo); + if (hydroInfo == null) { TipFormHelper.ShowError("淇濆瓨澶辫触锛�"); return; } - _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(id); + _hydroInfo = hydroInfo; + TipFormHelper.ShowSucceed("淇濆瓨鎴愬姛锛�"); + + + //Stopwatch sw = new Stopwatch(); + //sw.Start(); + //鑰楁椂宸ㄥぇ鐨勪唬鐮� + //sw.Stop(); + //TimeSpan ts2 = sw.Elapsed; + //Console.WriteLine("Stopwatch鎬诲叡鑺辫垂{0}ms.", ts2.TotalMilliseconds); } #endregion @@ -662,12 +734,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 +744,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 +761,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 +778,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 +795,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 +812,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 +829,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 +846,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 +863,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 +880,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 +897,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 +914,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 +931,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 +948,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 +965,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 +982,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 +999,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 +1016,7 @@ dlg.HydroChangedInfoEvent += visuals => { SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + UpdateVisualListCtrl(); }; dlg.ShowDialog(); }; @@ -1424,31 +1462,24 @@ //鍒锋柊 private async void barBtnRefresh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { + if (this.RefreshModelEvent == null) + { + return; + } if (XtraMessageBox.Show("鍒锋柊鍚庡皢涓㈠け褰撳墠姘村姏淇℃伅鏇存敼锛屾槸鍚︾户缁埛鏂帮紵", "璇㈤棶", MessageBoxButtons.YesNo) == DialogResult.Yes) { - if (_project == null) - { - return; - } - if (_projectSite == null) - { - return; - } - var hydroRelation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance - .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation); - Stopwatch sw = new Stopwatch(); - sw.Start(); - _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(hydroRelation.ModelID); - sw.Stop(); - TimeSpan ts2 = sw.Elapsed; - Console.WriteLine("Stopwatch鎬诲叡鑺辫垂{0}ms.", ts2.TotalMilliseconds); - _visual = null; - await _bimfaceCtrl?.ZoomAndSelectComponents(null); - //ShowSelectedProperty(); - TipFormHelper.ShowSucceed("鏁版嵁宸插埛鏂�"); - var visualListHelper = GetVisualListHelper(); - visualListHelper.InitialData(_hydroInfo); + var hydroInfo = await this.RefreshModelEvent.Invoke(); + if (hydroInfo == null) + { + TipFormHelper.ShowError("鍒锋柊澶辫触锛�"); + return; + } + _hydroInfo = hydroInfo; + SelectVisual(visual: null, eVisualSource.None); + + ResetVisualList(); + TipFormHelper.ShowSucceed("鍒锋柊鎴愬姛锛�"); } } @@ -1562,6 +1593,19 @@ _monitorValueHelper = new SimulationMonitorValueHelper(visualListHelper, monitorHelper); } 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 @@ -2020,14 +2064,37 @@ #region 姘存车鍒楄〃 //鎬ц兘鏇茬嚎 - private void barBtnPumpCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + private void PumpFeat() { + if (_hydroInfo == null) + { + return; + } + var pumps = _hydroInfo.Pumps; + if (pumps == null || pumps.Count < 1) + { + XtraMessageBox.Show("鏃犳按娉典俊鎭�"); + return; + } var dlg = new SimulationPumpFeatDlg(); + dlg.SaveEvent += async (list) => + { + pumps.ForEach(x => x.UpdateWorkingInfo(list)); + var visualVmListHelper = GetVisualVmListHelper(); + visualVmListHelper.UpdateProperty(pumps.Select(x => x as Yw.Model.HydroVisualInfo).ToList()); + SelectVisual(_visual, eVisualSource.None); + var gradingHelper = await GetGradingHelper(); + gradingHelper.Set(); + }; dlg.SetBindingData(_hydroInfo); dlg.ShowDialog(); } - #region 骞惰仈妯℃嫙 + //鎬ц兘鏇茬嚎 + private void barBtnPumpCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + PumpFeat(); + } //骞惰仈妯℃嫙 private void PumpParallel() @@ -2057,14 +2124,12 @@ var visualVmListHelper = GetVisualVmListHelper(); visualVmListHelper.UpdateProperty(pumps.Select(x => x as Yw.Model.HydroVisualInfo).ToList()); SelectVisual(_visual, eVisualSource.None); - var calcuResultLabelHelper = await GetCalcuResultLabelHelper(); - calcuResultLabelHelper.Set(); + var gradingHelper = await GetGradingHelper(); + gradingHelper.Set(); }; dlg.SetBindingData(_hydroInfo); dlg.ShowDialog(); } - - //骞惰仈妯℃嫙 private void barBtnPumpParallel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) @@ -2072,8 +2137,6 @@ PumpParallel(); } - - #endregion #endregion @@ -2123,7 +2186,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); @@ -2158,6 +2221,13 @@ #region 鏋勪欢鏄庣粏 UpdateVisualListCtrl(); + + #endregion + + #region 棰滆壊鍒嗙骇 + + var gradingHelper = await GetGradingHelper(); + gradingHelper.Set(); #endregion @@ -2233,6 +2303,7 @@ { this.barBtnAddWorking.Enabled = false; workingHelper.ResetWorking(rhs); + UpdateWorkingCheckedList(rhs, false); this.AppendWorkingEvent?.Invoke(rhs); }; dlg.ShowDialog(); @@ -2263,11 +2334,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); } @@ -2306,92 +2398,26 @@ //姘存车鍒嗘瀽 private void barBtnPumpAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { - if (_hydroInfo == null) + var workingCheckedListHelper = GetWorkingCheckedListHelper(); + var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList(); + if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1) { - return; + var workingHelper = GetWorkingHelper(); + if (!workingHelper.Initialized) + { + TipFormHelper.ShowWarn("璇疯绠楀悗閲嶈瘯锛�"); + return; + } + var dlg = new SimulationSingleWorkingPumpAnalyDlg(); + dlg.SetBindingData(workingHelper.HydroInfo, workingHelper.CalcuResult); + dlg.ShowDialog(); } - if (_hydroInfo.Pumps == null || _hydroInfo.Pumps.Count < 1) + else { - return; + var dlg = new SimulationMultiWorkingPumpAnalyDlg(); + dlg.SetBindingData(_hydroInfo, allCheckedWorkingList); + dlg.ShowDialog(); } - - var calcuResultHelper = GetCalcuResultHelper(); - var vmList = new List<XhsSinglePumpViewModel>(); - foreach (var pump in _hydroInfo.Pumps) - { - if (!pump.RatedN.HasValue) - { - continue; - } - var qh = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQH)?.CurveData; - var qe = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQE)?.CurveData; - var qp = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQP)?.CurveData; - if (qh == null) - { - continue; - } - - var qhPtList = qh.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); - var qePtList = qe?.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); - var qpPtList = qp?.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); - - var vm = new XhsSinglePumpViewModel(); - vmList.Add(vm); - vm.ID = pump.ID; - vm.Name = pump.Name; - vm.Code = pump.Code; - vm.IsBp = true; - vm.RunStatus = pump.LinkStatus == Yw.Hydro.LinkStatus.Open; - vm.RatedHz = pump.RatedHz; - vm.CurrentHz = Math.Round(pump.RatedHz * pump.SpeedRatio, 1); - vm.RatedSpeed = pump.RatedN.Value; - vm.CurrentSpeed = Math.Round(pump.RatedN.Value * pump.SpeedRatio); - vm.CurveQH = qhPtList; - vm.CurveQE = qePtList; - vm.CurveQP = qpPtList; - - var calcuResultVisualDict = calcuResultHelper.GetVisualDict(); - if (calcuResultVisualDict != null && calcuResultVisualDict.Count > 0) - { - //var calcuResult = allCalcuResultList.Find(x => x.Code == pump.Code) as HydroCalcuLinkResult; - //if (calcuResult != null) - //{ - // if (calcuResult.CalcuFlow.HasValue) - // { - // vm.CalcuQ = Math.Abs(calcuResult.CalcuFlow.Value); - // } - - // var calcuResultStart = allCalcuResultList.Find(x => x.Code == pump.StartCode) as HydroCalcuNodeResult; - // var calcuResultEnd = allCalcuResultList.Find(x => x.Code == pump.EndCode) as HydroCalcuNodeResult; - // if (calcuResultStart != null && calcuResultEnd != null) - // { - // if (calcuResultStart.CalcuHead.HasValue && calcuResultEnd.CalcuHead.HasValue) - // { - // vm.CalcuH = Math.Round(Math.Abs(calcuResultStart.CalcuHead.Value - calcuResultEnd.CalcuHead.Value), 4); - // } - // } - //} - } - - } - - //var dlg = new PumpParallelAnalyDlg(); - //dlg.SetBindingData(vmList); - //dlg.ReloadDataEvent += (list) => - //{ - // list?.ForEach(x => - // { - // var pump = _hydroInfo.Pumps?.Find(t => t.Code == x.Code); - // if (pump != null) - // { - // pump.LinkStatus = x.RunStatus ? Yw.Hydro.PumpStatus.Open : Yw.Hydro.PumpStatus.Closed; - // pump.SpeedRatio = Math.Round(x.CurrentHz / pump.RatedHz, 1); - // } - // }); - // //ShowSelectedProperty(); - // return true; - //}; - //dlg.ShowDialog(); } //鑳芥晥鍒嗘瀽 @@ -2408,11 +2434,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(); @@ -2424,8 +2451,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) @@ -2445,12 +2491,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(); } @@ -2486,8 +2540,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