From 30e078df2eae453b8ea39680816d5abbf5c51b25 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期四, 26 九月 2024 14:01:07 +0800 Subject: [PATCH] Xhs匹配改造,有错误 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs | 383 +++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 274 insertions(+), 109 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs index d8a7f32..3d2be6c 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs @@ -1,7 +1,10 @@ 锘縢lobal using Yw.EPAnet; +using DevExpress.Xpo.Helpers; using HStation.WinFrmUI.Xhs; using HStation.WinFrmUI.Xhs.Core; using NPOI.SS.Formula.Functions; +using Yw.WinFrmUI.HydroL2d; +using Yw.WinFrmUI.HydroL3d; namespace HStation.WinFrmUI { @@ -14,12 +17,16 @@ this.PageTitle.HeaderSvgImage = this.svgImg32[0]; this.docPnlHydroCheck.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; this.docPnlHydroCalcu.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlHydroParterList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlUnMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.assetsMainChoicePage1.FormRowClickEvent += xhsProjectSimulationHydroCheckFailedCtrl1_HydroClickEvent; } private HStation.Vmo.XhsProjectVmo _project = null;//椤圭洰 private HStation.Vmo.XhsProjectSiteVmo _projectSite = null;//椤圭洰绔� private Yw.Model.HydroModelInfo _hydroInfo = null;//姘村姏淇℃伅 - private List<string> _fastShowHideCodeList = null;//鏄鹃殣缂栫爜鍒楄〃 + private Yw.Model.HydroParterInfo _parter = null; private Yw.EPAnet.CheckResult _checkResult = null; @@ -52,8 +59,6 @@ .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation); _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(hydroRelation.ModelID); } - this.xhsProjectSimulationPropertyCtrl1.SetBindingData(_hydroInfo); - this.xhsProjectSimulationQ3dCtrl1.SetBindingData(_hydroInfo); } /// <summary> @@ -67,90 +72,65 @@ return; } this.PageTitle.Caption = $"{_project.Name}\r\n姘村姏妯℃嫙"; - await this.xhsProjectSimulationBimfaceCtrl1.SetBindingData(_project, _projectSite); + await this.xhsProjectSimulationBimfaceCtrl1.SetBindingData(_project, _projectSite, () => _hydroInfo); + this.xhsProjectSimulationQ3dCtrl1.SetBindingData(_hydroInfo); + this.xhsProjectSimulationL3dCtrl1.SetBindingData(_hydroInfo); } - #region 妯″瀷 - - //涓�閿樉闅� - private async void barBtnShowHide_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + //灞炴�ч潰鏉胯幏鍙栨按鍔涗俊鎭簨浠� + private Yw.Model.HydroModelInfo xhsProjectSimulationPropertyCtrl1_GetHydroInfoEvent() { - if (_hydroInfo == null) - { - return; - } - if (_hydroInfo.Decorators == null || _hydroInfo.Decorators.Count < 1) - { - return; - } - if (_fastShowHideCodeList == null) - { - _fastShowHideCodeList = _hydroInfo.Waterboxs.Select(x => x.Code).ToList(); - await this.xhsProjectSimulationBimfaceCtrl1.HideComponents(_fastShowHideCodeList); - } - else - { - await this.xhsProjectSimulationBimfaceCtrl1.ShowComponents(_fastShowHideCodeList); - _fastShowHideCodeList = null; - } + return _hydroInfo; } - #endregion 妯″瀷 - #region 姘村姏 - //姘村姏楠岃瘉 - private void barBtnHydroCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) - { - if (_hydroInfo == null) - { - return; - } - var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo); - _checkResult = netWork.Check(); - if (_checkResult.Succeed) - { - TipFormHelper.ShowSucceed("鏍¢獙閫氳繃锛�"); - return; - } - this.xhsProjectSimulationHydroCheckFailedCtrl1.SetBindingData(_checkResult.FailedList); - this.docPnlHydroCalcu.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; - this.docPnlHydroCheck.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; - } + //姘村姏璁$畻 - private void barBtnHydroCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + private async void barBtnHydroCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (_hydroInfo == null) { return; } + this.docPnlHydroCheck.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlHydroCalcu.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlHydroParterList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlUnMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo); _calcuResult = netWork.Calcu(); if (_calcuResult.Succeed) { ShowProperty(); TipFormHelper.ShowSucceed("璁$畻鎴愬姛锛�"); - return; } - this.xhsProjectSimulationHydroCalcuFailedCtrl1.SetBindingData(_calcuResult.FailedList); - this.docPnlHydroCheck.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; - this.docPnlHydroCalcu.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; + else + { + this.xhsProjectSimulationHydroCalcuFailedCtrl1.SetBindingData(_calcuResult.FailedList); + this.docPnlHydroCalcu.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; + this.docPnlHydroCalcu.Height = 350; + } + await this.xhsProjectSimulationBimfaceCtrl1.ShowCalcuCustomLabels(_calcuResult); } //姘村姏鏋勪欢鍒楄〃 private void barBtnHydroParterList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { - var dlg = new HydroParterListDlg(); - dlg.TopMost = true; - dlg.HydroClickEvent += async (parter) => + if (_hydroInfo == null) { - _parter = parter; - await this.xhsProjectSimulationBimfaceCtrl1.SetSelectedComponents(new List<string>() { parter.Code }); - ShowProperty(); - }; - dlg.SetBindingData(_hydroInfo); - dlg.Show(); + return; + } + this.docPnlHydroCheck.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlHydroCalcu.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlHydroParterList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlUnMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + // this.docPnlMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + + this.hydroParterListCtrl1.SetBindingData(_hydroInfo); + this.docPnlHydroParterList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; + this.docPnlHydroParterList.Height = 350; } //瀵煎嚭姘村姏INP鏂囦欢 @@ -171,17 +151,244 @@ TipFormHelper.ShowSucceed("瀵煎嚭鎴愬姛"); } - //bimface 鏋勪欢鐐瑰嚮 - private void xhsProjectSimulationBimfaceCtrl1_ClickParterEvent(string objectId) + + + + + + + + + + + + + //姘村姏鏋勪欢鏄庣粏闈㈡澘鐐瑰嚮浜嬩欢 + private async void hydroParterListCtrl1_HydroClickEvent(Yw.Model.HydroParterInfo parter) + { + var allParterList = _hydroInfo.GetAllParters(); + _parter = allParterList.Find(x => x.ID == parter.ID); + await this.xhsProjectSimulationBimfaceCtrl1.SetSelectedComponents(new List<string>() { _parter.Code }); + ShowProperty(); + } + + #region Bimface + + //bimface 鍔犺浇瀹屾垚浜嬩欢 + private async void xhsProjectSimulationBimfaceCtrl1_LoadCompletedEvent() + { + if (_hydroInfo == null) + { + return; + } + var elementIds = new List<string>(); + var pumps = _hydroInfo.Pumps?.Where(x => x.LinkStatus == Yw.Hydro.PumpStatus.Open).ToList(); + pumps?.ForEach(x => elementIds.Add(x.Code)); + var valves = _hydroInfo.Valves?.Where(x => x.LinkStatus == Yw.Hydro.ValveStatus.Open).ToList(); + valves?.ForEach(x => elementIds.Add(x.Code)); + await this.xhsProjectSimulationBimfaceCtrl1.SetOpenComponentsColor(elementIds); + } + + //bimface 姘村姏鐐瑰嚮浜嬩欢 + private void xhsProjectSimulationBimfaceCtrl1_HydroClickEvent(Yw.Model.HydroParterInfo obj) + { + if (_hydroInfo == null) + { + return; + } + _parter = obj; + ShowProperty(); + SetBimfaceLinkColor(); + } + + //璁剧疆Bimface杩炴帴棰滆壊 + private async void SetBimfaceLinkColor() + { + if (_hydroInfo == null) + { + return; + } + List<string> elementIds = null; + if (_parter != null) + { + if (_parter is Yw.Model.HydroLinkInfo linker) + { + elementIds = new List<string>() { linker.StartCode, linker.EndCode }; + } + } + await this.xhsProjectSimulationBimfaceCtrl1.SetLinkComponentsColor(elementIds); + } + + #endregion + + #region 鑷姩鍖归厤 + + //鑷姩鍖归厤 + private void barBtnMatching_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + if (_hydroInfo == null) + { + return; + } + this.docPnlHydroCheck.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlHydroCalcu.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlHydroParterList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlUnMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + + var input = AssetsMatchingParasHelper.Create(_hydroInfo); + this.assetsMainChoicePage1.SetBindingData(input); + this.assetsMainChoicePage1.RelaodEvent += (output) => + { + return AssetsMatchingParasHelper.Apply(_hydroInfo, output); + }; + this.docPnlMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; + this.docPnlMatchingList.Height = 350; + } + + + #endregion + + #region 鏈尮閰嶅垪琛� + + //鏈尮閰嶅垪琛� + private void barBtnUnMatchingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + if (_hydroInfo == null) + { + return; + } + this.docPnlHydroCheck.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlHydroCalcu.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlHydroParterList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlUnMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + + this.xhsProjectSimulationUnMatchingListCtrl1.SetBindingData(_hydroInfo); + this.docPnlUnMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; + this.docPnlUnMatchingList.Height = 350; + } + + //鏈尮閰嶅垪琛ㄧ偣鍑讳簨浠� + private async void xhsProjectSimulationUnMatchingListCtrl1_HydroClickEvent(Yw.Model.HydroParterInfo parter) + { + var allParterList = _hydroInfo.GetAllParters(); + _parter = allParterList.Find(x => x.ID == parter.ID); + var elementIds = new List<string>() { _parter.Code }; + await this.xhsProjectSimulationBimfaceCtrl1.ZoomAndSelectComponents(elementIds); + ShowProperty(); + } + + //鏈尮閰嶅垪琛ㄦ煡鐪嬫ā鍨� + private async void xhsProjectSimulationUnMatchingListCtrl1_ViewModelEvent(List<Yw.Model.HydroParterInfo> parters) + { + var codes = parters?.Select(x => x.Code).Distinct().ToList(); + await this.xhsProjectSimulationBimfaceCtrl1.ZoomAndSelectComponents(codes); + _parter = null; + ShowProperty(); + } + + + #endregion + + #region 涓�閿樉闅� + + //鏄鹃殣缂栫爜鍒楄〃 + private List<string> _fastShowHideCodeList = null; + + //瑙﹀彂涓�閿樉闅� + private async void barBtnShowHide_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + if (_hydroInfo == null) + { + return; + } + if (_hydroInfo.Decorators == null || _hydroInfo.Decorators.Count < 1) + { + return; + } + if (_fastShowHideCodeList == null) + { + _fastShowHideCodeList = _hydroInfo.Decorators.Select(x => x.Code).ToList(); + await this.xhsProjectSimulationBimfaceCtrl1.HideComponents(_fastShowHideCodeList); + } + else + { + await this.xhsProjectSimulationBimfaceCtrl1.ShowComponents(_fastShowHideCodeList); + _fastShowHideCodeList = null; + } + } + + #endregion + + #region 姘村姏鏍¢獙 + + //姘村姏楠岃瘉 + private void barBtnHydroCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + if (_hydroInfo == null) + { + return; + } + this.docPnlHydroCheck.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlHydroCalcu.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlHydroParterList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlUnMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + this.docPnlMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; + + var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo); + _checkResult = netWork.Check(); + if (_checkResult.Succeed) + { + TipFormHelper.ShowSucceed("鏍¢獙閫氳繃锛�"); + return; + } + this.xhsProjectSimulationHydroCheckFailedCtrl1.SetBindingData(_checkResult.FailedList); + this.docPnlHydroCheck.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; + this.docPnlHydroCheck.Height = 350; + } + + //姘村姏鏍¢獙鐐瑰嚮 + private async void xhsProjectSimulationHydroCheckFailedCtrl1_HydroClickEvent(string code) { if (_hydroInfo == null) { return; } var allParterList = _hydroInfo.GetAllParters(); - _parter = allParterList.Find(x => x.Code == objectId); + _parter = allParterList.Find(x => x.Code == code); + var elementIds = new List<string>() { _parter.Code }; + await this.xhsProjectSimulationBimfaceCtrl1.ZoomAndSelectComponents(elementIds); ShowProperty(); } + + #endregion + + + + #region 淇濆瓨姘村姏淇℃伅 + + //淇濆瓨 + private async void barBtnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + if (_hydroInfo == null) + { + return; + } + var id = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.Save(_hydroInfo); + if (id < 1) + { + TipFormHelper.ShowError("淇濆瓨澶辫触锛�"); + return; + } + _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(id); + TipFormHelper.ShowSucceed("淇濆瓨鎴愬姛锛�"); + } + + + #endregion + + #region 涓氬姟鏂规硶 //鏄剧ず灞炴�� private void ShowProperty() @@ -192,10 +399,10 @@ } if (_parter == null) { + this.xhsProjectSimulationPropertyCtrl1.SelectParter(null); return; } - var allParterList = _hydroInfo.GetAllParters(); - this.xhsProjectSimulationPropertyCtrl1.SelectParter(_parter, allParterList); + this.xhsProjectSimulationPropertyCtrl1.SelectParter(_parter.Code); if (_calcuResult != null) { if (_calcuResult.Succeed) @@ -233,58 +440,16 @@ } } - #endregion 姘村姏 - #region 鏇村 - //淇濆瓨 - private async void barBtnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) - { - if (_hydroInfo == null) - { - return; - } - var id = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.Save(_hydroInfo); - if (id < 1) - { - TipFormHelper.ShowError("淇濆瓨澶辫触锛�"); - return; - } - _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(id); - TipFormHelper.ShowSucceed("淇濆瓨鎴愬姛锛�"); - } - #endregion 鏇村 - #region 鑷姩鍖归厤 + #endregion - //鑷姩鍖归厤 - private void barBtnAllAutoMatching_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) - { - var dlg = new AssetsAutoMatchingMainDlg(new AssetsAutoMatchingInputViewModel()); - dlg.ShowDialog(); - } - #endregion 鑷姩鍖归厤 - private void BtnPerformChart_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) - { - var dlg = new PerformChart(); - dlg.ShowDialog(); - } - //姘村姏鏍¢獙鐐瑰嚮 - private async void xhsProjectSimulationHydroCheckFailedCtrl1_HydroClickEvent(string obj) - { - if (_hydroInfo == null) - { - return; - } - await this.xhsProjectSimulationBimfaceCtrl1.SetSelectedComponents(new List<string>() { obj }); - var allParterList = _hydroInfo.GetAllParters(); - _parter = allParterList.Find(x => x.Code == obj); - ShowProperty(); - } + } } \ No newline at end of file -- Gitblit v1.9.3