From c62abea9769bd09d8339628b364105fb3bf934f1 Mon Sep 17 00:00:00 2001 From: duheng <2784771470@qq.com> Date: 星期二, 10 十二月 2024 17:34:13 +0800 Subject: [PATCH] 修改报表方法 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs | 422 ++++++++++++++++++++++++++++++++++------------------ 1 files changed, 276 insertions(+), 146 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 2b635a3..5907903 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 @@ -2142,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); @@ -2153,6 +2197,7 @@ ShowCalcuWarningCtrl(calcuResult); } this.barBtnAddWorking.Enabled = true; + this.barBtnExportWord.Enabled = true; TipFormHelper.ShowSucceed("璁$畻鎴愬姛锛�"); } else @@ -2180,6 +2225,13 @@ #endregion + #region 棰滆壊鍒嗙骇 + + var gradingHelper = await GetGradingHelper(); + gradingHelper.Set(); + + #endregion + #region 璁$畻鏍囩 var calcuResultLabelHelper = await GetCalcuResultLabelHelper(); @@ -2197,6 +2249,21 @@ private void barBtnCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Calcu(); + } + + #endregion + + #region 瀵煎嚭鎶ュ憡 + + private void barBtnExportWord_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + var fileName = FileDialogHelper.SaveWordDoc("瀵煎嚭Word鎶ュ憡"); + if (string.IsNullOrEmpty(fileName)) + { + return; + } + SimulationWordReport word = new SimulationWordReport(); + word.Create(fileName); } #endregion @@ -2252,6 +2319,7 @@ { this.barBtnAddWorking.Enabled = false; workingHelper.ResetWorking(rhs); + UpdateWorkingCheckedList(rhs, false); this.AppendWorkingEvent?.Invoke(rhs); }; dlg.ShowDialog(); @@ -2282,6 +2350,20 @@ 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) { @@ -2289,10 +2371,38 @@ helper.Update(working, hasChecked); } + //绉婚櫎宸ュ喌閫夋嫨鍒楄〃 + public void RemoveWorkingCheckedList(HydroWorkingVmo working) + { + var helper = GetWorkingCheckedListHelper(); + helper.Remove(working); + } + #endregion #region 宸ュ喌鍒嗘瀽 + + //閫夋嫨杩涘彛姘存簮 + private void SelectInputSource() + { + 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); + } + } + } + } //绮惧害璇勪及 private async void barBtnWorkingEvaluation_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) @@ -2341,11 +2451,10 @@ } else { - //var dlg = new HydroMultiWorkingLossStatisticsDlg(); - //dlg.SetBindingData(_hydroInfo, allCheckedWorkingList); - //dlg.ShowDialog(); + var dlg = new SimulationMultiWorkingPumpAnalyDlg(); + dlg.SetBindingData(_hydroInfo, allCheckedWorkingList); + dlg.ShowDialog(); } - } //鑳芥晥鍒嗘瀽 @@ -2362,11 +2471,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 +2488,12 @@ { if (_visual == null) { - TipFormHelper.ShowWarn("璇烽�夋嫨鏋勪欢鍚庨噸璇曪紒"); - return; + SelectInputSource(); + if (_visual == null) + { + TipFormHelper.ShowWarn("璇烽�夋嫨鏋勪欢鍚庨噸璇曪紒"); + return; + } } HydroVisualInfo visual = _visual; if (_visual is HydroLinkInfo linkInfo) @@ -2399,12 +2513,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 +2562,15 @@ { if (_visual == null) { - TipFormHelper.ShowWarn("璇烽�夋嫨鏋勪欢鍚庨噸璇曪紒"); - return; + if (_visual == null) + { + SelectInputSource(); + if (_visual == null) + { + TipFormHelper.ShowWarn("璇烽�夋嫨鏋勪欢鍚庨噸璇曪紒"); + return; + } + } } HydroVisualInfo visual = _visual; if (_visual is HydroLinkInfo linkInfo) @@ -2483,5 +2612,6 @@ + } } \ No newline at end of file -- Gitblit v1.9.3