| | |
| | | global using Yw.EPAnet; |
| | | using DevExpress.Diagram.Core.Native; |
| | | using DevExpress.Mvvm.Native; |
| | | using DevExpress.Xpo.Helpers; |
| | | using DevExpress.XtraRichEdit.Layout; |
| | | using DevExpress.XtraSpreadsheet.Commands; |
| | | using HStation.WinFrmUI.PhartRelation; |
| | | using NPOI.SS.Formula.Functions; |
| | | using System.Diagnostics; |
| | | using System.Windows.Media.Media3D; |
| | | using Yw.Pump; |
| | | using Yw.Model; |
| | | using Yw.Vmo; |
| | | using Yw.WinFrmUI.Bimface; |
| | | using Yw.WinFrmUI.Hydro; |
| | | |
| | | namespace HStation.WinFrmUI |
| | | { |
| | |
| | | private Yw.Model.HydroModelInfo _hydroInfo = null;//水力信息 |
| | | |
| | | |
| | | private Yw.WinFrmUI.HydroCheckResult _checkResult = null;//检查结果 |
| | | private Yw.EPAnet.CalcuResult _calcuResult = null;//计算结果 |
| | | |
| | | /// <summary> |
| | | /// 绑定数据 |
| | |
| | | ShowBimfaceCtrl(); |
| | | ShowQ3dCtrl(); |
| | | ShowPropertyCtrl(); |
| | | } |
| | | |
| | | //初始化UI |
| | | private async void InitialUI() |
| | | { |
| | | var workingTupleHelper = GetWorkingTupleHelper(); |
| | | var allWorkingList = await workingTupleHelper.GetWorkingList(); |
| | | InitialUIWorkingList(allWorkingList); |
| | | var working = allWorkingList?.LastOrDefault(); |
| | | SetUIWorking(working); |
| | | } |
| | | |
| | | |
| | | #region Bimface |
| | | #region BIM控件 |
| | | |
| | | //bimface控件 |
| | | private XhsProjectSimulationBimfaceCtrl _bimfaceCtrl = null; |
| | |
| | | //获取 bimface 控件 |
| | | private async Task<XhsProjectSimulationBimfaceCtrl> GetBimfaceCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_bimfaceCtrl == null) |
| | | { |
| | | _bimfaceCtrl = new XhsProjectSimulationBimfaceCtrl(); |
| | | _bimfaceCtrl.Dock = DockStyle.Fill; |
| | | await _bimfaceCtrl.InitialData(_project, _projectSite, () => _hydroInfo); |
| | | await _bimfaceCtrl.InitialData(_project, _projectSite); |
| | | _bimfaceCtrl.LoadCompletedEvent += () => |
| | | {//view加载完成事件 |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | ApplyGrading(); |
| | | InitialUI(); |
| | | }; |
| | | _bimfaceCtrl.HydroMouseLeftClickEvent += (obj) => |
| | | _bimfaceCtrl.HydroMouseLeftClickEvent += (code) => |
| | | {//鼠标左键点击事件 |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | _selectedParter = obj; |
| | | ShowProperty(); |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visual = visualListHelper.GetVisual(code); |
| | | SelectVisual(visual, eVisualSource.Bimface); |
| | | }; |
| | | } |
| | | return _bimfaceCtrl; |
| | |
| | | this.tabPageBimface.Controls.Add(bimfaceCtrl); |
| | | } |
| | | |
| | | private void SelectBimfaceParter() |
| | | { |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Q3d |
| | | #region Q3d控件 |
| | | |
| | | //Q3d 控件 |
| | | private XhsProjectSimulationQ3dCtrl _q3dCtrl = null; |
| | |
| | | //获取 Q3d 控件 |
| | | private XhsProjectSimulationQ3dCtrl GetQ3dCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_q3dCtrl == null) |
| | | { |
| | | _q3dCtrl = new XhsProjectSimulationQ3dCtrl(); |
| | | _q3dCtrl.Dock = DockStyle.Fill; |
| | | _q3dCtrl.InitialData(() => _hydroInfo); |
| | | _q3dCtrl.SelectedPartersChangedEvent += (obj) => |
| | | _q3dCtrl.SelectedPartersChangedEvent += (codes) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _selectedParter = allParterList?.Find(x => x.Code == obj?.FirstOrDefault()); |
| | | ShowProperty(); |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visuals = visualListHelper.GetVisualList(codes); |
| | | SelectVisual(visuals?.LastOrDefault(), eVisualSource.Q3d); |
| | | }; |
| | | } |
| | | return _q3dCtrl; |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 构件属性 |
| | | #region 属性控件 |
| | | |
| | | //属性控件 |
| | | private XhsProjectSimulationPropertyCtrl _propertyCtrl = null; |
| | |
| | | //获取属性控件 |
| | | private XhsProjectSimulationPropertyCtrl GetPropertyCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_propertyCtrl == null) |
| | | { |
| | | _propertyCtrl = new XhsProjectSimulationPropertyCtrl(); |
| | | _propertyCtrl.Dock = DockStyle.Fill; |
| | | _propertyCtrl.InitialData(() => _hydroInfo, () => GetCalcuResultList()); |
| | | _propertyCtrl.BlinkLinkParterEvent += async (code, linkCode) => |
| | | { //强调连接组件 |
| | | if (string.IsNullOrEmpty(code)) |
| | | _propertyCtrl.HydroViewEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Property); |
| | | }; |
| | | _propertyCtrl.BlinkLinkNodeEvent += async (link, linkNodeCode) => |
| | | { //强调连接节点 |
| | | if (link == null) |
| | | { |
| | | return; |
| | | } |
| | | if (string.IsNullOrEmpty(linkCode)) |
| | | { |
| | | return; |
| | | } |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualList = _hydroInfo.GetAllVisuals(); |
| | | if (allVisualList == null || allVisualList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var linkParter = allVisualList.Find(x => x.Code == linkCode); |
| | | if (linkParter == null) |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var linkNode = visualListHelper.GetVisual(linkNodeCode); |
| | | if (linkNode == null) |
| | | { |
| | | return; |
| | | } |
| | | var blinkCodes = new List<string>(); |
| | | if (linkParter.GetType() == typeof(Yw.Model.HydroJunctionInfo)) |
| | | if (linkNode.GetType() == typeof(HydroJunctionInfo)) |
| | | { |
| | | var allLinkList = _hydroInfo.GetAllLinks(); |
| | | var allLinkList = visualListHelper.GetLinkList(); |
| | | if (allLinkList == null || allLinkList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var linkList = allLinkList.Where(x => (x.StartCode == linkParter.Code || x.EndCode == linkParter.Code) && x.Code != code).ToList(); |
| | | var linkList = allLinkList.Where(x => (x.StartCode == linkNodeCode || x.EndCode == linkNodeCode) && x.Code != linkNodeCode).ToList(); |
| | | if (linkList == null || linkList.Count < 1) |
| | | { |
| | | return; |
| | |
| | | } |
| | | else |
| | | { |
| | | blinkCodes.Add(linkCode); |
| | | blinkCodes.Add(linkNodeCode); |
| | | } |
| | | |
| | | await _bimfaceCtrl?.ClearBlinkComponents(); |
| | | await _bimfaceCtrl?.SetBlinkComponents(blinkCodes); |
| | | await Task.Delay(5000); |
| | | await _bimfaceCtrl?.ClearBlinkComponents(); |
| | | }; |
| | | _propertyCtrl.PropertyValueChangedEvent += (parter) => |
| | | _propertyCtrl.PropertyValueChangedEvent += async (visual) => |
| | | { |
| | | if (parter == null) |
| | | if (visual == null) |
| | | { |
| | | return; |
| | | } |
| | | UpdateParterListProperty(parter); |
| | | AutoApplyGrading(); |
| | | UpdateVisualListCtrl(); |
| | | var gradingHelper = await GetGradingHelper(); |
| | | gradingHelper.Set(); |
| | | }; |
| | | _propertyCtrl.ViewParterEvent += (parter) => |
| | | _propertyCtrl.MarkPropertyValueChangedEvent += async (visual) => |
| | | { |
| | | if (parter == null) |
| | | { |
| | | return; |
| | | } |
| | | _bimfaceCtrl?.ZoomToComponent(parter.Code); |
| | | //标注属性发生改变 |
| | | //判断当前是否有标注展示,若有则更新标注,最好是更新单个标注 |
| | | var markHelper = await GetMarkHelper(); |
| | | markHelper.Set(visual); |
| | | }; |
| | | _propertyCtrl.GradingPropertyValueChangedEvent += async (visual) => |
| | | { |
| | | //分级属性发生改变 |
| | | //判断当前是否有分级展示,若有则更新分级,最好是更新单个分级 |
| | | var gradingHelper = await GetGradingHelper(); |
| | | gradingHelper.Set(visual); |
| | | }; |
| | | _propertyCtrl.FlowEffectPropertyValueChangedEvent += async (visual) => |
| | | { |
| | | //流向属性发生改变 |
| | | //判断流向是否加载,如果加载则更新流向,最好是更新单个流向 |
| | | var flowEffectHelper = await GetFlowEffectHelper(); |
| | | flowEffectHelper.Set(visual); |
| | | }; |
| | | |
| | | } |
| | | 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 ShowProperty() |
| | | //设置属性控件 |
| | | private async void SetPropertyCtrl(HydroVisualInfo visual) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (this.docPnlRight.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Hidden) |
| | | { |
| | | ShowPropertyCtrl(); |
| | | } |
| | | if (_selectedParter == null) |
| | | { |
| | | _propertyCtrl?.CancelSelectParter(); |
| | | return; |
| | | } |
| | | _propertyCtrl?.SelectParter(_selectedParter.Code); |
| | | |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | if (allCalcuResultList != null && allCalcuResultList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList.Find(x => x.Code == _selectedParter.Code); |
| | | if (calcuResult != null) |
| | | { |
| | | _propertyCtrl?.UpdateCalcuProperty(calcuResult); |
| | | } |
| | | } |
| | | ShowPropertyCtrl(); |
| | | var visualVmListHelper = await GetVisualVmListHelper(); |
| | | var vm = visualVmListHelper.GetVisual(visual); |
| | | _propertyCtrl.SelectedObject = vm; |
| | | } |
| | | |
| | | //更新属性控件 |
| | | private void UpdatePropertyCtrl() |
| | | { |
| | | _propertyCtrl?.UpdateRows(); |
| | | } |
| | | |
| | | //清理属性控件 |
| | | private void ClearPropertyCtrl() |
| | | { |
| | | if (_propertyCtrl != null) |
| | | { |
| | | _propertyCtrl.SelectedObject = null; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 选择构件 |
| | | |
| | | //可见来源 |
| | | protected enum eVisualSource |
| | | { |
| | | None, |
| | | Bimface, |
| | | Q3d, |
| | | Property, |
| | | List, |
| | | Search, |
| | | Monitor, |
| | | Check, |
| | | Calcu, |
| | | Warning, |
| | | } |
| | | |
| | | //选择构件 |
| | | private Yw.Model.HydroParterInfo _selectedParter = null; |
| | | private Yw.Model.HydroVisualInfo _visual = null; |
| | | |
| | | //更新选择组件属性 |
| | | private void UpdateSelectedParterProperty() |
| | | //选择构件 |
| | | private void SelectVisual(HydroVisualInfo visual, eVisualSource source) |
| | | { |
| | | if (_selectedParter == null) |
| | | _visual = visual; |
| | | switch (source) |
| | | { |
| | | return; |
| | | case eVisualSource.None: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Bimface: |
| | | { |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Q3d: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Property: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | } |
| | | break; |
| | | case eVisualSource.List: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Search: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Monitor: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Check: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Calcu: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Warning: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | _propertyCtrl?.UpdateProperty(); |
| | | } |
| | | |
| | | //更新选择组件计算属性 |
| | | private void UpdateSelectedParterCalcuProperty() |
| | | #endregion |
| | | |
| | | #region 构件明细 |
| | | |
| | | #region 可见列表 |
| | | |
| | | //可见列表辅助类 |
| | | private SimulationVisualListHelper _visualListHelper = null; |
| | | |
| | | //获取可见列表辅助类 |
| | | private SimulationVisualListHelper GetVisualListHelper() |
| | | { |
| | | if (_selectedParter == null) |
| | | if (_visualListHelper == null) |
| | | { |
| | | return; |
| | | _visualListHelper = new SimulationVisualListHelper(); |
| | | _visualListHelper.InitialData(_hydroInfo); |
| | | } |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | if (allCalcuResultList == null || allCalcuResultList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var calcuResult = allCalcuResultList.Find(x => x.Code == _selectedParter.Code); |
| | | if (calcuResult == null) |
| | | { |
| | | return; |
| | | } |
| | | _propertyCtrl?.UpdateCalcuProperty(calcuResult); |
| | | return _visualListHelper; |
| | | } |
| | | |
| | | //更新构件列表属性 |
| | | private void UpdateParterListProperty() |
| | | #endregion |
| | | |
| | | #region 视图列表 |
| | | |
| | | //可见视图列表辅助类 |
| | | private SimulationVisualVmListHelper _visualVmListHelper = null; |
| | | |
| | | //获取可见视图列表辅助类 |
| | | private async Task<SimulationVisualVmListHelper> GetVisualVmListHelper() |
| | | { |
| | | if (this.docPnlBottom.Visibility != DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | return default; |
| | | } |
| | | var parterListCtrl = this.controlContainerBottom.Controls[0] as Yw.WinFrmUI.HydroParterListCtrl; |
| | | if (parterListCtrl == null) |
| | | if (_visualVmListHelper == null) |
| | | { |
| | | return; |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var calcuResultHelper = await GetCalcuResultHelper(); |
| | | _visualVmListHelper = new SimulationVisualVmListHelper(visualListHelper, calcuResultHelper); |
| | | } |
| | | parterListCtrl.UpdateProperty(); |
| | | return _visualVmListHelper; |
| | | } |
| | | |
| | | //更新构件列表属性 |
| | | private void UpdateParterListProperty(Yw.Model.HydroParterInfo parter) |
| | | #endregion |
| | | |
| | | #region 明细控件 |
| | | |
| | | //构件明细控件 |
| | | private Yw.WinFrmUI.HydroVisualListCtrl _visualListCtrl = null; |
| | | |
| | | //获取构件明细控件 |
| | | private Yw.WinFrmUI.HydroVisualListCtrl GetVisualListCtrl() |
| | | { |
| | | if (this.docPnlBottom.Visibility != DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | if (_visualListCtrl == null) |
| | | { |
| | | return; |
| | | _visualListCtrl = new HydroVisualListCtrl(); |
| | | _visualListCtrl.Dock = DockStyle.Fill; |
| | | _visualListCtrl.HydroClickInfoEvent += (visual) => |
| | | { |
| | | |
| | | }; |
| | | _visualListCtrl.HydroChangedInfoEvent += (visualList) => |
| | | { |
| | | |
| | | }; |
| | | } |
| | | var parterListCtrl = this.controlContainerBottom.Controls[0] as Yw.WinFrmUI.HydroParterListCtrl; |
| | | if (parterListCtrl == null) |
| | | { |
| | | return; |
| | | } |
| | | parterListCtrl.UpdateProperty(parter); |
| | | return _visualListCtrl; |
| | | } |
| | | |
| | | //更新构件列表属性 |
| | | private void UpdateParterListProperty(List<Yw.Model.HydroParterInfo> parterList) |
| | | //构件明细控件是否可见 |
| | | private bool IsVisualListCtrlVisible |
| | | { |
| | | if (this.docPnlBottom.Visibility != DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | get |
| | | { |
| | | return; |
| | | 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; |
| | | } |
| | | var parterListCtrl = this.controlContainerBottom.Controls[0] as Yw.WinFrmUI.HydroParterListCtrl; |
| | | if (parterListCtrl == null) |
| | | { |
| | | return; |
| | | } |
| | | parterListCtrl.UpdateProperty(parterList); |
| | | } |
| | | |
| | | //更新构件列表计算属性 |
| | | private void UpdateParterListCalcuProperty() |
| | | //显示构件明细控件 |
| | | private async void ShowVisualListCtrl() |
| | | { |
| | | if (this.docPnlBottom.Visibility != DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var parterListCtrl = this.controlContainerBottom.Controls[0] as Yw.WinFrmUI.HydroParterListCtrl; |
| | | if (parterListCtrl == null) |
| | | var visualListCtrl = GetVisualListCtrl(); |
| | | if (!IsVisualListCtrlVisible) |
| | | { |
| | | return; |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(visualListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "构件明细"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | parterListCtrl.UpdateCalcuProperty(allCalcuResultList); |
| | | var visualVmListHelper = await GetVisualVmListHelper(); |
| | | var allVisualVmList = visualVmListHelper.GetVisualList(); |
| | | visualListCtrl.SetBindingData(allVisualVmList); |
| | | var calcuResult = await GetCalcuResult(); |
| | | if (calcuResult != null && calcuResult.Succeed) |
| | | { |
| | | visualListCtrl.SetCalcuView(); |
| | | } |
| | | else |
| | | { |
| | | visualListCtrl.SetNormalView(); |
| | | } |
| | | } |
| | | |
| | | //更新构件明细控件 |
| | | private void UpdateVisualListCtrl() |
| | | { |
| | | if (!IsVisualListCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | | _visualListCtrl?.UpdateBindingData(); |
| | | } |
| | | |
| | | //构件明细 |
| | | private void barBtnVisualList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowVisualListCtrl(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 构件显示 |
| | | |
| | | //构件可见辅助类 |
| | | private SimulationVisualVisibleHelper _visualVisibleHelper = null; |
| | | |
| | | //获取构件可见辅助类 |
| | | private async Task<SimulationVisualVisibleHelper> GetVisualVisibleHelper() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_visualVisibleHelper == null) |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var bimfaceCtrl = await GetBimfaceCtrl(); |
| | | _visualVisibleHelper = new SimulationVisualVisibleHelper(visualListHelper, bimfaceCtrl); |
| | | _visualVisibleHelper.InitialData(_hydroInfo); |
| | | } |
| | | return _visualVisibleHelper; |
| | | } |
| | | |
| | | //设置构件可见性 |
| | | private async void SetVisualVisible() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var visualVisibleHelper = await GetVisualVisibleHelper(); |
| | | var allVisibleList = visualVisibleHelper.Items; |
| | | var dlg = new SetHydroVisualVisibleDlg(); |
| | | dlg.SetBindingData(allVisibleList); |
| | | dlg.ReloadDataEvent += (list) => |
| | | { |
| | | visualVisibleHelper.Items = list; |
| | | visualVisibleHelper.Set(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //设置构件显示 |
| | | private void barBtnSetVisualVisible_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | SetVisualVisible(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _selectedParter = allParterList?.Find(x => x.Code == code); |
| | | var allParterList = _hydroInfo.GetAllVisuals(); |
| | | _visual = allParterList?.Find(x => x.Code == code); |
| | | var elementIds = new List<string>(); |
| | | if (_selectedParter != null) |
| | | if (_visual != null) |
| | | { |
| | | elementIds.Add(_selectedParter.Code); |
| | | elementIds.Add(_visual.Code); |
| | | } |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowProperty(); |
| | | //ShowSelectedProperty(); |
| | | }; |
| | | _matchingListCtrl.ApplyMatchingEvent += (output) => |
| | | { |
| | |
| | | } |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | var matchingListCtrl = GetMatchingListCtrl(); |
| | | var input = AssetsMatchingParasHelper.Create(_hydroInfo, GetCalcuResultList()); |
| | | var input = AssetsMatchingParasHelper.Create(_hydroInfo, null); |
| | | matchingListCtrl.SetBindingData(input); |
| | | this.controlContainerBottom.Controls.Add(matchingListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 未匹配列表 |
| | | #region 未匹列表 |
| | | |
| | | //获取未匹配列表控件 |
| | | private XhsProjectSimulationUnMatchingListCtrl GetUnMatchingListCtrl() |
| | |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _selectedParter = allParterList?.Find(x => x.Code == parter.Code); |
| | | var allParterList = _hydroInfo.GetAllVisuals(); |
| | | _visual = allParterList?.Find(x => x.Code == parter.Code); |
| | | var elementIds = new List<string>() { parter.Code }; |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowProperty(); |
| | | //ShowSelectedProperty(); |
| | | }; |
| | | _unMatchingListCtrl.ViewModelEvent += async (parters) =>//查看模型 |
| | | { |
| | | var codes = parters?.Select(x => x.Code).Distinct().ToList(); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(codes); |
| | | _selectedParter = null; |
| | | ShowProperty(); |
| | | _visual = null; |
| | | //ShowSelectedProperty(); |
| | | }; |
| | | } |
| | | return _unMatchingListCtrl; |
| | |
| | | |
| | | #region 一键显隐 |
| | | |
| | | //一键显隐 |
| | | private async Task FastShowHidden() |
| | | //设置装饰件可见性 |
| | | private async void SetDecoratorVisible(bool isDecoratorVisible) |
| | | { |
| | | if (_hydroInfo == null) |
| | | var codes = _hydroInfo.Decorators?.Select(x => x.Code).Distinct().ToList(); |
| | | if (isDecoratorVisible) |
| | | { |
| | | return; |
| | | } |
| | | if (_hydroInfo.Decorators == null || _hydroInfo.Decorators.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | if (_fastShowHiddenCodeList == null) |
| | | { |
| | | _fastShowHiddenCodeList = _hydroInfo.Decorators.Select(x => x.Code).ToList(); |
| | | await _bimfaceCtrl?.HideComponents(_fastShowHiddenCodeList); |
| | | await _bimfaceCtrl?.ShowComponents(codes); |
| | | } |
| | | else |
| | | { |
| | | await _bimfaceCtrl?.ShowComponents(_fastShowHiddenCodeList); |
| | | _fastShowHiddenCodeList = null; |
| | | await _bimfaceCtrl?.HideComponents(codes); |
| | | } |
| | | } |
| | | |
| | | //显隐编码列表 |
| | | private List<string> _fastShowHiddenCodeList = null; |
| | | |
| | | //触发一键显隐 |
| | | private async void barBtnFastShowHidden_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //设置 |
| | | private void barCkDecorator_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | await FastShowHidden(); |
| | | SetDecoratorVisible(this.barCkDecorator.Checked); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 水力校验 |
| | | |
| | | //校验控件 |
| | | private XhsProjectSimulationHydroCheckResultCtrl _checkCtrl = null; |
| | | |
| | | //获取校验控件 |
| | | private XhsProjectSimulationHydroCheckResultCtrl GetCheckCtrl() |
| | | { |
| | | if (_checkCtrl == null) |
| | | { |
| | | _checkCtrl = new XhsProjectSimulationHydroCheckResultCtrl(); |
| | | _checkCtrl.Dock = DockStyle.Fill; |
| | | _checkCtrl.HydroClickEvent += async (code) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var elementIds = new List<string>(); |
| | | if (string.IsNullOrEmpty(code)) |
| | | { |
| | | _selectedParter = null; |
| | | } |
| | | else |
| | | { |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _selectedParter = allParterList?.Find(x => x.Code == code); |
| | | if (_selectedParter != null) |
| | | { |
| | | elementIds.Add(_selectedParter.Code); |
| | | } |
| | | } |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowProperty(); |
| | | }; |
| | | } |
| | | return _checkCtrl; |
| | | } |
| | | |
| | | //显示检查控件 |
| | | private void ShowCheckCtrl() |
| | | { |
| | | if (_checkResult == null) |
| | | { |
| | | return; |
| | | } |
| | | var checkCtrl = GetCheckCtrl(); |
| | | checkCtrl.SetBindingData(_checkResult); |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(checkCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "检查结果"; |
| | | this.docPnlBottom.Height = 350; |
| | | |
| | | } |
| | | |
| | | //水力检查 |
| | | private void barBtnHydroCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | _checkResult = _hydroInfo.Check(); |
| | | ShowCheckCtrl(); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region 保存信息 |
| | | |
| | |
| | | |
| | | #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) => |
| | | { |
| | | _selectedParter = parter; |
| | | await _bimfaceCtrl?.ZoomAndSelectComponent(_selectedParter.Code); |
| | | ShowProperty(); |
| | | }; |
| | | _parterListCtrl.HydroChangedEvent += (parterList) => |
| | | { |
| | | UpdateSelectedParterProperty(); |
| | | AutoApplyGrading(); |
| | | }; |
| | | } |
| | | return _parterListCtrl; |
| | | } |
| | | |
| | | //显示构件明细控件 |
| | | private void ShowParterListCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | var parterListCtrl = GetParterListCtrl(); |
| | | parterListCtrl.SetBindingData(_hydroInfo, allCalcuResultList); |
| | | if (allCalcuResultList == null || allCalcuResultList.Count < 1) |
| | | { |
| | | parterListCtrl.SetNormalView(); |
| | | } |
| | | else |
| | | { |
| | | parterListCtrl.SetCalcuView(); |
| | | } |
| | | 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 批量配置 |
| | | |
| | | //注册批量配置事件 |
| | |
| | | //水箱 |
| | | 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) => |
| | | { |
| | | //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(); |
| | | //}; |
| | | //dlg.ShowDialog(); |
| | | }; |
| | | //连接节点 |
| | | this.barBtnSetJunctionList.ItemClick += delegate |
| | |
| | | //闷头 |
| | | 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) => |
| | | { |
| | | //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(); |
| | | //}; |
| | | //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) => |
| | | { |
| | | //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(); |
| | | //}; |
| | | //dlg.ShowDialog(); |
| | | }; |
| | | //三通 |
| | | this.barBtnSetThreelinkList.ItemClick += delegate |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 并联分析 |
| | | #region 构件查询 |
| | | |
| | | //查询组件 |
| | | private HydroVisualSearchListCtrl _searchCtrl = null; |
| | | |
| | | //获取查询组件 |
| | | private async Task<HydroVisualSearchListCtrl> GetSearchCtrl() |
| | | { |
| | | if (_searchCtrl == null) |
| | | { |
| | | var visualVmListHelper = await GetVisualVmListHelper(); |
| | | var allVisualVmList = visualVmListHelper.GetVisualList(); |
| | | _searchCtrl = new HydroVisualSearchListCtrl(); |
| | | _searchCtrl.Dock = DockStyle.Fill; |
| | | _searchCtrl.InitialData(allVisualVmList); |
| | | _searchCtrl.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Check); |
| | | }; |
| | | _searchCtrl.HydroSearchInfoEvent += (list) => |
| | | { |
| | | var visual = list?.FirstOrDefault(); |
| | | SelectVisual(visual, eVisualSource.Search); |
| | | }; |
| | | } |
| | | 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 async void ShowSearchCtrl(string content) |
| | | { |
| | | if (IsSearchCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | | var searchCtrl = await 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 SimulationMarkHelper _markHelper = null; |
| | | |
| | | //获取标注辅助类 |
| | | private async Task<SimulationMarkHelper> GetMarkHelper() |
| | | { |
| | | if (_markHelper == null) |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var bimfaceCtrl = await GetBimfaceCtrl(); |
| | | _markHelper = new SimulationMarkHelper(visualListHelper, bimfaceCtrl); |
| | | } |
| | | return _markHelper; |
| | | } |
| | | |
| | | //显示标注列表 |
| | | private async void ShowMarkList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var markHelper = await GetMarkHelper(); |
| | | var dlg = new SetHydroMarkDlg(); |
| | | dlg.SetBindingData(markHelper.Sets); |
| | | dlg.ReloadDataEvent += (list) => |
| | | { |
| | | markHelper.Sets = list; |
| | | markHelper.Set(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //设置标注 |
| | | private void barBtnSetMark_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowMarkList(); |
| | | } |
| | | |
| | | //是否显示 |
| | | private async void barCkMark_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var markHelper = await GetMarkHelper(); |
| | | markHelper.Visible = this.barCkMark.Checked; |
| | | markHelper.Set(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 颜色分级 |
| | | |
| | | //颜色分级辅助类 |
| | | private SimulationGradingHelper _gradingHelper = null; |
| | | |
| | | //获取颜色分级辅助类 |
| | | private async Task<SimulationGradingHelper> GetGradingHelper() |
| | | { |
| | | if (_gradingHelper == null) |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var calcuResultHelper = await GetCalcuResultHelper(); |
| | | var bimfaceCtrl = await GetBimfaceCtrl(); |
| | | _gradingHelper = new SimulationGradingHelper(visualListHelper, calcuResultHelper, bimfaceCtrl); |
| | | } |
| | | return _gradingHelper; |
| | | } |
| | | |
| | | //设置颜色分级列表 |
| | | private async void SetGradingList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var gradingHelper = await GetGradingHelper(); |
| | | var allGradingList = await gradingHelper.GetGradingList(); |
| | | var dlg = new SetHydroGradingTreeDlg(); |
| | | dlg.SetBindingData(_hydroInfo, allGradingList); |
| | | dlg.ReloadDataEvent += (list) => |
| | | { |
| | | gradingHelper.SetGradingList(list); |
| | | gradingHelper.Set(); |
| | | }; |
| | | dlg.ApplyDataEvent += (catalog, propName) => |
| | | { |
| | | gradingHelper.UpdateApply(catalog, propName); |
| | | gradingHelper.Set(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //配置颜色分级 |
| | | private void barBtnSetGradingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | SetGradingList(); |
| | | } |
| | | |
| | | //应用颜色分级列表 |
| | | private async void ApplyGradingList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var gradingHelper = await GetGradingHelper(); |
| | | var dlg = new ApplyHydroGradingDlg(); |
| | | dlg.SetBindingData(gradingHelper.Applies); |
| | | dlg.ReloadDataEvent += (list) => |
| | | { |
| | | gradingHelper.Applies = list; |
| | | gradingHelper.Set(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //应用颜色分级 |
| | | private void barBtnApplyGradingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ApplyGradingList(); |
| | | } |
| | | |
| | | //颜色分级展示 |
| | | private async void barCkGrading_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var gradingHelper = await GetGradingHelper(); |
| | | gradingHelper.Visible = this.barCkGrading.Checked; |
| | | gradingHelper.Set(); |
| | | } |
| | | |
| | | #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); |
| | | _visual = null; |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(null); |
| | | //ShowSelectedProperty(); |
| | | TipFormHelper.ShowSucceed("数据已刷新"); |
| | | |
| | | var visualListHelper = GetVisualListHelper(); |
| | | visualListHelper.InitialData(_hydroInfo); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 水流动画 |
| | | |
| | | //水流动画辅助类 |
| | | private SimulationFlowEffectHelper _flowEffectHelper = null; |
| | | |
| | | //获取水流动画辅助类 |
| | | private async Task<SimulationFlowEffectHelper> GetFlowEffectHelper() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_flowEffectHelper == null) |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var bimfaceCtrl = await GetBimfaceCtrl(); |
| | | _flowEffectHelper = new SimulationFlowEffectHelper(visualListHelper, bimfaceCtrl); |
| | | var calcuResult = await GetCalcuResult(); |
| | | _flowEffectHelper.InitialData(calcuResult); |
| | | } |
| | | return _flowEffectHelper; |
| | | } |
| | | |
| | | //水流动画是否可见 |
| | | private async void barCkFlowEffect_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var flowEffectHelper = await GetFlowEffectHelper(); |
| | | flowEffectHelper.Visible = this.barCkFlowEffect.Checked; |
| | | flowEffectHelper.Set(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 监测列表 |
| | | |
| | | #region 监测点 |
| | | |
| | | //监测点辅助类 |
| | | private SimulationMonitorHelper _monitorHelper = null; |
| | | |
| | | //获取监测点辅助类 |
| | | private SimulationMonitorHelper GetMonitorHelper() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_monitorHelper == null) |
| | | { |
| | | _monitorHelper = new SimulationMonitorHelper(_hydroInfo.ID); |
| | | } |
| | | return _monitorHelper; |
| | | } |
| | | |
| | | //设置监测点列表 |
| | | private async void SetMonitorList(HydroVisualInfo visual) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var monitorHelper = GetMonitorHelper(); |
| | | var allMonitorList = await monitorHelper.Get(); |
| | | var dlg = new SetHydroMonitorListDlg(); |
| | | dlg.SetBindingData(_hydroInfo, visual, allMonitorList); |
| | | dlg.ReloadDataEvent += async (list) => |
| | | { |
| | | var bol = await BLLFactory<Yw.BLL.HydroMonitor>.Instance.Save(_hydroInfo.ID, visual.Code, list); |
| | | if (!bol) |
| | | { |
| | | TipFormHelper.ShowError("设置失败!"); |
| | | return; |
| | | } |
| | | TipFormHelper.ShowSucceed("设置成功!"); |
| | | var monitorList = await monitorHelper.Update(visual.Code); |
| | | var monitorValueHelper = GetMonitorValueHelper(); |
| | | monitorValueHelper.Update(visual.Code, monitorList); |
| | | var monitorMarkerHelper = await GetMonitorMarkerHelper(); |
| | | monitorMarkerHelper.Update(visual.Code, monitorList); |
| | | monitorMarkerHelper.Set(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //设置监测点 |
| | | private void barBtnSetMonitor_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | SetMonitorList(_visual); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 监测值 |
| | | |
| | | //监测值辅助类 |
| | | private SimulationMonitorValueHelper _monitorValueHelper = null; |
| | | |
| | | //获取监测值辅助类 |
| | | private SimulationMonitorValueHelper GetMonitorValueHelper() |
| | | { |
| | | if (_monitorValueHelper == null) |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var monitorHelper = GetMonitorHelper(); |
| | | _monitorValueHelper = new SimulationMonitorValueHelper(visualListHelper, monitorHelper); |
| | | } |
| | | return _monitorValueHelper; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 监测值控件 |
| | | |
| | | //监测值列表控件 |
| | | private HydroMonitorValueListCtrl _monitorValueListCtrl = null; |
| | | |
| | | //获取监测值列表控件 |
| | | private HydroMonitorValueListCtrl GetMonitorValueListCtrl() |
| | | { |
| | | if (_monitorValueListCtrl == null) |
| | | { |
| | | _monitorValueListCtrl = new HydroMonitorValueListCtrl(); |
| | | _monitorValueListCtrl.Dock = DockStyle.Fill; |
| | | _monitorValueListCtrl.HydroViewEvent += (code) => |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visual = visualListHelper.GetVisual(code); |
| | | SelectVisual(visual, eVisualSource.Monitor); |
| | | }; |
| | | } |
| | | return _monitorValueListCtrl; |
| | | } |
| | | |
| | | //监测值列表控件是否可见 |
| | | private bool IsMonitorValueListCtrlVisible |
| | | { |
| | | get |
| | | { |
| | | if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | if (this.controlContainerBottom.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerBottom.Controls[0] is HydroMonitorValueListCtrl) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //显示监测值列表控件 |
| | | private async void ShowMonitorValueListCtrl() |
| | | { |
| | | var monitorValueListCtrl = GetMonitorValueListCtrl(); |
| | | if (!IsMonitorValueListCtrlVisible) |
| | | { |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(monitorValueListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "监测值"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | var monitorValueHelper = GetMonitorValueHelper(); |
| | | var allMonitorValueList = await monitorValueHelper.Get(); |
| | | monitorValueListCtrl.SetBindingData(allMonitorValueList); |
| | | } |
| | | |
| | | //设置监测值 |
| | | private void barBtnSetMonitorValue_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowMonitorValueListCtrl(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 监测点标记 |
| | | |
| | | //监测标记辅助类 |
| | | private SimulationMonitorMarkerHelper _monitorMarkerHelper = null; |
| | | |
| | | //获取监测标记辅助类 |
| | | private async Task<SimulationMonitorMarkerHelper> GetMonitorMarkerHelper() |
| | | { |
| | | if (_monitorMarkerHelper == null) |
| | | { |
| | | var monitorHelper = GetMonitorHelper(); |
| | | var bimfaceCtrl = await GetBimfaceCtrl(); |
| | | _monitorMarkerHelper = new SimulationMonitorMarkerHelper(monitorHelper, bimfaceCtrl); |
| | | } |
| | | return _monitorMarkerHelper; |
| | | } |
| | | |
| | | //显示状态改变 |
| | | private async void barCkMonitor_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var monitorMarkerHelper = await GetMonitorMarkerHelper(); |
| | | monitorMarkerHelper.Visible = this.barCkMonitor.Checked; |
| | | monitorMarkerHelper.Set(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | #region 模型检查 |
| | | |
| | | //检查控件 |
| | | private HydroCheckResultCtrl _checkCtrl = null; |
| | | |
| | | //获取检查控件 |
| | | private HydroCheckResultCtrl GetCheckCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_checkCtrl == null) |
| | | { |
| | | _checkCtrl = new HydroCheckResultCtrl(); |
| | | _checkCtrl.Dock = DockStyle.Fill; |
| | | _checkCtrl.HydroClickEvent += (code) => |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visual = visualListHelper.GetVisual(code); |
| | | SelectVisual(visual, eVisualSource.Check); |
| | | }; |
| | | } |
| | | return _checkCtrl; |
| | | } |
| | | |
| | | //检查控件是否可见 |
| | | private bool IsCheckCtrlVisible |
| | | { |
| | | get |
| | | { |
| | | if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | if (this.controlContainerBottom.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerBottom.Controls[0] is HydroCheckResultCtrl) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //显示检查控件 |
| | | private void ShowCheckCtrl(HydroCheckResult checkResult) |
| | | { |
| | | if (checkResult == null) |
| | | { |
| | | return; |
| | | } |
| | | var checkCtrl = GetCheckCtrl(); |
| | | if (!IsCheckCtrlVisible) |
| | | { |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(checkCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "检查结果"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | checkCtrl.SetBindingData(checkResult); |
| | | } |
| | | |
| | | //显示检查控件 |
| | | private async void ShowCheckCtrl() |
| | | { |
| | | var checkResult = await GetCheckResult(); |
| | | ShowCheckCtrl(checkResult); |
| | | } |
| | | |
| | | //检查 |
| | | private void barBtnCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var checkResult = _hydroInfo.Check(); |
| | | ShowCheckCtrl(checkResult); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 模型计算 |
| | | |
| | | #region 计算结果 |
| | | |
| | | //计算结果辅助类 |
| | | private SimulationCalcuResultHelper _calcuResultHelper = null; |
| | | |
| | | //获取计算结果辅助类 |
| | | private async Task<SimulationCalcuResultHelper> GetCalcuResultHelper() |
| | | { |
| | | if (_calcuResultHelper == null) |
| | | { |
| | | _calcuResultHelper = new SimulationCalcuResultHelper(); |
| | | var calcuResult = await GetCalcuResult(); |
| | | _calcuResultHelper.InitialData(calcuResult); |
| | | } |
| | | return _calcuResultHelper; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 计算失败 |
| | | |
| | | //计算失败控件 |
| | | private HydroCalcuFailedCtrl _calcuFailedCtrl = null; |
| | | |
| | | //获取计算失败控件 |
| | | private HydroCalcuFailedCtrl GetCalcuFailedCtrl() |
| | | { |
| | | if (_calcuFailedCtrl == null) |
| | | { |
| | | _calcuFailedCtrl = new HydroCalcuFailedCtrl(); |
| | | _calcuFailedCtrl.Dock = DockStyle.Fill; |
| | | } |
| | | return _calcuFailedCtrl; |
| | | } |
| | | |
| | | //计算失败控件是否可见 |
| | | private bool IsCalcuFailedCtrlVisible |
| | | { |
| | | get |
| | | { |
| | | if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | if (this.controlContainerBottom.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerBottom.Controls[0] is HydroCalcuFailedCtrl) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //显示计算失败控件 |
| | | private void ShowCalcuFailedCtrl(HydroCalcuResult calcuResult) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (calcuResult == null) |
| | | { |
| | | return; |
| | | } |
| | | if (calcuResult.Succeed) |
| | | { |
| | | return; |
| | | } |
| | | var calcuFailedCtrl = GetCalcuFailedCtrl(); |
| | | if (!IsCalcuFailedCtrlVisible) |
| | | { |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(calcuFailedCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "计算失败原因"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | calcuFailedCtrl.SetBindingData(calcuResult.FailedList); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 计算警告 |
| | | |
| | | //计算警告控件 |
| | | private HydroCalcuWarningCtrl _calcuWarningCtrl = null; |
| | | |
| | | //获取计算警告控件 |
| | | private HydroCalcuWarningCtrl GetCalcuWarningCtrl() |
| | | { |
| | | if (_calcuWarningCtrl == null) |
| | | { |
| | | _calcuWarningCtrl = new HydroCalcuWarningCtrl(); |
| | | _calcuWarningCtrl.Dock = DockStyle.Fill; |
| | | _calcuWarningCtrl.HydroClickEvent += (code) => |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visual = visualListHelper.GetVisual(code); |
| | | SelectVisual(visual, eVisualSource.Warning); |
| | | }; |
| | | } |
| | | return _calcuWarningCtrl; |
| | | } |
| | | |
| | | //计算警告控件是否可见 |
| | | private bool IsCalcuWarningCtrlVisible |
| | | { |
| | | get |
| | | { |
| | | if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | if (this.controlContainerBottom.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerBottom.Controls[0] is HydroCalcuWarningCtrl) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //显示计算警告控件 |
| | | private void ShowCalcuWarningCtrl(HydroCalcuResult calcuResult) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (calcuResult == null) |
| | | { |
| | | return; |
| | | } |
| | | if (!calcuResult.Succeed) |
| | | { |
| | | return; |
| | | } |
| | | var calcuWaringCtrl = GetCalcuWarningCtrl(); |
| | | if (!IsCalcuWarningCtrlVisible) |
| | | { |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(calcuWaringCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "计算警告"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var allVisualDict = visualListHelper.GetVisualDict(); |
| | | calcuWaringCtrl.SetBindingData(calcuResult.WainingList, allVisualDict); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 计算标签 |
| | | |
| | | //计算标签辅助类 |
| | | private SimulationCalcuResultLabelHelper _calcuResultLabelHelper = null; |
| | | |
| | | //获取计算标签辅助类 |
| | | private async Task<SimulationCalcuResultLabelHelper> GetCalcuResultLabelHelper() |
| | | { |
| | | if (_calcuResultLabelHelper == null) |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var calcuResultHelper = await GetCalcuResultHelper(); |
| | | var bimfaceCtrl = await GetBimfaceCtrl(); |
| | | _calcuResultLabelHelper = new SimulationCalcuResultLabelHelper(visualListHelper, calcuResultHelper, bimfaceCtrl); |
| | | } |
| | | return _calcuResultLabelHelper; |
| | | } |
| | | |
| | | //设置计算标签是否显示 |
| | | private async void barCkCalcu_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var calcuResultLabelHelper = await GetCalcuResultLabelHelper(); |
| | | calcuResultLabelHelper.Visible = this.barCkCalcu.Checked; |
| | | calcuResultLabelHelper.Set(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | #region 管网修复 |
| | | |
| | | //修复管网 |
| | | private async void Repair() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var checkResult = _hydroInfo.Check(); |
| | | if (!checkResult.Succeed) |
| | | { |
| | | ShowCheckCtrl(checkResult); |
| | | TipFormHelper.ShowWarn("检查失败导致无法进行试算,停止管网修复!"); |
| | | return; |
| | | } |
| | | var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.Simple); |
| | | if (!calcuResult.Succeed) |
| | | { |
| | | ShowCalcuFailedCtrl(calcuResult); |
| | | TipFormHelper.ShowWarn("试算失败,停止管网修复!"); |
| | | return; |
| | | } |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var allLinkList = visualListHelper.GetLinkList(); |
| | | if (allLinkList != null && allLinkList.Count < 1) |
| | | { |
| | | TipFormHelper.ShowError("模型中未包含管段信息,停止管网修复!"); |
| | | return; |
| | | } |
| | | int count = 0; |
| | | foreach (var link in allLinkList) |
| | | { |
| | | var calcuLink = calcuResult.LinkList?.Find(x => x.Code == link.Code); |
| | | if (calcuLink == null) |
| | | { |
| | | continue; |
| | | } |
| | | if (!calcuLink.CalcuFlow.HasValue) |
| | | { |
| | | continue; |
| | | } |
| | | if (calcuLink.CalcuFlow.Value < 0) |
| | | { |
| | | var tempCode = link.StartCode; |
| | | link.StartCode = link.EndCode; |
| | | link.EndCode = tempCode; |
| | | count++; |
| | | } |
| | | } |
| | | var visualVmListHelper = await GetVisualVmListHelper(); |
| | | visualVmListHelper.UpdateProperty(); |
| | | UpdateVisualListCtrl(); |
| | | UpdatePropertyCtrl(); |
| | | TipFormHelper.ShowSucceed($"修复完成,共修复管段({count})个!"); |
| | | } |
| | | |
| | | //管网修复 |
| | | private void barBtnRepair_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | Repair(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 导出INP |
| | | |
| | | //导出INP文件 |
| | | private void barBtnExportInp_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var fileName = 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 |
| | | |
| | | #region 并联计算 |
| | | |
| | | //并联分析 |
| | | private void barBtnAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | private void ParallelAnalysis() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var pumps = _hydroInfo.Pumps; |
| | | if (pumps == null || pumps.Count < 1) |
| | | { |
| | | XtraMessageBox.Show("无水泵信息"); |
| | | return; |
| | | } |
| | | var vmList = new List<XhsSinglePumpViewModel>(); |
| | | foreach (var pump in 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, 1); |
| | | vm.CurveQH = qhPtList; |
| | | vm.CurveQE = qePtList; |
| | | vm.CurveQP = qpPtList; |
| | | |
| | | } |
| | | |
| | | var dlg = new PumpParallelAnalyDlg(); |
| | | dlg.SetBindingData(vmList); |
| | | dlg.ReloadDataEvent += (list) => |
| | | { |
| | | list?.ForEach(x => |
| | | { |
| | | var pump = pumps.Find(t => t.Code == x.Code); |
| | | if (pump != null) |
| | | { |
| | | pump.LinkStatus = x.RunStatus ? Yw.Hydro.PumpStatus.Open : Yw.Hydro.PumpStatus.Closed; |
| | | pump.SpeedRatio = x.CurrentHz / pump.RatedHz; |
| | | } |
| | | }); |
| | | var codes = list?.Select(x => x.Code).ToList(); |
| | | //UpdateVisualViewModelProperty(codes); |
| | | //ShowSelectedProperty(); |
| | | UpdateVisualListCtrl(); |
| | | return true; |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //并联分析 |
| | | private void barBtnParallel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ParallelAnalysis(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 工况计算 |
| | | |
| | | //工况元组辅助类 |
| | | private SimulationWorkingTupleHelper _workingTupleHelper = null; |
| | | |
| | | //获取工况元组辅助类 |
| | | private SimulationWorkingTupleHelper GetWorkingTupleHelper() |
| | | { |
| | | if (_workingTupleHelper == null) |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | _workingTupleHelper = new SimulationWorkingTupleHelper(visualListHelper); |
| | | } |
| | | return _workingTupleHelper; |
| | | } |
| | | |
| | | //设置工况窗体 |
| | | private async void CalcuWorking() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var workingTupleHelper = GetWorkingTupleHelper(); |
| | | var allWorkingList = await workingTupleHelper.GetWorkingList(); |
| | | var monitorValueHelper = GetMonitorValueHelper(); |
| | | var allMonitorValueList = await monitorValueHelper.Get(); |
| | | var dlg = new SetHydroWorkingDlg(); |
| | | dlg.SetBindingData(_hydroInfo, allWorkingList, allMonitorValueList); |
| | | dlg.HydroViewEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Calcu); |
| | | }; |
| | | dlg.HydroCalcuEvent += async (working) => |
| | | { |
| | | var vmo = new HydroWorkingVmo(); |
| | | vmo.ModelID = _hydroInfo.ID; |
| | | vmo.Name = working.Name; |
| | | vmo.WorkingInfo = JsonHelper.Object2Json(working.WorkingInfo); |
| | | vmo.MonitorInfo = JsonHelper.Object2Json(working.MonitorInfo); |
| | | vmo.SortCode = allWorkingList.Count < 1 ? 1 : allWorkingList.Max(x => x.SortCode) + 1; |
| | | vmo.Description = working.Description; |
| | | vmo.ID = await BLLFactory<Yw.BLL.HydroWorking>.Instance.Insert(vmo); |
| | | if (vmo.ID < 1) |
| | | { |
| | | TipFormHelper.ShowError("创建工况失败,计算取消!"); |
| | | return; |
| | | } |
| | | |
| | | _hydroInfo.UpdateWorkingInfo(working.WorkingInfo); |
| | | |
| | | //校验 |
| | | var checkResult = _hydroInfo.Check(); |
| | | if (!checkResult.Succeed) |
| | | { |
| | | ShowCheckCtrl(checkResult); |
| | | workingTupleHelper.AppendTuple(vmo, checkResult, null); |
| | | SetUIWorking(vmo); |
| | | TipFormHelper.ShowError("校验失败,请检查后重试"); |
| | | } |
| | | else |
| | | { |
| | | WaitFormHelper.ShowWaitForm(this, "正在计算分析中,请稍候..."); |
| | | //await Task.Delay(3000); |
| | | var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss); |
| | | WaitFormHelper.HideWaitForm(); |
| | | workingTupleHelper.AppendTuple(vmo, checkResult, calcuResult); |
| | | if (calcuResult.Succeed) |
| | | { |
| | | if (calcuResult.WainingList != null && calcuResult.WainingList.Count > 0) |
| | | { |
| | | ShowCalcuWarningCtrl(calcuResult); |
| | | } |
| | | TipFormHelper.ShowSucceed("计算成功!"); |
| | | } |
| | | else |
| | | { |
| | | ShowCalcuFailedCtrl(calcuResult); |
| | | TipFormHelper.ShowError("计算失败!"); |
| | | } |
| | | } |
| | | AppendUIWorking(vmo); |
| | | SetUIWorking(vmo); |
| | | }; |
| | | |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //工况计算 |
| | | private void barBtnWorkingCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | CalcuWorking(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 工况分析 |
| | | |
| | | #region 当前工况 |
| | | |
| | | //当前工况 |
| | | private Yw.Vmo.HydroWorkingVmo _working = null; |
| | | |
| | | //获取检查结果 |
| | | private async Task<HydroCheckResult> GetCheckResult() |
| | | { |
| | | var workingTupleHelper = GetWorkingTupleHelper(); |
| | | return await workingTupleHelper.GetCheckResult(_working); |
| | | } |
| | | |
| | | //获取计算结果 |
| | | private async Task<HydroCalcuResult> GetCalcuResult() |
| | | { |
| | | var workingTupleHelper = GetWorkingTupleHelper(); |
| | | return await workingTupleHelper.GetCalcuResult(_working); |
| | | } |
| | | |
| | | //初始化UI工况列表 |
| | | private void InitialUIWorkingList(List<HydroWorkingVmo> allWorkingList) |
| | | { |
| | | this.repositoryItemImageComboBox1.Items.BeginUpdate(); |
| | | this.repositoryItemImageComboBox1.Items.Clear(); |
| | | if (allWorkingList != null && allWorkingList.Count > 0) |
| | | { |
| | | allWorkingList.ForEach(x => this.repositoryItemImageComboBox1.Items.Add(x.Name, x, -1)); |
| | | } |
| | | this.repositoryItemImageComboBox1.Items.EndUpdate(); |
| | | } |
| | | |
| | | //增加UI工况 |
| | | private void AppendUIWorking(HydroWorkingVmo working) |
| | | { |
| | | this.repositoryItemImageComboBox1.Items.BeginUpdate(); |
| | | this.repositoryItemImageComboBox1.Items.Add(working.Name, working, -1); |
| | | this.repositoryItemImageComboBox1.Items.EndUpdate(); |
| | | } |
| | | |
| | | //设置UI工况 |
| | | private void SetUIWorking(HydroWorkingVmo working) |
| | | { |
| | | this.barEditCurrentWorking.EditValue = working; |
| | | } |
| | | |
| | | //当前工况发生改变 |
| | | private async void barEditCurrentWorking_EditValueChanged(object sender, EventArgs e) |
| | | { |
| | | _working = this.barEditCurrentWorking.EditValue as HydroWorkingVmo; |
| | | var calcuResult = await GetCalcuResult(); |
| | | |
| | | //计算结果辅助类 |
| | | var calcuResultHelper = await GetCalcuResultHelper(); |
| | | calcuResultHelper.InitialData(calcuResult); |
| | | |
| | | //工况控件 |
| | | UpdateWorkingCtrl(); |
| | | SelectWorkingCtrl(_working); |
| | | |
| | | //可见视图列表 |
| | | var visualVmListHelper = await GetVisualVmListHelper(); |
| | | visualVmListHelper.UpdateCalcuProperty(calcuResult); |
| | | |
| | | //计算标签 |
| | | var calcuResultLabelHelper = await GetCalcuResultLabelHelper(); |
| | | calcuResultLabelHelper.Set(); |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 工况控件 |
| | | |
| | | //工况控件 |
| | | private HydroWorkingTreeCtrl _workingCtrl = null; |
| | | |
| | | //获取工况控件 |
| | | private HydroWorkingTreeCtrl GetWorkingCtrl() |
| | | { |
| | | if (_workingCtrl == null) |
| | | { |
| | | _workingCtrl = new HydroWorkingTreeCtrl(); |
| | | _workingCtrl.Dock = DockStyle.Fill; |
| | | _workingCtrl.HydroClickEvent += (working) => |
| | | { |
| | | SetUIWorking(working); |
| | | }; |
| | | } |
| | | return _workingCtrl; |
| | | } |
| | | |
| | | //工况控件是否可见 |
| | | private bool IsWorkingCtrlVisible |
| | | { |
| | | get |
| | | { |
| | | if (this.docPnlRight.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | if (this.controlContainerRight.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerRight.Controls[0] is HydroWorkingTreeCtrl) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //显示工况控件 |
| | | private async void ShowWorkingCtrl() |
| | | { |
| | | var workingCtrl = GetWorkingCtrl(); |
| | | if (!IsWorkingCtrlVisible) |
| | | { |
| | | this.controlContainerRight.Controls.Clear(); |
| | | this.controlContainerRight.Controls.Add(workingCtrl); |
| | | this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlRight.Text = "工况"; |
| | | this.docPnlRight.Width = 300; |
| | | } |
| | | var workingTupleHelper = GetWorkingTupleHelper(); |
| | | var allWorkingList = await workingTupleHelper.GetWorkingList(); |
| | | workingCtrl.SetBindingData(allWorkingList); |
| | | } |
| | | |
| | | //更新工况控件 |
| | | private async void UpdateWorkingCtrl() |
| | | { |
| | | if (!IsWorkingCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | | var workingTupleHelper = GetWorkingTupleHelper(); |
| | | var allWorkingList = await workingTupleHelper.GetWorkingList(); |
| | | var workingCtrl = GetWorkingCtrl(); |
| | | workingCtrl.SetBindingData(allWorkingList); |
| | | } |
| | | |
| | | //选择工况控件 |
| | | private void SelectWorkingCtrl(HydroWorkingVmo working) |
| | | { |
| | | if (IsWorkingCtrlVisible) |
| | | { |
| | | var workingCtrl = GetWorkingCtrl(); |
| | | workingCtrl.Select(working); |
| | | } |
| | | } |
| | | |
| | | //工况列表点击 |
| | | private void barBtnWorkingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowWorkingCtrl(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 工况评估 |
| | | |
| | | //评估 |
| | | private async void Evaluate() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_working == null) |
| | | { |
| | | TipFormHelper.ShowWarn("尚未计算,请计算后重试!"); |
| | | return; |
| | | } |
| | | var workingTupleHelper = GetWorkingTupleHelper(); |
| | | var checkResult = await workingTupleHelper.GetCheckResult(_working); |
| | | if (checkResult == null) |
| | | { |
| | | return; |
| | | } |
| | | if (!checkResult.Succeed) |
| | | { |
| | | ShowCheckCtrl(checkResult); |
| | | TipFormHelper.ShowWarn("检查失败,停止评估!"); |
| | | return; |
| | | } |
| | | var calcuResult = await workingTupleHelper.GetCalcuResult(_working); |
| | | if (calcuResult == null) |
| | | { |
| | | return; |
| | | } |
| | | if (!calcuResult.Succeed) |
| | | { |
| | | ShowCalcuFailedCtrl(calcuResult); |
| | | TipFormHelper.ShowWarn("计算失败,停止评估!"); |
| | | return; |
| | | } |
| | | if (calcuResult.WainingList != null && calcuResult.WainingList.Count > 0) |
| | | { |
| | | ShowCalcuWarningCtrl(calcuResult); |
| | | TipFormHelper.ShowWarn("请关注警告信息!"); |
| | | } |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var allVisualDict = visualListHelper.GetVisualDict(); |
| | | var monitorHelper = GetMonitorHelper(); |
| | | var allMonitorList = await monitorHelper.Get(); |
| | | var allWorkingMonitorList = JsonHelper.Json2Object<List<HydroWorkingMonitorViewModel>>(_working.MonitorInfo); |
| | | var allCalcuResultDict = calcuResult.GetVisualDict(); |
| | | var dlg = new HydroWorkingEvaluationDlg(); |
| | | dlg.SetBindingData(allVisualDict, allMonitorList, allWorkingMonitorList, allCalcuResultDict); |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //精度评估 |
| | | private void barBtnWorkingEvaluation_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | Evaluate(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 工况并联 |
| | | |
| | | //并联分析 |
| | | private async void barBtnAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | |
| | | { |
| | | return; |
| | | } |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | |
| | | var calcuResultHelper = await GetCalcuResultHelper(); |
| | | var vmList = new List<XhsSinglePumpViewModel>(); |
| | | foreach (var pump in _hydroInfo.Pumps) |
| | | { |
| | |
| | | vm.CurveQE = qePtList; |
| | | vm.CurveQP = qpPtList; |
| | | |
| | | if (allCalcuResultList != null && allCalcuResultList.Count > 0) |
| | | var calcuResultVisualDict = calcuResultHelper.GetVisualDict(); |
| | | if (calcuResultVisualDict != null && calcuResultVisualDict.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 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 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); |
| | | // } |
| | | // } |
| | | //} |
| | | } |
| | | |
| | | } |
| | |
| | | pump.SpeedRatio = Math.Round(x.CurrentHz / pump.RatedHz, 1); |
| | | } |
| | | }); |
| | | ShowProperty(); |
| | | //ShowSelectedProperty(); |
| | | return true; |
| | | }; |
| | | dlg.ShowDialog(); |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 水力计算 |
| | | #region 工况能效 |
| | | |
| | | |
| | | #region 前提条件 |
| | | |
| | | //显示计算前提条件窗体 |
| | | private void ShowCalcuPrefixDlg() |
| | | private void barBtnWorkingPower_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new HStation.WinFrmUI.SetHydroCalcuPrefixDlg1(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.HydroViewEvent += async (parter) => |
| | | { |
| | | _selectedParter = parter; |
| | | if (_selectedParter != null) |
| | | { |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(new List<string>() { _selectedParter.Code }); |
| | | } |
| | | ShowProperty(); |
| | | }; |
| | | dlg.HydroCalcuEvent += async () => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | //校验 |
| | | _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("计算成功!"); |
| | | } |
| | | else |
| | | { |
| | | ShowCalcuFailedCtrl(); |
| | | TipFormHelper.ShowError("计算失败!"); |
| | | } |
| | | |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //显示工况计算窗体 |
| | | private void ShowWorkingCalcuDlg() |
| | | { |
| | | var dlg = new SetHydroWorkingInfoDlg(); |
| | | dlg.HydroViewEvent += async (parter) => |
| | | { |
| | | _selectedParter = parter; |
| | | if (_selectedParter != null) |
| | | { |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(new List<string>() { _selectedParter.Code }); |
| | | } |
| | | ShowProperty(); |
| | | }; |
| | | 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("计算成功!"); |
| | | } |
| | | else |
| | | { |
| | | ShowCalcuFailedCtrl(); |
| | | TipFormHelper.ShowError("计算失败!"); |
| | | } |
| | | AutoApplyGrading(); |
| | | UpdateParterListProperty(); |
| | | ShowProperty(); |
| | | }; |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.ShowDialog(); |
| | | XtraMessageBox.Show("正在开发中,敬请期待!"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 计算失败 |
| | | #region 损失曲线 |
| | | |
| | | //计算失败控件 |
| | | private HydroCalcuFailedCtrl _calcuFailedCtrl = null; |
| | | |
| | | //获取计算失败控件 |
| | | private HydroCalcuFailedCtrl GetCalcuFailedCtrl() |
| | | private void barBtnWorkingLossCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | 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; |
| | | XtraMessageBox.Show("正在开发中,敬请期待!"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 计算结果 |
| | | #region 损失比例 |
| | | |
| | | //所有计算结果列表 |
| | | private List<HydroCalcuResult> _allCalcuResultList = null; |
| | | |
| | | //获取计算结果 |
| | | //true 使用缓存,false 不使用缓存 |
| | | private List<HydroCalcuResult> GetCalcuResultList(bool isCache = true) |
| | | private void barBtnWorkingLossScale_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | 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; |
| | | XtraMessageBox.Show("正在开发中,敬请期待!"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | //水力计算 |
| | | private void barBtnHydroCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | #region 综合分析 |
| | | private void barBtnWorkingAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | //ShowCalcuPrefixDlg(); |
| | | ShowWorkingCalcuDlg(); |
| | | XtraMessageBox.Show("正在开发中,敬请期待!"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #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(); |
| | | _selectedParter = allParterList?.Find(x => x.Code == first.Code); |
| | | list.ForEach(x => elementIds.Add(x.Code)); |
| | | } |
| | | else |
| | | { |
| | | _selectedParter = null; |
| | | } |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowProperty(); |
| | | }; |
| | | } |
| | | 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> _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.GetCatalogName(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.GetCatalogName(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.GetCatalogName(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.GetCatalogName(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.GetCatalogName(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.GetCatalogName(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.GetCatalogName(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.GetCatalogName(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); |
| | | _selectedParter = null; |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(null); |
| | | ShowProperty(); |
| | | TipFormHelper.ShowSucceed("数据已刷新"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 水流动画 |
| | | |
| | | //加载流向 |
| | | private async void barBtnLoadFlowDirection_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var pipes = _hydroInfo.Pipes; |
| | | var list = pipes.Select(x => |
| | | { |
| | | return new Yw.WinFrmUI.Bimface.LogicFlowEffect() |
| | | { |
| | | Id = x.Code, |
| | | Rotation = 90, |
| | | Speed = 0.1d |
| | | }; |
| | | }).ToList(); |
| | | await _bimfaceCtrl?.LoadFlowEffect(list); |
| | | } |
| | | |
| | | //卸载流向 |
| | | private async void barBtnUnloadFlowDirection_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | await _bimfaceCtrl?.UnloadFlowEffect(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |