From 920315563b014498ed9ad11f29d69638bc2223ca Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期六, 21 十二月 2024 11:15:55 +0800 Subject: [PATCH] 导入修改 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs | 680 ++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 440 insertions(+), 240 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 311d22c..e5f6f59 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 @@ -30,24 +30,26 @@ /// 鏂板宸ュ喌浜嬩欢 /// </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;//椤圭洰绔� @@ -81,7 +83,7 @@ else { this.ribPageGroupForScheme.Visible = true; - this.PageTitle.Caption = $"姘村姏鏂规\r\n{_scheme.Name}"; + this.PageTitle.Caption = $"妯℃嫙鏂规\r\n{_scheme.Name}"; } } @@ -124,7 +126,7 @@ {//榧犳爣宸﹂敭鐐瑰嚮浜嬩欢 var visualListHelper = GetVisualListHelper(); var visual = visualListHelper.GetVisual(code); - SelectVisual(visual, eVisualSource.Bimface); + SelectVisual(visual, eSimulationVisualSource.Bimface); }; } return _bimfaceCtrl; @@ -138,7 +140,7 @@ this.tabPageBimface.Controls.Add(bimfaceCtrl); } - #endregion + #endregion BIM鎺т欢 #region Q3d鎺т欢 @@ -161,7 +163,7 @@ { var visualListHelper = GetVisualListHelper(); var visuals = visualListHelper.GetVisualList(codes); - SelectVisual(visuals?.LastOrDefault(), eVisualSource.Q3d); + SelectVisual(visuals?.LastOrDefault(), eSimulationVisualSource.Q3d); }; } return _q3dCtrl; @@ -175,7 +177,7 @@ this.tabPageQ3d.Controls.Add(q3dCtrl); } - #endregion + #endregion Q3d鎺т欢 #region 灞炴�ф帶浠� @@ -196,7 +198,7 @@ _propertyCtrl.AllowEdit = true; _propertyCtrl.HydroViewEvent += (visual) => { - SelectVisual(visual, eVisualSource.Property); + SelectVisual(visual, eSimulationVisualSource.Property); }; _propertyCtrl.BlinkLinkNodeEvent += async (link, linkNodeCode) => { //寮鸿皟杩炴帴鑺傜偣 @@ -218,7 +220,7 @@ { return; } - var linkList = allLinkList.Where(x => (x.StartCode == linkNodeCode || x.EndCode == linkNodeCode) && x.Code != linkNodeCode).ToList(); + var linkList = allLinkList.Where(x => (x.StartCode == linkNodeCode || x.EndCode == linkNodeCode) && x.Code != link.Code).ToList(); if (linkList == null || linkList.Count < 1) { return; @@ -266,7 +268,6 @@ var flowEffectHelper = await GetFlowEffectHelper(); flowEffectHelper.Set(visual); }; - } return _propertyCtrl; } @@ -321,122 +322,117 @@ _propertyCtrl?.UpdateRows(); } - #endregion + #endregion 灞炴�ф帶浠� #region 閫夋嫨鏋勪欢 - - //鍙鏉ユ簮 - protected enum eVisualSource - { - None, - Bimface, - Q3d, - Property, - List, - Set, - Search, - Monitor, - Check, - Calcu, - Warning, - } //閫夋嫨鏋勪欢 private Yw.Model.HydroVisualInfo _visual = null; //閫夋嫨鏋勪欢 - private void SelectVisual(HydroVisualInfo visual, eVisualSource source) + private void SelectVisual(HydroVisualInfo visual, eSimulationVisualSource source) { _visual = visual; switch (source) { - case eVisualSource.None: + case eSimulationVisualSource.None: { _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); this.barBtnSetMonitor.Enabled = visual != null; SetPropertyCtrl(visual); } break; - case eVisualSource.Bimface: + + case eSimulationVisualSource.Bimface: { this.barBtnSetMonitor.Enabled = visual != null; SetPropertyCtrl(visual); } break; - case eVisualSource.Q3d: + + case eSimulationVisualSource.Q3d: { _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); this.barBtnSetMonitor.Enabled = visual != null; SetPropertyCtrl(visual); } break; - case eVisualSource.Property: + + case eSimulationVisualSource.Property: { _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); this.barBtnSetMonitor.Enabled = visual != null; } break; - case eVisualSource.List: + + case eSimulationVisualSource.List: { _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); this.barBtnSetMonitor.Enabled = visual != null; SetPropertyCtrl(visual); } break; - case eVisualSource.Set: + + case eSimulationVisualSource.Set: { _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); this.barBtnSetMonitor.Enabled = visual != null; SetPropertyCtrl(visual); } break; - case eVisualSource.Search: + + case eSimulationVisualSource.Search: { _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); this.barBtnSetMonitor.Enabled = visual != null; SetPropertyCtrl(visual); } break; - case eVisualSource.Monitor: + + case eSimulationVisualSource.Monitor: { _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); this.barBtnSetMonitor.Enabled = visual != null; SetPropertyCtrl(visual); } break; - case eVisualSource.Check: + + case eSimulationVisualSource.Check: { _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); this.barBtnSetMonitor.Enabled = visual != null; SetPropertyCtrl(visual); } break; - case eVisualSource.Calcu: + + case eSimulationVisualSource.Calcu: { _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); this.barBtnSetMonitor.Enabled = visual != null; SetPropertyCtrl(visual); } break; - case eVisualSource.Warning: + + case eSimulationVisualSource.Warning: { _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); this.barBtnSetMonitor.Enabled = visual != null; SetPropertyCtrl(visual); } break; + default: break; } } //閫夋嫨鏋勪欢 - private void SelectVisual(string code, eVisualSource source) + private void SelectVisual(string code, eSimulationVisualSource source) { var visual = GetVisual(code); SelectVisual(visual, source); } - #endregion + #endregion 閫夋嫨鏋勪欢 #region 鏋勪欢鏄庣粏 @@ -485,7 +481,7 @@ return helper.GetSourceList(); } - #endregion + #endregion 鍙鍒楄〃 #region 瑙嗗浘鍒楄〃 @@ -515,7 +511,14 @@ return helper.GetVisualList(); } - #endregion + //鑾峰彇鍙瑙嗗浘 + private HydroVisualViewModel GetVisualViewModel(string code) + { + var helper = GetVisualVmListHelper(); + return helper.GetVisual(code); + } + + #endregion 瑙嗗浘鍒楄〃 #region 鏄庣粏鎺т欢 @@ -531,11 +534,11 @@ _visualListCtrl.Dock = DockStyle.Fill; _visualListCtrl.HydroClickInfoEvent += (visual) => { - SelectVisual(visual, eVisualSource.List); + SelectVisual(visual, eSimulationVisualSource.List); }; _visualListCtrl.HydroChangedInfoEvent += (visualList) => { - SelectVisual(_visual, eVisualSource.List); + SelectVisual(_visual, eSimulationVisualSource.List); }; } return _visualListCtrl; @@ -615,7 +618,7 @@ ShowVisualListCtrl(); } - #endregion + #endregion 鏄庣粏鎺т欢 #region 鏋勪欢鏄剧ず @@ -664,9 +667,9 @@ SetVisualVisible(); } - #endregion + #endregion 鏋勪欢鏄剧ず - #endregion + #endregion 鏋勪欢鏄庣粏 #region 涓�閿樉闅� @@ -690,7 +693,7 @@ SetDecoratorVisible(this.barCkDecorator.Checked); } - #endregion + #endregion 涓�閿樉闅� #region 淇濆瓨淇℃伅 @@ -715,16 +718,15 @@ TipFormHelper.ShowSucceed("淇濆瓨鎴愬姛锛�"); - //Stopwatch sw = new Stopwatch(); //sw.Start(); - //鑰楁椂宸ㄥぇ鐨勪唬鐮� + //鑰楁椂宸ㄥぇ鐨勪唬鐮� //sw.Stop(); //TimeSpan ts2 = sw.Elapsed; //Console.WriteLine("Stopwatch鎬诲叡鑺辫垂{0}ms.", ts2.TotalMilliseconds); } - #endregion + #endregion 淇濆瓨淇℃伅 #region 鎵归噺閰嶇疆 @@ -739,11 +741,11 @@ dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { - SelectVisual(visual, eVisualSource.Set); + SelectVisual(visual, eSimulationVisualSource.Set); }; dlg.HydroChangedInfoEvent += visuals => { - SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); UpdateVisualListCtrl(); }; dlg.ShowDialog(); @@ -756,11 +758,11 @@ dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { - SelectVisual(visual, eVisualSource.Set); + SelectVisual(visual, eSimulationVisualSource.Set); }; dlg.HydroChangedInfoEvent += visuals => { - SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); UpdateVisualListCtrl(); }; dlg.ShowDialog(); @@ -773,11 +775,11 @@ dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { - SelectVisual(visual, eVisualSource.Set); + SelectVisual(visual, eSimulationVisualSource.Set); }; dlg.HydroChangedInfoEvent += visuals => { - SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); UpdateVisualListCtrl(); }; dlg.ShowDialog(); @@ -790,11 +792,11 @@ dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { - SelectVisual(visual, eVisualSource.Set); + SelectVisual(visual, eSimulationVisualSource.Set); }; dlg.HydroChangedInfoEvent += visuals => { - SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); UpdateVisualListCtrl(); }; dlg.ShowDialog(); @@ -807,11 +809,11 @@ dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { - SelectVisual(visual, eVisualSource.Set); + SelectVisual(visual, eSimulationVisualSource.Set); }; dlg.HydroChangedInfoEvent += visuals => { - SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); UpdateVisualListCtrl(); }; dlg.ShowDialog(); @@ -824,11 +826,11 @@ dlg.SetBindingData(allVisualVmList); dlg.HydroClickInfoEvent += (visual) => { - SelectVisual(visual, eVisualSource.Set); + SelectVisual(visual, eSimulationVisualSource.Set); }; dlg.HydroChangedInfoEvent += visuals => { - SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); UpdateVisualListCtrl(); }; dlg.ShowDialog(); @@ -841,11 +843,11 @@ dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { - SelectVisual(visual, eVisualSource.Set); + SelectVisual(visual, eSimulationVisualSource.Set); }; dlg.HydroChangedInfoEvent += visuals => { - SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); UpdateVisualListCtrl(); }; dlg.ShowDialog(); @@ -858,11 +860,11 @@ dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { - SelectVisual(visual, eVisualSource.Set); + SelectVisual(visual, eSimulationVisualSource.Set); }; dlg.HydroChangedInfoEvent += visuals => { - SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); UpdateVisualListCtrl(); }; dlg.ShowDialog(); @@ -875,11 +877,11 @@ dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { - SelectVisual(visual, eVisualSource.Set); + SelectVisual(visual, eSimulationVisualSource.Set); }; dlg.HydroChangedInfoEvent += visuals => { - SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); UpdateVisualListCtrl(); }; dlg.ShowDialog(); @@ -892,16 +894,20 @@ dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { - SelectVisual(visual, eVisualSource.Set); + SelectVisual(visual, eSimulationVisualSource.Set); }; dlg.HydroChangedInfoEvent += visuals => { - SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); UpdateVisualListCtrl(); }; dlg.ShowDialog(); }; //鍘嬪姏琛� + this.barBtnSetPressmeterList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); + this.barBtnSetPressmeterList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Pressmeter; + this.barBtnSetPressmeterList.ImageOptions.SvgImageSize = new Size(32, 32); + this.barBtnSetPressmeterList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; this.barBtnSetPressmeterList.ItemClick += delegate { var allVisualViewModelList = GetVisualViewModelList(); @@ -909,11 +915,53 @@ dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { - SelectVisual(visual, eVisualSource.Set); + SelectVisual(visual, eSimulationVisualSource.Set); }; dlg.HydroChangedInfoEvent += visuals => { - SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); + UpdateVisualListCtrl(); + }; + dlg.ShowDialog(); + }; + //鍠峰槾 + this.barBtnSetNozzleList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); + this.barBtnSetNozzleList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Nozzle; + this.barBtnSetNozzleList.ImageOptions.SvgImageSize = new Size(32, 32); + this.barBtnSetNozzleList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; + this.barBtnSetNozzleList.ItemClick += delegate + { + var allVisualViewModelList = GetVisualViewModelList(); + var dlg = new SetHydroNozzleListDlg(); + dlg.SetBindingData(allVisualViewModelList); + dlg.HydroClickInfoEvent += (visual) => + { + SelectVisual(visual, eSimulationVisualSource.Set); + }; + dlg.HydroChangedInfoEvent += visuals => + { + SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); + UpdateVisualListCtrl(); + }; + dlg.ShowDialog(); + }; + //鍐峰嵈濉� + this.barBtnSetCoolingList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); + this.barBtnSetCoolingList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Cooling; + this.barBtnSetCoolingList.ImageOptions.SvgImageSize = new Size(32, 32); + this.barBtnSetCoolingList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; + this.barBtnSetCoolingList.ItemClick += delegate + { + var allVisualViewModelList = GetVisualViewModelList(); + var dlg = new SetHydroCoolingListDlg(); + dlg.SetBindingData(allVisualViewModelList); + dlg.HydroClickInfoEvent += (visual) => + { + SelectVisual(visual, eSimulationVisualSource.Set); + }; + dlg.HydroChangedInfoEvent += visuals => + { + SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); UpdateVisualListCtrl(); }; dlg.ShowDialog(); @@ -926,11 +974,11 @@ dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { - SelectVisual(visual, eVisualSource.Set); + SelectVisual(visual, eSimulationVisualSource.Set); }; dlg.HydroChangedInfoEvent += visuals => { - SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); UpdateVisualListCtrl(); }; dlg.ShowDialog(); @@ -943,11 +991,11 @@ dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { - SelectVisual(visual, eVisualSource.Set); + SelectVisual(visual, eSimulationVisualSource.Set); }; dlg.HydroChangedInfoEvent += visuals => { - SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); UpdateVisualListCtrl(); }; dlg.ShowDialog(); @@ -960,11 +1008,11 @@ dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { - SelectVisual(visual, eVisualSource.Set); + SelectVisual(visual, eSimulationVisualSource.Set); }; dlg.HydroChangedInfoEvent += visuals => { - SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); UpdateVisualListCtrl(); }; dlg.ShowDialog(); @@ -977,11 +1025,11 @@ dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { - SelectVisual(visual, eVisualSource.Set); + SelectVisual(visual, eSimulationVisualSource.Set); }; dlg.HydroChangedInfoEvent += visuals => { - SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); UpdateVisualListCtrl(); }; dlg.ShowDialog(); @@ -994,16 +1042,16 @@ dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { - SelectVisual(visual, eVisualSource.Set); + SelectVisual(visual, eSimulationVisualSource.Set); }; dlg.HydroChangedInfoEvent += visuals => { - SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); UpdateVisualListCtrl(); }; dlg.ShowDialog(); }; - //鎹㈢儹鍣� + //鍘嬬缉鏈� this.barBtnSetCompressorList.ItemClick += delegate { var allVisualViewModelList = GetVisualViewModelList(); @@ -1011,17 +1059,16 @@ dlg.SetBindingData(allVisualViewModelList); dlg.HydroClickInfoEvent += (visual) => { - SelectVisual(visual, eVisualSource.Set); + SelectVisual(visual, eSimulationVisualSource.Set); }; dlg.HydroChangedInfoEvent += visuals => { - SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); UpdateVisualListCtrl(); }; dlg.ShowDialog(); }; } - //鏄剧ずRadialMenu private void barBtnSetList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) @@ -1095,6 +1142,16 @@ else { this.barBtnSetHydrantList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; + } + + //鍐峰嵈濉� + if (_hydroInfo.Coolings == null || _hydroInfo.Coolings.Count < 1) + { + this.barBtnSetCoolingList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; + } + else + { + this.barBtnSetCoolingList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; } //闂峰ご @@ -1226,11 +1283,9 @@ { this.barBtnSetCompressorList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; } - - } - #endregion + #endregion 鎵归噺閰嶇疆 #region 鏋勪欢鏌ヨ @@ -1249,12 +1304,12 @@ _searchCtrl.InitialData(allVisualVmList); _searchCtrl.HydroClickInfoEvent += (visual) => { - SelectVisual(visual, eVisualSource.Check); + SelectVisual(visual, eSimulationVisualSource.Check); }; _searchCtrl.HydroSearchInfoEvent += (list) => { var visual = list?.FirstOrDefault(); - SelectVisual(visual, eVisualSource.Search); + SelectVisual(visual, eSimulationVisualSource.Search); }; } return _searchCtrl; @@ -1321,7 +1376,7 @@ ShowSearchDlg(); } - #endregion + #endregion 鏋勪欢鏌ヨ #region 妯″瀷鏍囨敞 @@ -1373,7 +1428,7 @@ markHelper.Set(); } - #endregion + #endregion 妯″瀷鏍囨敞 #region 棰滆壊鍒嗙骇 @@ -1455,7 +1510,7 @@ gradingHelper.Set(); } - #endregion + #endregion 棰滆壊鍒嗙骇 #region 浜哄伐鍒锋柊 @@ -1468,7 +1523,6 @@ } if (XtraMessageBox.Show("鍒锋柊鍚庡皢涓㈠け褰撳墠姘村姏淇℃伅鏇存敼锛屾槸鍚︾户缁埛鏂帮紵", "璇㈤棶", MessageBoxButtons.YesNo) == DialogResult.Yes) { - var hydroInfo = await this.RefreshModelEvent.Invoke(); if (hydroInfo == null) { @@ -1476,14 +1530,14 @@ return; } _hydroInfo = hydroInfo; - SelectVisual(visual: null, eVisualSource.None); + SelectVisual(visual: null, eSimulationVisualSource.None); ResetVisualList(); TipFormHelper.ShowSucceed("鍒锋柊鎴愬姛锛�"); } } - #endregion + #endregion 浜哄伐鍒锋柊 #region 姘存祦鍔ㄧ敾 @@ -1516,7 +1570,7 @@ flowEffectHelper.Set(); } - #endregion + #endregion 姘存祦鍔ㄧ敾 #region 鐩戞祴鍒楄〃 @@ -1538,6 +1592,13 @@ _monitorHelper = new SimulationMonitorHelper(visualListHelper); } return _monitorHelper; + } + + //鑾峰彇鐩戞祴鐐瑰垪琛� + private async Task<List<HydroMonitorVmo>> GetMonitorList() + { + var helper = GetMonitorHelper(); + return await helper.Get(); } //璁剧疆鐩戞祴鐐瑰垪琛� @@ -1576,7 +1637,7 @@ SetMonitorList(_visual); } - #endregion + #endregion 鐩戞祴鐐� #region 鐩戞祴鍊� @@ -1595,17 +1656,23 @@ return _monitorValueHelper; } + //鑾峰彇鐩戞祴鍊煎垪琛� + private async Task<List<HydroMonitorValueViewModel>> GetMonitorValueList() + { + var helper = GetMonitorValueHelper(); + return await helper.Get(); + } + //閲嶇疆 private void ResetMonitorValue() { var allWorkingList = GetWorkingList(); - var working = allWorkingList?.Last(x => !string.IsNullOrEmpty(x.MonitorInfo)); + var working = allWorkingList?.LastOrDefault(x => !string.IsNullOrEmpty(x.MonitorInfo)); if (working != null) { var helper = GetMonitorValueHelper(); helper.Reset(working.MonitorInfo); } - } #endregion @@ -1624,9 +1691,8 @@ _monitorValueListCtrl.Dock = DockStyle.Fill; _monitorValueListCtrl.HydroViewEvent += (code) => { - var visualListHelper = GetVisualListHelper(); - var visual = visualListHelper.GetVisual(code); - SelectVisual(visual, eVisualSource.Monitor); + var visual = GetVisual(code); + SelectVisual(visual, eSimulationVisualSource.Monitor); }; } return _monitorValueListCtrl; @@ -1663,9 +1729,8 @@ this.docPnlBottom.Text = "鐩戞祴鍊�"; this.docPnlBottom.Height = 350; } - var monitorValueHelper = GetMonitorValueHelper(); - var allMonitorValueList = await monitorValueHelper.Get(); - monitorValueListCtrl.SetBindingData(allMonitorValueList); + var allMonitorValueList = await GetMonitorValueList(); + monitorValueListCtrl.SetBindingData(allMonitorValueList, _visual); } //璁剧疆鐩戞祴鍊� @@ -1703,7 +1768,7 @@ #endregion - #endregion + #endregion 鐩戞祴鍒楄〃 #region 妯″瀷妫�鏌� @@ -1725,7 +1790,7 @@ { var visualListHelper = GetVisualListHelper(); var visual = visualListHelper.GetVisual(code); - SelectVisual(visual, eVisualSource.Check); + SelectVisual(visual, eSimulationVisualSource.Check); }; } return _checkCtrl; @@ -1787,7 +1852,7 @@ ShowCheckCtrl(checkResult); } - #endregion + #endregion 妯″瀷妫�鏌� #region 妯″瀷璁$畻 @@ -1807,7 +1872,7 @@ return _calcuResultHelper; } - #endregion + #endregion 璁$畻缁撴灉 #region 璁$畻澶辫触 @@ -1871,7 +1936,7 @@ calcuFailedCtrl.SetBindingData(calcuResult.FailedList); } - #endregion + #endregion 璁$畻澶辫触 #region 璁$畻璀﹀憡 @@ -1889,7 +1954,7 @@ { var visualListHelper = GetVisualListHelper(); var visual = visualListHelper.GetVisual(code); - SelectVisual(visual, eVisualSource.Warning); + SelectVisual(visual, eSimulationVisualSource.Warning); }; } return _calcuWarningCtrl; @@ -1943,7 +2008,7 @@ calcuWaringCtrl.SetBindingData(calcuResult.WainingList, allVisualDict); } - #endregion + #endregion 璁$畻璀﹀憡 #region 璁$畻鏍囩 @@ -1970,72 +2035,7 @@ calcuResultLabelHelper.Set(); } - #endregion - - #endregion - - #region 绠$綉淇 - - //淇绠$綉 - private void Repair() - { - if (_hydroInfo == null) - { - return; - } - var checkResult = _hydroInfo.Check(); - if (!checkResult.Succeed) - { - ShowCheckCtrl(checkResult); - TipFormHelper.ShowWarn("妫�鏌ュけ璐ュ鑷存棤娉曡繘琛岃瘯绠楋紝鍋滄绠$綉淇锛�"); - return; - } - var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.Simple); - if (!calcuResult.Succeed) - { - ShowCalcuFailedCtrl(calcuResult); - TipFormHelper.ShowWarn("璇曠畻澶辫触锛屽仠姝㈢缃戜慨澶嶏紒"); - return; - } - var visualListHelper = GetVisualListHelper(); - var allLinkList = visualListHelper.GetLinkList(); - if (allLinkList != null && allLinkList.Count < 1) - { - TipFormHelper.ShowError("妯″瀷涓湭鍖呭惈绠℃淇℃伅锛屽仠姝㈢缃戜慨澶嶏紒"); - return; - } - int count = 0; - foreach (var link in allLinkList) - { - var calcuLink = calcuResult.LinkList?.Find(x => x.Code == link.Code); - if (calcuLink == null) - { - continue; - } - if (!calcuLink.CalcuFlow.HasValue) - { - continue; - } - if (calcuLink.CalcuFlow.Value < 0) - { - var tempCode = link.StartCode; - link.StartCode = link.EndCode; - link.EndCode = tempCode; - count++; - } - } - var visualVmListHelper = GetVisualVmListHelper(); - visualVmListHelper.UpdateProperty(); - UpdateVisualListCtrl(); - UpdatePropertyCtrl(); - TipFormHelper.ShowSucceed($"淇瀹屾垚锛屽叡淇绠℃({count})涓紒"); - } - - //绠$綉淇 - private void barBtnRepair_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) - { - Repair(); - } + #endregion 璁$畻鏍囩 #endregion @@ -2059,7 +2059,7 @@ TipFormHelper.ShowSucceed("瀵煎嚭鎴愬姛"); } - #endregion + #endregion 瀵煎嚭INP #region 姘存车鍒楄〃 @@ -2082,7 +2082,7 @@ pumps.ForEach(x => x.UpdateWorkingInfo(list)); var visualVmListHelper = GetVisualVmListHelper(); visualVmListHelper.UpdateProperty(pumps.Select(x => x as Yw.Model.HydroVisualInfo).ToList()); - SelectVisual(_visual, eVisualSource.None); + SelectVisual(_visual, eSimulationVisualSource.None); var gradingHelper = await GetGradingHelper(); gradingHelper.Set(); }; @@ -2123,7 +2123,7 @@ }); var visualVmListHelper = GetVisualVmListHelper(); visualVmListHelper.UpdateProperty(pumps.Select(x => x as Yw.Model.HydroVisualInfo).ToList()); - SelectVisual(_visual, eVisualSource.None); + SelectVisual(_visual, eSimulationVisualSource.None); var gradingHelper = await GetGradingHelper(); gradingHelper.Set(); }; @@ -2134,11 +2134,10 @@ //骞惰仈妯℃嫙 private void barBtnPumpParallel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { - PumpParallel(); } - #endregion + #endregion 姘存车鍒楄〃 #region 姘村姏璁$畻 @@ -2157,7 +2156,7 @@ dlg.SetBindingData(_hydroInfo, allWorkingList, allMonitorValueList); dlg.HydroViewEvent += (visual) => { - SelectVisual(visual, eVisualSource.Calcu); + SelectVisual(visual, eSimulationVisualSource.Calcu); }; dlg.HydroCalcuEvent += async (vm) => { @@ -2170,7 +2169,11 @@ working.ModelID = vm.ModelID; working.Name = vm.Name; working.WorkingInfo = JsonHelper.Object2Json(vm.WorkingInfo); - working.MonitorInfo = JsonHelper.Object2Json(vm.MonitorInfo); + var useWorkingMonitorInfo = vm.MonitorInfo?.Where(x => x.PropValue.HasValue).ToList(); + if (useWorkingMonitorInfo != null && useWorkingMonitorInfo.Count > 0) + { + working.MonitorInfo = JsonHelper.Object2Json(useWorkingMonitorInfo); + } working.SortCode = vm.SortCode; working.Description = vm.Description; @@ -2197,6 +2200,7 @@ ShowCalcuWarningCtrl(calcuResult); } this.barBtnAddWorking.Enabled = true; + this.barBtnExportWord.Enabled = true; TipFormHelper.ShowSucceed("璁$畻鎴愬姛锛�"); } else @@ -2210,38 +2214,35 @@ var visualVmListHelper = GetVisualVmListHelper(); visualVmListHelper.UpdateCalcuProperty(calcuResult); - #endregion + #endregion 瑙嗗浘鍒楄〃 #region 褰撳墠鏋勪欢 - SelectVisual(_visual, eVisualSource.Calcu); + SelectVisual(_visual, eSimulationVisualSource.Calcu); - #endregion + #endregion 褰撳墠鏋勪欢 #region 鏋勪欢鏄庣粏 UpdateVisualListCtrl(); - #endregion + #endregion 鏋勪欢鏄庣粏 #region 棰滆壊鍒嗙骇 var gradingHelper = await GetGradingHelper(); gradingHelper.Set(); - #endregion + #endregion 棰滆壊鍒嗙骇 #region 璁$畻鏍囩 var calcuResultLabelHelper = await GetCalcuResultLabelHelper(); calcuResultLabelHelper.Set(); - #endregion - + #endregion 璁$畻鏍囩 }; - dlg.ShowDialog(); - } //姘村姏璁$畻 @@ -2250,7 +2251,49 @@ Calcu(); } - #endregion + #endregion 姘村姏璁$畻 + + #region 瀵煎嚭鎶ュ憡 + + private async void barBtnExportWord_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + if (_visual == null) + { + SelectInputSource(); + if (_visual == null) + { + TipFormHelper.ShowWarn("璇烽�夋嫨鏋勪欢鍚庨噸璇曪紒"); + return; + } + } + HydroVisualInfo visual = _visual; + if (_visual is HydroLinkInfo linkInfo) + { + var visualListHelper = GetVisualListHelper(); + visual = visualListHelper.GetVisual(linkInfo.StartCode); + } + + var allMonitorList = await GetMonitorList(); + var working = GetWorking(); + var calcuResult = GetCalcuResult(); + + var dlg = new SimulationWorkingReportDlg(); + dlg.ReloadDataEvent += (vm) => + { + var fileName = FileDialogHelper.SaveWordDoc("瀵煎嚭Word鎶ュ憡"); + if (string.IsNullOrEmpty(fileName)) + { + return; + } + var reportHelper = new SimulationWorkingReportHelper(); + reportHelper.Create(fileName, vm); + TipFormHelper.ShowInfo("瀵煎嚭鎴愬姛锛�"); + }; + dlg.SetBindingData(_project, _hydroInfo, allMonitorList, working, calcuResult, visual); + dlg.ShowDialog(); + } + + #endregion 瀵煎嚭鎶ュ憡 #region 褰撳墠宸ュ喌 @@ -2315,7 +2358,7 @@ AddWorking(); } - #endregion + #endregion 褰撳墠宸ュ喌 #region 閫夋嫨宸ュ喌 @@ -2341,6 +2384,13 @@ return helper.GetWorkingList(); } + //鑾峰彇閫夋嫨宸ュ喌鍒楄〃 + private List<HydroWorkingVmo> GetCheckedWorkingList() + { + var helper = GetWorkingCheckedListHelper(); + return helper.GetCheckedWorkingList(); + } + //鏇存柊宸ュ喌閫夋嫨鍒楄〃 public void UpdateWorkingCheckedList(HydroWorkingVmo working) { @@ -2362,10 +2412,117 @@ helper.Remove(working); } + #endregion 閫夋嫨宸ュ喌 + + #region 鐩戞祴鍒嗘瀽 + + //鐩戞祴鍒嗘瀽鍒楄〃鎺т欢 + private HydroWorkingMonitorAnalyListCtrl _monitorAnalyListCtrl = null; + + //鑾峰彇鐩戞祴鍒嗘瀽鍒楄〃鎺т欢 + private HydroWorkingMonitorAnalyListCtrl GetMonitorAnalyListCtrl() + { + if (_monitorAnalyListCtrl == null) + { + _monitorAnalyListCtrl = new HydroWorkingMonitorAnalyListCtrl(); + _monitorAnalyListCtrl.Dock = DockStyle.Fill; + _monitorAnalyListCtrl.HydroViewEvent += (code) => + { + var visual = GetVisual(code); + SelectVisual(visual, eSimulationVisualSource.Monitor); + }; + } + return _monitorAnalyListCtrl; + } + + //鐩戞祴鍒嗘瀽鍒楄〃鎺т欢鏄惁鍙 + private bool IsMonitorAnalyListCtrlVisible + { + get + { + if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) + { + if (this.controlContainerBottom.Controls.Count > 0) + { + if (this.controlContainerBottom.Controls[0] is HydroWorkingMonitorAnalyListCtrl) + { + return true; + } + } + } + return false; + } + } + + //鏄剧ず鐩戞祴鍊煎垪琛ㄦ帶浠� + private async void ShowMonitorAnalyListCtrl() + { + if (_hydroInfo == null) + { + return; + } + var allWorkingList = GetCheckedWorkingList(); + if (allWorkingList == null || allWorkingList.Count < 1) + { + var workingHelper = GetWorkingHelper(); + if (!workingHelper.Initialized) + { + TipFormHelper.ShowWarn("璇疯绠楀悗閲嶈瘯锛�"); + return; + } + } + var monitorAnalyListCtrl = GetMonitorAnalyListCtrl(); + if (!IsMonitorAnalyListCtrlVisible) + { + this.controlContainerBottom.Controls.Clear(); + this.controlContainerBottom.Controls.Add(monitorAnalyListCtrl); + this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; + this.docPnlBottom.Text = "鐩戞祴鍒嗘瀽"; + this.docPnlBottom.Height = 350; + } + var allMontorList = await GetMonitorList(); + var allMonitorValueList = await GetMonitorValueList(); + + if (allWorkingList == null || allWorkingList.Count < 1) + { + monitorAnalyListCtrl.SetBindingData(_hydroInfo, allMontorList, allMonitorValueList, GetWorking(), GetCalcuResult(), _visual); + } + else + { + monitorAnalyListCtrl.SetBindingData(_hydroInfo, allMontorList, allMonitorValueList, allWorkingList, _visual); + } + } + + //鐩戞祴鍒嗘瀽 + private void barBtnWorkingMonitorAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + ShowMonitorAnalyListCtrl(); + } #endregion #region 宸ュ喌鍒嗘瀽 + + //閫夋嫨杩涘彛姘存簮 + private void SelectInputSource() + { + var sources = GetSourceList(); + if (sources != null) + { + if (sources.Count == 1) + { + SelectVisual(sources[0], eSimulationVisualSource.None); + } + else + { + var source = sources.FirstOrDefault(x => x.Flags.Contains(HStation.Xhs.Flags.杩涘彛)); + if (source != null) + { + SelectVisual(source, eSimulationVisualSource.None); + } + } + } + } //绮惧害璇勪及 private async void barBtnWorkingEvaluation_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) @@ -2421,8 +2578,9 @@ } //鑳芥晥鍒嗘瀽 - private void barBtnWorkingPower_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + private async void barBtnWorkingPower_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { + var allMonitorList = await GetMonitorList(); var workingCheckedListHelper = GetWorkingCheckedListHelper(); var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList(); if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1) @@ -2434,14 +2592,13 @@ return; } var dlg = new SimulationSingleWorkingEnergyDlg(); - dlg.SetBindingData(workingHelper.Working, workingHelper.HydroInfo, workingHelper.CalcuResult); + dlg.SetBindingData(workingHelper.Working, workingHelper.HydroInfo, allMonitorList, workingHelper.CalcuResult); dlg.ShowDialog(); } else { - var dlg = new SimulationMultiWorkingEnergyDlg(); - dlg.SetBindingData(_hydroInfo, allCheckedWorkingList); + dlg.SetBindingData(_hydroInfo, allMonitorList, allCheckedWorkingList); dlg.ShowDialog(); } } @@ -2451,22 +2608,7 @@ { if (_visual == null) { - 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); - } - } - } + SelectInputSource(); if (_visual == null) { TipFormHelper.ShowWarn("璇烽�夋嫨鏋勪欢鍚庨噸璇曪紒"); @@ -2493,7 +2635,7 @@ var dlg = new HydroSingleWorkingLossCurveDlg(); dlg.HydroClickEvent += (code) => { - SelectVisual(code, eVisualSource.None); + SelectVisual(code, eSimulationVisualSource.None); }; dlg.SetBindingData(workingHelper.HydroInfo, workingHelper.CalcuResult, visual); dlg.ShowDialog(); @@ -2503,7 +2645,7 @@ var dlg = new HydroMultiWorkingLossCurveDlg(); dlg.HydroClickEvent += (code) => { - SelectVisual(code, eVisualSource.None); + SelectVisual(code, eSimulationVisualSource.None); }; dlg.SetBindingData(_hydroInfo, allCheckedWorkingList, visual); dlg.ShowDialog(); @@ -2540,26 +2682,14 @@ { if (_visual == null) { - 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; + SelectInputSource(); + if (_visual == null) + { + TipFormHelper.ShowWarn("璇烽�夋嫨鏋勪欢鍚庨噸璇曪紒"); + return; + } } } HydroVisualInfo visual = _visual; @@ -2596,10 +2726,80 @@ #endregion + #region 鏂规绠$悊 + //鏇存柊鏂规 + private void UpdateScheme() + { + if (_scheme == null) + { + return; + } + if (_hydroInfo == null) + { + return; + } + var dlg = new EditXhsSchemeDlg(); + dlg.SetBindingData(_scheme, _hydroInfo); + dlg.ReloadDataEvent += (rhs) => + { + _scheme = rhs; + this.PageTitle.Caption = $"妯℃嫙鏂规\r\n{_scheme.Name}"; + UpdatePageTitle(this.PageGuid, this.PageTitle); + this.UpdateSchemeEvent?.Invoke(_scheme); + }; + dlg.ShowDialog(); + } + //缂栬緫鏂规 + private void barBtnEditScheme_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + UpdateScheme(); + } + //鍒犻櫎鏂规 + private async void DeleteScheme() + { + var bol = XtraMessageBox.Show("璇烽棶鏄惁鍒犻櫎褰撳墠鏂规锛�", "璇㈤棶", MessageBoxButtons.YesNo) == DialogResult.Yes; + if (!bol) + { + return; + } + if (_scheme == null) + { + return; + } + var relation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance + .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsScheme, _scheme.ID, HStation.Xhs.Purpose.Simulation); + if (relation == null) + { + TipFormHelper.ShowError("姘村姏妯℃嫙鏂规鍒犻櫎澶辫触锛岃閲嶈瘯锛�"); + return; + } + if (!await BLLFactory<Yw.BLL.HydroModelRelation>.Instance.DeleteAllByID(relation.ID)) + { + TipFormHelper.ShowError("姘村姏妯℃嫙鏂规鍒犻櫎澶辫触锛岃閲嶈瘯锛�"); + return; + } + + if (!await BLLFactory<HStation.BLL.XhsScheme>.Instance.DeleteByID(_scheme.ID)) + { + TipFormHelper.ShowError("姘村姏妯℃嫙鏂规鍒犻櫎澶辫触锛岃閲嶈瘯锛�"); + return; + } + this.RemoveSchemeEvent?.Invoke(_scheme); + TipFormHelper.ShowSucceed("姘村姏妯℃嫙鏂规鍒犻櫎鎴愬姛锛�"); + ClosePage(this.PageGuid); + } + + //鍒犻櫎鏂规 + private void barBtnDeleteScheme_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + DeleteScheme(); + } + + #endregion 鏂规绠$悊 } -- Gitblit v1.9.3