| | |
| | | global using Yw.EPAnet; |
| | | using DevExpress.CodeParser; |
| | | using DevExpress.Diagram.Core.Native; |
| | | using DevExpress.Diagram.Core.Native; |
| | | using DevExpress.Mvvm.Native; |
| | | using DevExpress.Office.Utils; |
| | | using DevExpress.PivotGrid.QueryMode.TuplesTree; |
| | | using DevExpress.Utils.Extensions; |
| | | using DevExpress.Xpo.Helpers; |
| | | using DevExpress.XtraBars.Ribbon; |
| | | using DevExpress.XtraRichEdit.Layout; |
| | | using DevExpress.XtraSpreadsheet.Commands; |
| | | using DevExpress.Utils.MVVM; |
| | | using DevExpress.XtraMap; |
| | | using HStation.WinFrmUI.PhartRelation; |
| | | using Microsoft.Web.WebView2.Core; |
| | | using NetTaste; |
| | | using Mapster; |
| | | using NPOI.SS.Formula.Functions; |
| | | using System.Diagnostics; |
| | | using System.Windows.Media; |
| | | using System.Windows.Media.Media3D; |
| | | using Yw.EPAnet; |
| | | using Yw.Hydro; |
| | | using Yw.Model; |
| | | using Yw.Pump; |
| | | using Yw.Vmo; |
| | | using Yw.WinFrmUI.Bimface; |
| | | using Yw.WinFrmUI.Hydro; |
| | | using Yw.WinFrmUI.Q3d; |
| | | |
| | | namespace HStation.WinFrmUI |
| | | { |
| | |
| | | RegistBulkSetEvents(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 新增工况事件 |
| | | /// </summary> |
| | | public event Action<HydroWorkingVmo> AppendWorkingEvent; |
| | | |
| | | private HStation.Vmo.XhsProjectVmo _project = null;//项目 |
| | | private HStation.Vmo.XhsProjectSiteVmo _projectSite = null;//项目站 |
| | | private Yw.Model.HydroModelInfo _hydroInfo = null;//水力信息 |
| | | |
| | | |
| | | private Dictionary<HydroWorkingVmo, bool> _allWorkingCheckedListDict = null;//所有工况选择列表字典 |
| | | |
| | | /// <summary> |
| | | /// 绑定数据 |
| | | /// </summary> |
| | | public async Task SetBindingData |
| | | public void SetBindingData |
| | | ( |
| | | HStation.Vmo.XhsProjectVmo project, |
| | | HStation.Vmo.XhsProjectSiteVmo projectSite, |
| | | Yw.Model.HydroModelInfo hydroInfo |
| | | XhsProjectVmo project, |
| | | XhsProjectSiteVmo projectSite, |
| | | Yw.Model.HydroModelInfo hydroInfo, |
| | | Dictionary<HydroWorkingVmo, bool> allWorkingCheckedListDict |
| | | ) |
| | | { |
| | | if (project == null) |
| | | { |
| | | return; |
| | | } |
| | | _project = project; |
| | | _projectSite = projectSite; |
| | | _hydroInfo = hydroInfo; |
| | | if (_projectSite == null) |
| | | { |
| | | _projectSite = await BLLFactory<HStation.BLL.XhsProjectSite>.Instance.GetDefaultByProjectID(_project.ID); |
| | | } |
| | | if (_hydroInfo == null) |
| | | { |
| | | var hydroRelation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance |
| | | .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation); |
| | | _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(hydroRelation.ModelID); |
| | | } |
| | | _allWorkingCheckedListDict = allWorkingCheckedListDict; |
| | | //this.PageTitle.Caption = $"{_project.Name}\r\n水力模拟"; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | public override void InitialDataSource() |
| | | { |
| | | base.InitialDataSource(); |
| | | if (_project == null) |
| | | { |
| | | return; |
| | | } |
| | | this.PageTitle.Caption = $"{_project.Name}\r\n水力模拟"; |
| | | ShowBimfaceCtrl(); |
| | | ShowQ3dCtrl(); |
| | | ShowPropertyCtrl(); |
| | | } |
| | | |
| | | private void InitialUI() |
| | | { |
| | | InitialCurrentWorking(); |
| | | } |
| | | |
| | | |
| | | #region BIM控件 |
| | | |
| | |
| | | //获取 bimface 控件 |
| | | private async Task<XhsProjectSimulationBimfaceCtrl> GetBimfaceCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_bimfaceCtrl == null) |
| | | { |
| | | var overlay = this.ShowOverlay(); |
| | | _bimfaceCtrl = new XhsProjectSimulationBimfaceCtrl(); |
| | | _bimfaceCtrl.Dock = DockStyle.Fill; |
| | | await _bimfaceCtrl.InitialData(_project, _projectSite); |
| | | _bimfaceCtrl.LoadCompletedEvent += () => |
| | | {//view加载完成事件 |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | InitialUI(); |
| | | overlay.Close(); |
| | | this.barCkDecorator.Checked = false; |
| | | this.barCkGrading.Checked = true; |
| | | }; |
| | | _bimfaceCtrl.HydroMouseLeftClickEvent += (obj) => |
| | | _bimfaceCtrl.HydroMouseLeftClickEvent += (code) => |
| | | {//鼠标左键点击事件 |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | //_selectedVisual = obj; |
| | | //ShowSelectedProperty(); |
| | | 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控件 |
| | |
| | | //获取 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.GetAllVisuals(); |
| | | _visual = allParterList?.Find(x => x.Code == obj?.FirstOrDefault()); |
| | | //ShowSelectedProperty(); |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visuals = visualListHelper.GetVisualList(codes); |
| | | SelectVisual(visuals?.LastOrDefault(), eVisualSource.Q3d); |
| | | }; |
| | | } |
| | | return _q3dCtrl; |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 构件明细 |
| | | |
| | | #region 可见列表 |
| | | |
| | | //所有可视字典 |
| | | private Dictionary<string, HydroVisualInfo> _allVisualDict = null; |
| | | |
| | | //获取可视字典 |
| | | private Dictionary<string, HydroVisualInfo> GetVisualDict() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_allVisualDict == null) |
| | | { |
| | | _allVisualDict = new Dictionary<string, HydroVisualInfo>(); |
| | | var allVisualList = _hydroInfo.GetAllVisuals(); |
| | | allVisualList?.ForEach(x => _allVisualDict.Add(x.Code, x)); |
| | | } |
| | | return _allVisualDict; |
| | | } |
| | | |
| | | //获取可视列表 |
| | | private List<HydroVisualInfo> GetVisualList() |
| | | { |
| | | var allVisualDict = GetVisualDict(); |
| | | return allVisualDict?.Values.ToList(); |
| | | } |
| | | |
| | | //获取节点列表 |
| | | private List<HydroNodeInfo> GetNodeList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | return _hydroInfo.GetAllNodes(); |
| | | } |
| | | |
| | | //获取管段列表 |
| | | private List<HydroLinkInfo> GetLinkList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | return _hydroInfo.GetAllLinks(); |
| | | } |
| | | |
| | | //获取可视构件 |
| | | private HydroVisualInfo GetVisual(string code) |
| | | { |
| | | var allVisualDict = GetVisualDict(); |
| | | if (allVisualDict == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (allVisualDict.ContainsKey(code)) |
| | | { |
| | | return allVisualDict[code]; |
| | | } |
| | | return default; |
| | | } |
| | | |
| | | //获取可视构件列表 |
| | | private List<HydroVisualInfo> GetVisualList(List<string> codes) |
| | | { |
| | | return codes?.Select(x => GetVisual(x)).Where(x => x != null).ToList(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 视图列表 |
| | | |
| | | //所有可见视图字典 |
| | | private Dictionary<string, HydroVisualViewModel> _allVisualViewModelDict = null; |
| | | |
| | | //获取可见视图字典 |
| | | private Dictionary<string, HydroVisualViewModel> GetVisualViewModelDict() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_allVisualViewModelDict == null) |
| | | { |
| | | _allVisualViewModelDict = new Dictionary<string, HydroVisualViewModel>(); |
| | | var allVisualDict = GetVisualDict(); |
| | | if (allVisualDict != null && allVisualDict.Count > 0) |
| | | { |
| | | foreach (var visualKeyValue in allVisualDict) |
| | | { |
| | | var vm = HydroVisualViewModelBuilder.CreateVisualViewModel(visualKeyValue.Value, _hydroInfo); |
| | | var calcuVisualResult = GetCalcuVisualResult(visualKeyValue.Key); |
| | | if (calcuVisualResult != null) |
| | | { |
| | | vm.UpdateCalcuProperty(calcuVisualResult); |
| | | } |
| | | _allVisualViewModelDict.Add(visualKeyValue.Key, vm); |
| | | } |
| | | } |
| | | } |
| | | return _allVisualViewModelDict; |
| | | } |
| | | |
| | | //获取可见视图列表 |
| | | private List<HydroVisualViewModel> GetVisualViewModelList() |
| | | { |
| | | var allVisualViewModelDict = GetVisualViewModelDict(); |
| | | return allVisualViewModelDict?.Values.ToList(); |
| | | } |
| | | |
| | | //更新可见视图属性 |
| | | private void UpdateVisualViewModelProperty() |
| | | { |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | allVisualViewModelList?.ForEach(x => x.UpdateProperty()); |
| | | } |
| | | |
| | | //更新可见视图属性 |
| | | private void UpdateVisualViewModelProperty(string code) |
| | | { |
| | | var allVisualViewModelDict = GetVisualViewModelDict(); |
| | | if (allVisualViewModelDict != null && allVisualViewModelDict.Count > 0) |
| | | { |
| | | if (allVisualViewModelDict.ContainsKey(code)) |
| | | { |
| | | allVisualViewModelDict[code].UpdateProperty(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //更新可见视图属性 |
| | | private void UpdateVisualViewModelProperty(List<string> codes) |
| | | { |
| | | codes?.ForEach(x => UpdateVisualViewModelProperty(x)); |
| | | } |
| | | |
| | | //更新可见视图属性 |
| | | private void UpdateVisualViewModelProperty(List<HydroVisualInfo> visualList) |
| | | { |
| | | visualList?.ForEach(x => UpdateVisualViewModelProperty(x.Code)); |
| | | } |
| | | |
| | | //更新可见视图计算属性 |
| | | private void UpdateVisualViewModelCalcuProperty() |
| | | { |
| | | var allVisualViewModelDict = GetVisualViewModelDict(); |
| | | if (allVisualViewModelDict != null && allVisualViewModelDict.Count > 0) |
| | | { |
| | | foreach (var visualViewModelKeyValue in allVisualViewModelDict) |
| | | { |
| | | var calcuVisualResult = GetCalcuVisualResult(visualViewModelKeyValue.Key); |
| | | if (calcuVisualResult != null) |
| | | { |
| | | visualViewModelKeyValue.Value.UpdateCalcuProperty(calcuVisualResult); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //获取可见视图 |
| | | private HydroVisualViewModel GetVisualViewModel(string code) |
| | | { |
| | | if (string.IsNullOrEmpty(code)) |
| | | { |
| | | return default; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | return allVisualViewModelList?.Find(x => x.Code == code); |
| | | } |
| | | |
| | | //获取可见视图 |
| | | private HydroVisualViewModel GetVisualViewModel(Yw.Model.HydroVisualInfo visual) |
| | | { |
| | | return GetVisualViewModel(visual?.Code); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | #region 构件控件 |
| | | |
| | | //构件明细控件 |
| | | private Yw.WinFrmUI.HydroVisualListCtrl _visualListCtrl = null; |
| | | |
| | | //获取构件明细控件 |
| | | private Yw.WinFrmUI.HydroVisualListCtrl GetVisualListCtrl() |
| | | { |
| | | if (_visualListCtrl == null) |
| | | { |
| | | _visualListCtrl = new HydroVisualListCtrl(); |
| | | _visualListCtrl.Dock = DockStyle.Fill; |
| | | _visualListCtrl.HydroClickInfoEvent += async (visual) => |
| | | { |
| | | //ShowPropertyCtrl(visual); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponent(_visual?.Code); |
| | | }; |
| | | _visualListCtrl.HydroChangedInfoEvent += (visualList) => |
| | | { |
| | | UpdateMarkList(visualList); |
| | | //UpdateSelectedProperty(); |
| | | ApplyGradingResultList(); |
| | | }; |
| | | } |
| | | return _visualListCtrl; |
| | | } |
| | | |
| | | //构件明细控件是否可见 |
| | | private bool IsVisualListCtrlVisible |
| | | { |
| | | get |
| | | { |
| | | if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | if (this.controlContainerBottom.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerBottom.Controls[0] is HydroVisualListCtrl) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //显示构件明细控件 |
| | | private void ShowVisualListCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (IsVisualListCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | var visualListCtrl = GetVisualListCtrl(); |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | visualListCtrl.SetBindingData(allVisualViewModelList); |
| | | var allCalcuResultList = GetCalcuVisualResultList(Yw.EPAnet.CalcuMode.MinorLoss, false); |
| | | if (allCalcuResultList == null || allCalcuResultList.Count < 1) |
| | | { |
| | | visualListCtrl.SetNormalView(); |
| | | } |
| | | else |
| | | { |
| | | visualListCtrl.SetCalcuView(); |
| | | } |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(visualListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "构件明细"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | |
| | | //更新构件明细控件 |
| | | private void UpdateVisualListCtrl() |
| | | { |
| | | if (!IsVisualListCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | | _visualListCtrl?.UpdateBindingData(); |
| | | } |
| | | |
| | | //构件明细 |
| | | private void barBtnHydroVisualList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowVisualListCtrl(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 选择构件 |
| | | |
| | | //可见来源 |
| | | protected enum eVisualSource |
| | | { |
| | | None, |
| | | Bimface, |
| | | Q3d, |
| | | Check, |
| | | Property, |
| | | Calcu, |
| | | Monitor, |
| | | Warning, |
| | | } |
| | | |
| | | //选择构件 |
| | | private Yw.Model.HydroVisualInfo _visual = null; |
| | | |
| | | //选择构件 |
| | | private void SelectVisual(HydroVisualInfo visual, eVisualSource source) |
| | | { |
| | | if (visual == null) |
| | | { |
| | | switch (source) |
| | | { |
| | | case eVisualSource.None: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(null); |
| | | this.barBtnSetMonitor.Enabled = false; |
| | | ClearPropertyCtrl(); |
| | | } |
| | | break; |
| | | case eVisualSource.Bimface: |
| | | { |
| | | this.barBtnSetMonitor.Enabled = false; |
| | | ClearPropertyCtrl(); |
| | | } |
| | | break; |
| | | case eVisualSource.Check: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(null); |
| | | this.barBtnSetMonitor.Enabled = false; |
| | | ClearPropertyCtrl(); |
| | | } |
| | | break; |
| | | case eVisualSource.Property: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(null); |
| | | this.barBtnSetMonitor.Enabled = false; |
| | | } |
| | | break; |
| | | case eVisualSource.Calcu: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(null); |
| | | this.barBtnSetMonitor.Enabled = false; |
| | | ClearPropertyCtrl(); |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | _visual = null; |
| | | return; |
| | | } |
| | | if (_visual == null) |
| | | { |
| | | |
| | | _visual = visual; |
| | | return; |
| | | } |
| | | if (_visual.Code == visual.Code) |
| | | { |
| | | UpdatePropertyCtrl(); |
| | | return; |
| | | } |
| | | _visual = visual; |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual.Code); |
| | | this.barBtnSetMonitor.Enabled = true; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 属性控件 |
| | | |
| | | //属性控件 |
| | |
| | | //获取属性控件 |
| | | private XhsProjectSimulationPropertyCtrl GetPropertyCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_propertyCtrl == null) |
| | | { |
| | | _propertyCtrl = new XhsProjectSimulationPropertyCtrl(); |
| | | _propertyCtrl.Dock = DockStyle.Fill; |
| | | _propertyCtrl.HydroViewEvent += (visual) => |
| | | { |
| | | if (visual == null) |
| | | { |
| | | return; |
| | | } |
| | | _bimfaceCtrl?.ZoomToComponent(visual.Code); |
| | | SelectVisual(visual, eVisualSource.Property); |
| | | }; |
| | | _propertyCtrl.BlinkLinkNodeEvent += async (link, linkNodeCode) => |
| | | { //强调连接节点 |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (link == null) |
| | | { |
| | | return; |
| | | } |
| | | if (string.IsNullOrEmpty(linkNodeCode)) |
| | | { |
| | | return; |
| | | } |
| | | var linkNode = GetVisual(linkNodeCode); |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var linkNode = visualListHelper.GetVisual(linkNodeCode); |
| | | if (linkNode == null) |
| | | { |
| | | return; |
| | |
| | | var blinkCodes = new List<string>(); |
| | | if (linkNode.GetType() == typeof(HydroJunctionInfo)) |
| | | { |
| | | var allLinkList = GetLinkList(); |
| | | var allLinkList = visualListHelper.GetLinkList(); |
| | | if (allLinkList == null || allLinkList.Count < 1) |
| | | { |
| | | return; |
| | |
| | | await Task.Delay(5000); |
| | | await _bimfaceCtrl?.ClearBlinkComponents(); |
| | | }; |
| | | _propertyCtrl.PropertyValueChangedEvent += (visual) => |
| | | _propertyCtrl.PropertyValueChangedEvent += async (visual) => |
| | | { |
| | | if (visual == null) |
| | | { |
| | | return; |
| | | } |
| | | UpdateVisualListCtrl(); |
| | | //ApplyGradingResultList(visual); |
| | | var gradingHelper = await GetGradingHelper(); |
| | | gradingHelper.Set(); |
| | | }; |
| | | _propertyCtrl.MarkPropertyValueChangedEvent += (visual) => |
| | | _propertyCtrl.MarkPropertyValueChangedEvent += async (visual) => |
| | | { |
| | | //标注属性发生改变 |
| | | //判断当前是否有标注展示,若有则更新标注,最好是更新单个标注 |
| | | var markHelper = await GetMarkHelper(); |
| | | markHelper.Set(visual); |
| | | }; |
| | | _propertyCtrl.GradingPropertyValueChangedEvent += (parter) => |
| | | _propertyCtrl.GradingPropertyValueChangedEvent += async (visual) => |
| | | { |
| | | //分级属性发生改变 |
| | | //判断当前是否有分级展示,若有则更新分级,最好是更新单个分级 |
| | | var gradingHelper = await GetGradingHelper(); |
| | | gradingHelper.Set(visual); |
| | | }; |
| | | _propertyCtrl.FlowEffectPropertyValueChangedEvent += (visual) => |
| | | _propertyCtrl.FlowEffectPropertyValueChangedEvent += async (visual) => |
| | | { |
| | | //流向属性发生改变 |
| | | //判断流向是否加载,如果加载则更新流向,最好是更新单个流向 |
| | | var flowEffectHelper = await GetFlowEffectHelper(); |
| | | flowEffectHelper.Set(visual); |
| | | }; |
| | | |
| | | } |
| | |
| | | private void SetPropertyCtrl(HydroVisualInfo visual) |
| | | { |
| | | ShowPropertyCtrl(); |
| | | var vm = GetVisualViewModel(visual); |
| | | var visualVmListHelper = GetVisualVmListHelper(); |
| | | var vm = visualVmListHelper.GetVisual(visual); |
| | | _propertyCtrl.SelectedObject = vm; |
| | | } |
| | | |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 自动匹配 |
| | | #region 选择构件 |
| | | |
| | | //获取匹配列表控件 |
| | | private XhsProjectSimulationMatchingListCtrl GetMatchingListCtrl() |
| | | //可见来源 |
| | | protected enum eVisualSource |
| | | { |
| | | if (_matchingListCtrl == null) |
| | | { |
| | | _matchingListCtrl = new XhsProjectSimulationMatchingListCtrl(); |
| | | _matchingListCtrl.Dock = DockStyle.Fill; |
| | | _matchingListCtrl.HydroClickEvent += async (code) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllVisuals(); |
| | | _visual = allParterList?.Find(x => x.Code == code); |
| | | var elementIds = new List<string>(); |
| | | if (_visual != null) |
| | | { |
| | | elementIds.Add(_visual.Code); |
| | | } |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | //ShowSelectedProperty(); |
| | | }; |
| | | _matchingListCtrl.ApplyMatchingEvent += (output) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return false; |
| | | } |
| | | return AssetsMatchingParasHelper.Apply(_hydroInfo, output); |
| | | }; |
| | | } |
| | | return _matchingListCtrl; |
| | | None, |
| | | Bimface, |
| | | Q3d, |
| | | Property, |
| | | List, |
| | | Search, |
| | | Monitor, |
| | | Check, |
| | | Calcu, |
| | | Warning, |
| | | } |
| | | |
| | | //匹配列表控件 |
| | | private XhsProjectSimulationMatchingListCtrl _matchingListCtrl = null; |
| | | //选择构件 |
| | | private Yw.Model.HydroVisualInfo _visual = null; |
| | | |
| | | //自动匹配 |
| | | private void barBtnMatchingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //选择构件 |
| | | private void SelectVisual(HydroVisualInfo visual, eVisualSource source) |
| | | { |
| | | if (_hydroInfo == 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; |
| | | } |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | var matchingListCtrl = GetMatchingListCtrl(); |
| | | var input = AssetsMatchingParasHelper.Create(_hydroInfo, GetCalcuVisualResultList(Yw.EPAnet.CalcuMode.MinorLoss, false)); |
| | | matchingListCtrl.SetBindingData(input); |
| | | this.controlContainerBottom.Controls.Add(matchingListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "匹配列表"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 未匹列表 |
| | | #region 构件明细 |
| | | |
| | | //获取未匹配列表控件 |
| | | private XhsProjectSimulationUnMatchingListCtrl GetUnMatchingListCtrl() |
| | | #region 可见列表 |
| | | |
| | | //可见列表辅助类 |
| | | private SimulationVisualListHelper _visualListHelper = null; |
| | | |
| | | //获取可见列表辅助类 |
| | | private SimulationVisualListHelper GetVisualListHelper() |
| | | { |
| | | if (_unMatchingListCtrl == null) |
| | | if (_visualListHelper == null) |
| | | { |
| | | _unMatchingListCtrl = new XhsProjectSimulationUnMatchingListCtrl(); |
| | | _unMatchingListCtrl.Dock = DockStyle.Fill; |
| | | _unMatchingListCtrl.HydroClickEvent += async (parter) =>//行点击 |
| | | { |
| | | if (parter == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllVisuals(); |
| | | _visual = allParterList?.Find(x => x.Code == parter.Code); |
| | | var elementIds = new List<string>() { parter.Code }; |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | //ShowSelectedProperty(); |
| | | }; |
| | | _unMatchingListCtrl.ViewModelEvent += async (parters) =>//查看模型 |
| | | { |
| | | var codes = parters?.Select(x => x.Code).Distinct().ToList(); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(codes); |
| | | _visual = null; |
| | | //ShowSelectedProperty(); |
| | | }; |
| | | _visualListHelper = new SimulationVisualListHelper(); |
| | | _visualListHelper.InitialData(_hydroInfo); |
| | | } |
| | | return _unMatchingListCtrl; |
| | | return _visualListHelper; |
| | | } |
| | | |
| | | private XhsProjectSimulationUnMatchingListCtrl _unMatchingListCtrl = null;//未匹配列表 |
| | | #endregion |
| | | |
| | | //未匹配列表 |
| | | private void barBtnUnMatchingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | #region 视图列表 |
| | | |
| | | //可见视图列表辅助类 |
| | | private SimulationVisualVmListHelper _visualVmListHelper = null; |
| | | |
| | | //获取可见视图列表辅助类 |
| | | private SimulationVisualVmListHelper GetVisualVmListHelper() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_visualVmListHelper == null) |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var calcuResultHelper = GetCalcuResultHelper(); |
| | | _visualVmListHelper = new SimulationVisualVmListHelper(visualListHelper, calcuResultHelper); |
| | | } |
| | | return _visualVmListHelper; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 明细控件 |
| | | |
| | | //构件明细控件 |
| | | private Yw.WinFrmUI.HydroVisualListCtrl _visualListCtrl = null; |
| | | |
| | | //获取构件明细控件 |
| | | private Yw.WinFrmUI.HydroVisualListCtrl GetVisualListCtrl() |
| | | { |
| | | if (_visualListCtrl == null) |
| | | { |
| | | _visualListCtrl = new HydroVisualListCtrl(); |
| | | _visualListCtrl.Dock = DockStyle.Fill; |
| | | _visualListCtrl.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.List); |
| | | }; |
| | | _visualListCtrl.HydroChangedInfoEvent += (visualList) => |
| | | { |
| | | SelectVisual(_visual, eVisualSource.List); |
| | | }; |
| | | } |
| | | return _visualListCtrl; |
| | | } |
| | | |
| | | //构件明细控件是否可见 |
| | | private bool IsVisualListCtrlVisible |
| | | { |
| | | get |
| | | { |
| | | if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | if (this.controlContainerBottom.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerBottom.Controls[0] is HydroVisualListCtrl) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //显示构件明细控件 |
| | | private void ShowVisualListCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | var unMatchingListCtrl = GetUnMatchingListCtrl(); |
| | | unMatchingListCtrl.SetBindingData(_hydroInfo); |
| | | this.controlContainerBottom.Controls.Add(unMatchingListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "未匹配列表"; |
| | | this.docPnlBottom.Height = 350; |
| | | var visualListCtrl = GetVisualListCtrl(); |
| | | if (!IsVisualListCtrlVisible) |
| | | { |
| | | 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 visualVmListHelper = GetVisualVmListHelper(); |
| | | var allVisualVmList = visualVmListHelper.GetVisualList(); |
| | | visualListCtrl.SetBindingData(allVisualVmList); |
| | | var calcuResult = 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 |
| | | |
| | |
| | | SetDecoratorVisible(this.barCkDecorator.Checked); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 构件显示 |
| | | |
| | | //所有显示列表 |
| | | private List<HydroVisualVisibleViewModel> _allVisibleList = null; |
| | | |
| | | //获取显示列表 |
| | | private List<HydroVisualVisibleViewModel> GetVisibleList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_allVisibleList == null) |
| | | { |
| | | _allVisibleList = _hydroInfo.GetVisibleList(); |
| | | if (_allVisibleList == null) |
| | | { |
| | | _allVisibleList = new List<HydroVisualVisibleViewModel>(); |
| | | } |
| | | } |
| | | return _allVisibleList; |
| | | } |
| | | |
| | | //设置显示列表 |
| | | private async void SetVisibleList(List<HydroVisualVisibleViewModel> allVisibleList) |
| | | { |
| | | if (allVisibleList == null || allVisibleList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var dict = new Dictionary<string, HydroVisualVisibleViewModel>(); |
| | | allVisibleList.ForEach(x => dict.Add(x.Catalog, x)); |
| | | var allVisualList = GetVisualList(); |
| | | if (allVisualList != null && allVisualList.Count > 0) |
| | | { |
| | | var tcodes = new List<string>(); |
| | | var ocodes = new List<string>(); |
| | | allVisualList.ForEach(x => |
| | | { |
| | | if (dict.ContainsKey(x.Catalog)) |
| | | { |
| | | var visible = dict[x.Catalog]; |
| | | if (visible.Visible) |
| | | { |
| | | ocodes.Add(x.Code); |
| | | } |
| | | else |
| | | { |
| | | tcodes.Add(x.Code); |
| | | } |
| | | } |
| | | }); |
| | | await _bimfaceCtrl?.TranslucentComponents(tcodes); |
| | | await _bimfaceCtrl?.OpaqueComponents(ocodes); |
| | | } |
| | | } |
| | | |
| | | //设置显示列表 |
| | | private void SetVisibleList() |
| | | { |
| | | var allVisibleList = GetVisibleList(); |
| | | SetVisibleList(allVisibleList); |
| | | } |
| | | |
| | | //显示构件显示窗体 |
| | | private void ShowVisualVisibleDlg() |
| | | { |
| | | var allVisibleList = GetVisibleList(); |
| | | var dlg = new SetHydroVisualVisibleDlg(); |
| | | dlg.SetBindingData(allVisibleList); |
| | | dlg.ReloadDataEvent += (list) => |
| | | { |
| | | _allVisibleList = list; |
| | | SetVisibleList(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //设置构件显示 |
| | | private void barBtnSetVisualVisible_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowVisualVisibleDlg(); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region 保存信息 |
| | | |
| | |
| | | { |
| | | if (_searchCtrl == null) |
| | | { |
| | | var visualVmListHelper = GetVisualVmListHelper(); |
| | | var allVisualVmList = visualVmListHelper.GetVisualList(); |
| | | _searchCtrl = new HydroVisualSearchListCtrl(); |
| | | _searchCtrl.Dock = DockStyle.Fill; |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | _searchCtrl.InitialData(allVisualViewModelList); |
| | | _searchCtrl.HydroClickInfoEvent += async (visual) => |
| | | _searchCtrl.InitialData(allVisualVmList); |
| | | _searchCtrl.HydroClickInfoEvent += (visual) => |
| | | { |
| | | //ShowPropertyCtrl(visual); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | SelectVisual(visual, eVisualSource.Check); |
| | | }; |
| | | _searchCtrl.HydroSearchInfoEvent += async (list) => |
| | | _searchCtrl.HydroSearchInfoEvent += (list) => |
| | | { |
| | | var elementIds = new List<string>(); |
| | | if (list != null && list.Count > 0) |
| | | { |
| | | _visual = list.First(); |
| | | list.ForEach(x => elementIds.Add(x.Code)); |
| | | } |
| | | else |
| | | { |
| | | _visual = null; |
| | | } |
| | | //ShowSelectedProperty(); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | var visual = list?.FirstOrDefault(); |
| | | SelectVisual(visual, eVisualSource.Search); |
| | | }; |
| | | } |
| | | return _searchCtrl; |
| | |
| | | |
| | | #region 模型标注 |
| | | |
| | | #region 标注设置 |
| | | //标注辅助类 |
| | | private SimulationMarkHelper _markHelper = null; |
| | | |
| | | //所有标注设置列表 |
| | | private List<HydroMarkSetViewModel> _allMarkSetList = null; |
| | | |
| | | //获取标注设置列表 |
| | | private List<HydroMarkSetViewModel> GetMarkSetList() |
| | | //获取标注辅助类 |
| | | private async Task<SimulationMarkHelper> GetMarkHelper() |
| | | { |
| | | if (_hydroInfo == null) |
| | | if (_markHelper == null) |
| | | { |
| | | return default; |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var calcuResultHelper = GetCalcuResultHelper(); |
| | | var bimfaceCtrl = await GetBimfaceCtrl(); |
| | | _markHelper = new SimulationMarkHelper(visualListHelper, calcuResultHelper, bimfaceCtrl); |
| | | } |
| | | if (_allMarkSetList == null) |
| | | { |
| | | _allMarkSetList = HydroMarkHelper.GetSetList(_hydroInfo); |
| | | } |
| | | return _allMarkSetList; |
| | | return _markHelper; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 标注结果 |
| | | |
| | | //所有标注结果列表 |
| | | private List<HydroMarkResultViewModel> _allMarkResultList = null; |
| | | |
| | | //获取标注结果列表 |
| | | //UseCache 是否使用缓存 |
| | | private List<HydroMarkResultViewModel> GetMarkResultList(bool useCache = true) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (!useCache) |
| | | { |
| | | var allSetList = GetMarkSetList(); |
| | | _allMarkResultList = HydroMarkHelper.GetResultList(_hydroInfo, allSetList); |
| | | } |
| | | if (_allMarkResultList == null) |
| | | { |
| | | var allSetList = GetMarkSetList(); |
| | | _allMarkResultList = HydroMarkHelper.GetResultList(_hydroInfo, allSetList); |
| | | } |
| | | return _allMarkResultList; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 标注显示 |
| | | |
| | | //标注是否显示 |
| | | private bool _isMarkVisible = false; |
| | | |
| | | //更新标注 |
| | | private async void UpdateMark(Yw.Model.HydroVisualInfo visual) |
| | | { |
| | | var allSetList = GetMarkSetList(); |
| | | var result = HydroMarkHelper.GetResult(visual, allSetList); |
| | | if (result == null) |
| | | { |
| | | return; |
| | | } |
| | | var allResultList = GetMarkResultList(true); |
| | | allResultList.Remove(x => x.Code == visual.Code); |
| | | allResultList.Add(result); |
| | | if (_isMarkVisible) |
| | | { |
| | | var leadLabel = new LogicMarkLeadLabel() { Id = result.Code, Text = result.Text, Distance = null }; |
| | | await _bimfaceCtrl?.UpdateLogicMarkLeadLabel(leadLabel); |
| | | } |
| | | } |
| | | |
| | | //更新标注列表 |
| | | private void UpdateMarkList(List<Yw.Model.HydroVisualInfo> visuals) |
| | | { |
| | | if (visuals == null || visuals.Count < 1) |
| | | { |
| | | visuals.ForEach(x => UpdateMark(x)); |
| | | } |
| | | } |
| | | |
| | | //应用标注列表 |
| | | //UseCache 是否使用缓存 |
| | | private async void ApplyMarkList(bool useCache = true) |
| | | { |
| | | if (_isMarkVisible) |
| | | { |
| | | var allResultList = GetMarkResultList(useCache); |
| | | var leadLabels = allResultList?.Select(x => new LogicMarkLeadLabel(x.Code, x.Text, null)).ToList(); |
| | | await _bimfaceCtrl?.SetLogicMarkLeadLabels(leadLabels); |
| | | } |
| | | else |
| | | { |
| | | await _bimfaceCtrl?.ClearLogicMarkLeadLabels(); |
| | | } |
| | | } |
| | | |
| | | //显示标注设置窗体 |
| | | private void ShowSetMarkDlg() |
| | | //显示标注列表 |
| | | private async void ShowMarkList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allMarkSetList = GetMarkSetList(); |
| | | var markHelper = await GetMarkHelper(); |
| | | var dlg = new SetHydroMarkDlg(); |
| | | dlg.SetBindingData(allMarkSetList); |
| | | dlg.SetBindingData(markHelper.Sets); |
| | | dlg.ReloadDataEvent += (list) => |
| | | { |
| | | _allMarkSetList = list; |
| | | ApplyMarkList(false); |
| | | markHelper.Sets = list; |
| | | markHelper.Set(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | |
| | | //设置标注 |
| | | private void barBtnSetMark_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowSetMarkDlg(); |
| | | ShowMarkList(); |
| | | } |
| | | |
| | | //是否显示 |
| | | private void barCkMark_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | private async void barCkMark_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | _isMarkVisible = this.barCkMark.Checked; |
| | | ApplyMarkList(true); |
| | | var markHelper = await GetMarkHelper(); |
| | | markHelper.Visible = this.barCkMark.Checked; |
| | | markHelper.Set(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | #region 颜色分级 |
| | | |
| | | #region 颜色配置 |
| | | //颜色分级辅助类 |
| | | private SimulationGradingHelper _gradingHelper = null; |
| | | |
| | | //所有颜色分级配置列表 |
| | | private List<HydroGradingVmo> _allGradingList = null; |
| | | |
| | | //获取颜色分级配置列表 |
| | | private async Task<List<HydroGradingVmo>> GetGradingList() |
| | | //获取颜色分级辅助类 |
| | | private async Task<SimulationGradingHelper> GetGradingHelper() |
| | | { |
| | | if (_hydroInfo == null) |
| | | if (_gradingHelper == null) |
| | | { |
| | | return default; |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var calcuResultHelper = GetCalcuResultHelper(); |
| | | var bimfaceCtrl = await GetBimfaceCtrl(); |
| | | _gradingHelper = new SimulationGradingHelper(visualListHelper, calcuResultHelper, bimfaceCtrl); |
| | | } |
| | | if (_allGradingList == null) |
| | | { |
| | | _allGradingList = await HydroGradingHelper.GetGradingList(_hydroInfo); |
| | | } |
| | | return _allGradingList; |
| | | return _gradingHelper; |
| | | } |
| | | |
| | | //显示颜色分级窗体 |
| | | private async void ShowGradingDlg() |
| | | //设置颜色分级列表 |
| | | private async void SetGradingList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allGradingList = await GetGradingList(); |
| | | var gradingHelper = await GetGradingHelper(); |
| | | var allGradingList = await gradingHelper.GetGradingList(); |
| | | var dlg = new SetHydroGradingTreeDlg(); |
| | | dlg.SetBindingData(_hydroInfo, allGradingList); |
| | | dlg.ReloadDataEvent += (list) => |
| | | { |
| | | _allGradingList = list; |
| | | ApplyGradingResultList(false); |
| | | gradingHelper.SetGradingList(list); |
| | | gradingHelper.Set(); |
| | | }; |
| | | dlg.ApplyDataEvent += (catalog, propName) => |
| | | { |
| | | UpdateGradingApplyList(catalog, propName); |
| | | ApplyGradingResultList(false); |
| | | gradingHelper.UpdateApply(catalog, propName); |
| | | gradingHelper.Set(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //配置颜色分级 |
| | | private void barBtnGradingSet_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | private void barBtnSetGradingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowGradingDlg(); |
| | | SetGradingList(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 应用分级 |
| | | |
| | | //颜色分级应用列表 |
| | | private List<HydroGradingApplyViewModel> _allGradingApplyList = null; |
| | | |
| | | //获取颜色分级应用列表 |
| | | private List<HydroGradingApplyViewModel> GetGradingApplyList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_allGradingApplyList == null) |
| | | { |
| | | _allGradingApplyList = HydroGradingHelper.GetApplyList(_hydroInfo); |
| | | } |
| | | return _allGradingApplyList; |
| | | } |
| | | |
| | | //更新颜色分级应用列表 |
| | | private void UpdateGradingApplyList(string catalog, string propName) |
| | | { |
| | | var allGradingApplyList = GetGradingApplyList(); |
| | | if (allGradingApplyList == null || allGradingApplyList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var apply = allGradingApplyList.Find(x => x.Catalog == catalog); |
| | | if (apply == null) |
| | | { |
| | | return; |
| | | } |
| | | apply.PropName = propName; |
| | | } |
| | | |
| | | //显示颜色分级应用窗体 |
| | | private void ShowGradingApplyDlg() |
| | | //应用颜色分级列表 |
| | | private async void ApplyGradingList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allGradingApplyList = GetGradingApplyList(); |
| | | if (allGradingApplyList == null || allGradingApplyList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var gradingHelper = await GetGradingHelper(); |
| | | var dlg = new ApplyHydroGradingDlg(); |
| | | dlg.SetBindingData(allGradingApplyList); |
| | | dlg.ReloadDataEvent += (obj) => |
| | | dlg.SetBindingData(gradingHelper.Applies); |
| | | dlg.ReloadDataEvent += (list) => |
| | | { |
| | | _allGradingApplyList = obj; |
| | | ApplyGradingResultList(false); |
| | | gradingHelper.Applies = list; |
| | | gradingHelper.Set(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //应用颜色分级 |
| | | private void barBtnGradingApply_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | private void barBtnApplyGradingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowGradingApplyDlg(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 应用结果 |
| | | |
| | | //所有颜色分级结果列表 |
| | | private List<HydroGradingResultViewModel> _allGradingResultList = null; |
| | | |
| | | //获取颜色分级结果列表 |
| | | //UseCache是否使用缓存 |
| | | private async Task<List<HydroGradingResultViewModel>> GetGradingResultList(bool useCache = true) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | var allGradingList = await GetGradingList(); |
| | | var allGradingApplyList = GetGradingApplyList(); |
| | | var allCalcuResultList = GetCalcuVisualResultList(Yw.EPAnet.CalcuMode.MinorLoss, false); |
| | | if (!useCache) |
| | | { |
| | | _allGradingResultList = HydroGradingHelper.GetResultList(_hydroInfo, allGradingList, allGradingApplyList, allCalcuResultList); |
| | | } |
| | | if (_allGradingResultList == null) |
| | | { |
| | | _allGradingResultList = HydroGradingHelper.GetResultList(_hydroInfo, allGradingList, allGradingApplyList, allCalcuResultList); |
| | | } |
| | | return _allGradingResultList; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 结果展示 |
| | | |
| | | //颜色分级是否显示 |
| | | private bool _isGradingVisible = false; |
| | | |
| | | //应用颜色分级结果列表 |
| | | //UseCache是否使用缓存 |
| | | private async void ApplyGradingResultList(bool useCache = true) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allGradingResultList = await GetGradingResultList(useCache); |
| | | if (allGradingResultList == null || allGradingResultList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | if (_isGradingVisible) |
| | | { |
| | | var groupList = allGradingResultList.GroupBy(x => x.Color).ToList(); |
| | | groupList.ForEach(async x => await _bimfaceCtrl?.OverrideComponentsColor(x.Select(t => t.Code).Distinct().ToList(), x.Key, 1)); |
| | | } |
| | | else |
| | | { |
| | | var codes = allGradingResultList.Select(x => x.Code).Distinct().ToList(); |
| | | await _bimfaceCtrl?.RestoreComponentsColor(codes); |
| | | } |
| | | } |
| | | |
| | | //应用颜色分级结果列表 |
| | | private async void ApplyGradingResultList(Yw.Model.HydroVisualInfo visual) |
| | | { |
| | | if (visual == null) |
| | | { |
| | | return; |
| | | } |
| | | var allGradingList = await GetGradingList(); |
| | | var allGradingApplyList = GetGradingApplyList(); |
| | | var allGradingResultList = await GetGradingResultList(true); |
| | | var allCalcuResultList = GetCalcuVisualResultList(Yw.EPAnet.CalcuMode.MinorLoss, false); |
| | | var oldResult = allGradingResultList?.Find(x => x.Code == visual.Code); |
| | | if (oldResult != null) |
| | | { |
| | | allGradingResultList.Remove(oldResult); |
| | | } |
| | | var newResult = HydroGradingHelper.GetResult(visual, allGradingList, allGradingApplyList, allCalcuResultList); |
| | | if (newResult != null) |
| | | { |
| | | allGradingResultList.Add(newResult); |
| | | } |
| | | if (_isGradingVisible) |
| | | { |
| | | if (newResult == null) |
| | | { |
| | | if (oldResult != null) |
| | | { |
| | | await _bimfaceCtrl?.RestoreComponentsColor(oldResult.Code); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | await _bimfaceCtrl?.OverrideComponentsColor(newResult.Code, newResult.Color, 1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //应用颜色分级结果列表 |
| | | private void ApplyGradingResultList(List<Yw.Model.HydroVisualInfo> visualList) |
| | | { |
| | | if (visualList == null || visualList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | visualList.ForEach(x => ApplyGradingResultList(x)); |
| | | ApplyGradingList(); |
| | | } |
| | | |
| | | //颜色分级展示 |
| | | private void barCkGrading_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | private async void barCkGrading_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | _isGradingVisible = this.barCkGrading.Checked; |
| | | ApplyGradingResultList(true); |
| | | var gradingHelper = await GetGradingHelper(); |
| | | gradingHelper.Visible = this.barCkGrading.Checked; |
| | | gradingHelper.Set(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(null); |
| | | //ShowSelectedProperty(); |
| | | TipFormHelper.ShowSucceed("数据已刷新"); |
| | | |
| | | var visualListHelper = GetVisualListHelper(); |
| | | visualListHelper.InitialData(_hydroInfo); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | #region 水流动画 |
| | | |
| | | //水流动画是否可见 |
| | | private bool _isFlowEffectVisible = false; |
| | | //水流动画辅助类 |
| | | private SimulationFlowEffectHelper _flowEffectHelper = null; |
| | | |
| | | //所有水流动画列表 |
| | | private List<LogicFlowEffect> _allFlowEffectList = null; |
| | | |
| | | //获取流向列表 |
| | | private List<LogicFlowEffect> GetFlowEffectList() |
| | | //获取水流动画辅助类 |
| | | private async Task<SimulationFlowEffectHelper> GetFlowEffectHelper() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_allFlowEffectList == null) |
| | | if (_flowEffectHelper == null) |
| | | { |
| | | _allFlowEffectList = new List<LogicFlowEffect>(); |
| | | var allCalcuResultList = GetCalcuVisualResultList(Yw.EPAnet.CalcuMode.MinorLoss, false); |
| | | if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) |
| | | { |
| | | foreach (var parter in _hydroInfo.Pipes) |
| | | { |
| | | var flowEffect = new LogicFlowEffect(); |
| | | _allFlowEffectList.Add(flowEffect); |
| | | flowEffect.Id = parter.Code; |
| | | flowEffect.Rotation = 90; |
| | | flowEffect.SpeedX = 0.1; |
| | | if (parter.FlowDirectionX == Yw.Hydro.FlowDirection.None) |
| | | { |
| | | flowEffect.SpeedX = 0; |
| | | } |
| | | else if (parter.FlowDirectionX == Yw.Hydro.FlowDirection.Positive) |
| | | { |
| | | flowEffect.SpeedX = 0.1; |
| | | } |
| | | else |
| | | { |
| | | flowEffect.SpeedX = -0.1; |
| | | } |
| | | |
| | | if (parter.FlowDirectionY == Yw.Hydro.FlowDirection.None) |
| | | { |
| | | flowEffect.SpeedY = 0; |
| | | } |
| | | else if (parter.FlowDirectionY == Yw.Hydro.FlowDirection.Positive) |
| | | { |
| | | flowEffect.SpeedY = 0.1; |
| | | } |
| | | else |
| | | { |
| | | flowEffect.SpeedY = -0.1; |
| | | } |
| | | |
| | | var calcuResult = allCalcuResultList?.Find(x => x.Code == parter.Code) as HydroCalcuLinkResult; |
| | | if (calcuResult != null) |
| | | { |
| | | if (calcuResult.CalcuVelocity < 0) |
| | | { |
| | | flowEffect.SpeedX = -flowEffect.SpeedX; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var bimfaceCtrl = await GetBimfaceCtrl(); |
| | | _flowEffectHelper = new SimulationFlowEffectHelper(visualListHelper, bimfaceCtrl); |
| | | var calcuResult = GetCalcuResult(); |
| | | _flowEffectHelper.InitialData(calcuResult); |
| | | } |
| | | return _allFlowEffectList; |
| | | } |
| | | |
| | | //加载水流动画 |
| | | private async void LoadFlowEffect() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allFlowEffectList = GetFlowEffectList(); |
| | | await _bimfaceCtrl?.LoadFlowEffect(allFlowEffectList); |
| | | } |
| | | |
| | | //卸载水流动画 |
| | | private async void UnloadFlowEffect() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | await _bimfaceCtrl?.UnloadFlowEffect(); |
| | | } |
| | | |
| | | //设置水力动画 |
| | | private void SetFlowEffect() |
| | | { |
| | | if (_isFlowEffectVisible) |
| | | { |
| | | LoadFlowEffect(); |
| | | } |
| | | else |
| | | { |
| | | UnloadFlowEffect(); |
| | | } |
| | | } |
| | | |
| | | //更新水流动画 |
| | | private async void UpdateFlowEffect(Yw.Model.HydroVisualInfo visual) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allFlowEffectList = GetFlowEffectList(); |
| | | var flowEffect = _allFlowEffectList?.Find(x => x.Id == visual.Code); |
| | | if (flowEffect == null) |
| | | { |
| | | return; |
| | | } |
| | | if (visual.FlowDirectionX == Yw.Hydro.FlowDirection.None) |
| | | { |
| | | flowEffect.SpeedX = 0; |
| | | } |
| | | else if (visual.FlowDirectionX == Yw.Hydro.FlowDirection.Positive) |
| | | { |
| | | flowEffect.SpeedX = 0.1; |
| | | } |
| | | else |
| | | { |
| | | flowEffect.SpeedX = -0.1; |
| | | } |
| | | |
| | | if (visual.FlowDirectionY == Yw.Hydro.FlowDirection.None) |
| | | { |
| | | flowEffect.SpeedY = 0; |
| | | } |
| | | else if (visual.FlowDirectionY == Yw.Hydro.FlowDirection.Positive) |
| | | { |
| | | flowEffect.SpeedY = 0.1; |
| | | } |
| | | else |
| | | { |
| | | flowEffect.SpeedY = -0.1; |
| | | } |
| | | |
| | | var allCalcuResultList = GetCalcuVisualResultList(Yw.EPAnet.CalcuMode.MinorLoss, false); |
| | | var calcuResult = allCalcuResultList?.Find(x => x.Code == visual.Code) as HydroCalcuLinkResult; |
| | | if (calcuResult != null) |
| | | { |
| | | if (calcuResult.CalcuVelocity < 0) |
| | | { |
| | | flowEffect.SpeedX = -flowEffect.SpeedX; |
| | | } |
| | | } |
| | | if (_isFlowEffectVisible) |
| | | { |
| | | await _bimfaceCtrl?.UpdateFlowEffect(flowEffect); |
| | | } |
| | | return _flowEffectHelper; |
| | | } |
| | | |
| | | //水流动画是否可见 |
| | | private void barCkFlowEffect_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | private async void barCkFlowEffect_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | _isFlowEffectVisible = this.barCkFlowEffect.Checked; |
| | | SetFlowEffect(); |
| | | var flowEffectHelper = await GetFlowEffectHelper(); |
| | | flowEffectHelper.Visible = this.barCkFlowEffect.Checked; |
| | | flowEffectHelper.Set(); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | |
| | | #region 监测点 |
| | | |
| | | //所有监测列表 |
| | | private List<HydroMonitorVmo> _allMonitorList = null; |
| | | //监测点辅助类 |
| | | private SimulationMonitorHelper _monitorHelper = null; |
| | | |
| | | //获取监测列表 |
| | | private async Task<List<HydroMonitorVmo>> GetMonitorList() |
| | | //获取监测点辅助类 |
| | | private SimulationMonitorHelper GetMonitorHelper() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_allMonitorList == null) |
| | | if (_monitorHelper == null) |
| | | { |
| | | _allMonitorList = await BLLFactory<Yw.BLL.HydroMonitor>.Instance.GetByModelID(_hydroInfo.ID); |
| | | if (_allMonitorList == null) |
| | | { |
| | | _allMonitorList = new List<HydroMonitorVmo>(); |
| | | } |
| | | var visualListHelper = GetVisualListHelper(); |
| | | _monitorHelper = new SimulationMonitorHelper(visualListHelper); |
| | | } |
| | | return _allMonitorList; |
| | | return _monitorHelper; |
| | | } |
| | | |
| | | //更新监测列表 |
| | | private async Task<List<HydroMonitorVmo>> UpdateMonitorList(string code) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | var allMonitorList = await GetMonitorList(); |
| | | allMonitorList.RemoveAll(x => x.Relation == code); |
| | | var monitorList = await BLLFactory<Yw.BLL.HydroMonitor>.Instance.GetByRelation(_hydroInfo.ID, code); |
| | | if (monitorList != null && monitorList.Count > 0) |
| | | { |
| | | allMonitorList.AddRange(monitorList); |
| | | } |
| | | return monitorList; |
| | | } |
| | | |
| | | //设置监测点窗体 |
| | | private async void SetMonitorListDlg(HydroVisualInfo visual) |
| | | //设置监测点列表 |
| | | private async void SetMonitorList(HydroVisualInfo visual) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (visual == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | var allMonitorList = await GetMonitorList(); |
| | | 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("设置失败"); |
| | | TipFormHelper.ShowError("设置失败!"); |
| | | return; |
| | | } |
| | | TipFormHelper.ShowSucceed("设置成功"); |
| | | var monitorList = await UpdateMonitorList(visual.Code); |
| | | UpdateMonitorValueList(visual.Code, monitorList); |
| | | SetLogicMonitorList(); |
| | | 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) |
| | | { |
| | | SetMonitorListDlg(_visual); |
| | | SetMonitorList(_visual); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 监测值 |
| | | |
| | | //所有监测值列表 |
| | | private List<HydroMonitorValueViewModel> _allMonitorValueList = null; |
| | | //监测值辅助类 |
| | | private SimulationMonitorValueHelper _monitorValueHelper = null; |
| | | |
| | | //获取监测值列表 |
| | | private async Task<List<HydroMonitorValueViewModel>> GetMonitorValueList() |
| | | //获取监测值辅助类 |
| | | private SimulationMonitorValueHelper GetMonitorValueHelper() |
| | | { |
| | | if (_allMonitorValueList == null) |
| | | if (_monitorValueHelper == null) |
| | | { |
| | | _allMonitorValueList = new List<HydroMonitorValueViewModel>(); |
| | | var allMonitorList = await GetMonitorList(); |
| | | if (allMonitorList != null && allMonitorList.Count > 0) |
| | | { |
| | | var allVisualDict = GetVisualDict(); |
| | | if (allVisualDict != null && allVisualDict.Count > 0) |
| | | { |
| | | foreach (var monitor in allMonitorList) |
| | | { |
| | | if (allVisualDict.ContainsKey(monitor.Relation)) |
| | | { |
| | | var visual = allVisualDict[monitor.Relation]; |
| | | var vm = new HydroMonitorValueViewModel(monitor, visual); |
| | | _allMonitorValueList.Add(vm); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var monitorHelper = GetMonitorHelper(); |
| | | _monitorValueHelper = new SimulationMonitorValueHelper(visualListHelper, monitorHelper); |
| | | } |
| | | return _allMonitorValueList; |
| | | } |
| | | |
| | | //更新监测值列表 |
| | | private async void UpdateMonitorValueList(string code, List<HydroMonitorVmo> monitorList) |
| | | { |
| | | var visual = GetVisual(code); |
| | | if (visual == null) |
| | | { |
| | | return; |
| | | } |
| | | var allMonitorValueList = await GetMonitorValueList(); |
| | | var monitorValueList = allMonitorValueList.Where(x => x.Vmo.Relation == code).ToList(); |
| | | monitorValueList?.ForEach(x => |
| | | { |
| | | var result = monitorList?.Exists(t => t.Relation == x.Vmo.Relation && t.PropName == x.Vmo.PropName); |
| | | if (!(result.HasValue && result.Value)) |
| | | { |
| | | allMonitorValueList.Remove(x); |
| | | } |
| | | }); |
| | | monitorList?.ForEach(x => |
| | | { |
| | | var result = monitorValueList?.Exists(t => t.Vmo.Relation == x.Relation && t.Vmo.PropName == x.PropName); |
| | | if (!(result.HasValue && result.Value)) |
| | | { |
| | | var vm = new HydroMonitorValueViewModel(x, visual); |
| | | allMonitorValueList.Add(vm); |
| | | } |
| | | }); |
| | | return _monitorValueHelper; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 监测值列表控件 |
| | | #region 监测值控件 |
| | | |
| | | //监测值列表控件 |
| | | private HydroMonitorValueListCtrl _monitorValueListCtrl = null; |
| | |
| | | _monitorValueListCtrl.Dock = DockStyle.Fill; |
| | | _monitorValueListCtrl.HydroViewEvent += (code) => |
| | | { |
| | | var visual = GetVisual(code); |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visual = visualListHelper.GetVisual(code); |
| | | SelectVisual(visual, eVisualSource.Monitor); |
| | | }; |
| | | } |
| | |
| | | this.docPnlBottom.Text = "监测值"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | var allMonitorValueList = await GetMonitorValueList(); |
| | | var monitorValueHelper = GetMonitorValueHelper(); |
| | | var allMonitorValueList = await monitorValueHelper.Get(); |
| | | monitorValueListCtrl.SetBindingData(allMonitorValueList); |
| | | } |
| | | |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 监测列表显示 |
| | | #region 监测点标记 |
| | | |
| | | //监测是否显示 |
| | | private bool _isMonitorVisible = false; |
| | | //监测标记辅助类 |
| | | private SimulationMonitorMarkerHelper _monitorMarkerHelper = null; |
| | | |
| | | //获取业务监测列表 |
| | | private async Task<List<LogicMonitor>> GetLogicMonitorList() |
| | | //获取监测标记辅助类 |
| | | private async Task<SimulationMonitorMarkerHelper> GetMonitorMarkerHelper() |
| | | { |
| | | var allMonitorList = await GetMonitorList(); |
| | | var allLogicMonitorList = allMonitorList.Select(x => |
| | | if (_monitorMarkerHelper == null) |
| | | { |
| | | var logicMonitor = new LogicMonitor(); |
| | | logicMonitor.Id = x.Relation; |
| | | logicMonitor.PropName = x.PropName; |
| | | logicMonitor.Description = x.Description; |
| | | return logicMonitor; |
| | | }).ToList(); |
| | | return allLogicMonitorList; |
| | | } |
| | | |
| | | //设置业务监测列表 |
| | | private async void SetLogicMonitorList() |
| | | { |
| | | if (_isMonitorVisible) |
| | | { |
| | | var allLogicMonitorList = await GetLogicMonitorList(); |
| | | await _bimfaceCtrl?.SetLogicMonitors(allLogicMonitorList); |
| | | var monitorHelper = GetMonitorHelper(); |
| | | var bimfaceCtrl = await GetBimfaceCtrl(); |
| | | _monitorMarkerHelper = new SimulationMonitorMarkerHelper(monitorHelper, bimfaceCtrl); |
| | | } |
| | | else |
| | | { |
| | | await _bimfaceCtrl?.ClearLogicMonitors(); |
| | | } |
| | | return _monitorMarkerHelper; |
| | | } |
| | | |
| | | //显示状态改变 |
| | | private void barCkMonitor_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | private async void barCkMonitor_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | _isMonitorVisible = this.barCkMonitor.Checked; |
| | | SetLogicMonitorList(); |
| | | var monitorMarkerHelper = await GetMonitorMarkerHelper(); |
| | | monitorMarkerHelper.Visible = this.barCkMonitor.Checked; |
| | | monitorMarkerHelper.Set(); |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | |
| | | |
| | | #region 模型检查 |
| | | |
| | | #region 检查结果 |
| | | |
| | | //检查结果 |
| | | private HydroCheckResult _checkResult = null; |
| | | |
| | | //获取检查结果 |
| | | private HydroCheckResult GetCheckResult() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_checkResult == null) |
| | | { |
| | | _checkResult = _hydroInfo.Check(); |
| | | } |
| | | return _checkResult; |
| | | } |
| | | |
| | | #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) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var visual = GetVisual(code); |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visual = visualListHelper.GetVisual(code); |
| | | SelectVisual(visual, eVisualSource.Check); |
| | | }; |
| | | } |
| | |
| | | //显示检查控件 |
| | | private void ShowCheckCtrl() |
| | | { |
| | | if (_checkResult == null) |
| | | { |
| | | return; |
| | | } |
| | | ShowCheckCtrl(_checkResult); |
| | | } |
| | | |
| | | //检查 |
| | | private void Check() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | _checkResult = _hydroInfo.Check(); |
| | | ShowCheckCtrl(_checkResult); |
| | | var checkResult = GetCheckResult(); |
| | | ShowCheckCtrl(checkResult); |
| | | } |
| | | |
| | | //检查 |
| | | private void barBtnCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | Check(); |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var checkResult = _hydroInfo.Check(); |
| | | ShowCheckCtrl(checkResult); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | |
| | | |
| | | #region 计算结果 |
| | | |
| | | //计算结果 |
| | | private HydroCalcuResult _calcuResult = null; |
| | | //计算结果辅助类 |
| | | private SimulationCalcuResultHelper _calcuResultHelper = null; |
| | | |
| | | //获取计算结果 |
| | | private HydroCalcuResult GetCalcuResult(string calcuMode, bool needCalcuAgain = false) |
| | | //获取计算结果辅助类 |
| | | private SimulationCalcuResultHelper GetCalcuResultHelper() |
| | | { |
| | | if (_hydroInfo == null) |
| | | if (_calcuResultHelper == null) |
| | | { |
| | | return default; |
| | | var workingHelper = GetWorkingHelper(); |
| | | _calcuResultHelper = new SimulationCalcuResultHelper(workingHelper); |
| | | } |
| | | if (needCalcuAgain) |
| | | { |
| | | _calcuResult = _hydroInfo.Calcu(calcuMode); |
| | | } |
| | | if (_calcuResult == null) |
| | | { |
| | | _calcuResult = _hydroInfo.Calcu(calcuMode); |
| | | } |
| | | return _calcuResult; |
| | | } |
| | | |
| | | //获取可视组件计算结果列表 |
| | | private List<HydroCalcuVisualResult> GetCalcuVisualResultList(string calcuMode, bool needCalcuAgain = false) |
| | | { |
| | | var calcuResult = GetCalcuResult(calcuMode, needCalcuAgain); |
| | | if (calcuResult == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (!calcuResult.Succeed) |
| | | { |
| | | return default; |
| | | } |
| | | return calcuResult.GetVisualList(); |
| | | } |
| | | |
| | | //获取节点计算结果列表 |
| | | private List<HydroCalcuNodeResult> GetCalcuNodeResultList(string calcuMode, bool needCalcuAgain = false) |
| | | { |
| | | var calcuResult = GetCalcuResult(calcuMode, needCalcuAgain); |
| | | if (calcuResult == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (!calcuResult.Succeed) |
| | | { |
| | | return default; |
| | | } |
| | | return calcuResult.NodeList; |
| | | } |
| | | |
| | | //获取管段计算结果列表 |
| | | private List<HydroCalcuLinkResult> GetCalcuLinkResultList(string calcuMode, bool needCalcuAgain = false) |
| | | { |
| | | var calcuResult = GetCalcuResult(calcuMode, needCalcuAgain); |
| | | if (calcuResult == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (!calcuResult.Succeed) |
| | | { |
| | | return default; |
| | | } |
| | | return calcuResult.LinkList; |
| | | } |
| | | |
| | | //所有可见计算字典 |
| | | private Dictionary<string, HydroCalcuVisualResult> _allCalcuVisualDict = null; |
| | | |
| | | //获取可见计算字典 |
| | | private Dictionary<string, HydroCalcuVisualResult> GetCalcuVisualDict(string calcuMode, bool needCalcuAgain = false) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | var allCalcuVisualResultList = GetCalcuVisualResultList(calcuMode, needCalcuAgain); |
| | | if (needCalcuAgain) |
| | | { |
| | | _allCalcuVisualDict = new Dictionary<string, HydroCalcuVisualResult>(); |
| | | allCalcuVisualResultList?.ForEach(x => _allCalcuVisualDict.Add(x.Code, x)); |
| | | } |
| | | if (_allCalcuVisualDict == null) |
| | | { |
| | | _allCalcuVisualDict = new Dictionary<string, HydroCalcuVisualResult>(); |
| | | allCalcuVisualResultList?.ForEach(x => _allCalcuVisualDict.Add(x.Code, x)); |
| | | } |
| | | return _allCalcuVisualDict; |
| | | } |
| | | |
| | | //获取可见计算字典 |
| | | private Dictionary<string, HydroCalcuVisualResult> GetCalcuVisualDict(HydroCalcuResult calcuResult) |
| | | { |
| | | if (calcuResult == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (!calcuResult.Succeed) |
| | | { |
| | | return default; |
| | | } |
| | | var allCalcuVisualList = calcuResult.GetVisualList(); |
| | | var dict = new Dictionary<string, HydroCalcuVisualResult>(); |
| | | allCalcuVisualList?.ForEach(x => dict.Add(x.Code, x)); |
| | | return dict; |
| | | } |
| | | |
| | | //获取可见计算结果 |
| | | private HydroCalcuVisualResult GetCalcuVisualResult(string code, string calcuMode = Yw.EPAnet.CalcuMode.MinorLoss, bool needCalcuAgain = false) |
| | | { |
| | | var allCalcuVisualDict = GetCalcuVisualDict(calcuMode, needCalcuAgain); |
| | | if (allCalcuVisualDict == null || allCalcuVisualDict.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | if (allCalcuVisualDict.ContainsKey(code)) |
| | | { |
| | | return allCalcuVisualDict[code]; |
| | | } |
| | | return default; |
| | | } |
| | | |
| | | //获取可见计算结果 |
| | | private HydroCalcuVisualResult GetCalcuVisualResult(Yw.Model.HydroVisualInfo visual, string calcuMode = Yw.EPAnet.CalcuMode.MinorLoss, bool needCalcuAgain = false) |
| | | { |
| | | return GetCalcuVisualResult(visual?.Code, calcuMode, needCalcuAgain); |
| | | return _calcuResultHelper; |
| | | } |
| | | |
| | | #endregion |
| | |
| | | calcuFailedCtrl.SetBindingData(calcuResult.FailedList); |
| | | } |
| | | |
| | | //显示计算失败控件 |
| | | private void ShowCalcuFailedCtrl() |
| | | { |
| | | if (_calcuResult == null) |
| | | { |
| | | return; |
| | | } |
| | | ShowCalcuFailedCtrl(_calcuResult); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 计算警告 |
| | |
| | | _calcuWarningCtrl.Dock = DockStyle.Fill; |
| | | _calcuWarningCtrl.HydroClickEvent += (code) => |
| | | { |
| | | var visual = GetVisual(code); |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visual = visualListHelper.GetVisual(code); |
| | | SelectVisual(visual, eVisualSource.Warning); |
| | | }; |
| | | } |
| | |
| | | this.docPnlBottom.Text = "计算警告"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | var dict = GetVisualDict(); |
| | | calcuWaringCtrl.SetBindingData(calcuResult.WainingList, dict); |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var allVisualDict = visualListHelper.GetVisualDict(); |
| | | calcuWaringCtrl.SetBindingData(calcuResult.WainingList, allVisualDict); |
| | | } |
| | | |
| | | //显示计算警告控件 |
| | | private void ShowCalcuWarningCtrl() |
| | | #endregion |
| | | |
| | | #region 计算标签 |
| | | |
| | | //计算标签辅助类 |
| | | private SimulationCalcuResultLabelHelper _calcuResultLabelHelper = null; |
| | | |
| | | //获取计算标签辅助类 |
| | | private async Task<SimulationCalcuResultLabelHelper> GetCalcuResultLabelHelper() |
| | | { |
| | | if (_calcuResult == null) |
| | | if (_calcuResultLabelHelper == null) |
| | | { |
| | | return; |
| | | var calcuResultHelper = GetCalcuResultHelper(); |
| | | var bimfaceCtrl = await GetBimfaceCtrl(); |
| | | _calcuResultLabelHelper = new SimulationCalcuResultLabelHelper(calcuResultHelper, bimfaceCtrl); |
| | | } |
| | | ShowCalcuWarningCtrl(_calcuResult); |
| | | 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 |
| | |
| | | TipFormHelper.ShowWarn("试算失败,停止管网修复!"); |
| | | return; |
| | | } |
| | | var allLinkList = GetLinkList(); |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var allLinkList = visualListHelper.GetLinkList(); |
| | | if (allLinkList != null && allLinkList.Count < 1) |
| | | { |
| | | TipFormHelper.ShowError("模型中未包含管段信息,停止管网修复!"); |
| | |
| | | count++; |
| | | } |
| | | } |
| | | UpdateVisualViewModelProperty(); |
| | | var visualVmListHelper = GetVisualVmListHelper(); |
| | | visualVmListHelper.UpdateProperty(); |
| | | UpdateVisualListCtrl(); |
| | | //UpdateSelectedProperty(); |
| | | UpdatePropertyCtrl(); |
| | | TipFormHelper.ShowSucceed($"修复完成,共修复管段({count})个!"); |
| | | } |
| | | |
| | |
| | | return; |
| | | } |
| | | var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo); |
| | | var json = JsonHelper.Object2Json(netWork); |
| | | var result = netWork.ToInpString(); |
| | | File.WriteAllText(fileName, result); |
| | | TipFormHelper.ShowSucceed("导出成功"); |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 并联分析 |
| | | #region 水泵列表 |
| | | |
| | | //并联分析 |
| | | private void ParallelAnalysis() |
| | | #region 并联模拟 |
| | | |
| | | //并联模拟 |
| | | private void PumpParallel() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | |
| | | } |
| | | }); |
| | | var codes = list?.Select(x => x.Code).ToList(); |
| | | UpdateVisualViewModelProperty(codes); |
| | | //UpdateVisualViewModelProperty(codes); |
| | | //ShowSelectedProperty(); |
| | | UpdateVisualListCtrl(); |
| | | return true; |
| | |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //并联分析 |
| | | private void barBtnParallel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //并联模拟 |
| | | private void barBtnPumpParallel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ParallelAnalysis(); |
| | | PumpParallel(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 工况计算 |
| | | #endregion |
| | | |
| | | //所有工况元组列表 |
| | | private List<Tuple<HydroWorkingVmo, HydroCheckResult, HydroCalcuResult>> _allWorkingTupleList = null; |
| | | #region 水力计算 |
| | | |
| | | //获取工况元组列表 |
| | | private async Task<List<Tuple<HydroWorkingVmo, HydroCheckResult, HydroCalcuResult>>> GetWorkingTupleList() |
| | | //计算 |
| | | private async void Calcu() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | return; |
| | | } |
| | | if (_allWorkingTupleList == null) |
| | | { |
| | | _allWorkingTupleList = new List<Tuple<HydroWorkingVmo, HydroCheckResult, HydroCalcuResult>>(); |
| | | var allWorkingList = await BLLFactory<Yw.BLL.HydroWorking>.Instance.GetByModelID(_hydroInfo.ID); |
| | | allWorkingList?.ForEach(x => |
| | | { |
| | | var checkResult = _hydroInfo.Check(); |
| | | HydroCalcuResult calcuResult = null; |
| | | if (checkResult != null && checkResult.Succeed) |
| | | { |
| | | calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss); |
| | | } |
| | | _allWorkingTupleList.Add(new Tuple<HydroWorkingVmo, HydroCheckResult, HydroCalcuResult>(x, checkResult, calcuResult)); |
| | | }); |
| | | } |
| | | return _allWorkingTupleList; |
| | | } |
| | | |
| | | //获取工况元组 |
| | | private async Task<Tuple<HydroWorkingVmo, HydroCheckResult, HydroCalcuResult>> GetWorkingTuple(HydroWorkingVmo working) |
| | | { |
| | | if (working == null) |
| | | { |
| | | return default; |
| | | } |
| | | var allWorkingTupleList = await GetWorkingTupleList(); |
| | | var workingTuple = allWorkingTupleList?.Find(x => x.Item1.ID == working.ID); |
| | | return workingTuple; |
| | | } |
| | | |
| | | //获取工况检查结果 |
| | | private async Task<HydroCheckResult> GetWorkingCheckResult(HydroWorkingVmo working) |
| | | { |
| | | var tuple = await GetWorkingTuple(working); |
| | | return tuple?.Item2; |
| | | } |
| | | |
| | | //获取工况计算结果 |
| | | private async Task<HydroCalcuResult> GetWorkingCalcuResult(HydroWorkingVmo working) |
| | | { |
| | | var tuple = await GetWorkingTuple(working); |
| | | return tuple?.Item3; |
| | | } |
| | | |
| | | //获取工况列表 |
| | | private async Task<List<HydroWorkingVmo>> GetWorkingList() |
| | | { |
| | | var allWorkingTupleList = await GetWorkingTupleList(); |
| | | return allWorkingTupleList?.Select(x => x.Item1).OrderBy(x => x.SortCode).ToList(); |
| | | } |
| | | |
| | | //添加工况元组 |
| | | private async void AppendWorkingTuple(HydroWorkingVmo working, HydroCheckResult check, HydroCalcuResult calcu) |
| | | { |
| | | var allWorkingTupleList = await GetWorkingTupleList(); |
| | | allWorkingTupleList.Add(new Tuple<HydroWorkingVmo, HydroCheckResult, HydroCalcuResult>(working, check, calcu)); |
| | | } |
| | | |
| | | //移除工况元组 |
| | | private async void RemoveWorkingTuple(HydroWorkingVmo working) |
| | | { |
| | | var allWorkingTupleList = await GetWorkingTupleList(); |
| | | if (allWorkingTupleList.Count > 0) |
| | | { |
| | | allWorkingTupleList.RemoveAll(x => x.Item1.ID == working.ID); |
| | | } |
| | | } |
| | | |
| | | //设置工况窗体 |
| | | private async void SetHydroWorkingDlg() |
| | | { |
| | | var allWorkingList = await GetWorkingList(); |
| | | var allMonitorValueList = await GetMonitorValueList(); |
| | | var workingCheckedListHelper = GetWorkingCheckedListHelper(); |
| | | var allWorkingList = workingCheckedListHelper.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) => |
| | | dlg.HydroCalcuEvent += async (vm) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | 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; |
| | | } |
| | | allWorkingList.Add(vmo); |
| | | _hydroInfo.UpdateWorkingInfo(vm.WorkingInfo); |
| | | allMonitorValueList.UpdateMonitorValue(vm.MonitorInfo); |
| | | |
| | | _hydroInfo.UpdateWorkingInfo(working.WorkingInfo); |
| | | var hydroInfo = _hydroInfo.Adapt<Yw.Model.HydroModelInfo>(); |
| | | |
| | | var working = new HydroWorkingVmo(); |
| | | working.ModelID = vm.ModelID; |
| | | working.Name = vm.Name; |
| | | working.WorkingInfo = JsonHelper.Object2Json(vm.WorkingInfo); |
| | | working.MonitorInfo = JsonHelper.Object2Json(vm.MonitorInfo); |
| | | working.SortCode = vm.SortCode; |
| | | working.Description = vm.Description; |
| | | |
| | | var workingHelper = GetWorkingHelper(); |
| | | //校验 |
| | | var checkResult = _hydroInfo.Check(); |
| | | if (!_checkResult.Succeed) |
| | | if (!checkResult.Succeed) |
| | | { |
| | | AppendWorkingTuple(vmo, checkResult, null); |
| | | AppendCurrentWorking(vmo); |
| | | ShowCheckCtrl(); |
| | | TipFormHelper.ShowWarn("校验失败,请检查后重试"); |
| | | ShowCheckCtrl(checkResult); |
| | | workingHelper.InitialData(hydroInfo, working, checkResult, null); |
| | | TipFormHelper.ShowError("校验失败,请检查后重试"); |
| | | return; |
| | | } |
| | | |
| | | WaitFormHelper.ShowWaitForm(this, "正在计算分析中,请稍候..."); |
| | | |
| | | |
| | | //await Task.Delay(5000); |
| | | //await Task.Delay(3000); |
| | | var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss); |
| | | |
| | | |
| | | WaitFormHelper.HideWaitForm(); |
| | | workingHelper.InitialData(hydroInfo, working, checkResult, calcuResult); |
| | | if (calcuResult.Succeed) |
| | | { |
| | | AppendWorkingTuple(vmo, checkResult, calcuResult); |
| | | AppendCurrentWorking(vmo); |
| | | UpdateVisualViewModelProperty(); |
| | | UpdateVisualViewModelCalcuProperty(); |
| | | UpdateVisualListCtrl(); |
| | | SetCalcuLabels(); |
| | | //UpdateSelectedProperty(); |
| | | //await _bimfaceCtrl?.SetLogicCalcuCustomLabelsCalcuResult(_calcuResult); |
| | | if (calcuResult.WainingList != null && calcuResult.WainingList.Count > 0) |
| | | { |
| | | ShowCalcuWarningCtrl(calcuResult); |
| | | } |
| | | this.barBtnAddWorking.Enabled = true; |
| | | TipFormHelper.ShowSucceed("计算成功!"); |
| | | var codes = _hydroInfo.Pumps.Select(x => x.Code).ToList(); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(codes); |
| | | } |
| | | else |
| | | { |
| | | ShowCalcuFailedCtrl(); |
| | | ShowCalcuFailedCtrl(calcuResult); |
| | | TipFormHelper.ShowError("计算失败!"); |
| | | } |
| | | ApplyGradingResultList(false); |
| | | UpdateVisualListCtrl(); |
| | | //ShowSelectedProperty(); |
| | | |
| | | #region 视图列表 |
| | | |
| | | var visualVmListHelper = GetVisualVmListHelper(); |
| | | visualVmListHelper.UpdateCalcuProperty(calcuResult); |
| | | |
| | | #endregion |
| | | |
| | | #region 计算标签 |
| | | |
| | | var calcuResultLabelHelper = await GetCalcuResultLabelHelper(); |
| | | calcuResultLabelHelper.Set(); |
| | | |
| | | #endregion |
| | | |
| | | }; |
| | | dlg.SetBindingData(_hydroInfo, allWorkingList, allMonitorValueList); |
| | | |
| | | dlg.ShowDialog(); |
| | | |
| | | } |
| | | |
| | | //水力计算 |
| | | private void barBtnHydroCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | private void barBtnCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | SetHydroWorkingDlg(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 计算标签 |
| | | |
| | | //所有计算标签 |
| | | private List<LogicCalcuCustomLabel> _allCalcuLabels = null; |
| | | |
| | | //获取计算标签 |
| | | private List<LogicCalcuCustomLabel> GetCalcuLabels() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | var allCalcuResultList = GetCalcuVisualResultList(Yw.EPAnet.CalcuMode.MinorLoss, false); |
| | | if (allCalcuResultList == null || allCalcuResultList.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | var list = new List<LogicCalcuCustomLabel>(); |
| | | |
| | | _hydroInfo.Pumps?.ForEach(x => |
| | | { |
| | | var hz = Math.Round(x.RatedHz * x.SpeedRatio); |
| | | var calcuPumpResult = GetCalcuVisualResult(x.Code) as HydroCalcuLinkResult; |
| | | if (calcuPumpResult != null) |
| | | { |
| | | var calcuPumpStartResult = GetCalcuVisualResult(x.StartCode) as HydroCalcuNodeResult; |
| | | var calcuPumpEndResult = GetCalcuVisualResult(x.EndCode) as HydroCalcuNodeResult; |
| | | var pumpCustomLabel = new LogicCalcuCustomLabel(); |
| | | pumpCustomLabel.Id = x.Code; |
| | | pumpCustomLabel.Distance = 20000; |
| | | pumpCustomLabel.Data = new List<LogicCalcuCustomLabelItem>() |
| | | { |
| | | new LogicCalcuCustomLabelItem(){ Name="状态",Value=HydroLinkStatusHelper.GetStatusName(x.LinkStatus),Unit=string.Empty}, |
| | | new LogicCalcuCustomLabelItem(){ Name="频率",Value=hz.ToString(),Unit=string.Empty}, |
| | | new LogicCalcuCustomLabelItem(){ Name="流量",Value=Math.Round(calcuPumpResult.CalcuFlow.Value,1).ToString(),Unit="m³/h"}, |
| | | new LogicCalcuCustomLabelItem(){ Name="进口压力",Value=Math.Round(calcuPumpStartResult.CalcuHead.Value,4).ToString(),Unit="m"}, |
| | | new LogicCalcuCustomLabelItem(){ Name="出口压力",Value=Math.Round(calcuPumpEndResult.CalcuHead.Value,4).ToString(),Unit="m"}, |
| | | }; |
| | | list.Add(pumpCustomLabel); |
| | | } |
| | | }); |
| | | |
| | | _hydroInfo.GetAllEmitters()?.ForEach(x => |
| | | { |
| | | var calcuEmitter = GetCalcuVisualResult(x.Code) as HydroCalcuNodeResult; |
| | | var emitterCustomLabel = new LogicCalcuCustomLabel(); |
| | | emitterCustomLabel.Id = x.Code; |
| | | emitterCustomLabel.Distance = 30000; |
| | | emitterCustomLabel.Data = new List<LogicCalcuCustomLabelItem>() |
| | | { |
| | | new LogicCalcuCustomLabelItem(){ Name="流量",Value=Math.Round(calcuEmitter.CalcuDemand.Value,1).ToString(),Unit="m³/h"}, |
| | | new LogicCalcuCustomLabelItem(){ Name="压力",Value=Math.Round(calcuEmitter.CalcuDemand.Value,4).ToString(),Unit="m"} |
| | | }; |
| | | list.Add(emitterCustomLabel); |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | //计算标签是否显示 |
| | | private bool _isCalcuLabelsVisible = false; |
| | | |
| | | //设置计算标签 |
| | | private void SetCalcuLabels() |
| | | { |
| | | if (_isCalcuLabelsVisible) |
| | | { |
| | | var allCalcuLabels = GetCalcuLabels(); |
| | | _bimfaceCtrl?.SetLogicCalcuCustomLabels(allCalcuLabels); |
| | | } |
| | | else |
| | | { |
| | | _bimfaceCtrl?.ClearLogicCalcuCustomLabels(); |
| | | } |
| | | } |
| | | |
| | | //设置计算标签是否显示 |
| | | private void barCkCalcuLabels_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | _isCalcuLabelsVisible = this.barCkCalcuLabels.Checked; |
| | | Calcu(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 当前工况 |
| | | |
| | | //当前工况 |
| | | private Yw.Vmo.HydroWorkingVmo _working = null; |
| | | //工况辅助类 |
| | | private SimulationWorkingHelper _workingHelper = null; |
| | | |
| | | //初始化当前工况 |
| | | private async void InitialCurrentWorking() |
| | | //获取工况辅助类 |
| | | private SimulationWorkingHelper GetWorkingHelper() |
| | | { |
| | | var allWorkingList = await GetWorkingList(); |
| | | this.repositoryItemImageComboBox1.Items.BeginUpdate(); |
| | | this.repositoryItemImageComboBox1.Items.Clear(); |
| | | if (allWorkingList != null && allWorkingList.Count > 0) |
| | | if (_workingHelper == null) |
| | | { |
| | | allWorkingList.ForEach(x => this.repositoryItemImageComboBox1.Items.Add(x.Name, x, -1)); |
| | | this.barEditCurrentWorking.EditValue = allWorkingList.Last(); |
| | | _workingHelper = new SimulationWorkingHelper(); |
| | | } |
| | | this.repositoryItemImageComboBox1.Items.EndUpdate(); |
| | | return _workingHelper; |
| | | } |
| | | |
| | | //增加当前工况 |
| | | private void AppendCurrentWorking(HydroWorkingVmo working) |
| | | //获取工况 |
| | | private HydroWorkingVmo GetWorking() |
| | | { |
| | | this.repositoryItemImageComboBox1.Items.BeginUpdate(); |
| | | this.repositoryItemImageComboBox1.Items.Add(working.Name, working, -1); |
| | | this.repositoryItemImageComboBox1.Items.EndUpdate(); |
| | | this.barEditCurrentWorking.EditValue = working; |
| | | var workingHelper = GetWorkingHelper(); |
| | | return workingHelper.Working; |
| | | } |
| | | |
| | | //设置当前工况 |
| | | private async void SetCurrentWorking(HydroWorkingVmo working) |
| | | //获取检查结果 |
| | | private HydroCheckResult GetCheckResult() |
| | | { |
| | | this.barEditCurrentWorking.EditValue = working; |
| | | _working = working; |
| | | var allWorkingTupleList = await GetWorkingTupleList(); |
| | | var tuple = allWorkingTupleList?.Find(x => x.Item1.ID == working.ID); |
| | | if (tuple == null) |
| | | { |
| | | return; |
| | | } |
| | | _checkResult = tuple.Item2; |
| | | _calcuResult = tuple.Item3; |
| | | var workingHelper = GetWorkingHelper(); |
| | | return workingHelper.CheckResult; |
| | | } |
| | | |
| | | //当前工况发生改变 |
| | | private void barEditCurrentWorking_EditValueChanged(object sender, EventArgs e) |
| | | //获取计算结果 |
| | | private HydroCalcuResult GetCalcuResult() |
| | | { |
| | | var working = this.barEditCurrentWorking.EditValue as HydroWorkingVmo; |
| | | SetCurrentWorking(working); |
| | | var workingHelper = GetWorkingHelper(); |
| | | return workingHelper.CalcuResult; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 工况控件 |
| | | |
| | | //工况控件 |
| | | private HydroWorkingTreeCtrl _workingCtrl = null; |
| | | |
| | | //获取工况控件 |
| | | private async Task<HydroWorkingTreeCtrl> GetWorkingCtrl() |
| | | //新增工况 |
| | | private void AddWorking() |
| | | { |
| | | if (_workingCtrl == null) |
| | | { |
| | | var allWorkingList = await GetWorkingList(); |
| | | _workingCtrl = new HydroWorkingTreeCtrl(); |
| | | _workingCtrl.Dock = DockStyle.Fill; |
| | | _workingCtrl.SetBindingData(allWorkingList); |
| | | _workingCtrl.FocusedChangedEvent += (vmo) => |
| | | { |
| | | SetCurrentWorking(vmo); |
| | | }; |
| | | } |
| | | 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() |
| | | { |
| | | if (IsWorkingCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | | var workingCtrl = await GetWorkingCtrl(); |
| | | this.controlContainerRight.Controls.Clear(); |
| | | this.controlContainerRight.Controls.Add(workingCtrl); |
| | | this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlRight.Text = "工况"; |
| | | this.docPnlRight.Width = 300; |
| | | } |
| | | |
| | | //隐藏工况控件 |
| | | private void HideWorkingCtrl() |
| | | { |
| | | if (IsWorkingCtrlVisible) |
| | | { |
| | | this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; |
| | | } |
| | | } |
| | | |
| | | //更新工况控件 |
| | | private async void UpdateWorkingCtrl() |
| | | { |
| | | var allWorkingList = await GetWorkingList(); |
| | | var workingCtrl = await GetWorkingCtrl(); |
| | | workingCtrl.SetBindingData(allWorkingList); |
| | | } |
| | | |
| | | //工况列表点击 |
| | | private void barBtnWorkingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowWorkingCtrl(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 工况评估 |
| | | |
| | | //评估 |
| | | private async void Evaluate() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_working == null) |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (workingHelper.Working == null) |
| | | { |
| | | TipFormHelper.ShowWarn("尚未计算,请计算后重试!"); |
| | | return; |
| | | } |
| | | var checkResult = await GetWorkingCheckResult(_working); |
| | | if (checkResult == null) |
| | | var dlg = new AddHydroWorkingDlg(); |
| | | dlg.SetBindingData(workingHelper.Working); |
| | | dlg.ReloadDataEvent += (rhs) => |
| | | { |
| | | return; |
| | | } |
| | | if (!checkResult.Succeed) |
| | | { |
| | | ShowCheckCtrl(checkResult); |
| | | TipFormHelper.ShowWarn("检查失败,停止评估!"); |
| | | return; |
| | | } |
| | | var calcuResult = await GetWorkingCalcuResult(_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 allVisualDict = GetVisualDict(); |
| | | var allMonitorList = await GetMonitorList(); |
| | | var allWorkingMonitorList = JsonHelper.Json2Object<List<HydroWorkingMonitorViewModel>>(_working.MonitorInfo); |
| | | var allCalcuResultDict = GetCalcuVisualDict(calcuResult); |
| | | var dlg = new HydroWorkingEvaluationDlg(); |
| | | dlg.SetBindingData(allVisualDict, allMonitorList, allWorkingMonitorList, allCalcuResultDict); |
| | | this.barBtnAddWorking.Enabled = false; |
| | | workingHelper.ResetWorking(rhs); |
| | | this.AppendWorkingEvent?.Invoke(rhs); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //精度评估 |
| | | private void barBtnWorkingEvaluation_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //增加工况 |
| | | private void barBtnAddWorking_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | Evaluate(); |
| | | AddWorking(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 工况并联 |
| | | #region 选择工况 |
| | | |
| | | //并联分析 |
| | | private void barBtnAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //工况选择列表辅助类 |
| | | private SimulationWorkingCheckedListHelper _workingCheckedListHelper = null; |
| | | |
| | | //获取工况元组辅助类 |
| | | private SimulationWorkingCheckedListHelper GetWorkingCheckedListHelper() |
| | | { |
| | | if (_workingCheckedListHelper == null) |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | _workingCheckedListHelper = new SimulationWorkingCheckedListHelper(visualListHelper); |
| | | _workingCheckedListHelper.InitialData(_allWorkingCheckedListDict); |
| | | } |
| | | return _workingCheckedListHelper; |
| | | } |
| | | |
| | | //更新工况选择列表 |
| | | public void UpdateWorkingCheckedList(HydroWorkingVmo working, bool hasChecked) |
| | | { |
| | | var helper = GetWorkingCheckedListHelper(); |
| | | helper.Update(working, hasChecked); |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region 工况分析 |
| | | |
| | | //精度评估 |
| | | private async void barBtnWorkingEvaluation_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var monitorHelper = GetMonitorHelper(); |
| | | var allMonitorList = await monitorHelper.Get(); |
| | | |
| | | var workingCheckedListHelper = GetWorkingCheckedListHelper(); |
| | | var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList(); |
| | | if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1) |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (!workingHelper.Initialized) |
| | | { |
| | | TipFormHelper.ShowWarn("请计算后重试!"); |
| | | return; |
| | | } |
| | | var dlg = new HydroSingleWorkingEvaluationDlg(); |
| | | dlg.SetBindingData(workingHelper.HydroInfo, allMonitorList, workingHelper.Working, workingHelper.CalcuResult); |
| | | dlg.ShowDialog(); |
| | | } |
| | | else |
| | | { |
| | | var dlg = new HydroMultiWorkingEvaluationDlg(); |
| | | dlg.SetBindingData(_hydroInfo, allMonitorList, allCheckedWorkingList); |
| | | dlg.ShowDialog(); |
| | | } |
| | | } |
| | | |
| | | //水泵分析 |
| | | private void barBtnPumpAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | |
| | | { |
| | | return; |
| | | } |
| | | var allCalcuResultList = GetCalcuVisualResultList(Yw.EPAnet.CalcuMode.MinorLoss, false); |
| | | |
| | | var calcuResultHelper = 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); |
| | | // } |
| | | // } |
| | | //} |
| | | } |
| | | |
| | | } |
| | |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 工况能效 |
| | | |
| | | //能效分析 |
| | | private void barBtnWorkingPower_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | XtraMessageBox.Show("正在开发中,敬请期待!"); |
| | | var workingCheckedListHelper = GetWorkingCheckedListHelper(); |
| | | var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList(); |
| | | if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1) |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (!workingHelper.Initialized) |
| | | { |
| | | TipFormHelper.ShowWarn("请计算后重试!"); |
| | | return; |
| | | } |
| | | var dlg = new SimulationSingleWorkingEnergyDlg(); |
| | | dlg.SetBindingData(workingHelper.HydroInfo, workingHelper.CalcuResult); |
| | | dlg.ShowDialog(); |
| | | } |
| | | else |
| | | { |
| | | var dlg = new SimulationMultiWorkingEnergyDlg(); |
| | | dlg.SetBindingData(_hydroInfo, allCheckedWorkingList); |
| | | dlg.ShowDialog(); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 损失曲线 |
| | | |
| | | //损失曲线 |
| | | private void barBtnWorkingLossCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | XtraMessageBox.Show("正在开发中,敬请期待!"); |
| | | if (_visual == null) |
| | | { |
| | | TipFormHelper.ShowWarn("请选择构件后重试!"); |
| | | return; |
| | | } |
| | | HydroVisualInfo visual = _visual; |
| | | if (_visual is HydroLinkInfo linkInfo) |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | visual = visualListHelper.GetVisual(linkInfo.StartCode); |
| | | } |
| | | |
| | | var workingCheckedListHelper = GetWorkingCheckedListHelper(); |
| | | var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList(); |
| | | if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1) |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (!workingHelper.Initialized) |
| | | { |
| | | TipFormHelper.ShowWarn("请计算后重试!"); |
| | | return; |
| | | } |
| | | var dlg = new HydroSingleWorkingLossCurveDlg(); |
| | | dlg.SetBindingData(workingHelper.HydroInfo, workingHelper.CalcuResult, visual); |
| | | dlg.ShowDialog(); |
| | | } |
| | | else |
| | | { |
| | | var dlg = new HydroMultiWorkingLossCurveDlg(); |
| | | dlg.SetBindingData(_hydroInfo, allCheckedWorkingList, visual); |
| | | dlg.ShowDialog(); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 损失比例 |
| | | |
| | | private void barBtnWorkingLossScale_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //损失统计 |
| | | private void barBtnWorkingLossStatistics_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | XtraMessageBox.Show("正在开发中,敬请期待!"); |
| | | var workingCheckedListHelper = GetWorkingCheckedListHelper(); |
| | | var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList(); |
| | | if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1) |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (!workingHelper.Initialized) |
| | | { |
| | | TipFormHelper.ShowWarn("请计算后重试!"); |
| | | return; |
| | | } |
| | | var dlg = new HydroSingleWorkingLossStatisticsDlg(); |
| | | dlg.SetBindingData(workingHelper.HydroInfo); |
| | | dlg.ShowDialog(); |
| | | } |
| | | else |
| | | { |
| | | var dlg = new HydroMultiWorkingLossStatisticsDlg(); |
| | | dlg.SetBindingData(_hydroInfo, allCheckedWorkingList); |
| | | dlg.ShowDialog(); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 综合分析 |
| | | private void barBtnWorkingAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //综合分析 |
| | | private async void barBtnWorkingAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | XtraMessageBox.Show("正在开发中,敬请期待!"); |
| | | if (_visual == null) |
| | | { |
| | | TipFormHelper.ShowWarn("请选择构件后重试!"); |
| | | return; |
| | | } |
| | | HydroVisualInfo visual = _visual; |
| | | if (_visual is HydroLinkInfo linkInfo) |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | visual = visualListHelper.GetVisual(linkInfo.StartCode); |
| | | } |
| | | |
| | | var monitorHelper = GetMonitorHelper(); |
| | | var allMonitorList = await monitorHelper.Get(); |
| | | |
| | | var workingCheckedListHelper = GetWorkingCheckedListHelper(); |
| | | var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList(); |
| | | if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1) |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (!workingHelper.Initialized) |
| | | { |
| | | TipFormHelper.ShowWarn("请计算后重试!"); |
| | | return; |
| | | } |
| | | var dlg = new SimulationSingleWorkingAnalyDlg(); |
| | | dlg.SetBindingData(workingHelper.HydroInfo, allMonitorList, workingHelper.Working, workingHelper.CalcuResult, visual); |
| | | dlg.ShowDialog(); |
| | | } |
| | | else |
| | | { |
| | | var dlg = new SimulationMultiWorkingAnalyDlg(); |
| | | dlg.SetBindingData(_hydroInfo, allMonitorList, allCheckedWorkingList, visual); |
| | | dlg.ShowDialog(); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |