| | |
| | | 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; |
| | | |
| | | namespace HStation.WinFrmUI |
| | | { |
| | |
| | | InitializeComponent(); |
| | | this.PageTitle.Caption = "水力模拟"; |
| | | this.PageTitle.HeaderSvgImage = this.svgImg32[0]; |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; |
| | | 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; |
| | | } |
| | | |
| | | private HStation.Vmo.XhsProjectVmo _project = 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> |
| | |
| | | await this.xhsProjectSimulationBimfaceCtrl1.SetBindingData(_project, _projectSite); |
| | | } |
| | | |
| | | #region 模型 |
| | | //属性面板获取水力信息事件 |
| | | private Yw.Model.HydroModelInfo xhsProjectSimulationPropertyCtrl1_GetHydroInfoEvent() |
| | | { |
| | | return _hydroInfo; |
| | | } |
| | | |
| | | //一键显隐 |
| | | private async void barBtnShowHide_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | |
| | | } |
| | | } |
| | | |
| | | #endregion 模型 |
| | | |
| | | #region 水力 |
| | | |
| | | //水力验证 |
| | | private void barBtnHydroCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | |
| | | { |
| | | 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); |
| | | _checkResult = netWork.Check(); |
| | | if (_checkResult.Succeed) |
| | |
| | | } |
| | | this.xhsProjectSimulationHydroCheckFailedCtrl1.SetBindingData(_checkResult.FailedList); |
| | | this.docPnlHydroCheck.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlHydroCheck.Height = 350; |
| | | } |
| | | |
| | | //水力计算 |
| | |
| | | { |
| | | 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) |
| | |
| | | TipFormHelper.ShowSucceed("计算成功!"); |
| | | return; |
| | | } |
| | | var dlg = new XhsProjectSimulationHydroCalcuFailedDlg(); |
| | | dlg.SetBindingData(_calcuResult.FailedList); |
| | | dlg.ShowDialog(); |
| | | this.xhsProjectSimulationHydroCalcuFailedCtrl1.SetBindingData(_calcuResult.FailedList); |
| | | this.docPnlHydroCalcu.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlHydroCalcu.Height = 350; |
| | | } |
| | | |
| | | //水力构件列表 |
| | | 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.hydroParterListCtrl1.SetBindingData(_hydroInfo); |
| | | this.docPnlHydroParterList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlHydroParterList.Height = 350; |
| | | } |
| | | |
| | | //导出水力INP文件 |
| | |
| | | var result = netWork.ToInpString(); |
| | | File.WriteAllText(fileName, result); |
| | | TipFormHelper.ShowSucceed("导出成功"); |
| | | } |
| | | |
| | | //未匹配列表 |
| | | 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.docPnlUnMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; |
| | | |
| | | this.xhsProjectSimulationUnMatchingListCtrl1.SetBindingData(_hydroInfo); |
| | | this.docPnlUnMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlUnMatchingList.Height = 350; |
| | | } |
| | | |
| | | //bimface 构件点击 |
| | |
| | | } |
| | | } |
| | | |
| | | #endregion 水力 |
| | | |
| | | #region 更多 |
| | | |
| | | //保存 |
| | | private async void barBtnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | |
| | | return; |
| | | } |
| | | _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(id); |
| | | //this.xhsProjectSimulationPropertyCtrl1.SetMatching(_hydroInfo); |
| | | TipFormHelper.ShowSucceed("保存成功!"); |
| | | } |
| | | |
| | | #endregion 更多 |
| | | |
| | | #region 自动匹配 |
| | | |
| | | //自动匹配 |
| | | private void barBtnAllAutoMatching_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var input = new AssetsAutoMatchingViewModel(); |
| | | input.PumpMatchingModels = _hydroInfo.Pumps?.Select(x => new PumpMatchingViewModel() |
| | | { |
| | | ID = x.ID, |
| | | Code = x.Code, |
| | | Name = x.Name, |
| | | DbID = x.DbId, |
| | | DbLocked = x.DbLocked, |
| | | //ChartDbID=_hydroInfo.Curves?.Find(t=>t.Code==x.CurveQH)?.DbId,这里不是long CurveDbId |
| | | ModelType = x.ModelType, |
| | | RatedP = x.RatedP, |
| | | RatedH = x.RatedH, |
| | | RatedN = x.RatedN, |
| | | RatedQ = x.RatedQ, |
| | | }).ToList(); |
| | | input.ElbowsMatchingModels = _hydroInfo.Elbows?.Select(x => new ElbowsMatchingViewModel() |
| | | { |
| | | ID = x.ID, |
| | | Name = x.Name, |
| | | Code = x.Code, |
| | | // Dbid=x.DbId,这里是string DbId |
| | | DbLocked = x.DbLocked, |
| | | ModelType = x.ModelType, |
| | | // Caliber = x.Caliber, |
| | | Material = x.Material |
| | | }).ToList(); |
| | | input.ThreeLinkMatchingModels = _hydroInfo.Threelinks?.Select(x => new ThreeLinkMatchingViewModel() |
| | | { |
| | | ID = x.ID, |
| | | Name = x.Name, |
| | | Code = x.Code, |
| | | // Dbid=x.DbId,这里是string DbId |
| | | DbLocked = x.DbLocked, |
| | | ModelType = x.ModelType, |
| | | // Caliber = x.Caliber, |
| | | Material = x.Material |
| | | }).ToList(); |
| | | input.FourLinkMatchingModels = _hydroInfo.Fourlinks?.Select(x => new FourLinkMatchingViewModel() |
| | | { |
| | | ID = x.ID, |
| | | Name = x.Name, |
| | | Code = x.Code, |
| | | // Dbid=x.DbId,这里是string DbId |
| | | DbLocked = x.DbLocked, |
| | | ModelType = x.ModelType, |
| | | // Caliber = x.Caliber, |
| | | Material = x.Material |
| | | }).ToList(); |
| | | input.PipeLineMatchingModels = _hydroInfo.Pipes?.Select(x => new PipeLineMatchingViewModel() |
| | | { |
| | | ID = x.ID, |
| | | Name = x.Name, |
| | | Code = x.Code, |
| | | // Dbid=x.DbId,这里是string DbId |
| | | DbLocked = x.DbLocked, |
| | | ModelType = x.ModelType, |
| | | //Caliber = x.Diameter,//这里是数值 |
| | | Material = x.Material |
| | | }).ToList(); |
| | | |
| | | input.ValveMatchingModels = _hydroInfo.Pipes?.Select(x => new ValveMatchingViewModel() |
| | | { |
| | | ID = x.ID, |
| | | Name = x.Name, |
| | | Code = x.Code, |
| | | // Dbid=x.DbId,这里是string DbId |
| | | DbLocked = x.DbLocked, |
| | | ModelType = x.ModelType, |
| | | Caliber = x.Diameter.ToString(),//这里是数值 |
| | | Material = x.Material//怎么没有阀门类型 |
| | | }).ToList(); |
| | | |
| | | //既然入参和出参已经保持一致了,就不能叫做InputViewModel了,有歧义 |
| | | //这里可以先是窗体,调试好,后面改成控件 |
| | | var dlg = new AssetsAutoMatchingMainDlg(); |
| | | dlg.SetBindingData(input); |
| | | dlg.RelaodEvent += (rhs) => |
| | | { |
| | | return false; |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | #endregion 自动匹配 |
| | | |
| | | private void BtnPerformChart_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | |
| | | ShowProperty(); |
| | | } |
| | | |
| | | //水力构件明细面板点击事件 |
| | | 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(); |
| | | } |
| | | |
| | | |
| | | //未匹配列表点击事件 |
| | | private async void xhsProjectSimulationUnMatchingListCtrl1_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(); |
| | | } |
| | | |
| | | //未匹配列表查看模型 |
| | | private async void xhsProjectSimulationUnMatchingListCtrl1_ViewModelEvent(List<Yw.Model.HydroParterInfo> parters) |
| | | { |
| | | var codes = parters?.Select(x => x.Code).Distinct().ToList(); |
| | | await this.xhsProjectSimulationBimfaceCtrl1.AddSelectedComponents(codes); |
| | | _parter = null; |
| | | ShowProperty(); |
| | | } |
| | | |
| | | } |
| | | } |