| | |
| | | global 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 |
| | | { |
| | |
| | | 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; |
| | |
| | | .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> |
| | |
| | | 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文件 |
| | |
| | | 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() |
| | |
| | | } |
| | | 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) |
| | |
| | | } |
| | | } |
| | | |
| | | #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(); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |