| | |
| | | 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; |
| | | using DevExpress.Mvvm.Native; |
| | | using HStation.WinFrmUI.PhartRelation; |
| | | using Yw.WinFrmUI.Bimface; |
| | | using Yw.WinFrmUI.Hydro; |
| | | |
| | | namespace HStation.WinFrmUI |
| | | { |
| | |
| | | InitializeComponent(); |
| | | this.PageTitle.Caption = "水力模拟"; |
| | | 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.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; |
| | | this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; |
| | | } |
| | | |
| | | private HStation.Vmo.XhsProjectVmo _project = null;//项目 |
| | |
| | | private Yw.Model.HydroModelInfo _hydroInfo = null;//水力信息 |
| | | |
| | | private Yw.Model.HydroParterInfo _parter = null; |
| | | private Yw.EPAnet.CheckResult _checkResult = null; |
| | | private Yw.WinFrmUI.HydroCheckResult _checkResult = null; |
| | | private Yw.EPAnet.CalcuResult _calcuResult = null; |
| | | |
| | | /// <summary> |
| | |
| | | return; |
| | | } |
| | | this.PageTitle.Caption = $"{_project.Name}\r\n水力模拟"; |
| | | await this.xhsProjectSimulationBimfaceCtrl1.SetBindingData(_project, _projectSite, () => _hydroInfo); |
| | | this.xhsProjectSimulationQ3dCtrl1.SetBindingData(_hydroInfo); |
| | | this.xhsProjectSimulationL3dCtrl1.SetBindingData(_hydroInfo); |
| | | this.xhsProjectSimulationPropertyCtrl1.SetBindingData(() => _hydroInfo); |
| | | var bimfaceCtrl = GetBimfaceCtrl(); |
| | | this.tabPageBimface.Controls.Clear(); |
| | | this.tabPageBimface.Controls.Add(bimfaceCtrl); |
| | | await bimfaceCtrl.InitialData(_project, _projectSite, () => _hydroInfo); |
| | | var q3dCtrl = GetQ3dCtrl(); |
| | | this.tabPageQ3d.Controls.Clear(); |
| | | this.tabPageQ3d.Controls.Add(q3dCtrl); |
| | | q3dCtrl.InitialData(() => _hydroInfo); |
| | | ShowPropertyCtrl(); |
| | | |
| | | } |
| | | |
| | | #region Bimface |
| | | |
| | | //获取 bimface 控件 |
| | | private XhsProjectSimulationBimfaceCtrl GetBimfaceCtrl() |
| | | { |
| | | if (_bimfaceCtrl == null) |
| | | { |
| | | _bimfaceCtrl = new XhsProjectSimulationBimfaceCtrl(); |
| | | _bimfaceCtrl.Dock = DockStyle.Fill; |
| | | _bimfaceCtrl.LoadCompletedEvent += async () => |
| | | {//view加载完成事件 |
| | | 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 _bimfaceCtrl?.SetOpenComponentsColor(elementIds); |
| | | }; |
| | | _bimfaceCtrl.HydroMouseLeftClickEvent += (obj) => |
| | | {//鼠标左键点击事件 |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | _parter = obj; |
| | | ShowProperty(); |
| | | SetBimfaceLinkColor(); |
| | | }; |
| | | } |
| | | return _bimfaceCtrl; |
| | | } |
| | | |
| | | //bimface控件 |
| | | private XhsProjectSimulationBimfaceCtrl _bimfaceCtrl = null; |
| | | |
| | | //设置Bimface连接颜色 |
| | | private async void SetBimfaceLinkColor() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_parter != null) |
| | | { |
| | | if (_parter is Yw.Model.HydroLinkInfo link) |
| | | { |
| | | await _bimfaceCtrl?.RestoreLinkComponentsColor(); |
| | | |
| | | var allVisualList = _hydroInfo.GetAllVisuals(); |
| | | var allLinkList = _hydroInfo.GetAllLinks(); |
| | | var startParter = allVisualList?.Find(x => x.Code == link.StartCode); |
| | | if (startParter != null) |
| | | { |
| | | var startElementIds = new List<string>(); |
| | | if (startParter.GetType() == typeof(Yw.Model.HydroJunctionInfo)) |
| | | { |
| | | var startLinkList = allLinkList?.Where(x => x.StartCode == startParter.Code || x.EndCode == startParter.Code && x.Code != _parter.Code).ToList(); |
| | | if (startLinkList != null && startLinkList.Count > 0) |
| | | { |
| | | startElementIds.AddRange(startLinkList.Select(x => x.Code)); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | startElementIds.Add(startParter.Code); |
| | | } |
| | | if (startElementIds.Count > 0) |
| | | { |
| | | await _bimfaceCtrl?.SetLinkStartComponentsColor(startElementIds); |
| | | } |
| | | } |
| | | var endParter = allVisualList?.Find(x => x.Code == link.EndCode); |
| | | if (endParter != null) |
| | | { |
| | | var endElementIds = new List<string>(); |
| | | if (endParter.GetType() == typeof(Yw.Model.HydroJunctionInfo)) |
| | | { |
| | | var endLinkList = allLinkList?.Where(x => x.StartCode == endParter.Code || x.EndCode == endParter.Code && x.Code != _parter.Code).ToList(); |
| | | if (endLinkList != null && endLinkList.Count > 0) |
| | | { |
| | | endElementIds.AddRange(endLinkList.Select(x => x.Code)); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | endElementIds.Add(endParter.Code); |
| | | } |
| | | if (endElementIds.Count > 0) |
| | | { |
| | | await _bimfaceCtrl?.SetLinkEndComponentsColor(endElementIds); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Q3d |
| | | |
| | | //获取Q3d控件 |
| | | private XhsProjectSimulationQ3dCtrl GetQ3dCtrl() |
| | | { |
| | | if (_q3dCtrl == null) |
| | | { |
| | | _q3dCtrl = new XhsProjectSimulationQ3dCtrl(); |
| | | _q3dCtrl.Dock = DockStyle.Fill; |
| | | _q3dCtrl.SelectedPartersChangedEvent += (obj) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _parter = allParterList?.Find(x => x.Code == obj?.FirstOrDefault()); |
| | | ShowProperty(); |
| | | }; |
| | | } |
| | | return _q3dCtrl; |
| | | } |
| | | |
| | | //Q3d控件 |
| | | private XhsProjectSimulationQ3dCtrl _q3dCtrl = null; |
| | | |
| | | #endregion Q3d |
| | | |
| | | #region 属性面板 |
| | | |
| | | //属性控件 |
| | | private XhsProjectSimulationPropertyCtrl _propertyCtrl = null; |
| | | |
| | | //获取属性控件 |
| | | private XhsProjectSimulationPropertyCtrl GetPropertyCtrl() |
| | | { |
| | | if (_propertyCtrl == null) |
| | | { |
| | | _propertyCtrl = new XhsProjectSimulationPropertyCtrl(); |
| | | _propertyCtrl.Dock = DockStyle.Fill; |
| | | _propertyCtrl.InitialData(() => _hydroInfo, () => GetAllCalcuResult()); |
| | | _propertyCtrl.BlinkLinkParterEvent += async (code, linkCode) => |
| | | { //强调连接组件 |
| | | if (string.IsNullOrEmpty(code)) |
| | | { |
| | | return; |
| | | } |
| | | if (string.IsNullOrEmpty(linkCode)) |
| | | { |
| | | return; |
| | | } |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualList = _hydroInfo.GetAllVisuals(); |
| | | if (allVisualList == null || allVisualList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var linkParter = allVisualList.Find(x => x.Code == linkCode); |
| | | if (linkParter == null) |
| | | { |
| | | return; |
| | | } |
| | | var blinkCodes = new List<string>(); |
| | | if (linkParter.GetType() == typeof(Yw.Model.HydroJunctionInfo)) |
| | | { |
| | | var allLinkList = _hydroInfo.GetAllLinks(); |
| | | if (allLinkList == null || allLinkList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var linkList = allLinkList.Where(x => (x.StartCode == linkParter.Code || x.EndCode == linkParter.Code) && x.Code != code).ToList(); |
| | | if (linkList == null || linkList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | blinkCodes.AddRange(linkList.Select(x => x.Code)); |
| | | } |
| | | else |
| | | { |
| | | blinkCodes.Add(linkCode); |
| | | } |
| | | |
| | | await _bimfaceCtrl?.SetBlinkComponents(blinkCodes); |
| | | await Task.Delay(5000); |
| | | await _bimfaceCtrl?.ClearBlinkComponents(); |
| | | }; |
| | | } |
| | | return _propertyCtrl; |
| | | } |
| | | |
| | | //显示属性面板 |
| | | private void ShowPropertyCtrl() |
| | | { |
| | | var propertyCtrl = GetPropertyCtrl(); |
| | | this.controlContainerRight.Controls.Clear(); |
| | | this.controlContainerRight.Controls.Add(propertyCtrl); |
| | | this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlRight.Text = "属性"; |
| | | this.docPnlRight.Width = 300; |
| | | } |
| | | |
| | | //属性面板按钮 |
| | | private void barBtnProperty_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowPropertyCtrl(); |
| | | } |
| | | |
| | | //显示属性 |
| | | private void ShowProperty() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (this.docPnlRight.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Hidden) |
| | | { |
| | | ShowPropertyCtrl(); |
| | | } |
| | | |
| | | if (_parter == null) |
| | | { |
| | | _propertyCtrl?.SelectParter(null); |
| | | return; |
| | | } |
| | | |
| | | _propertyCtrl?.SelectParter(_parter.Code); |
| | | if (_calcuResult != null) |
| | | { |
| | | if (_calcuResult.Succeed) |
| | | { |
| | | var allCalcuParterList = _calcuResult.GetParterList(); |
| | | var calcuParter = allCalcuParterList.Find(x => x.Id == _parter.Code); |
| | | if (calcuParter != null) |
| | | { |
| | | IHydroCalcuResult calcuProperty = null; |
| | | if (calcuParter is Yw.EPAnet.CalcuNode calcuNode) |
| | | { |
| | | var calcuNodeProperty = new Yw.WinFrmUI.HydroCalcuNodeResult(); |
| | | calcuNodeProperty.Code = _parter.Code; |
| | | calcuNodeProperty.CalcuPress = calcuNode.Press; |
| | | calcuNodeProperty.CalcuDemand = calcuNode.Demand; |
| | | calcuNodeProperty.CalcuHead = calcuNode.Head; |
| | | calcuProperty = calcuNodeProperty; |
| | | } |
| | | else if (calcuParter is Yw.EPAnet.CalcuLink calcuLink) |
| | | { |
| | | var calcuLinkProperty = new Yw.WinFrmUI.HydroCalcuLinkResult(); |
| | | calcuLinkProperty.Code = _parter.Code; |
| | | calcuLinkProperty.CalcuHeadLoss = calcuLink.Headloss; |
| | | calcuLinkProperty.CalcuFlow = calcuLink.Flow; |
| | | calcuLinkProperty.CalcuVelocity = calcuLink.Velocity; |
| | | calcuProperty = calcuLinkProperty; |
| | | } |
| | | |
| | | if (calcuProperty != null) |
| | | { |
| | | _propertyCtrl?.UpdateCalcuProperty(calcuProperty); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 自动匹配 |
| | | |
| | | //获取匹配列表控件 |
| | | private XhsProjectSimulationMatchingListCtrl GetMatchingListCtrl() |
| | | { |
| | | if (_matchingListCtrl == null) |
| | | { |
| | | _matchingListCtrl = new XhsProjectSimulationMatchingListCtrl(); |
| | | _matchingListCtrl.Dock = DockStyle.Fill; |
| | | _matchingListCtrl.HydroClickEvent += async (code) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _parter = allParterList?.Find(x => x.Code == code); |
| | | var elementIds = new List<string>(); |
| | | if (_parter != null) |
| | | { |
| | | elementIds.Add(_parter.Code); |
| | | } |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowProperty(); |
| | | SetBimfaceLinkColor(); |
| | | }; |
| | | _matchingListCtrl.ApplyMatchingEvent += (output) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return false; |
| | | } |
| | | return AssetsMatchingParasHelper.Apply(_hydroInfo, output); |
| | | }; |
| | | } |
| | | return _matchingListCtrl; |
| | | } |
| | | |
| | | //匹配列表控件 |
| | | private XhsProjectSimulationMatchingListCtrl _matchingListCtrl = null; |
| | | |
| | | //自动匹配 |
| | | private void barBtnMatchingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | var matchingListCtrl = GetMatchingListCtrl(); |
| | | var input = AssetsMatchingParasHelper.Create(_hydroInfo, GetAllCalcuResult()); |
| | | matchingListCtrl.SetBindingData(input); |
| | | this.controlContainerBottom.Controls.Add(matchingListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "匹配列表"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | |
| | | #endregion 自动匹配 |
| | | |
| | | #region 未匹配列表 |
| | | |
| | | //获取未匹配列表控件 |
| | | private XhsProjectSimulationUnMatchingListCtrl GetUnMatchingListCtrl() |
| | | { |
| | | if (_unMatchingListCtrl == null) |
| | | { |
| | | _unMatchingListCtrl = new XhsProjectSimulationUnMatchingListCtrl(); |
| | | _unMatchingListCtrl.Dock = DockStyle.Fill; |
| | | _unMatchingListCtrl.HydroClickEvent += async (parter) =>//行点击 |
| | | { |
| | | if (parter == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _parter = allParterList?.Find(x => x.Code == parter.Code); |
| | | var elementIds = new List<string>() { parter.Code }; |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowProperty(); |
| | | SetBimfaceLinkColor(); |
| | | }; |
| | | _unMatchingListCtrl.ViewModelEvent += async (parters) =>//查看模型 |
| | | { |
| | | var codes = parters?.Select(x => x.Code).Distinct().ToList(); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(codes); |
| | | _parter = null; |
| | | ShowProperty(); |
| | | }; |
| | | } |
| | | return _unMatchingListCtrl; |
| | | } |
| | | |
| | | private XhsProjectSimulationUnMatchingListCtrl _unMatchingListCtrl = null;//未匹配列表 |
| | | |
| | | //未匹配列表 |
| | | private void barBtnUnMatchingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | var unMatchingListCtrl = GetUnMatchingListCtrl(); |
| | | unMatchingListCtrl.SetBindingData(_hydroInfo); |
| | | this.controlContainerBottom.Controls.Add(unMatchingListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "未匹配列表"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | |
| | | #endregion 未匹配列表 |
| | | |
| | | #region 一键显隐 |
| | | |
| | | //一键显隐 |
| | | private async Task FastShowHidden() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_hydroInfo.Decorators == null || _hydroInfo.Decorators.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | if (_fastShowHiddenCodeList == null) |
| | | { |
| | | _fastShowHiddenCodeList = _hydroInfo.Decorators.Select(x => x.Code).ToList(); |
| | | await _bimfaceCtrl?.HideComponents(_fastShowHiddenCodeList); |
| | | } |
| | | else |
| | | { |
| | | await _bimfaceCtrl?.ShowComponents(_fastShowHiddenCodeList); |
| | | _fastShowHiddenCodeList = null; |
| | | } |
| | | } |
| | | |
| | | //显隐编码列表 |
| | | private List<string> _fastShowHiddenCodeList = null; |
| | | |
| | | //触发一键显隐 |
| | | private async void barBtnFastShowHidden_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | await FastShowHidden(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 水力校验 |
| | | |
| | | //校验控件 |
| | | private XhsProjectSimulationHydroCheckResultCtrl _checkCtrl = null; |
| | | |
| | | //获取校验控件 |
| | | private XhsProjectSimulationHydroCheckResultCtrl GetCheckCtrl() |
| | | { |
| | | if (_checkCtrl == null) |
| | | { |
| | | _checkCtrl = new XhsProjectSimulationHydroCheckResultCtrl(); |
| | | _checkCtrl.Dock = DockStyle.Fill; |
| | | _checkCtrl.HydroClickEvent += async (code) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var elementIds = new List<string>(); |
| | | if (string.IsNullOrEmpty(code)) |
| | | { |
| | | _parter = null; |
| | | } |
| | | else |
| | | { |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _parter = allParterList?.Find(x => x.Code == code); |
| | | if (_parter != null) |
| | | { |
| | | elementIds.Add(_parter.Code); |
| | | } |
| | | } |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowProperty(); |
| | | SetBimfaceLinkColor(); |
| | | }; |
| | | } |
| | | return _checkCtrl; |
| | | } |
| | | |
| | | //显示校验控件 |
| | | private void ShowCheckCtrl() |
| | | { |
| | | if (_checkResult == null) |
| | | { |
| | | return; |
| | | } |
| | | var checkCtrl = GetCheckCtrl(); |
| | | checkCtrl.SetBindingData(_checkResult); |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(checkCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "校验结果"; |
| | | this.docPnlBottom.Height = 350; |
| | | |
| | | } |
| | | |
| | | //水力验证 |
| | | private void barBtnHydroCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | _checkResult = _hydroInfo.Check(); |
| | | ShowCheckCtrl(); |
| | | } |
| | | |
| | | #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 Yw.WinFrmUI.HydroParterListCtrl _parterListCtrl = null; |
| | | |
| | | //获取构件明细控件 |
| | | private Yw.WinFrmUI.HydroParterListCtrl GetParterListCtrl() |
| | | { |
| | | if (_parterListCtrl == null) |
| | | { |
| | | _parterListCtrl = new HydroParterListCtrl(); |
| | | _parterListCtrl.Dock = DockStyle.Fill; |
| | | _parterListCtrl.HydroClickEvent += async (parter) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _parter = allParterList?.Find(x => x.Code == parter.Code); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(new List<string>() { _parter.Code }); |
| | | ShowProperty(); |
| | | SetBimfaceLinkColor(); |
| | | }; |
| | | } |
| | | return _parterListCtrl; |
| | | } |
| | | |
| | | //显示构件明细控件 |
| | | private void ShowParterListCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var parterListCtrl = GetParterListCtrl(); |
| | | parterListCtrl.SetBindingData(_hydroInfo, GetAllCalcuResult()); |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(parterListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "构件明细"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | |
| | | //构件明细 |
| | | private void barBtnHydroParterList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowParterListCtrl(); |
| | | } |
| | | |
| | | #endregion 构件明细 |
| | | |
| | | #region INP导出 |
| | | |
| | |
| | | TipFormHelper.ShowSucceed("导出成功"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #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 Bimface |
| | | |
| | | #region 属性面板 |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region 自动匹配 |
| | | |
| | | //自动匹配 |
| | | private void barBtnMatchingList_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.xhsProjectSimulationMatchingListCtrl1.SetBindingData(input); |
| | | this.docPnlMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlMatchingList.Height = 350; |
| | | } |
| | | |
| | | //水力信息点击 |
| | | private async void xhsProjectSimulationMatchingListCtrl1_HydroClickEvent(string code) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _parter = allParterList.Find(x => x.Code == code); |
| | | var elementIds = new List<string>() { _parter.Code }; |
| | | await this.xhsProjectSimulationBimfaceCtrl1.ZoomAndSelectComponents(elementIds); |
| | | ShowProperty(); |
| | | SetBimfaceLinkColor(); |
| | | } |
| | | |
| | | //应用匹配事件 |
| | | private bool xhsProjectSimulationMatchingListCtrl1_ApplyMatchingEvent(AssetsMatchingViewModel output) |
| | | { |
| | | return AssetsMatchingParasHelper.Apply(_hydroInfo, output); |
| | | } |
| | | |
| | | #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(); |
| | | SetBimfaceLinkColor(); |
| | | } |
| | | |
| | | //未匹配列表查看模型 |
| | | 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 == code); |
| | | var elementIds = new List<string>() { _parter.Code }; |
| | | await this.xhsProjectSimulationBimfaceCtrl1.ZoomAndSelectComponents(elementIds); |
| | | ShowProperty(); |
| | | SetBimfaceLinkColor(); |
| | | } |
| | | |
| | | #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 barBtnHydroParterList_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; |
| | | |
| | | this.hydroParterListCtrl1.SetBindingData(_hydroInfo); |
| | | this.docPnlHydroParterList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlHydroParterList.Height = 350; |
| | | } |
| | | |
| | | //水力构件明细面板点击事件 |
| | | private async void hydroParterListCtrl1_HydroClickEvent(Yw.Model.HydroParterInfo parter) |
| | | { |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _parter = allParterList.Find(x => x.ID == parter.ID); |
| | | await this.xhsProjectSimulationBimfaceCtrl1.ZoomAndSelectComponents(new List<string>() { _parter.Code }); |
| | | ShowProperty(); |
| | | SetBimfaceLinkColor(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 业务方法 |
| | | |
| | | //显示属性 |
| | | private void ShowProperty() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_parter == null) |
| | | { |
| | | this.xhsProjectSimulationPropertyCtrl1.SelectParter(null); |
| | | return; |
| | | } |
| | | this.xhsProjectSimulationPropertyCtrl1.SelectParter(_parter.Code); |
| | | if (_calcuResult != null) |
| | | { |
| | | if (_calcuResult.Succeed) |
| | | { |
| | | var allCalcuParterList = _calcuResult.GetParterList(); |
| | | var calcuParter = allCalcuParterList.Find(x => x.Id == _parter.Code); |
| | | if (calcuParter != null) |
| | | { |
| | | IHydroCalcuProperty calcuProperty = null; |
| | | if (calcuParter is Yw.EPAnet.CalcuNode calcuNode) |
| | | { |
| | | var calcuNodeProperty = new Yw.WinFrmUI.HydroCalcuNodeProperty(); |
| | | calcuNodeProperty.ID = _parter.ID; |
| | | calcuNodeProperty.CalcuPress = calcuNode.Press; |
| | | calcuNodeProperty.CalcuDemand = calcuNode.Demand; |
| | | calcuNodeProperty.CalcuHead = calcuNode.Head; |
| | | calcuProperty = calcuNodeProperty; |
| | | } |
| | | else if (calcuParter is Yw.EPAnet.CalcuLink calcuLink) |
| | | { |
| | | var calcuLinkProperty = new Yw.WinFrmUI.HydroCalcuLinkProperty(); |
| | | calcuLinkProperty.ID = _parter.ID; |
| | | calcuLinkProperty.CalcuHeadLoss = calcuLink.Headloss; |
| | | calcuLinkProperty.CalcuFlow = calcuLink.Flow; |
| | | calcuLinkProperty.CalcuVelocity = calcuLink.Velocity; |
| | | calcuProperty = calcuLinkProperty; |
| | | } |
| | | |
| | | if (calcuProperty != null) |
| | | { |
| | | this.xhsProjectSimulationPropertyCtrl1.UpdateCalcuProperty(calcuProperty); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion 业务方法 |
| | | #endregion INP导出 |
| | | |
| | | #region 配置 |
| | | |
| | |
| | | this.rmSet.ShowPopup(MousePosition, true); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 配置 |
| | | |
| | | #region 性能曲线 |
| | | |
| | | |
| | | //性能曲线 |
| | | private void barBtnFeatCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_calcuResult == null) |
| | | { |
| | | return; |
| | | } |
| | | if (!_calcuResult.Succeed) |
| | | { |
| | | return; |
| | | } |
| | | //if (_calcuResult == null) |
| | | //{ |
| | | // return; |
| | | //} |
| | | //if (!_calcuResult.Succeed) |
| | | //{ |
| | | // return; |
| | | //} |
| | | //var pumps = _hydroInfo.Pumps?.Where(x => x.LinkStatus == Yw.Hydro.LinkStatus.Open).ToList(); |
| | | var pumps = _hydroInfo.Pumps; |
| | | var vmList = pumps.Select(x => new HStation.WinFrmUI.PhartRelation.Perform2dMultiViewModel() |
| | | var curve_list = _hydroInfo.Curves; |
| | | if (curve_list == null || !curve_list.Any()) |
| | | { |
| | | Id = x.Code, |
| | | Name = x.Code, |
| | | SpeedRatio = x.SpeedRatio ?? 1, |
| | | PointsQH = _hydroInfo.Curves?.Find(t => t.Code == x.CurveQH)?.CurveData?.Select(z => new PhartRelation.PerformPoint2dViewModel() { X = z.X, Y = z.Y }).ToList(), |
| | | PointsQP = _hydroInfo.Curves?.Find(t => t.Code == x.CurveQP)?.CurveData?.Select(z => new PhartRelation.PerformPoint2dViewModel() { X = z.X, Y = z.Y }).ToList(), |
| | | PointsQE = _hydroInfo.Curves?.Find(t => t.Code == x.CurveQE)?.CurveData?.Select(z => new PhartRelation.PerformPoint2dViewModel() { X = z.X, Y = z.Y }).ToList(), |
| | | }).ToList(); |
| | | var dlg = new HStation.WinFrmUI.PhartRelation.XtrPerform2dMultiViewDlg(); |
| | | dlg.SetBindingData(vmList, false, true); |
| | | return; |
| | | } |
| | | var vmList = new List<XhsSinglePumpViewModel>(); |
| | | foreach (var x in pumps) |
| | | { |
| | | if (!x.RatedN.HasValue) |
| | | { |
| | | continue; |
| | | } |
| | | var qh = curve_list.Find(t => t.Code == x.CurveQH)?.CurveData; |
| | | var qe = curve_list.Find(t => t.Code == x.CurveQE)?.CurveData; |
| | | var qp = curve_list.Find(t => t.Code == x.CurveQP)?.CurveData; |
| | | |
| | | if (qh == null) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | var rated_speed = x.RatedN.Value; |
| | | var speed_ratio = x.SpeedRatio; |
| | | |
| | | var qh_pt_list = qh.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); |
| | | var qe_pt_list = qe?.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); |
| | | var qp_pt_list = qp?.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); |
| | | |
| | | var vm = new XhsSinglePumpViewModel(); |
| | | vm.ID = x.ID; |
| | | vm.Name = x.Name; |
| | | vm.ID = x.ID; |
| | | vm.Name = x.Name; |
| | | vm.Code = x.Code; |
| | | //vm.IsBp = x.IsBp; |
| | | vm.RunStatus = x.LinkStatus == Yw.Hydro.LinkStatus.Open; |
| | | vm.RatedHz = x.RatedHz; |
| | | vm.CurrentHz = x.RatedHz; |
| | | vm.RatedSpeed = rated_speed; |
| | | vm.CurrentSpeed = rated_speed; |
| | | vm.CurveQH = qh_pt_list; |
| | | vm.CurveQE = qe_pt_list; |
| | | vm.CurveQP = qp_pt_list; |
| | | //vm.CalcuQ = x.c; |
| | | //vm.CalcuH = x.CalcuH; |
| | | |
| | | vmList.Add(vm); |
| | | } |
| | | |
| | | var dlg = new HStation.WinFrmUI.PhartRelation.PumpParallelChartDlg(); |
| | | dlg.SetBindingData(vmList); |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | |
| | | |
| | | #region 水力计算 |
| | | |
| | | //计算控件 |
| | | private SetHydroCalcuPrefixCtrl _calcuCtrl = null; |
| | | |
| | | //获取计算控件 |
| | | private SetHydroCalcuPrefixCtrl GetCalcuCtrl() |
| | | { |
| | | if (_calcuCtrl == null) |
| | | { |
| | | _calcuCtrl = new SetHydroCalcuPrefixCtrl(); |
| | | _calcuCtrl.Dock = DockStyle.Fill; |
| | | _calcuCtrl.InitialData(() => _hydroInfo); |
| | | _calcuCtrl.HydroViewEvent += async (parter) => |
| | | {//水力查看事件 |
| | | if (parter == null) |
| | | { |
| | | return; |
| | | } |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(new List<string>() { parter.Code }); |
| | | }; |
| | | _calcuCtrl.HydroCalcuEvent += async () => |
| | | {//水力计算事件 |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | //校验 |
| | | _checkResult = _hydroInfo.Check(); |
| | | if (!_checkResult.Succeed) |
| | | { |
| | | ShowCheckCtrl(); |
| | | TipFormHelper.ShowWarn("校验失败,请检查后重试"); |
| | | return; |
| | | } |
| | | |
| | | var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo); |
| | | _calcuResult = netWork.Calcu(); |
| | | if (_calcuResult.Succeed) |
| | | { |
| | | this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; |
| | | await _bimfaceCtrl?.SetLogicCalcuCustomLabels(_calcuResult); |
| | | TipFormHelper.ShowSucceed("计算成功!"); |
| | | } |
| | | else |
| | | { |
| | | _calcuCtrl.SetFailedList(_calcuResult.FailedList); |
| | | this.docPnlRight.Text = "失败原因"; |
| | | this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | TipFormHelper.ShowError("计算失败"); |
| | | } |
| | | }; |
| | | } |
| | | return _calcuCtrl; |
| | | } |
| | | |
| | | //获取计算结果 |
| | | private List<IHydroCalcuResult> GetAllCalcuResult() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_calcuResult == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (!_calcuResult.Succeed) |
| | | { |
| | | return default; |
| | | } |
| | | var list = new List<IHydroCalcuResult>(); |
| | | |
| | | var allNodeList = _hydroInfo.GetAllNodes(); |
| | | if (allNodeList != null && allNodeList.Count > 0) |
| | | { |
| | | var allCalcuNodeList = _calcuResult.NodeList; |
| | | if (allCalcuNodeList != null && allCalcuNodeList.Count > 0) |
| | | { |
| | | foreach (var node in allNodeList) |
| | | { |
| | | var calcuNode = allCalcuNodeList.Find(x => x.Id == node.Code); |
| | | if (calcuNode != null) |
| | | { |
| | | var calcuResult = new HydroCalcuNodeResult() |
| | | { |
| | | Code = node.Code, |
| | | CalcuPress = calcuNode.Press, |
| | | CalcuHead = calcuNode.Head, |
| | | CalcuDemand = calcuNode.Demand |
| | | }; |
| | | list.Add(calcuResult); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | var allListList = _hydroInfo.GetAllLinks(); |
| | | if (allListList != null && allListList.Count > 0) |
| | | { |
| | | var allCalcuLinkList = _calcuResult.LinkList; |
| | | if (allCalcuLinkList != null && allCalcuLinkList.Count > 0) |
| | | { |
| | | foreach (var link in allListList) |
| | | { |
| | | var calcuLink = allCalcuLinkList.Find(x => x.Id == link.Code); |
| | | if (calcuLink != null) |
| | | { |
| | | var calcuResult = new HydroCalcuLinkResult() |
| | | { |
| | | Code = link.Code, |
| | | CalcuFlow = calcuLink.Flow, |
| | | CalcuVelocity = calcuLink.Velocity, |
| | | CalcuHeadLoss = calcuLink.Headloss |
| | | }; |
| | | list.Add(calcuResult); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | //水力计算 |
| | | private async void barBtnHydroCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | private 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; |
| | | this.docPnlMatchingList.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; |
| | | |
| | | var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo); |
| | | _calcuResult = netWork.Calcu(); |
| | | if (_calcuResult.Succeed) |
| | | { |
| | | ShowProperty(); |
| | | TipFormHelper.ShowSucceed("计算成功!"); |
| | | } |
| | | else |
| | | { |
| | | this.xhsProjectSimulationHydroCalcuFailedCtrl1.SetBindingData(_calcuResult.FailedList); |
| | | this.docPnlHydroCalcu.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlHydroCalcu.Height = 350; |
| | | } |
| | | await this.xhsProjectSimulationBimfaceCtrl1.ShowCalcuCustomLabels(_calcuResult); |
| | | var calcuPrefixCtrl = GetCalcuCtrl(); |
| | | calcuPrefixCtrl.SetBindingData(); |
| | | this.controlContainerRight.Controls.Clear(); |
| | | this.controlContainerRight.Controls.Add(calcuPrefixCtrl); |
| | | this.docPnlRight.Text = "前提条件"; |
| | | this.docPnlRight.Width = SetHydroCalcuPrefixCtrl.ControlMinWidth; |
| | | this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 构件查询 |
| | | |
| | | //查询组件 |
| | | private XhsProjectSimulationSearchCtrl _searchCtrl = null; |
| | | |
| | | //获取查询组件 |
| | | private XhsProjectSimulationSearchCtrl GetSearchCtrl() |
| | | { |
| | | if (_searchCtrl == null) |
| | | { |
| | | _searchCtrl = new XhsProjectSimulationSearchCtrl(); |
| | | _searchCtrl.Dock = DockStyle.Fill; |
| | | _searchCtrl.InitialData(() => _hydroInfo); |
| | | _searchCtrl.ApplySearchEvent += async (list) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var elementIds = new List<string>(); |
| | | if (list != null && list.Count > 0) |
| | | { |
| | | var first = list.First(); |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _parter = allParterList?.Find(x => x.Code == first.Code); |
| | | list.ForEach(x => elementIds.Add(x.Code)); |
| | | } |
| | | else |
| | | { |
| | | _parter = null; |
| | | } |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowProperty(); |
| | | SetBimfaceLinkColor(); |
| | | }; |
| | | } |
| | | return _searchCtrl; |
| | | } |
| | | |
| | | //显示查询控件 |
| | | private void ShowSearchCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var searchCtrl = GetSearchCtrl(); |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(searchCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "构件查询"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | |
| | | //查询 |
| | | private void barBtnSearch_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowSearchCtrl(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 模型标注 |
| | | |
| | | //所有标注列表 |
| | | private List<HydroMarkSetViewModel> _allMarkList = null; |
| | | |
| | | //显示标注窗体 |
| | | private async void ShowMarkDlg() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_allMarkList == null) |
| | | { |
| | | _allMarkList = new List<HydroMarkSetViewModel>(); |
| | | if (_hydroInfo.Waterboxs != null && _hydroInfo.Waterboxs.Count > 0) |
| | | { |
| | | _allMarkList.Add(new HydroMarkSetViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Waterbox, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Waterbox), |
| | | MarkType = (int)eWaterboxMarkType.None |
| | | }); |
| | | } |
| | | if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0) |
| | | { |
| | | _allMarkList.Add(new HydroMarkSetViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Pump, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pump), |
| | | MarkType = (int)eWaterboxMarkType.None |
| | | }); |
| | | } |
| | | if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0) |
| | | { |
| | | _allMarkList.Add(new HydroMarkSetViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Valve, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Valve), |
| | | MarkType = (int)eWaterboxMarkType.None |
| | | }); |
| | | } |
| | | if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) |
| | | { |
| | | _allMarkList.Add(new HydroMarkSetViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Pipe, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pipe), |
| | | MarkType = (int)eWaterboxMarkType.None |
| | | }); |
| | | } |
| | | if (_hydroInfo.Nozzles != null && _hydroInfo.Nozzles.Count > 0) |
| | | { |
| | | _allMarkList.Add(new HydroMarkSetViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Nozzle, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Nozzle), |
| | | MarkType = (int)eWaterboxMarkType.None |
| | | }); |
| | | } |
| | | } |
| | | var dlg = new SetHydroMarkDlg(); |
| | | dlg.InitialData(() => _hydroInfo); |
| | | dlg.SetBindingData(_allMarkList); |
| | | dlg.ReloadDataEvent += async (allResultList) => |
| | | { |
| | | var leadLabels = allResultList?.Select(x => new LogicMarkLeadLabel(x.Code, x.Text)).ToList(); |
| | | await _bimfaceCtrl?.SetLogicMarkLeadLabels(leadLabels); |
| | | }; |
| | | if (dlg.ShowDialog() != DialogResult.OK) |
| | | { |
| | | await _bimfaceCtrl?.ClearLogicMarkLeadLabels(); |
| | | } |
| | | } |
| | | |
| | | //设置标注 |
| | | private void barBtnSetMark_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowMarkDlg(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 颜色分级 |
| | | |
| | | private List<HydroGradingApplyViewModel> _allGradingApplyList = null; |
| | | private List<string> _allGradingCodeList = null; |
| | | |
| | | //设置 |
| | | private void barBtnGradingSet_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new SetHydroGradingModelDlg(); |
| | | dlg.SetBindingData(_hydroInfo.ID); |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //应用 |
| | | private void barBtnGradingApply_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_allGradingApplyList == null) |
| | | { |
| | | _allGradingApplyList = new List<HydroGradingApplyViewModel>(); |
| | | if (_hydroInfo.Waterboxs != null && _hydroInfo.Waterboxs.Count > 0) |
| | | { |
| | | _allGradingApplyList.Add(new HydroGradingApplyViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Waterbox, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Waterbox), |
| | | PropName = string.Empty |
| | | }); |
| | | } |
| | | if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0) |
| | | { |
| | | _allGradingApplyList.Add(new HydroGradingApplyViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Pump, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pump), |
| | | PropName = string.Empty |
| | | }); |
| | | } |
| | | if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0) |
| | | { |
| | | _allGradingApplyList.Add(new HydroGradingApplyViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Valve, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Valve), |
| | | PropName = string.Empty |
| | | }); |
| | | } |
| | | if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) |
| | | { |
| | | _allGradingApplyList.Add(new HydroGradingApplyViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Pipe, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pipe), |
| | | PropName = string.Empty |
| | | }); |
| | | } |
| | | if (_hydroInfo.Nozzles != null && _hydroInfo.Nozzles.Count > 0) |
| | | { |
| | | _allGradingApplyList.Add(new HydroGradingApplyViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Nozzle, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Nozzle), |
| | | PropName = string.Empty |
| | | }); |
| | | } |
| | | } |
| | | var dlg = new ApplyHydroGradingDlg(); |
| | | dlg.SetBindingData(() => _hydroInfo, _allGradingApplyList, GetAllCalcuResult()); |
| | | dlg.ReloadDataEvent += (obj) => |
| | | { |
| | | _allGradingCodeList = obj?.Select(x => x.Code).Distinct().ToList(); |
| | | var objGroupList = obj?.GroupBy(x => x.Color).ToList(); |
| | | objGroupList.ForEach(async x => |
| | | { |
| | | await _bimfaceCtrl?.OverrideComponentsColor(x.Select(t => t.Code).Distinct().ToList(), x.Key, 1); |
| | | }); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //取消 |
| | | private async void barBtnGradingCancel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | await _bimfaceCtrl?.RestoreComponentsColor(_allGradingCodeList); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |