| | |
| | | global using Yw.EPAnet; |
| | | using DevExpress.Mvvm.Native; |
| | | using DevExpress.Xpo.Helpers; |
| | | using DevExpress.XtraRichEdit.Layout; |
| | | using DevExpress.XtraSpreadsheet.Commands; |
| | | using HStation.WinFrmUI.PhartRelation; |
| | | using System.Diagnostics; |
| | | using System.Windows.Media; |
| | | using System.Windows.Media.Media3D; |
| | | using Yw.Pump; |
| | | using Yw.Vmo; |
| | | using Yw.WinFrmUI.Bimface; |
| | | using Yw.WinFrmUI.Hydro; |
| | | |
| | |
| | | this.PageTitle.Caption = "水力模拟"; |
| | | this.PageTitle.HeaderSvgImage = this.svgImg32[0]; |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; |
| | | this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; |
| | | RegistBulkSetEvents(); |
| | | } |
| | | |
| | | private HStation.Vmo.XhsProjectVmo _project = null;//项目 |
| | | private HStation.Vmo.XhsProjectSiteVmo _projectSite = null;//项目站 |
| | | private Yw.Model.HydroModelInfo _hydroInfo = null;//水力信息 |
| | | |
| | | private Yw.Model.HydroParterInfo _parter = null; |
| | | private Yw.WinFrmUI.HydroCheckResult _checkResult = null; |
| | | private Yw.EPAnet.CalcuResult _calcuResult = null; |
| | | |
| | | private Yw.WinFrmUI.HydroCheckResult _checkResult = null;//检查结果 |
| | | private Yw.EPAnet.CalcuResult _calcuResult = null;//计算结果 |
| | | |
| | | |
| | | /// <summary> |
| | | /// 绑定数据 |
| | |
| | | /// <summary> |
| | | /// 初始化数据 |
| | | /// </summary> |
| | | public override async void InitialDataSource() |
| | | public override void InitialDataSource() |
| | | { |
| | | base.InitialDataSource(); |
| | | if (_project == null) |
| | |
| | | return; |
| | | } |
| | | this.PageTitle.Caption = $"{_project.Name}\r\n水力模拟"; |
| | | 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); |
| | | ShowBimfaceCtrl(); |
| | | ShowQ3dCtrl(); |
| | | ShowPropertyCtrl(); |
| | | |
| | | } |
| | | |
| | | |
| | | #region Bimface |
| | | |
| | | //bimface控件 |
| | | private XhsProjectSimulationBimfaceCtrl _bimfaceCtrl = null; |
| | | |
| | | //获取 bimface 控件 |
| | | private XhsProjectSimulationBimfaceCtrl GetBimfaceCtrl() |
| | | private async Task<XhsProjectSimulationBimfaceCtrl> GetBimfaceCtrl() |
| | | { |
| | | if (_bimfaceCtrl == null) |
| | | { |
| | | _bimfaceCtrl = new XhsProjectSimulationBimfaceCtrl(); |
| | | _bimfaceCtrl.Dock = DockStyle.Fill; |
| | | _bimfaceCtrl.LoadCompletedEvent += async () => |
| | | await _bimfaceCtrl.InitialData(_project, _projectSite, () => _hydroInfo); |
| | | _bimfaceCtrl.LoadCompletedEvent += () => |
| | | {//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); |
| | | ApplyGrading(); |
| | | }; |
| | | _bimfaceCtrl.HydroMouseLeftClickEvent += (obj) => |
| | | {//鼠标左键点击事件 |
| | |
| | | { |
| | | return; |
| | | } |
| | | _parter = obj; |
| | | ShowProperty(); |
| | | SetBimfaceLinkColor(); |
| | | _selectedVisual = obj; |
| | | ShowSelectedProperty(); |
| | | }; |
| | | } |
| | | return _bimfaceCtrl; |
| | | } |
| | | |
| | | //bimface控件 |
| | | private XhsProjectSimulationBimfaceCtrl _bimfaceCtrl = null; |
| | | |
| | | //设置Bimface连接颜色 |
| | | private async void SetBimfaceLinkColor() |
| | | //显示 bimface 控件 |
| | | private async void ShowBimfaceCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_parter != null) |
| | | { |
| | | if (_parter is Yw.Model.HydroLinkInfo link) |
| | | { |
| | | await _bimfaceCtrl?.RestoreLinkComponentsColor(); |
| | | var bimfaceCtrl = await GetBimfaceCtrl(); |
| | | this.tabPageBimface.Controls.Clear(); |
| | | this.tabPageBimface.Controls.Add(bimfaceCtrl); |
| | | } |
| | | |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | private void SelectBimfaceParter() |
| | | { |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Q3d |
| | | |
| | | //获取Q3d控件 |
| | | //Q3d 控件 |
| | | private XhsProjectSimulationQ3dCtrl _q3dCtrl = null; |
| | | |
| | | //获取 Q3d 控件 |
| | | private XhsProjectSimulationQ3dCtrl GetQ3dCtrl() |
| | | { |
| | | if (_q3dCtrl == null) |
| | | { |
| | | _q3dCtrl = new XhsProjectSimulationQ3dCtrl(); |
| | | _q3dCtrl.Dock = DockStyle.Fill; |
| | | _q3dCtrl.InitialData(() => _hydroInfo); |
| | | _q3dCtrl.SelectedPartersChangedEvent += (obj) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _parter = allParterList?.Find(x => x.Code == obj?.FirstOrDefault()); |
| | | ShowProperty(); |
| | | var allParterList = _hydroInfo.GetAllVisuals(); |
| | | _selectedVisual = allParterList?.Find(x => x.Code == obj?.FirstOrDefault()); |
| | | ShowSelectedProperty(); |
| | | }; |
| | | } |
| | | return _q3dCtrl; |
| | | } |
| | | |
| | | //Q3d控件 |
| | | private XhsProjectSimulationQ3dCtrl _q3dCtrl = null; |
| | | //显示 Q3d 控件 |
| | | private void ShowQ3dCtrl() |
| | | { |
| | | var q3dCtrl = GetQ3dCtrl(); |
| | | this.tabPageQ3d.Controls.Clear(); |
| | | this.tabPageQ3d.Controls.Add(q3dCtrl); |
| | | } |
| | | |
| | | #endregion Q3d |
| | | #endregion |
| | | |
| | | #region 属性面板 |
| | | #region 属性控件 |
| | | |
| | | //属性控件 |
| | | private XhsProjectSimulationPropertyCtrl _propertyCtrl = null; |
| | |
| | | { |
| | | _propertyCtrl = new XhsProjectSimulationPropertyCtrl(); |
| | | _propertyCtrl.Dock = DockStyle.Fill; |
| | | _propertyCtrl.InitialData(() => _hydroInfo, () => GetAllCalcuResult()); |
| | | _propertyCtrl.InitialData(() => _hydroInfo, () => GetCalcuResultList()); |
| | | _propertyCtrl.BlinkLinkParterEvent += async (code, linkCode) => |
| | | { //强调连接组件 |
| | | if (string.IsNullOrEmpty(code)) |
| | |
| | | await Task.Delay(5000); |
| | | await _bimfaceCtrl?.ClearBlinkComponents(); |
| | | }; |
| | | |
| | | _propertyCtrl.ViewParterEvent += (parter) => |
| | | { |
| | | if (parter == null) |
| | | { |
| | | return; |
| | | } |
| | | _bimfaceCtrl?.ZoomToComponent(parter.Code); |
| | | }; |
| | | _propertyCtrl.PropertyValueChangedEvent += (parter) => |
| | | { |
| | | if (parter == null) |
| | | { |
| | | return; |
| | | } |
| | | UpdateVisualListCtrl(); |
| | | AutoApplyGrading(); |
| | | }; |
| | | _propertyCtrl.MarkPropertyValueChangedEvent += (parter) => |
| | | { |
| | | //标注属性发生改变 |
| | | //判断当前是否有标注展示,若有则更新标注,最好是更新单个标注 |
| | | }; |
| | | _propertyCtrl.GradingPropertyValueChangedEvent += (parter) => |
| | | { |
| | | //分级属性发生改变 |
| | | //判断当前是否有分级展示,若有则更新分级,最好是更新单个分级 |
| | | }; |
| | | _propertyCtrl.FlowDirectionPropertyValueChangedEvent += async (parter) => |
| | | { |
| | | //流向属性发生改变 |
| | | //判断流向是否加载,如果加载则更新流向,最好是更新单个流向 |
| | | UpdateFlowEffect(parter); |
| | | //await _bimfaceCtrl?.UnloadFlowEffectById(parter.Code); |
| | | }; |
| | | |
| | | } |
| | | return _propertyCtrl; |
| | | } |
| | | |
| | | //显示属性面板 |
| | | //属性控件是否可见 |
| | | private bool IsPropertyCtrlVisible |
| | | { |
| | | get |
| | | { |
| | | if (this.docPnlRight.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | if (this.controlContainerRight.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerRight.Controls[0] is XhsProjectSimulationPropertyCtrl) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //显示属性控件 |
| | | private void ShowPropertyCtrl() |
| | | { |
| | | if (IsPropertyCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | | var propertyCtrl = GetPropertyCtrl(); |
| | | this.controlContainerRight.Controls.Clear(); |
| | | this.controlContainerRight.Controls.Add(propertyCtrl); |
| | |
| | | this.docPnlRight.Width = 300; |
| | | } |
| | | |
| | | //属性面板按钮 |
| | | private void barBtnProperty_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //显示选择属性 |
| | | private void ShowSelectedProperty() |
| | | { |
| | | ShowPropertyCtrl(); |
| | | ShowSelectedProperty(_selectedVisual); |
| | | } |
| | | |
| | | //显示属性 |
| | | private void ShowProperty() |
| | | //显示选择属性 |
| | | private void ShowSelectedProperty(Yw.Model.HydroVisualInfo visual) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (this.docPnlRight.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Hidden) |
| | | ShowPropertyCtrl(); |
| | | _selectedVisual = visual; |
| | | if (_selectedVisual == null) |
| | | { |
| | | ShowPropertyCtrl(); |
| | | } |
| | | |
| | | if (_parter == null) |
| | | { |
| | | _propertyCtrl?.SelectParter(null); |
| | | _propertyCtrl.SelectedObject = null; |
| | | return; |
| | | } |
| | | _propertyCtrl.SelectedObject = GetVisualViewModel(_selectedVisual); |
| | | } |
| | | |
| | | _propertyCtrl?.SelectParter(_parter.Code); |
| | | if (_calcuResult != null) |
| | | //更新选择属性 |
| | | private void UpdateSelectedProperty() |
| | | { |
| | | if (!IsPropertyCtrlVisible) |
| | | { |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | return; |
| | | } |
| | | |
| | | if (_selectedVisual == null) |
| | | { |
| | | return; |
| | | } |
| | | _propertyCtrl?.UpdateRows(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region 自动匹配 |
| | | |
| | |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _parter = allParterList?.Find(x => x.Code == code); |
| | | var allParterList = _hydroInfo.GetAllVisuals(); |
| | | _selectedVisual = allParterList?.Find(x => x.Code == code); |
| | | var elementIds = new List<string>(); |
| | | if (_parter != null) |
| | | if (_selectedVisual != null) |
| | | { |
| | | elementIds.Add(_parter.Code); |
| | | elementIds.Add(_selectedVisual.Code); |
| | | } |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowProperty(); |
| | | SetBimfaceLinkColor(); |
| | | ShowSelectedProperty(); |
| | | }; |
| | | _matchingListCtrl.ApplyMatchingEvent += (output) => |
| | | { |
| | |
| | | } |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | var matchingListCtrl = GetMatchingListCtrl(); |
| | | var input = AssetsMatchingParasHelper.Create(_hydroInfo, GetAllCalcuResult()); |
| | | var input = AssetsMatchingParasHelper.Create(_hydroInfo, GetCalcuResultList()); |
| | | matchingListCtrl.SetBindingData(input); |
| | | this.controlContainerBottom.Controls.Add(matchingListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | |
| | | #endregion 自动匹配 |
| | | #endregion |
| | | |
| | | #region 未匹配列表 |
| | | |
| | |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _parter = allParterList?.Find(x => x.Code == parter.Code); |
| | | var allParterList = _hydroInfo.GetAllVisuals(); |
| | | _selectedVisual = allParterList?.Find(x => x.Code == parter.Code); |
| | | var elementIds = new List<string>() { parter.Code }; |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowProperty(); |
| | | SetBimfaceLinkColor(); |
| | | ShowSelectedProperty(); |
| | | }; |
| | | _unMatchingListCtrl.ViewModelEvent += async (parters) =>//查看模型 |
| | | { |
| | | var codes = parters?.Select(x => x.Code).Distinct().ToList(); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(codes); |
| | | _parter = null; |
| | | ShowProperty(); |
| | | _selectedVisual = null; |
| | | ShowSelectedProperty(); |
| | | }; |
| | | } |
| | | return _unMatchingListCtrl; |
| | |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | |
| | | #endregion 未匹配列表 |
| | | #endregion |
| | | |
| | | #region 一键显隐 |
| | | |
| | | //显隐编码列表 |
| | | private List<string> _fastShowHiddenCodeList = null; |
| | | |
| | | //一键显隐 |
| | | private async Task FastShowHidden() |
| | | private async void FastShowHidden() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | //显隐编码列表 |
| | | private List<string> _fastShowHiddenCodeList = null; |
| | | |
| | | //触发一键显隐 |
| | | private async void barBtnFastShowHidden_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | private void barBtnFastShowHidden_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | await FastShowHidden(); |
| | | FastShowHidden(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region 保存信息 |
| | | |
| | | //保存 |
| | | private async void barBtnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | Stopwatch sw = new Stopwatch(); |
| | | sw.Start(); |
| | | |
| | | |
| | | var id = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.Save(_hydroInfo); |
| | | |
| | | //耗时巨大的代码 |
| | | |
| | | sw.Stop(); |
| | | TimeSpan ts2 = sw.Elapsed; |
| | | Console.WriteLine("Stopwatch总共花费{0}ms.", ts2.TotalMilliseconds); |
| | | if (id < 1) |
| | | { |
| | | TipFormHelper.ShowError("保存失败!"); |
| | | return; |
| | | } |
| | | _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(id); |
| | | TipFormHelper.ShowSucceed("保存成功!"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region INP导出 |
| | | |
| | | //导出水力INP文件 |
| | | private void barBtnHydroExportInp_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var fileName = Yw.WinFrmUI.FileDialogHelper.SaveInp("导出Inp文件"); |
| | | if (string.IsNullOrEmpty(fileName)) |
| | | { |
| | | return; |
| | | } |
| | | var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo); |
| | | var result = netWork.ToInpString(); |
| | | File.WriteAllText(fileName, result); |
| | | TipFormHelper.ShowSucceed("导出成功"); |
| | | } |
| | | |
| | | #endregion INP导出 |
| | | |
| | | #region 批量配置 |
| | | |
| | | //注册批量配置事件 |
| | | private void RegistBulkSetEvents() |
| | | { |
| | | //水库 |
| | | this.barBtnSetReservoirList.ItemClick += delegate |
| | | { |
| | | //var dlg = new HydroReservoirBulkSetListDlg(); |
| | | //dlg.ShowDialog(); |
| | | }; |
| | | //水池 |
| | | this.barBtnSetTankList.ItemClick += delegate |
| | | { |
| | | //var dlg = new HydroTankBulkSetListDlg(); |
| | | //dlg.ShowDialog(); |
| | | }; |
| | | //水箱 |
| | | this.barBtnSetWaterboxList.ItemClick += delegate |
| | | { |
| | | //if (_hydroInfo == null) |
| | | //{ |
| | | // return; |
| | | //} |
| | | //var dlg = new SetHydroWaterboxListDlg(); |
| | | //dlg.SetBindingData(_hydroInfo); |
| | | //dlg.HydroClickEvent += async (obj) => |
| | | //{ |
| | | // if (obj == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // _selectedParter = obj; |
| | | // await _bimfaceCtrl?.ZoomAndSelectComponent(obj.Code); |
| | | // ShowProperty(); |
| | | //}; |
| | | //dlg.HydroChangedEvent += (obj) => |
| | | //{ |
| | | |
| | | //}; |
| | | //dlg.ShowDialog(); |
| | | }; |
| | | //连接节点 |
| | | this.barBtnSetJunctionList.ItemClick += delegate |
| | | { |
| | | //var dlg = new HydroJunctionBulkSetListDlg(); |
| | | //dlg.ShowDialog(); |
| | | }; |
| | | //闷头 |
| | | this.barBtnSetBluntheadList.ItemClick += delegate |
| | | { |
| | | //if (_hydroInfo == null) |
| | | //{ |
| | | // return; |
| | | //} |
| | | //var dlg = new SetHydroBluntheadListDlg(); |
| | | //dlg.SetBindingData(_hydroInfo); |
| | | //dlg.HydroClickEvent += async (obj) => |
| | | //{ |
| | | // if (obj == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // _selectedParter = obj; |
| | | // await _bimfaceCtrl?.ZoomAndSelectComponent(obj.Code); |
| | | // ShowProperty(); |
| | | //}; |
| | | //dlg.HydroChangedEvent += (obj) => |
| | | //{ |
| | | |
| | | //}; |
| | | //dlg.ShowDialog(); |
| | | }; |
| | | //弯头 |
| | | this.barBtnSetElbowsList.ItemClick += delegate |
| | | { |
| | | //if (_hydroInfo == null) |
| | | //{ |
| | | // return; |
| | | //} |
| | | //var dlg = new SetHydroElbowListDlg(); |
| | | //dlg.SetBindingData(_hydroInfo); |
| | | //dlg.HydroClickEvent += async (obj) => |
| | | //{ |
| | | // if (obj == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // _selectedParter = obj; |
| | | // await _bimfaceCtrl?.ZoomAndSelectComponent(obj.Code); |
| | | // ShowProperty(); |
| | | //}; |
| | | //dlg.HydroChangedEvent += (obj) => |
| | | //{ |
| | | |
| | | //}; |
| | | //dlg.ShowDialog(); |
| | | }; |
| | | //三通 |
| | | this.barBtnSetThreelinkList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new SetHydroThreelinkListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //四通 |
| | | this.barBtnSetFourlinkList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new SetHydroFourlinkListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //水表 |
| | | this.barBtnSetMeterList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new SetHydroMeterListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //流量计 |
| | | this.barBtnSetFlowmeterList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new SetHydroFlowmeterListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //压力表 |
| | | this.barBtnSetPressmeterList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new SetHydroPressmeterListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //管道 |
| | | this.barBtnSetPipeList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new SetHydroPipeListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //水泵 |
| | | this.barBtnSetPumpList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new SetHydroPumpListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //阀门 |
| | | this.barBtnSetValveList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new SetHydroValveListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.ShowDialog(); |
| | | }; |
| | | } |
| | | |
| | | |
| | | //显示RadialMenu |
| | | private void barBtnSetList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | this.rmSet.ShowPopup(MousePosition, true); |
| | | } |
| | | |
| | | //弹出前 |
| | | private void rmSet_BeforePopup(object sender, CancelEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | e.Cancel = true; |
| | | return; |
| | | } |
| | | //水库 |
| | | if (_hydroInfo.Reservoirs == null || _hydroInfo.Reservoirs.Count < 1) |
| | | { |
| | | this.barBtnSetReservoirList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetReservoirList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | //水池 |
| | | if (_hydroInfo.Tanks == null || _hydroInfo.Tanks.Count < 1) |
| | | { |
| | | this.barBtnSetTankList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetTankList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | //水箱 |
| | | if (_hydroInfo.Waterboxs == null || _hydroInfo.Waterboxs.Count < 1) |
| | | { |
| | | this.barBtnSetWaterboxList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetWaterboxList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | //连接节点 |
| | | if (_hydroInfo.Junctions == null || _hydroInfo.Junctions.Count < 1) |
| | | { |
| | | this.barBtnSetJunctionList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetJunctionList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | //喷嘴 |
| | | if (_hydroInfo.Nozzles == null || _hydroInfo.Nozzles.Count < 1) |
| | | { |
| | | this.barBtnSetNozzleList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetNozzleList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | //消火栓 |
| | | if (_hydroInfo.Hydrants == null || _hydroInfo.Hydrants.Count < 1) |
| | | { |
| | | this.barBtnSetHydrantList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetHydrantList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | //闷头 |
| | | if (_hydroInfo.Bluntheads == null || _hydroInfo.Bluntheads.Count < 1) |
| | | { |
| | | this.barBtnSetBluntheadList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetBluntheadList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | //弯头 |
| | | if (_hydroInfo.Elbows == null || _hydroInfo.Elbows.Count < 1) |
| | | { |
| | | this.barBtnSetElbowsList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetElbowsList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | //三通 |
| | | if (_hydroInfo.Threelinks == null || _hydroInfo.Threelinks.Count < 1) |
| | | { |
| | | this.barBtnSetThreelinkList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetThreelinkList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | //四通 |
| | | if (_hydroInfo.Fourlinks == null || _hydroInfo.Fourlinks.Count < 1) |
| | | { |
| | | this.barBtnSetFourlinkList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetFourlinkList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | //水表 |
| | | if (_hydroInfo.Meters == null || _hydroInfo.Meters.Count < 1) |
| | | { |
| | | this.barBtnSetMeterList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetMeterList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | //流量计 |
| | | if (_hydroInfo.Flowmeters == null || _hydroInfo.Flowmeters.Count < 1) |
| | | { |
| | | this.barBtnSetFlowmeterList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetFlowmeterList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | //压力表 |
| | | if (_hydroInfo.Pressmeters == null || _hydroInfo.Pressmeters.Count < 1) |
| | | { |
| | | this.barBtnSetPressmeterList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetPressmeterList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | //管道 |
| | | if (_hydroInfo.Pipes == null || _hydroInfo.Pipes.Count < 1) |
| | | { |
| | | this.barBtnSetPipeList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetPipeList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | //过渡件 |
| | | if (_hydroInfo.Translations == null || _hydroInfo.Translations.Count < 1) |
| | | { |
| | | this.barBtnSetTranslationList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetTranslationList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | //换热器 |
| | | if (_hydroInfo.Exchangers == null || _hydroInfo.Exchangers.Count < 1) |
| | | { |
| | | this.barBtnSetExchangerList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetExchangerList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | //空压机 |
| | | if (_hydroInfo.Compressors == null || _hydroInfo.Compressors.Count < 1) |
| | | { |
| | | this.barBtnSetCompressorList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetCompressorList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | //水泵 |
| | | if (_hydroInfo.Pumps == null || _hydroInfo.Pumps.Count < 1) |
| | | { |
| | | this.barBtnSetPumpList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetPumpList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | //阀门 |
| | | if (_hydroInfo.Valves == null || _hydroInfo.Valves.Count < 1) |
| | | { |
| | | this.barBtnSetValveList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetValveList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 并联分析 |
| | | |
| | | //并联分析 |
| | | private void barBtnAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_hydroInfo.Pumps == null || _hydroInfo.Pumps.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | var vmList = new List<XhsSinglePumpViewModel>(); |
| | | foreach (var pump in _hydroInfo.Pumps) |
| | | { |
| | | if (!pump.RatedN.HasValue) |
| | | { |
| | | continue; |
| | | } |
| | | var qh = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQH)?.CurveData; |
| | | var qe = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQE)?.CurveData; |
| | | var qp = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQP)?.CurveData; |
| | | if (qh == null) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | var qhPtList = qh.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); |
| | | var qePtList = qe?.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); |
| | | var qpPtList = qp?.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); |
| | | |
| | | var vm = new XhsSinglePumpViewModel(); |
| | | vmList.Add(vm); |
| | | vm.ID = pump.ID; |
| | | vm.Name = pump.Name; |
| | | vm.Code = pump.Code; |
| | | vm.IsBp = true; |
| | | vm.RunStatus = pump.LinkStatus == Yw.Hydro.LinkStatus.Open; |
| | | vm.RatedHz = pump.RatedHz; |
| | | vm.CurrentHz = Math.Round(pump.RatedHz * pump.SpeedRatio, 1); |
| | | vm.RatedSpeed = pump.RatedN.Value; |
| | | vm.CurrentSpeed = Math.Round(pump.RatedN.Value * pump.SpeedRatio); |
| | | vm.CurveQH = qhPtList; |
| | | vm.CurveQE = qePtList; |
| | | vm.CurveQP = qpPtList; |
| | | |
| | | if (allCalcuResultList != null && allCalcuResultList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList.Find(x => x.Code == pump.Code) as HydroCalcuLinkResult; |
| | | if (calcuResult != null) |
| | | { |
| | | if (calcuResult.CalcuFlow.HasValue) |
| | | { |
| | | vm.CalcuQ = Math.Abs(calcuResult.CalcuFlow.Value); |
| | | } |
| | | |
| | | var calcuResultStart = allCalcuResultList.Find(x => x.Code == pump.StartCode) as HydroCalcuNodeResult; |
| | | var calcuResultEnd = allCalcuResultList.Find(x => x.Code == pump.EndCode) as HydroCalcuNodeResult; |
| | | if (calcuResultStart != null && calcuResultEnd != null) |
| | | { |
| | | if (calcuResultStart.CalcuHead.HasValue && calcuResultEnd.CalcuHead.HasValue) |
| | | { |
| | | vm.CalcuH = Math.Round(Math.Abs(calcuResultStart.CalcuHead.Value - calcuResultEnd.CalcuHead.Value), 4); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | var dlg = new PumpParallelAnalyDlg(); |
| | | dlg.SetBindingData(vmList); |
| | | dlg.ReloadDataEvent += (list) => |
| | | { |
| | | list?.ForEach(x => |
| | | { |
| | | var pump = _hydroInfo.Pumps?.Find(t => t.Code == x.Code); |
| | | if (pump != null) |
| | | { |
| | | pump.LinkStatus = x.RunStatus ? Yw.Hydro.PumpStatus.Open : Yw.Hydro.PumpStatus.Closed; |
| | | pump.SpeedRatio = Math.Round(x.CurrentHz / pump.RatedHz, 1); |
| | | } |
| | | }); |
| | | ShowSelectedProperty(); |
| | | return true; |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 水力计算 |
| | | |
| | | |
| | | #region 前提条件 |
| | | |
| | | |
| | | //显示工况计算窗体 |
| | | private void ShowWorkingCalcuDlg() |
| | | { |
| | | var dlg = new SetHydroWorkingInfoDlg(); |
| | | dlg.HydroViewEvent += async (parter) => |
| | | { |
| | | _selectedVisual = parter as Yw.Model.HydroVisualInfo; |
| | | if (_selectedVisual != null) |
| | | { |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(new List<string>() { _selectedVisual.Code }); |
| | | } |
| | | ShowSelectedProperty(); |
| | | }; |
| | | dlg.HydroCalcuEvent += async (hydroInfo, workingInfo) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | _hydroInfo.UpdateWorkingInfo(workingInfo); |
| | | //校验 |
| | | _checkResult = _hydroInfo.Check(); |
| | | if (!_checkResult.Succeed) |
| | | { |
| | | ShowCheckCtrl(); |
| | | TipFormHelper.ShowWarn("校验失败,请检查后重试"); |
| | | return; |
| | | } |
| | | |
| | | WaitFormHelper.ShowWaitForm(this, "正在计算分析中,请稍候..."); |
| | | |
| | | |
| | | await Task.Delay(5000); |
| | | |
| | | var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo); |
| | | _calcuResult = netWork.Calcu(); |
| | | |
| | | WaitFormHelper.HideWaitForm(); |
| | | if (_calcuResult.Succeed) |
| | | { |
| | | GetCalcuResultList(false); |
| | | await _bimfaceCtrl?.SetLogicCalcuCustomLabels(_calcuResult); |
| | | TipFormHelper.ShowSucceed("计算成功!"); |
| | | var codes = _hydroInfo.Pumps.Select(x => x.Code).ToList(); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(codes); |
| | | } |
| | | else |
| | | { |
| | | ShowCalcuFailedCtrl(); |
| | | TipFormHelper.ShowError("计算失败!"); |
| | | } |
| | | AutoApplyGrading(); |
| | | UpdateVisualListCtrl(); |
| | | ShowSelectedProperty(); |
| | | }; |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 计算失败 |
| | | |
| | | //计算失败控件 |
| | | private HydroCalcuFailedCtrl _calcuFailedCtrl = null; |
| | | |
| | | //获取计算失败控件 |
| | | private HydroCalcuFailedCtrl GetCalcuFailedCtrl() |
| | | { |
| | | if (_calcuFailedCtrl == null) |
| | | { |
| | | _calcuFailedCtrl = new HydroCalcuFailedCtrl(); |
| | | _calcuFailedCtrl.Dock = DockStyle.Fill; |
| | | } |
| | | return _calcuFailedCtrl; |
| | | } |
| | | |
| | | //显示计算失败控件 |
| | | private void ShowCalcuFailedCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_calcuResult == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_calcuResult.Succeed) |
| | | { |
| | | return; |
| | | } |
| | | var calcuFailedCtrl = GetCalcuFailedCtrl(); |
| | | calcuFailedCtrl.SetBindingData(_calcuResult.FailedList); |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(calcuFailedCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "计算失败原因"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 计算结果 |
| | | |
| | | //所有计算结果列表 |
| | | private List<HydroCalcuResult> _allCalcuResultList = null; |
| | | |
| | | //获取计算结果 |
| | | //true 使用缓存,false 不使用缓存 |
| | | private List<HydroCalcuResult> GetCalcuResultList(bool isCache = true) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_calcuResult == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (!_calcuResult.Succeed) |
| | | { |
| | | return default; |
| | | } |
| | | if (isCache) |
| | | { |
| | | return _allCalcuResultList; |
| | | } |
| | | |
| | | _allCalcuResultList = new List<HydroCalcuResult>(); |
| | | |
| | | //节点 |
| | | var allNodeList = _hydroInfo.GetAllNodes(); |
| | | if (allNodeList != null && allNodeList.Count > 0) |
| | | { |
| | | foreach (var node in allNodeList) |
| | | { |
| | | var calcuNode = _calcuResult.NodeList?.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 |
| | | }; |
| | | _allCalcuResultList.Add(calcuResult); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //管段 |
| | | var allLinkList = _hydroInfo.GetAllLinks(); |
| | | if (allLinkList != null && allLinkList.Count > 0) |
| | | { |
| | | foreach (var link in allLinkList) |
| | | { |
| | | var calcuLink = _calcuResult.LinkList?.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 |
| | | }; |
| | | _allCalcuResultList.Add(calcuResult); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //流量计 |
| | | var allFlowmeterList = _hydroInfo.Flowmeters; |
| | | if (allFlowmeterList != null && allFlowmeterList.Count > 0) |
| | | { |
| | | foreach (var flowmeter in allFlowmeterList) |
| | | { |
| | | var calcuFlowmeterResult = _allCalcuResultList.Find(x => x.Code == flowmeter.Code) as HydroCalcuNodeResult; |
| | | if (calcuFlowmeterResult != null) |
| | | { |
| | | var calcuFlowmeterNewResult = new HydroCalcuFlowmeterResult(calcuFlowmeterResult); |
| | | var calcuFlowmeterLinkResultList = new List<HydroCalcuLinkResult>(); |
| | | var flowmeterLinkList = allLinkList?.Where(x => x.StartCode == flowmeter.Code || x.EndCode == flowmeter.Code).ToList(); |
| | | if (flowmeterLinkList != null && flowmeterLinkList.Count > 0) |
| | | { |
| | | foreach (var flowmeterLink in flowmeterLinkList) |
| | | { |
| | | var calcuFlowmeterLinkResult = _allCalcuResultList.Find(x => x.Code == flowmeterLink.Code) as HydroCalcuLinkResult; |
| | | if (calcuFlowmeterLinkResult != null) |
| | | { |
| | | calcuFlowmeterLinkResultList.Add(calcuFlowmeterLinkResult); |
| | | } |
| | | } |
| | | } |
| | | if (calcuFlowmeterLinkResultList.Exists(x => x.CalcuFlow.HasValue)) |
| | | { |
| | | calcuFlowmeterNewResult.CalcuQ = calcuFlowmeterLinkResultList.Where(x => x.CalcuFlow.HasValue).Average(x => x.CalcuFlow.Value); |
| | | } |
| | | _allCalcuResultList.Remove(calcuFlowmeterResult); |
| | | _allCalcuResultList.Add(calcuFlowmeterNewResult); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //压力表 |
| | | var allPressmeterList = _hydroInfo.Pressmeters; |
| | | if (allPressmeterList != null && allPressmeterList.Count > 0) |
| | | { |
| | | foreach (var pressmeter in allPressmeterList) |
| | | { |
| | | var calcuPressmeterResult = _allCalcuResultList.Find(x => x.Code == pressmeter.Code) as HydroCalcuNodeResult; |
| | | if (calcuPressmeterResult != null) |
| | | { |
| | | var calcuPressmeterNewResult = new HydroCalcuPressmeterResult(calcuPressmeterResult); |
| | | calcuPressmeterNewResult.CalcuPr = calcuPressmeterResult.CalcuPress; |
| | | _allCalcuResultList.Remove(calcuPressmeterResult); |
| | | _allCalcuResultList.Add(calcuPressmeterNewResult); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //水泵 |
| | | var allPumpList = _hydroInfo.Pumps; |
| | | if (allPumpList != null && allPumpList.Count > 0) |
| | | { |
| | | foreach (var pump in allPumpList) |
| | | { |
| | | var calcuPumpResult = _allCalcuResultList.Find(x => x.Code == pump.Code) as HydroCalcuLinkResult; |
| | | if (calcuPumpResult != null) |
| | | { |
| | | var calcuPumpNewResult = new HydroCalcuPumpResult(calcuPumpResult); |
| | | calcuPumpNewResult.CalcuQ = calcuPumpResult.CalcuFlow; |
| | | if (calcuPumpNewResult.CalcuQ.HasValue) |
| | | { |
| | | var calcuNodeStartResult = _allCalcuResultList.Find(x => x.Code == pump.StartCode) as HydroCalcuNodeResult; |
| | | var calcuNodeEndResult = _allCalcuResultList.Find(x => x.Code == pump.EndCode) as HydroCalcuNodeResult; |
| | | if (calcuNodeStartResult != null && calcuNodeEndResult != null) |
| | | { |
| | | if (calcuNodeStartResult.CalcuPress.HasValue && calcuNodeEndResult.CalcuPress.HasValue) |
| | | { |
| | | calcuPumpNewResult.CalcuH = Math.Abs(calcuNodeStartResult.CalcuPress.Value - calcuNodeEndResult.CalcuPress.Value); |
| | | } |
| | | if (pump.LinkStatus == Yw.Hydro.PumpStatus.Open && pump.RatedN.HasValue) |
| | | { |
| | | var curveqp = _hydroInfo.Curves?.Find(x => x.Code == pump.CurveQP); |
| | | if (curveqp != null) |
| | | { |
| | | if (curveqp.CurveData != null && curveqp.CurveData.Count > 3) |
| | | { |
| | | var point2dList = curveqp.CurveData.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); |
| | | var point2dSimularList = point2dList.GetQPPointListByN(pump.RatedN.Value, pump.RatedN.Value * pump.SpeedRatio); |
| | | var pumpCurveQp = new Yw.Pump.CurveQP(eFeatType.Cubic, point2dSimularList); |
| | | calcuPumpNewResult.CalcuP = pumpCurveQp.FeatCurve.GetPointY(calcuPumpNewResult.CalcuQ.Value); |
| | | } |
| | | } |
| | | } |
| | | if (calcuPumpNewResult.CalcuH.HasValue && calcuPumpNewResult.CalcuP.HasValue) |
| | | { |
| | | calcuPumpNewResult.CalcuE = Yw.Pump.CalculationHelper.CalcuE(calcuPumpNewResult.CalcuQ.Value, calcuPumpNewResult.CalcuH.Value, calcuPumpNewResult.CalcuP.Value); |
| | | } |
| | | } |
| | | } |
| | | _allCalcuResultList.Remove(calcuPumpResult); |
| | | _allCalcuResultList.Add(calcuPumpNewResult); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return _allCalcuResultList; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | //水力计算 |
| | | private void barBtnHydroCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | //ShowCalcuPrefixDlg(); |
| | | ShowWorkingCalcuDlg(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 构件查询 |
| | | |
| | | //查询组件 |
| | | private HydroVisualSearchListCtrl _searchCtrl = null; |
| | | |
| | | //获取查询组件 |
| | | private HydroVisualSearchListCtrl GetSearchCtrl() |
| | | { |
| | | if (_searchCtrl == null) |
| | | { |
| | | _searchCtrl = new HydroVisualSearchListCtrl(); |
| | | _searchCtrl.Dock = DockStyle.Fill; |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | _searchCtrl.InitialData(allVisualViewModelList); |
| | | _searchCtrl.HydroClickInfoEvent += async (visual) => |
| | | { |
| | | ShowSelectedProperty(visual); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | }; |
| | | _searchCtrl.HydroSearchInfoEvent += async (list) => |
| | | { |
| | | var elementIds = new List<string>(); |
| | | if (list != null && list.Count > 0) |
| | | { |
| | | _selectedVisual = list.First(); |
| | | list.ForEach(x => elementIds.Add(x.Code)); |
| | | } |
| | | else |
| | | { |
| | | _selectedVisual = null; |
| | | } |
| | | ShowSelectedProperty(); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | }; |
| | | } |
| | | return _searchCtrl; |
| | | } |
| | | |
| | | //查询控件是否可见 |
| | | private bool IsSearchCtrlVisible |
| | | { |
| | | get |
| | | { |
| | | if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | if (this.controlContainerBottom.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerBottom.Controls[0] is HydroVisualSearchListCtrl) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //显示查询控件 |
| | | private void ShowSearchCtrl(string content) |
| | | { |
| | | if (IsSearchCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | | var searchCtrl = GetSearchCtrl(); |
| | | searchCtrl.SetBindingData(content); |
| | | 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 ShowSearchDlg() |
| | | { |
| | | if (IsSearchCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new InputHydroVisualSearchListDlg(); |
| | | dlg.SearchEvent += (content) => |
| | | { |
| | | if (string.IsNullOrEmpty(content)) |
| | | { |
| | | return; |
| | | } |
| | | ShowSearchCtrl(content); |
| | | }; |
| | | dlg.SetBindingData(); |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //查询 |
| | | private void barBtnSearch_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowSearchDlg(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 模型标注 |
| | | |
| | | //所有标注设置列表 |
| | | private List<HydroMarkSetViewModel> _allMarkSetList = null; |
| | | |
| | | //获取标注设置列表 |
| | | private List<HydroMarkSetViewModel> GetMarkSetList() |
| | | { |
| | | if (_allMarkSetList == null) |
| | | { |
| | | _allMarkSetList = new List<HydroMarkSetViewModel>(); |
| | | if (_hydroInfo.Waterboxs != null && _hydroInfo.Waterboxs.Count > 0) |
| | | { |
| | | _allMarkSetList.Add(new HydroMarkSetViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Waterbox, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Waterbox), |
| | | MarkType = (int)eWaterboxMarkType.None |
| | | }); |
| | | } |
| | | if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0) |
| | | { |
| | | _allMarkSetList.Add(new HydroMarkSetViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Pump, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Pump), |
| | | MarkType = (int)eWaterboxMarkType.None |
| | | }); |
| | | } |
| | | if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0) |
| | | { |
| | | _allMarkSetList.Add(new HydroMarkSetViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Valve, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Valve), |
| | | MarkType = (int)eWaterboxMarkType.None |
| | | }); |
| | | } |
| | | if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) |
| | | { |
| | | _allMarkSetList.Add(new HydroMarkSetViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Pipe, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Pipe), |
| | | MarkType = (int)eWaterboxMarkType.None |
| | | }); |
| | | } |
| | | if (_hydroInfo.Nozzles != null && _hydroInfo.Nozzles.Count > 0) |
| | | { |
| | | _allMarkSetList.Add(new HydroMarkSetViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Nozzle, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Nozzle), |
| | | MarkType = (int)eWaterboxMarkType.None |
| | | }); |
| | | } |
| | | } |
| | | return _allMarkSetList; |
| | | } |
| | | |
| | | //所有标注结果列表 |
| | | private List<HydroMarkResultViewModel> _allMarkResultList = null; |
| | | |
| | | //获取标注结果列表 |
| | | private List<HydroMarkResultViewModel> GetMarkResultList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | _allMarkResultList = new List<HydroMarkResultViewModel>(); |
| | | var allMarkSetList = GetMarkSetList(); |
| | | foreach (var markSet in allMarkSetList) |
| | | { |
| | | switch (markSet.Code) |
| | | { |
| | | case Yw.Hydro.ParterCatalog.Waterbox: |
| | | { |
| | | if (_hydroInfo.Waterboxs != null && _hydroInfo.Waterboxs.Count > 0) |
| | | { |
| | | switch ((eWaterboxMarkType)markSet.MarkType) |
| | | { |
| | | case eWaterboxMarkType.None: |
| | | { |
| | | |
| | | } |
| | | break; |
| | | case eWaterboxMarkType.PoolElev: |
| | | { |
| | | _hydroInfo.Waterboxs.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"池底标高:{Math.Round(t.PoolElev, 4)}m" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case eWaterboxMarkType.InitLevel: |
| | | { |
| | | _hydroInfo.Waterboxs.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"初始水位:{Math.Round(t.InitLevel, 4)}m" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case eWaterboxMarkType.MinLevel: |
| | | { |
| | | _hydroInfo.Waterboxs.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"最小水位:{Math.Round(t.MinLevel, 4)}m" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case eWaterboxMarkType.MaxLevel: |
| | | { |
| | | _hydroInfo.Waterboxs.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"最高水位:{Math.Round(t.MaxLevel, 4)}m" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case eWaterboxMarkType.DN: |
| | | { |
| | | _hydroInfo.Waterboxs.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"直径:{Math.Round(t.DN, 4)}m" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case eWaterboxMarkType.MinVol: |
| | | { |
| | | _hydroInfo.Waterboxs.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"最小容积:{Math.Round(t.MinVol, 1)}m" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Pump: |
| | | { |
| | | if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0) |
| | | { |
| | | switch ((ePumpMarkType)markSet.MarkType) |
| | | { |
| | | case ePumpMarkType.None: |
| | | { |
| | | |
| | | } |
| | | break; |
| | | case ePumpMarkType.PumpStatus: |
| | | { |
| | | _hydroInfo.Pumps.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"开机状态:{Yw.WinFrmUI.HydroLinkStatusHelper.GetStatusName(t.LinkStatus)}" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case ePumpMarkType.RatedP: |
| | | { |
| | | _hydroInfo.Pumps.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"额定功率:{t.RatedP}kW" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case ePumpMarkType.RatedQ: |
| | | { |
| | | _hydroInfo.Pumps.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"额定流量:{t.RatedQ}m³/h" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case ePumpMarkType.RatedH: |
| | | { |
| | | _hydroInfo.Pumps.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"额定扬程:{t.RatedH}m" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case ePumpMarkType.RatedN: |
| | | { |
| | | _hydroInfo.Pumps.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"额定转速:{t.RatedN}r/min" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case ePumpMarkType.RatedHz: |
| | | { |
| | | _hydroInfo.Pumps.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"额定频率:{t.RatedHz}" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case ePumpMarkType.CurrentN: |
| | | { |
| | | _hydroInfo.Pumps.ForEach(t => |
| | | { |
| | | if (t.RatedN.HasValue) |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"设定转速:{Math.Round(t.RatedN.Value * t.SpeedRatio, 1)}r/min" |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | break; |
| | | case ePumpMarkType.CurrentHz: |
| | | { |
| | | _hydroInfo.Pumps.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"设定频率:{Math.Round(t.RatedHz * t.SpeedRatio, 1)}hz" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Valve: |
| | | { |
| | | if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0) |
| | | { |
| | | switch ((eValveMarkType)markSet.MarkType) |
| | | { |
| | | case eValveMarkType.None: |
| | | { |
| | | |
| | | } |
| | | break; |
| | | case eValveMarkType.ValveStatus: |
| | | { |
| | | _hydroInfo.Valves.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"阀门状态:{HydroLinkStatusHelper.GetStatusName(t.LinkStatus)}" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case eValveMarkType.ValveType: |
| | | { |
| | | _hydroInfo.Valves.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"阀门类型:{HydroValveTypeHelper.GetTypeName(t.ValveType)}" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case eValveMarkType.Diameter: |
| | | { |
| | | _hydroInfo.Valves.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"直径:{t.Diameter}mm" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case eValveMarkType.MinorLoss: |
| | | { |
| | | _hydroInfo.Valves.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"局阻系数:{t.MinorLoss}" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Pipe: |
| | | { |
| | | if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) |
| | | { |
| | | switch ((ePipeMarkType)markSet.MarkType) |
| | | { |
| | | case ePipeMarkType.None: |
| | | { |
| | | |
| | | } |
| | | break; |
| | | case ePipeMarkType.PipeStatus: |
| | | { |
| | | _hydroInfo.Pipes.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"状态:{Yw.WinFrmUI.HydroLinkStatusHelper.GetStatusName(t.LinkStatus)}" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case ePipeMarkType.Diameter: |
| | | { |
| | | _hydroInfo.Pipes.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"直径:{t.Diameter}mm" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case ePipeMarkType.Length: |
| | | { |
| | | _hydroInfo.Pipes.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"长度:{t.Length}m" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case ePipeMarkType.Roughness: |
| | | { |
| | | _hydroInfo.Pipes.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"粗糙系数:{t.Roughness}" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case ePipeMarkType.MinorLoss: |
| | | { |
| | | _hydroInfo.Pipes.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"局阻系数:{t.MinorLoss}" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Nozzle: |
| | | { |
| | | if (_hydroInfo.Nozzles != null && _hydroInfo.Nozzles.Count > 0) |
| | | { |
| | | switch ((eNozzleMarkType)markSet.MarkType) |
| | | { |
| | | case eNozzleMarkType.None: |
| | | { |
| | | |
| | | } |
| | | break; |
| | | case eNozzleMarkType.Elev: |
| | | { |
| | | _hydroInfo.Nozzles.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"标高:{Math.Round(t.Elev, 4)}m" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case eNozzleMarkType.Demand: |
| | | { |
| | | _hydroInfo.Nozzles.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"需水量:{t.Demand}m³/h" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | case eNozzleMarkType.Coefficient: |
| | | { |
| | | _hydroInfo.Nozzles.ForEach(t => |
| | | { |
| | | _allMarkResultList.Add(new HydroMarkResultViewModel() |
| | | { |
| | | Code = t.Code, |
| | | Text = $"喷射系数:{t.Coefficient}" |
| | | }); |
| | | }); |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | return _allMarkResultList; |
| | | } |
| | | |
| | | //应用标注结果列表 |
| | | private async Task ApplyMarkResultList() |
| | | { |
| | | var allMarkResultList = GetMarkResultList(); |
| | | var leadLabels = allMarkResultList?.Select(x => new LogicMarkLeadLabel(x.Code, x.Text, 100000)).ToList(); |
| | | await _bimfaceCtrl?.SetLogicMarkLeadLabels(leadLabels); |
| | | TipFormHelper.ShowSucceed("标注信息已设置"); |
| | | } |
| | | |
| | | //清除标注结果列表 |
| | | private async Task ClearMarkResultList() |
| | | { |
| | | if (_allMarkResultList == null || _allMarkResultList.Count < 1) |
| | | { |
| | | TipFormHelper.ShowWarn("尚未设置标注信息"); |
| | | return; |
| | | } |
| | | _allMarkResultList = null; |
| | | await _bimfaceCtrl?.ClearLogicMarkLeadLabels(); |
| | | TipFormHelper.ShowSucceed("标注信息已清除"); |
| | | } |
| | | |
| | | //显示标注设置窗体 |
| | | private void ShowMarkSetDlg() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allMarkSetList = GetMarkSetList(); |
| | | var dlg = new SetHydroMarkDlg(); |
| | | dlg.SetBindingData(allMarkSetList); |
| | | dlg.ReloadDataEvent += async (list) => |
| | | { |
| | | _allMarkSetList = list; |
| | | await ApplyMarkResultList(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //设置标注 |
| | | private void barBtnSetMark_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowMarkSetDlg(); |
| | | } |
| | | |
| | | //清除标注 |
| | | private async void barBtnClearMark_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | await ClearMarkResultList(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 颜色分级 |
| | | |
| | | #region 颜色配置 |
| | | |
| | | //所有分级列表 |
| | | private List<HydroGradingVmo> _allGradingList = null; |
| | | |
| | | //获取分级列表 |
| | | private async Task<List<HydroGradingVmo>> GetGradingList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_allGradingList == null) |
| | | { |
| | | _allGradingList = await BLLFactory<Yw.BLL.HydroGrading>.Instance.GetByModelID(_hydroInfo.ID); |
| | | if (_allGradingList == null || _allGradingList.Count < 1) |
| | | { |
| | | var config = Yw.Settings.HydroParasHelper.Hydro.Grading; |
| | | if (config != null && config.Items != null && config.Items.Count > 0) |
| | | { |
| | | _allGradingList = new List<HydroGradingVmo>(); |
| | | config.Items.ForEach(x => |
| | | { |
| | | var vmo = new HydroGradingVmo() |
| | | { |
| | | ModelID = _hydroInfo.ID, |
| | | Catalog = x.Catalog, |
| | | PropName = x.PropName, |
| | | SetValue = x.SetValue, |
| | | MinValue = x.MinValue, |
| | | MaxValue = x.MaxValue, |
| | | Color = x.Color, |
| | | SortCode = config.Items.IndexOf(x) |
| | | }; |
| | | _allGradingList.Add(vmo); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | return _allGradingList; |
| | | } |
| | | |
| | | //显示配置颜色分级窗体 |
| | | private async void ShowSetGradingDlg() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allGradingList = await GetGradingList(); |
| | | var dlg = new SetHydroGradingTreeDlg(); |
| | | dlg.SetBindingData(_hydroInfo, allGradingList); |
| | | dlg.ReloadDataEvent += (list) => |
| | | { |
| | | _allGradingList = list; |
| | | }; |
| | | dlg.ApplyDataEvent += (catalog, propName) => |
| | | { |
| | | ApplyGrading(catalog, propName); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //配置颜色分级 |
| | | private void barBtnGradingSet_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowSetGradingDlg(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 应用分级 |
| | | |
| | | //颜色分级应用列表 |
| | | private List<HydroGradingApplyViewModel> _allGradingApplyList = null; |
| | | |
| | | //获取颜色分级应用列表 |
| | | private List<HydroGradingApplyViewModel> GetGradingApplyList() |
| | | { |
| | | if (_allGradingApplyList == null) |
| | | { |
| | | _allGradingApplyList = new List<HydroGradingApplyViewModel>(); |
| | | |
| | | if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0) |
| | | { |
| | | _allGradingApplyList.Add(new HydroGradingApplyViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Pump, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Pump), |
| | | PropName = Yw.Hydro.ParterProp.LinkStatus |
| | | }); |
| | | } |
| | | if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0) |
| | | { |
| | | _allGradingApplyList.Add(new HydroGradingApplyViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Valve, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Valve), |
| | | PropName = Yw.Hydro.ParterProp.LinkStatus |
| | | }); |
| | | } |
| | | if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) |
| | | { |
| | | _allGradingApplyList.Add(new HydroGradingApplyViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Pipe, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Pipe), |
| | | PropName = Yw.Hydro.ParterProp.CalcuFlow |
| | | }); |
| | | } |
| | | } |
| | | return _allGradingApplyList; |
| | | } |
| | | |
| | | //获取颜色分级应用结果列表 |
| | | private async Task<List<HydroGradingApplyResultViewModel>> GetGradingApplyResultList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | //所有分级列表 |
| | | var allGradingList = await GetGradingList(); |
| | | if (allGradingList == null || allGradingList.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | //所有分级应用列表 |
| | | var allGradingApplyList = GetGradingApplyList(); |
| | | if (allGradingApplyList == null || allGradingApplyList.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | //所有计算结果列表 |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | |
| | | //所有应用结果列表 |
| | | var allGradingApplyResultList = new List<HydroGradingApplyResultViewModel>(); |
| | | allGradingApplyList.ForEach(x => |
| | | { |
| | | var allCatalogGradingList = allGradingList.Where(t => t.Catalog == x.Code).ToList(); |
| | | if (allCatalogGradingList != null || allCatalogGradingList.Count > 0) |
| | | { |
| | | switch (x.Code) |
| | | { |
| | | case Yw.Hydro.ParterCatalog.Pump: |
| | | { |
| | | if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0) |
| | | { |
| | | foreach (var pump in _hydroInfo.Pumps) |
| | | { |
| | | switch (x.PropName) |
| | | { |
| | | case Yw.Hydro.ParterProp.LinkStatus: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.LinkStatus).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var grading = gradingList.Meet(pump.LinkStatus); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterProp.CalcuFlow: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuFlow).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuFlow.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterProp.CalcuVelocity: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuVelocity.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterProp.CalcuHeadLoss: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuHeadLoss.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Valve: |
| | | { |
| | | if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0) |
| | | { |
| | | foreach (var valve in _hydroInfo.Valves) |
| | | { |
| | | switch (x.PropName) |
| | | { |
| | | case Yw.Hydro.ParterProp.LinkStatus: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.LinkStatus).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var grading = gradingList.Meet(valve.LinkStatus); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterProp.CalcuFlow: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuFlow).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuFlow.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterProp.CalcuVelocity: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuVelocity.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterProp.CalcuHeadLoss: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuHeadLoss.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Pipe: |
| | | { |
| | | if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) |
| | | { |
| | | foreach (var pipe in _hydroInfo.Pipes) |
| | | { |
| | | switch (x.PropName) |
| | | { |
| | | case Yw.Hydro.ParterProp.CalcuFlow: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuFlow).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuFlow.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pipe.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterProp.CalcuVelocity: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuVelocity.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pipe.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterProp.CalcuHeadLoss: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuHeadLoss.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pipe.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | }); |
| | | |
| | | return allGradingApplyResultList; |
| | | } |
| | | |
| | | //获取颜色分级应用结果列表 |
| | | private async Task<List<HydroGradingApplyResultViewModel>> GetGradingApplyResultList(string catalog, string propName) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | //所有分级列表 |
| | | var allGradingList = await GetGradingList(); |
| | | if (allGradingList == null || allGradingList.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | var currentGradingList = allGradingList.Where(x => x.Catalog == catalog).ToList(); |
| | | if (currentGradingList.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | //所有分级应用列表 |
| | | var allGradingApplyList = GetGradingApplyList(); |
| | | if (allGradingApplyList == null || allGradingApplyList.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | //当前分级应用 |
| | | var gradingApply = allGradingApplyList.Find(x => x.Code == catalog); |
| | | if (gradingApply == null) |
| | | { |
| | | return default; |
| | | } |
| | | gradingApply.PropName = propName; |
| | | |
| | | //所有计算结果 |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | |
| | | //应用结果列表 |
| | | var gradingApplyResultList = new List<HydroGradingApplyResultViewModel>(); |
| | | |
| | | switch (catalog) |
| | | { |
| | | case Yw.Hydro.ParterCatalog.Pump: |
| | | { |
| | | if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0) |
| | | { |
| | | foreach (var pump in _hydroInfo.Pumps) |
| | | { |
| | | switch (propName) |
| | | { |
| | | case Yw.Hydro.ParterProp.LinkStatus: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.LinkStatus).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var grading = gradingList.Meet(pump.LinkStatus); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterProp.CalcuFlow: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuFlow).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuFlow.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterProp.CalcuVelocity: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuVelocity.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterProp.CalcuHeadLoss: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuHeadLoss.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Valve: |
| | | { |
| | | if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0) |
| | | { |
| | | foreach (var valve in _hydroInfo.Valves) |
| | | { |
| | | switch (propName) |
| | | { |
| | | case Yw.Hydro.ParterProp.LinkStatus: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.LinkStatus).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var grading = gradingList.Meet(valve.LinkStatus); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterProp.CalcuFlow: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuFlow).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuFlow.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterProp.CalcuVelocity: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuVelocity.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterProp.CalcuHeadLoss: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuHeadLoss.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Pipe: |
| | | { |
| | | if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) |
| | | { |
| | | foreach (var pipe in _hydroInfo.Pipes) |
| | | { |
| | | switch (propName) |
| | | { |
| | | case Yw.Hydro.ParterProp.CalcuFlow: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuFlow).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuFlow.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pipe.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterProp.CalcuVelocity: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuVelocity.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pipe.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterProp.CalcuHeadLoss: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuHeadLoss.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pipe.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | |
| | | return gradingApplyResultList; |
| | | } |
| | | |
| | | //颜色分级是否应用了 |
| | | private bool _isGradingApply = false; |
| | | //颜色分级应用编码列表 |
| | | private List<string> _allGradingApplyCodeList = null; |
| | | |
| | | //应用颜色分级 |
| | | private async void ApplyGrading() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | _isGradingApply = true; |
| | | var allGradingApplyResultList = await GetGradingApplyResultList(); |
| | | if (allGradingApplyResultList == null || allGradingApplyResultList.Count < 1) |
| | | { |
| | | CancelApplyGrading(); |
| | | return; |
| | | } |
| | | var objGroupList = allGradingApplyResultList.GroupBy(x => x.Color).ToList(); |
| | | objGroupList.ForEach(async x => |
| | | { |
| | | await _bimfaceCtrl?.OverrideComponentsColor(x.Select(t => t.Code).Distinct().ToList(), x.Key, 1); |
| | | }); |
| | | _allGradingApplyCodeList = allGradingApplyResultList.Select(x => x.Code).Distinct().ToList(); |
| | | } |
| | | |
| | | //应用颜色分级 |
| | | private async void ApplyGrading(string catalog, string propName) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | _isGradingApply = true; |
| | | var allGradingApplyResultList = await GetGradingApplyResultList(catalog, propName); |
| | | if (allGradingApplyResultList == null || allGradingApplyResultList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var objGroupList = allGradingApplyResultList.GroupBy(x => x.Color).ToList(); |
| | | objGroupList.ForEach(async x => |
| | | { |
| | | await _bimfaceCtrl?.OverrideComponentsColor(x.Select(t => t.Code).Distinct().ToList(), x.Key, 1); |
| | | }); |
| | | var codeList = allGradingApplyResultList.Select(x => x.Code); |
| | | if (_allGradingApplyCodeList == null) |
| | | { |
| | | _allGradingApplyCodeList = new List<string>(); |
| | | } |
| | | _allGradingApplyCodeList.AddRange(codeList); |
| | | _allGradingApplyCodeList = _allGradingApplyCodeList.Distinct().ToList(); |
| | | } |
| | | |
| | | //自动应用颜色分级 |
| | | private void AutoApplyGrading() |
| | | { |
| | | if (!_isGradingApply) |
| | | { |
| | | return; |
| | | } |
| | | ApplyGrading(); |
| | | } |
| | | |
| | | //取消应用颜色分级 |
| | | private async void CancelApplyGrading() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | _isGradingApply = false; |
| | | if (_allGradingApplyCodeList != null && _allGradingApplyCodeList.Count > 0) |
| | | { |
| | | await _bimfaceCtrl?.RestoreComponentsColor(_allGradingApplyCodeList); |
| | | } |
| | | } |
| | | |
| | | //显示应用颜色分级窗体 |
| | | private void ShowApplyGradingDlg() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allGradingApplyList = GetGradingApplyList(); |
| | | if (allGradingApplyList == null || allGradingApplyList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new ApplyHydroGradingDlg(); |
| | | dlg.SetBindingData(allGradingApplyList); |
| | | dlg.ReloadDataEvent += (obj) => |
| | | { |
| | | _allGradingApplyList = obj; |
| | | ApplyGrading(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //应用颜色分级 |
| | | private void barBtnGradingApply_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowApplyGradingDlg(); |
| | | } |
| | | |
| | | //取消应用分级 |
| | | private void batBtnCancelGradingApply_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | CancelApplyGrading(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | #region 人工刷新 |
| | | |
| | | //刷新 |
| | | private async void barBtnRefresh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (XtraMessageBox.Show("刷新后将丢失当前水力信息更改,是否继续刷新?", "询问", MessageBoxButtons.YesNo) == DialogResult.Yes) |
| | | { |
| | | if (_project == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_projectSite == null) |
| | | { |
| | | return; |
| | | } |
| | | var hydroRelation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance |
| | | .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation); |
| | | Stopwatch sw = new Stopwatch(); |
| | | sw.Start(); |
| | | _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(hydroRelation.ModelID); |
| | | sw.Stop(); |
| | | TimeSpan ts2 = sw.Elapsed; |
| | | Console.WriteLine("Stopwatch总共花费{0}ms.", ts2.TotalMilliseconds); |
| | | _selectedVisual = null; |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(null); |
| | | ShowSelectedProperty(); |
| | | TipFormHelper.ShowSucceed("数据已刷新"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 水流动画 |
| | | |
| | | //所有流向列表 |
| | | private List<Yw.WinFrmUI.Bimface.LogicFlowEffect> _allFlowEffectList = null; |
| | | |
| | | //获取流向列表 |
| | | private List<Yw.WinFrmUI.Bimface.LogicFlowEffect> GetFlowEffectList() |
| | | { |
| | | if (_allFlowEffectList == null) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | _allFlowEffectList = new List<LogicFlowEffect>(); |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) |
| | | { |
| | | foreach (var parter in _hydroInfo.Pipes) |
| | | { |
| | | var flowEffect = new LogicFlowEffect(); |
| | | _allFlowEffectList.Add(flowEffect); |
| | | flowEffect.Id = parter.Code; |
| | | flowEffect.Rotation = 90; |
| | | flowEffect.SpeedX = 0.1; |
| | | if (parter.FlowDirectionX == Yw.Hydro.FlowDirection.None) |
| | | { |
| | | flowEffect.SpeedX = 0; |
| | | } |
| | | else if (parter.FlowDirectionX == Yw.Hydro.FlowDirection.Positive) |
| | | { |
| | | flowEffect.SpeedX = 0.1; |
| | | } |
| | | else |
| | | { |
| | | flowEffect.SpeedX = -0.1; |
| | | } |
| | | |
| | | if (parter.FlowDirectionY == Yw.Hydro.FlowDirection.None) |
| | | { |
| | | flowEffect.SpeedY = 0; |
| | | } |
| | | else if (parter.FlowDirectionY == Yw.Hydro.FlowDirection.Positive) |
| | | { |
| | | flowEffect.SpeedY = 0.1; |
| | | } |
| | | else |
| | | { |
| | | flowEffect.SpeedY = -0.1; |
| | | } |
| | | |
| | | var calcuResult = allCalcuResultList?.Find(x => x.Code == parter.Code) as HydroCalcuLinkResult; |
| | | if (calcuResult != null) |
| | | { |
| | | if (calcuResult.CalcuVelocity < 0) |
| | | { |
| | | flowEffect.SpeedX = -flowEffect.SpeedX; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return _allFlowEffectList; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载水流动画 |
| | | /// </summary> |
| | | private async void LoadFlowEffect() |
| | | { |
| | | if (_allFlowEffectList != null) |
| | | { |
| | | return; |
| | | } |
| | | var allFlowEffectList = GetFlowEffectList(); |
| | | await _bimfaceCtrl?.LoadFlowEffect(allFlowEffectList); |
| | | } |
| | | |
| | | //卸载流向 |
| | | private async void UnloadFlowEffect() |
| | | { |
| | | if (_allFlowEffectList == null) |
| | | { |
| | | return; |
| | | } |
| | | _allFlowEffectList = null; |
| | | await _bimfaceCtrl?.UnloadFlowEffect(); |
| | | } |
| | | |
| | | //更新水流动画 |
| | | private async void UpdateFlowEffect(Yw.Model.HydroParterInfo parter) |
| | | { |
| | | if (_allFlowEffectList == null) |
| | | { |
| | | return; |
| | | } |
| | | var visual = parter as Yw.Model.HydroVisualInfo; |
| | | if (visual == null) |
| | | { |
| | | return; |
| | | } |
| | | var flowEffect = _allFlowEffectList.Find(x => x.Id == parter.Code); |
| | | if (flowEffect == null) |
| | | { |
| | | return; |
| | | } |
| | | if (visual.FlowDirectionX == Yw.Hydro.FlowDirection.None) |
| | | { |
| | | flowEffect.SpeedX = 0; |
| | | } |
| | | else if (visual.FlowDirectionX == Yw.Hydro.FlowDirection.Positive) |
| | | { |
| | | flowEffect.SpeedX = 0.1; |
| | | } |
| | | else |
| | | { |
| | | flowEffect.SpeedX = -0.1; |
| | | } |
| | | |
| | | if (visual.FlowDirectionY == Yw.Hydro.FlowDirection.None) |
| | | { |
| | | flowEffect.SpeedY = 0; |
| | | } |
| | | else if (visual.FlowDirectionY == Yw.Hydro.FlowDirection.Positive) |
| | | { |
| | | flowEffect.SpeedY = 0.1; |
| | | } |
| | | else |
| | | { |
| | | flowEffect.SpeedY = -0.1; |
| | | } |
| | | |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | var calcuResult = allCalcuResultList?.Find(x => x.Code == visual.Code) as HydroCalcuLinkResult; |
| | | if (calcuResult != null) |
| | | { |
| | | if (calcuResult.CalcuVelocity < 0) |
| | | { |
| | | flowEffect.SpeedX = -flowEffect.SpeedX; |
| | | } |
| | | } |
| | | await _bimfaceCtrl?.UpdateFlowEffect(flowEffect); |
| | | } |
| | | |
| | | //加载流向 |
| | | private void barBtnLoadFlowDirection_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | LoadFlowEffect(); |
| | | } |
| | | |
| | | //卸载流向 |
| | | private void barBtnUnloadFlowDirection_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | UnloadFlowEffect(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 可见视图 |
| | | |
| | | //所有可见视图列表 |
| | | private List<HydroVisualViewModel> _allVisualViewModelList = null; |
| | | |
| | | //获取可见视图列表 |
| | | private List<HydroVisualViewModel> GetVisualViewModelList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_allVisualViewModelList == null) |
| | | { |
| | | _allVisualViewModelList = new List<HydroVisualViewModel>(); |
| | | var allVisualList = _hydroInfo.GetAllVisuals(); |
| | | if (allVisualList != null && allVisualList.Count > 0) |
| | | { |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | allVisualList.ForEach(x => |
| | | { |
| | | var vm = HydroVisualViewModelBuilder.CreateVisualViewModel(x, _hydroInfo); |
| | | var calcuResult = allCalcuResultList?.Find(x => x.Code == x.Code); |
| | | if (calcuResult != null) |
| | | { |
| | | vm.UpdateCalcuProperty(calcuResult); |
| | | } |
| | | _allVisualViewModelList.Add(vm); |
| | | }); |
| | | } |
| | | } |
| | | return _allVisualViewModelList; |
| | | } |
| | | |
| | | //更新可见视图计算属性 |
| | | private void UpdateVisualViewModelCalcuProperty() |
| | | { |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | if (allVisualViewModelList != null && allVisualViewModelList.Count > 0) |
| | | { |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | if (allCalcuResultList != null && allCalcuResultList.Count > 0) |
| | | { |
| | | allVisualViewModelList.ForEach(x => |
| | | { |
| | | var calcuResult = allCalcuResultList.Find(t => t.Code == x.Code); |
| | | if (calcuResult != null) |
| | | { |
| | | x.UpdateCalcuProperty(calcuResult); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //获取可见视图 |
| | | private HydroVisualViewModel GetVisualViewModel(Yw.Model.HydroVisualInfo visual) |
| | | { |
| | | if (visual == null) |
| | | { |
| | | return default; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | return allVisualViewModelList?.Find(x => x.Code == visual.Code); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 选择构件 |
| | | |
| | | //选择构件 |
| | | private Yw.Model.HydroVisualInfo _selectedVisual = null; |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region 构件明细 |
| | | |
| | | //构件明细控件 |
| | | private Yw.WinFrmUI.HydroVisualListCtrl _visualListCtrl = null; |
| | | |
| | | //获取构件明细控件 |
| | | private Yw.WinFrmUI.HydroVisualListCtrl GetVisualListCtrl() |
| | | { |
| | | if (_visualListCtrl == null) |
| | | { |
| | | _visualListCtrl = new HydroVisualListCtrl(); |
| | | _visualListCtrl.Dock = DockStyle.Fill; |
| | | _visualListCtrl.HydroClickInfoEvent += async (visual) => |
| | | { |
| | | ShowSelectedProperty(visual); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponent(_selectedVisual?.Code); |
| | | }; |
| | | _visualListCtrl.HydroChangedInfoEvent += (visualList) => |
| | | { |
| | | UpdateSelectedProperty(); |
| | | AutoApplyGrading(); |
| | | }; |
| | | } |
| | | return _visualListCtrl; |
| | | } |
| | | |
| | | //构件明细控件是否可见 |
| | | private bool IsVisualListCtrlVisible |
| | | { |
| | | get |
| | | { |
| | | if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | if (this.controlContainerBottom.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerBottom.Controls[0] is HydroVisualListCtrl) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //显示构件明细控件 |
| | | private void ShowVisualListCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (IsVisualListCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | var visualListCtrl = GetVisualListCtrl(); |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | visualListCtrl.SetBindingData(allVisualViewModelList); |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | if (allCalcuResultList == null || allCalcuResultList.Count < 1) |
| | | { |
| | | visualListCtrl.SetNormalView(); |
| | | } |
| | | else |
| | | { |
| | | visualListCtrl.SetCalcuView(); |
| | | } |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(visualListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "构件明细"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | |
| | | //更新构件明细控件 |
| | | private void UpdateVisualListCtrl() |
| | | { |
| | | if (!IsVisualListCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | | _visualListCtrl?.UpdateBindingData(); |
| | | } |
| | | |
| | | //构件明细 |
| | | private void barBtnHydroVisualList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowVisualListCtrl(); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | var elementIds = new List<string>(); |
| | | if (string.IsNullOrEmpty(code)) |
| | | { |
| | | _parter = null; |
| | | _selectedVisual = null; |
| | | } |
| | | else |
| | | { |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _parter = allParterList?.Find(x => x.Code == code); |
| | | if (_parter != null) |
| | | var allParterList = _hydroInfo.GetAllVisuals(); |
| | | _selectedVisual = allParterList?.Find(x => x.Code == code); |
| | | if (_selectedVisual != null) |
| | | { |
| | | elementIds.Add(_parter.Code); |
| | | elementIds.Add(_selectedVisual.Code); |
| | | } |
| | | } |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowProperty(); |
| | | SetBimfaceLinkColor(); |
| | | ShowSelectedProperty(); |
| | | }; |
| | | } |
| | | return _checkCtrl; |
| | | } |
| | | |
| | | //显示校验控件 |
| | | //显示检查控件 |
| | | private void ShowCheckCtrl() |
| | | { |
| | | if (_checkResult == null) |
| | |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(checkCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "校验结果"; |
| | | this.docPnlBottom.Text = "检查结果"; |
| | | this.docPnlBottom.Height = 350; |
| | | |
| | | } |
| | | |
| | | //水力验证 |
| | | //水力检查 |
| | | private void barBtnHydroCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | |
| | | 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导出 |
| | | |
| | | //导出水力INP文件 |
| | | private void barBtnHydroExportInp_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var fileName = Yw.WinFrmUI.FileDialogHelper.SaveInp("导出Inp文件"); |
| | | if (string.IsNullOrEmpty(fileName)) |
| | | { |
| | | return; |
| | | } |
| | | var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo); |
| | | var result = netWork.ToInpString(); |
| | | File.WriteAllText(fileName, result); |
| | | TipFormHelper.ShowSucceed("导出成功"); |
| | | } |
| | | |
| | | #endregion INP导出 |
| | | |
| | | #region 配置 |
| | | |
| | | //显示RadialMenu |
| | | private void barBtnSetList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | this.rmSet.ShowPopup(MousePosition, true); |
| | | } |
| | | |
| | | #endregion 配置 |
| | | |
| | | #region 性能曲线 |
| | | |
| | | //性能曲线 |
| | | private void barBtnFeatCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | //if (_calcuResult == null) |
| | | //{ |
| | | // return; |
| | | //} |
| | | //if (!_calcuResult.Succeed) |
| | | //{ |
| | | // return; |
| | | //} |
| | | var pumps = _hydroInfo.Pumps?.Where(x => x.LinkStatus == Yw.Hydro.LinkStatus.Open).ToList(); |
| | | |
| | | var curve_list = _hydroInfo.Curves; |
| | | if (curve_list == null || !curve_list.Any()) |
| | | { |
| | | return; |
| | | } |
| | | var vmList = new List<Yw.WinFrmUI.Phart.PumpSerialParallelViewModel>(); |
| | | 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 Yw.Geometry.Point2d(x.X, x.Y)).ToList(); |
| | | var qe_pt_list = qe?.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); |
| | | var qp_pt_list = qp?.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); |
| | | |
| | | var vm = new Yw.WinFrmUI.Phart.PumpSerialParallelViewModel(); |
| | | vm.Id = x.Code; |
| | | vm.Name = x.Name; |
| | | //vm.IsBp = ; |
| | | vm.RatedSpeed = rated_speed; |
| | | vm.CurrentSpeed = Math.Round(rated_speed * speed_ratio); |
| | | vm.CurrentHz = Math.Round(vm.CurrentSpeed / vm.RatedSpeed * 50, 1); |
| | | |
| | | vm.Qh = new Yw.Geometry.CubicSpline2d(qh_pt_list); |
| | | vm.Qe = new Yw.Geometry.CubicSpline2d(qe_pt_list); |
| | | vm.Qp = new Yw.Geometry.CubicSpline2d(qp_pt_list); |
| | | vmList.Add(vm); |
| | | } |
| | | |
| | | var dlg = new HStation.WinFrmUI.PhartRelation.PumpSerialParallelChartDlg(); |
| | | dlg.SetBindingData(vmList, null, true); |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #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 void barBtnHydroCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | 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 |
| | | |
| | | |
| | | |
| | | |
| | | } |