From 142473031b3728bc0999d5be3b63bc5b62047504 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期四, 21 十一月 2024 15:34:40 +0800 Subject: [PATCH] 核心界面修改 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs | 3514 +++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 3,035 insertions(+), 479 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs index 4f71974..b05f471 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs @@ -1,4 +1,25 @@ 锘縢lobal using Yw.EPAnet; +using DevExpress.CodeParser; +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 HStation.WinFrmUI.PhartRelation; +using Microsoft.Web.WebView2.Core; +using NetTaste; +using NPOI.SS.Formula.Functions; +using System.Diagnostics; +using System.Windows.Media; +using System.Windows.Media.Media3D; +using Yw.Hydro; +using Yw.Model; +using Yw.Pump; +using Yw.Vmo; using Yw.WinFrmUI.Bimface; using Yw.WinFrmUI.Hydro; @@ -12,16 +33,14 @@ this.PageTitle.Caption = "姘村姏妯℃嫙"; this.PageTitle.HeaderSvgImage = this.svgImg32[0]; this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; - + RegistBulkSetEvents(); } private HStation.Vmo.XhsProjectVmo _project = null;//椤圭洰 private HStation.Vmo.XhsProjectSiteVmo _projectSite = null;//椤圭洰绔� private Yw.Model.HydroModelInfo _hydroInfo = null;//姘村姏淇℃伅 - private Yw.Model.HydroParterInfo _parter = null; - private Yw.WinFrmUI.HydroCheckResult _checkResult = null; - private Yw.EPAnet.CalcuResult _calcuResult = null; + /// <summary> /// 缁戝畾鏁版嵁 @@ -55,7 +74,7 @@ /// <summary> /// 鍒濆鍖栨暟鎹� /// </summary> - public override async void InitialDataSource() + public override void InitialDataSource() { base.InitialDataSource(); if (_project == null) @@ -63,35 +82,37 @@ return; } this.PageTitle.Caption = $"{_project.Name}\r\n姘村姏妯℃嫙"; - var bimfaceCtrl = GetBimfaceCtrl(); - this.tabPageBimface.Controls.Clear(); - this.tabPageBimface.Controls.Add(bimfaceCtrl); - await bimfaceCtrl.InitialData(_project, _projectSite, () => _hydroInfo); - this.xhsProjectSimulationQ3dCtrl1.SetBindingData(_hydroInfo); - this.xhsProjectSimulationPropertyCtrl1.InitialData(() => _hydroInfo); + ShowBimfaceCtrl(); + ShowQ3dCtrl(); + ShowPropertyCtrl(); } - #region Bimface + private void InitialUI() + { + InitialCurrentWorking(); + } + + + #region BIM鎺т欢 + + //bimface鎺т欢 + private XhsProjectSimulationBimfaceCtrl _bimfaceCtrl = null; //鑾峰彇 bimface 鎺т欢 - private XhsProjectSimulationBimfaceCtrl GetBimfaceCtrl() + private async Task<XhsProjectSimulationBimfaceCtrl> GetBimfaceCtrl() { if (_bimfaceCtrl == null) { _bimfaceCtrl = new XhsProjectSimulationBimfaceCtrl(); _bimfaceCtrl.Dock = DockStyle.Fill; - _bimfaceCtrl.LoadCompletedEvent += async () => + await _bimfaceCtrl.InitialData(_project, _projectSite); + _bimfaceCtrl.LoadCompletedEvent += () => {//view鍔犺浇瀹屾垚浜嬩欢 if (_hydroInfo == null) { return; } - var elementIds = new List<string>(); - var pumps = _hydroInfo.Pumps?.Where(x => x.LinkStatus == Yw.Hydro.PumpStatus.Open).ToList(); - pumps?.ForEach(x => elementIds.Add(x.Code)); - var valves = _hydroInfo.Valves?.Where(x => x.LinkStatus == Yw.Hydro.ValveStatus.Open).ToList(); - valves?.ForEach(x => elementIds.Add(x.Code)); - await _bimfaceCtrl?.SetOpenComponentsColor(elementIds); + InitialUI(); }; _bimfaceCtrl.HydroMouseLeftClickEvent += (obj) => {//榧犳爣宸﹂敭鐐瑰嚮浜嬩欢 @@ -99,98 +120,574 @@ { return; } - _parter = obj; - ShowProperty(); - SetBimfaceLinkColor(); + //_selectedVisual = obj; + //ShowSelectedProperty(); }; } return _bimfaceCtrl; } - //bimface鎺т欢 - private XhsProjectSimulationBimfaceCtrl _bimfaceCtrl = null; - //璁剧疆Bimface杩炴帴棰滆壊 - private async void SetBimfaceLinkColor() + //鏄剧ず bimface 鎺т欢 + private async void ShowBimfaceCtrl() + { + var bimfaceCtrl = await GetBimfaceCtrl(); + this.tabPageBimface.Controls.Clear(); + this.tabPageBimface.Controls.Add(bimfaceCtrl); + } + + private void SelectBimfaceParter() + { + + } + + #endregion + + #region Q3d鎺т欢 + + //Q3d 鎺т欢 + private XhsProjectSimulationQ3dCtrl _q3dCtrl = null; + + //鑾峰彇 Q3d 鎺т欢 + private XhsProjectSimulationQ3dCtrl GetQ3dCtrl() + { + if (_q3dCtrl == null) + { + _q3dCtrl = new XhsProjectSimulationQ3dCtrl(); + _q3dCtrl.Dock = DockStyle.Fill; + _q3dCtrl.InitialData(() => _hydroInfo); + _q3dCtrl.SelectedPartersChangedEvent += (obj) => + { + if (_hydroInfo == null) + { + return; + } + var allParterList = _hydroInfo.GetAllVisuals(); + _visual = allParterList?.Find(x => x.Code == obj?.FirstOrDefault()); + //ShowSelectedProperty(); + }; + } + return _q3dCtrl; + } + + //鏄剧ず Q3d 鎺т欢 + private void ShowQ3dCtrl() + { + var q3dCtrl = GetQ3dCtrl(); + this.tabPageQ3d.Controls.Clear(); + this.tabPageQ3d.Controls.Add(q3dCtrl); + } + + #endregion + + #region 鏋勪欢鏄庣粏 + + #region 鍙鍒楄〃 + + //鎵�鏈夊彲瑙嗗瓧鍏� + private Dictionary<string, HydroVisualInfo> _allVisualDict = null; + + //鑾峰彇鍙瀛楀吀 + private Dictionary<string, HydroVisualInfo> GetVisualDict() { if (_hydroInfo == null) { - return; + return default; } - if (_parter != null) + if (_allVisualDict == null) { - if (_parter is Yw.Model.HydroLinkInfo link) - { - await _bimfaceCtrl?.RestoreLinkComponentsColor(); + _allVisualDict = new Dictionary<string, HydroVisualInfo>(); + var allVisualList = _hydroInfo.GetAllVisuals(); + allVisualList?.ForEach(x => _allVisualDict.Add(x.Code, x)); + } + return _allVisualDict; + } - var allVisualList = _hydroInfo.GetAllVisuals(); - var allLinkList = _hydroInfo.GetAllLinks(); - var startParter = allVisualList?.Find(x => x.Code == link.StartCode); - if (startParter != null) + //鑾峰彇鍙鍒楄〃 + 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 startElementIds = new List<string>(); - if (startParter.GetType() == typeof(Yw.Model.HydroJunctionInfo)) + var vm = HydroVisualViewModelBuilder.CreateVisualViewModel(visualKeyValue.Value, _hydroInfo); + var calcuVisualResult = GetCalcuVisualResult(visualKeyValue.Key); + if (calcuVisualResult != null) { - var startLinkList = allLinkList?.Where(x => x.StartCode == startParter.Code || x.EndCode == startParter.Code && x.Code != _parter.Code).ToList(); - if (startLinkList != null && startLinkList.Count > 0) - { - startElementIds.AddRange(startLinkList.Select(x => x.Code)); - } + vm.UpdateCalcuProperty(calcuVisualResult); } - else - { - startElementIds.Add(startParter.Code); - } - if (startElementIds.Count > 0) - { - await _bimfaceCtrl?.SetLinkStartComponentsColor(startElementIds); - } + _allVisualViewModelDict.Add(visualKeyValue.Key, vm); } - var endParter = allVisualList?.Find(x => x.Code == link.EndCode); - if (endParter != null) + } + } + 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) { - var endElementIds = new List<string>(); - if (endParter.GetType() == typeof(Yw.Model.HydroJunctionInfo)) - { - var endLinkList = allLinkList?.Where(x => x.StartCode == endParter.Code || x.EndCode == endParter.Code && x.Code != _parter.Code).ToList(); - if (endLinkList != null && endLinkList.Count > 0) - { - endElementIds.AddRange(endLinkList.Select(x => x.Code)); - } - } - else - { - endElementIds.Add(endParter.Code); - } - if (endElementIds.Count > 0) - { - await _bimfaceCtrl?.SetLinkEndComponentsColor(endElementIds); - } + 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 - #region Q3d + #endregion - //鐐瑰嚮浜嬩欢 - private void xhsProjectSimulationQ3dCtrl1_ClickParterEvent(string code) + #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; } - var allParterList = _hydroInfo.GetAllParters(); - _parter = allParterList?.Find(x => x.Code == code); - ShowProperty(); + 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 灞炴�ч潰鏉� + #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 _propertyCtrl = null; + + //鑾峰彇灞炴�ф帶浠� + private XhsProjectSimulationPropertyCtrl GetPropertyCtrl() + { + if (_propertyCtrl == null) + { + _propertyCtrl = new XhsProjectSimulationPropertyCtrl(); + _propertyCtrl.Dock = DockStyle.Fill; + _propertyCtrl.HydroViewEvent += (visual) => + { + if (visual == null) + { + return; + } + _bimfaceCtrl?.ZoomToComponent(visual.Code); + }; + _propertyCtrl.BlinkLinkNodeEvent += async (link, linkNodeCode) => + { //寮鸿皟杩炴帴鑺傜偣 + if (_hydroInfo == null) + { + return; + } + if (link == null) + { + return; + } + if (string.IsNullOrEmpty(linkNodeCode)) + { + return; + } + var linkNode = GetVisual(linkNodeCode); + if (linkNode == null) + { + return; + } + var blinkCodes = new List<string>(); + if (linkNode.GetType() == typeof(HydroJunctionInfo)) + { + var allLinkList = GetLinkList(); + if (allLinkList == null || allLinkList.Count < 1) + { + return; + } + var linkList = allLinkList.Where(x => (x.StartCode == linkNodeCode || x.EndCode == linkNodeCode) && x.Code != linkNodeCode).ToList(); + if (linkList == null || linkList.Count < 1) + { + return; + } + blinkCodes.AddRange(linkList.Select(x => x.Code)); + } + else + { + blinkCodes.Add(linkNodeCode); + } + + await _bimfaceCtrl?.ClearBlinkComponents(); + await _bimfaceCtrl?.SetBlinkComponents(blinkCodes); + await Task.Delay(5000); + await _bimfaceCtrl?.ClearBlinkComponents(); + }; + _propertyCtrl.PropertyValueChangedEvent += (visual) => + { + if (visual == null) + { + return; + } + UpdateVisualListCtrl(); + //ApplyGradingResultList(visual); + }; + _propertyCtrl.MarkPropertyValueChangedEvent += (visual) => + { + //鏍囨敞灞炴�у彂鐢熸敼鍙� + //鍒ゆ柇褰撳墠鏄惁鏈夋爣娉ㄥ睍绀猴紝鑻ユ湁鍒欐洿鏂版爣娉紝鏈�濂芥槸鏇存柊鍗曚釜鏍囨敞 + }; + _propertyCtrl.GradingPropertyValueChangedEvent += (parter) => + { + //鍒嗙骇灞炴�у彂鐢熸敼鍙� + //鍒ゆ柇褰撳墠鏄惁鏈夊垎绾у睍绀猴紝鑻ユ湁鍒欐洿鏂板垎绾э紝鏈�濂芥槸鏇存柊鍗曚釜鍒嗙骇 + }; + _propertyCtrl.FlowEffectPropertyValueChangedEvent += (visual) => + { + //娴佸悜灞炴�у彂鐢熸敼鍙� + //鍒ゆ柇娴佸悜鏄惁鍔犺浇锛屽鏋滃姞杞藉垯鏇存柊娴佸悜锛屾渶濂芥槸鏇存柊鍗曚釜娴佸悜 + }; + + } + return _propertyCtrl; + } + + //灞炴�ф帶浠舵槸鍚﹀彲瑙� + private bool IsPropertyCtrlVisible + { + get + { + if (this.docPnlRight.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) + { + if (this.controlContainerRight.Controls.Count > 0) + { + if (this.controlContainerRight.Controls[0] is XhsProjectSimulationPropertyCtrl) + { + return true; + } + } + } + return false; + } + } + + //鏄剧ず灞炴�ф帶浠� + private void ShowPropertyCtrl() + { + if (IsPropertyCtrlVisible) + { + return; + } + var propertyCtrl = GetPropertyCtrl(); + this.controlContainerRight.Controls.Clear(); + this.controlContainerRight.Controls.Add(propertyCtrl); + this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; + this.docPnlRight.Text = "灞炴��"; + this.docPnlRight.Width = 300; + } + + //璁剧疆灞炴�ф帶浠� + private void SetPropertyCtrl(HydroVisualInfo visual) + { + ShowPropertyCtrl(); + var vm = GetVisualViewModel(visual); + _propertyCtrl.SelectedObject = vm; + } + + //鏇存柊灞炴�ф帶浠� + private void UpdatePropertyCtrl() + { + _propertyCtrl?.UpdateRows(); + } + + //娓呯悊灞炴�ф帶浠� + private void ClearPropertyCtrl() + { + if (_propertyCtrl != null) + { + _propertyCtrl.SelectedObject = null; + } + } #endregion @@ -209,16 +706,15 @@ { return; } - var allParterList = _hydroInfo.GetAllParters(); - _parter = allParterList?.Find(x => x.Code == code); + var allParterList = _hydroInfo.GetAllVisuals(); + _visual = allParterList?.Find(x => x.Code == code); var elementIds = new List<string>(); - if (_parter != null) + if (_visual != null) { - elementIds.Add(_parter.Code); + elementIds.Add(_visual.Code); } await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); - ShowProperty(); - SetBimfaceLinkColor(); + //ShowSelectedProperty(); }; _matchingListCtrl.ApplyMatchingEvent += (output) => { @@ -231,6 +727,7 @@ } return _matchingListCtrl; } + //鍖归厤鍒楄〃鎺т欢 private XhsProjectSimulationMatchingListCtrl _matchingListCtrl = null; @@ -243,7 +740,7 @@ } this.controlContainerBottom.Controls.Clear(); var matchingListCtrl = GetMatchingListCtrl(); - var input = AssetsMatchingParasHelper.Create(_hydroInfo); + 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; @@ -251,10 +748,9 @@ this.docPnlBottom.Height = 350; } - #endregion - #region 鏈尮閰嶅垪琛� + #region 鏈尮鍒楄〃 //鑾峰彇鏈尮閰嶅垪琛ㄦ帶浠� private XhsProjectSimulationUnMatchingListCtrl GetUnMatchingListCtrl() @@ -273,23 +769,23 @@ { return; } - var allParterList = _hydroInfo.GetAllParters(); - _parter = allParterList?.Find(x => x.Code == parter.Code); + var allParterList = _hydroInfo.GetAllVisuals(); + _visual = allParterList?.Find(x => x.Code == parter.Code); var elementIds = new List<string>() { parter.Code }; await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); - ShowProperty(); - SetBimfaceLinkColor(); + //ShowSelectedProperty(); }; _unMatchingListCtrl.ViewModelEvent += async (parters) =>//鏌ョ湅妯″瀷 { var codes = parters?.Select(x => x.Code).Distinct().ToList(); await _bimfaceCtrl?.ZoomAndSelectComponents(codes); - _parter = null; - ShowProperty(); + _visual = null; + //ShowSelectedProperty(); }; } return _unMatchingListCtrl; } + private XhsProjectSimulationUnMatchingListCtrl _unMatchingListCtrl = null;//鏈尮閰嶅垪琛� //鏈尮閰嶅垪琛� @@ -308,99 +804,119 @@ this.docPnlBottom.Height = 350; } - - #endregion #region 涓�閿樉闅� - //鏄鹃殣缂栫爜鍒楄〃 - private List<string> _fastShowHideCodeList = null; - - //瑙﹀彂涓�閿樉闅� - private async void barBtnShowHide_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + //璁剧疆瑁呴グ浠跺彲瑙佹�� + private async void SetDecoratorVisible(bool isDecoratorVisible) { - if (_hydroInfo == null) + var codes = _hydroInfo.Decorators?.Select(x => x.Code).Distinct().ToList(); + if (isDecoratorVisible) { - return; - } - if (_hydroInfo.Decorators == null || _hydroInfo.Decorators.Count < 1) - { - return; - } - if (_fastShowHideCodeList == null) - { - _fastShowHideCodeList = _hydroInfo.Decorators.Select(x => x.Code).ToList(); - await _bimfaceCtrl?.HideComponents(_fastShowHideCodeList); + await _bimfaceCtrl?.ShowComponents(codes); } else { - await _bimfaceCtrl?.ShowComponents(_fastShowHideCodeList); - _fastShowHideCodeList = null; + await _bimfaceCtrl?.HideComponents(codes); } + } + + //璁剧疆 + private void barCkDecorator_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + SetDecoratorVisible(this.barCkDecorator.Checked); } #endregion - #region 姘村姏鏍¢獙 + #region 鏋勪欢鏄剧ず - //鑾峰彇鏍¢獙缁撴灉鎺т欢 - private XhsProjectSimulationHydroCheckResultCtrl GetCheckResultCtrl() - { - if (_checkResultCtrl == null) - { - _checkResultCtrl = new XhsProjectSimulationHydroCheckResultCtrl(); - _checkResultCtrl.Dock = DockStyle.Fill; - _checkResultCtrl.HydroClickEvent += async (code) => - { - if (_hydroInfo == null) - { - return; - } - var elementIds = new List<string>(); - if (string.IsNullOrEmpty(code)) - { - _parter = null; - } - else - { - var allParterList = _hydroInfo.GetAllParters(); - _parter = allParterList?.Find(x => x.Code == code); - if (_parter != null) - { - elementIds.Add(_parter.Code); - } - } - await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); - ShowProperty(); - SetBimfaceLinkColor(); - }; - } - return _checkResultCtrl; - } - //鏍¢獙缁撴灉鎺т欢 - private XhsProjectSimulationHydroCheckResultCtrl _checkResultCtrl = null; + //鎵�鏈夋樉绀哄垪琛� + private List<HydroVisualVisibleViewModel> _allVisibleList = null; - //姘村姏楠岃瘉 - private void barBtnHydroCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + //鑾峰彇鏄剧ず鍒楄〃 + 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; } - _checkResult = _hydroInfo.Check(); - this.controlContainerBottom.Controls.Clear(); - var checkResultCtrl = GetCheckResultCtrl(); - checkResultCtrl.SetBindingData(_checkResult); - this.controlContainerBottom.Controls.Add(checkResultCtrl); - this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; - this.docPnlBottom.Text = "鏍¢獙缁撴灉"; - this.docPnlBottom.Height = 350; + 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 - #region 淇濆瓨姘村姏淇℃伅 + #region 淇濆瓨淇℃伅 //淇濆瓨 private async void barBtnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) @@ -409,7 +925,17 @@ { return; } + Stopwatch sw = new Stopwatch(); + sw.Start(); + + var id = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.Save(_hydroInfo); + + //鑰楁椂宸ㄥぇ鐨勪唬鐮� + + sw.Stop(); + TimeSpan ts2 = sw.Elapsed; + Console.WriteLine("Stopwatch鎬诲叡鑺辫垂{0}ms.", ts2.TotalMilliseconds); if (id < 1) { TipFormHelper.ShowError("淇濆瓨澶辫触锛�"); @@ -421,62 +947,1804 @@ #endregion - #region 鏋勪欢鏄庣粏 + #region 鎵归噺閰嶇疆 - //鑾峰彇鏋勪欢鏄庣粏鎺т欢 - private Yw.WinFrmUI.HydroParterListCtrl GetParterListCtrl() + //娉ㄥ唽鎵归噺閰嶇疆浜嬩欢 + private void RegistBulkSetEvents() { - if (_parterListCtrl == null) + //姘村簱 + this.barBtnSetReservoirList.ItemClick += delegate { - _parterListCtrl = new HydroParterListCtrl(); - _parterListCtrl.Dock = DockStyle.Fill; - _parterListCtrl.HydroClickEvent += async (parter) => + //var dlg = new HydroReservoirBulkSetListDlg(); + //dlg.ShowDialog(); + }; + //姘存睜 + this.barBtnSetTankList.ItemClick += delegate + { + //var dlg = new HydroTankBulkSetListDlg(); + //dlg.ShowDialog(); + }; + //姘寸 + this.barBtnSetWaterboxList.ItemClick += delegate + { + //if (_hydroInfo == null) + //{ + // return; + //} + //var dlg = new SetHydroWaterboxListDlg(); + //dlg.SetBindingData(_hydroInfo); + //dlg.HydroClickEvent += async (obj) => + //{ + // if (obj == null) + // { + // return; + // } + // _selectedParter = obj; + // await _bimfaceCtrl?.ZoomAndSelectComponent(obj.Code); + // ShowProperty(); + //}; + //dlg.HydroChangedEvent += (obj) => + //{ + + //}; + //dlg.ShowDialog(); + }; + //杩炴帴鑺傜偣 + this.barBtnSetJunctionList.ItemClick += delegate + { + //var dlg = new HydroJunctionBulkSetListDlg(); + //dlg.ShowDialog(); + }; + //闂峰ご + this.barBtnSetBluntheadList.ItemClick += delegate + { + //if (_hydroInfo == null) + //{ + // return; + //} + //var dlg = new SetHydroBluntheadListDlg(); + //dlg.SetBindingData(_hydroInfo); + //dlg.HydroClickEvent += async (obj) => + //{ + // if (obj == null) + // { + // return; + // } + // _selectedParter = obj; + // await _bimfaceCtrl?.ZoomAndSelectComponent(obj.Code); + // ShowProperty(); + //}; + //dlg.HydroChangedEvent += (obj) => + //{ + + //}; + //dlg.ShowDialog(); + }; + //寮ご + this.barBtnSetElbowsList.ItemClick += delegate + { + //if (_hydroInfo == null) + //{ + // return; + //} + //var dlg = new SetHydroElbowListDlg(); + //dlg.SetBindingData(_hydroInfo); + //dlg.HydroClickEvent += async (obj) => + //{ + // if (obj == null) + // { + // return; + // } + // _selectedParter = obj; + // await _bimfaceCtrl?.ZoomAndSelectComponent(obj.Code); + // ShowProperty(); + //}; + //dlg.HydroChangedEvent += (obj) => + //{ + + //}; + //dlg.ShowDialog(); + }; + //涓夐�� + this.barBtnSetThreelinkList.ItemClick += delegate + { + if (_hydroInfo == null) { - if (_hydroInfo == null) + return; + } + var dlg = new SetHydroThreelinkListDlg(); + dlg.SetBindingData(_hydroInfo); + dlg.ShowDialog(); + }; + //鍥涢�� + this.barBtnSetFourlinkList.ItemClick += delegate + { + if (_hydroInfo == null) + { + return; + } + var dlg = new SetHydroFourlinkListDlg(); + dlg.SetBindingData(_hydroInfo); + dlg.ShowDialog(); + }; + //姘磋〃 + this.barBtnSetMeterList.ItemClick += delegate + { + if (_hydroInfo == null) + { + return; + } + var dlg = new SetHydroMeterListDlg(); + dlg.SetBindingData(_hydroInfo); + dlg.ShowDialog(); + }; + //娴侀噺璁� + this.barBtnSetFlowmeterList.ItemClick += delegate + { + if (_hydroInfo == null) + { + return; + } + var dlg = new SetHydroFlowmeterListDlg(); + dlg.SetBindingData(_hydroInfo); + dlg.ShowDialog(); + }; + //鍘嬪姏琛� + this.barBtnSetPressmeterList.ItemClick += delegate + { + if (_hydroInfo == null) + { + return; + } + var dlg = new SetHydroPressmeterListDlg(); + dlg.SetBindingData(_hydroInfo); + dlg.ShowDialog(); + }; + //绠¢亾 + this.barBtnSetPipeList.ItemClick += delegate + { + if (_hydroInfo == null) + { + return; + } + var dlg = new SetHydroPipeListDlg(); + dlg.SetBindingData(_hydroInfo); + dlg.ShowDialog(); + }; + //姘存车 + this.barBtnSetPumpList.ItemClick += delegate + { + if (_hydroInfo == null) + { + return; + } + var dlg = new SetHydroPumpListDlg(); + dlg.SetBindingData(_hydroInfo); + dlg.ShowDialog(); + }; + //闃�闂� + this.barBtnSetValveList.ItemClick += delegate + { + if (_hydroInfo == null) + { + return; + } + var dlg = new SetHydroValveListDlg(); + dlg.SetBindingData(_hydroInfo); + dlg.ShowDialog(); + }; + } + + + //鏄剧ずRadialMenu + private void barBtnSetList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + this.rmSet.ShowPopup(MousePosition, true); + } + + //寮瑰嚭鍓� + private void rmSet_BeforePopup(object sender, CancelEventArgs e) + { + if (_hydroInfo == null) + { + e.Cancel = true; + return; + } + //姘村簱 + if (_hydroInfo.Reservoirs == null || _hydroInfo.Reservoirs.Count < 1) + { + this.barBtnSetReservoirList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; + } + else + { + this.barBtnSetReservoirList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; + } + + //姘存睜 + if (_hydroInfo.Tanks == null || _hydroInfo.Tanks.Count < 1) + { + this.barBtnSetTankList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; + } + else + { + this.barBtnSetTankList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; + } + + //姘寸 + if (_hydroInfo.Waterboxs == null || _hydroInfo.Waterboxs.Count < 1) + { + this.barBtnSetWaterboxList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; + } + else + { + this.barBtnSetWaterboxList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; + } + + //杩炴帴鑺傜偣 + if (_hydroInfo.Junctions == null || _hydroInfo.Junctions.Count < 1) + { + this.barBtnSetJunctionList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; + } + else + { + this.barBtnSetJunctionList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; + } + + //鍠峰槾 + if (_hydroInfo.Nozzles == null || _hydroInfo.Nozzles.Count < 1) + { + this.barBtnSetNozzleList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; + } + else + { + this.barBtnSetNozzleList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; + } + + //娑堢伀鏍� + if (_hydroInfo.Hydrants == null || _hydroInfo.Hydrants.Count < 1) + { + this.barBtnSetHydrantList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; + } + else + { + this.barBtnSetHydrantList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; + } + + //闂峰ご + if (_hydroInfo.Bluntheads == null || _hydroInfo.Bluntheads.Count < 1) + { + this.barBtnSetBluntheadList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; + } + else + { + this.barBtnSetBluntheadList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; + } + + //寮ご + if (_hydroInfo.Elbows == null || _hydroInfo.Elbows.Count < 1) + { + this.barBtnSetElbowsList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; + } + else + { + this.barBtnSetElbowsList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; + } + + //涓夐�� + if (_hydroInfo.Threelinks == null || _hydroInfo.Threelinks.Count < 1) + { + this.barBtnSetThreelinkList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; + } + else + { + this.barBtnSetThreelinkList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; + } + + //鍥涢�� + if (_hydroInfo.Fourlinks == null || _hydroInfo.Fourlinks.Count < 1) + { + this.barBtnSetFourlinkList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; + } + else + { + this.barBtnSetFourlinkList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; + } + + //姘磋〃 + if (_hydroInfo.Meters == null || _hydroInfo.Meters.Count < 1) + { + this.barBtnSetMeterList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; + } + else + { + this.barBtnSetMeterList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; + } + + //娴侀噺璁� + if (_hydroInfo.Flowmeters == null || _hydroInfo.Flowmeters.Count < 1) + { + this.barBtnSetFlowmeterList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; + } + else + { + this.barBtnSetFlowmeterList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; + } + + //鍘嬪姏琛� + if (_hydroInfo.Pressmeters == null || _hydroInfo.Pressmeters.Count < 1) + { + this.barBtnSetPressmeterList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; + } + else + { + this.barBtnSetPressmeterList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; + } + + //绠¢亾 + if (_hydroInfo.Pipes == null || _hydroInfo.Pipes.Count < 1) + { + this.barBtnSetPipeList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; + } + else + { + this.barBtnSetPipeList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; + } + + //杩囨浮浠� + if (_hydroInfo.Translations == null || _hydroInfo.Translations.Count < 1) + { + this.barBtnSetTranslationList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; + } + else + { + this.barBtnSetTranslationList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; + } + + //鎹㈢儹鍣� + if (_hydroInfo.Exchangers == null || _hydroInfo.Exchangers.Count < 1) + { + this.barBtnSetExchangerList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; + } + else + { + this.barBtnSetExchangerList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; + } + + //绌哄帇鏈� + if (_hydroInfo.Compressors == null || _hydroInfo.Compressors.Count < 1) + { + this.barBtnSetCompressorList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; + } + else + { + this.barBtnSetCompressorList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; + } + + //姘存车 + if (_hydroInfo.Pumps == null || _hydroInfo.Pumps.Count < 1) + { + this.barBtnSetPumpList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; + } + else + { + this.barBtnSetPumpList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; + } + + //闃�闂� + if (_hydroInfo.Valves == null || _hydroInfo.Valves.Count < 1) + { + this.barBtnSetValveList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; + } + else + { + this.barBtnSetValveList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; + } + + } + + #endregion + + #region 鏋勪欢鏌ヨ + + //鏌ヨ缁勪欢 + private HydroVisualSearchListCtrl _searchCtrl = null; + + //鑾峰彇鏌ヨ缁勪欢 + private HydroVisualSearchListCtrl GetSearchCtrl() + { + if (_searchCtrl == null) + { + _searchCtrl = new HydroVisualSearchListCtrl(); + _searchCtrl.Dock = DockStyle.Fill; + var allVisualViewModelList = GetVisualViewModelList(); + _searchCtrl.InitialData(allVisualViewModelList); + _searchCtrl.HydroClickInfoEvent += async (visual) => + { + //ShowPropertyCtrl(visual); + await _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); + }; + _searchCtrl.HydroSearchInfoEvent += async (list) => + { + var elementIds = new List<string>(); + if (list != null && list.Count > 0) { - return; + _visual = list.First(); + list.ForEach(x => elementIds.Add(x.Code)); } - var allParterList = _hydroInfo.GetAllParters(); - _parter = allParterList?.Find(x => x.Code == parter.Code); - await _bimfaceCtrl?.ZoomAndSelectComponents(new List<string>() { _parter.Code }); - ShowProperty(); - SetBimfaceLinkColor(); + else + { + _visual = null; + } + //ShowSelectedProperty(); + await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); }; } - return _parterListCtrl; + return _searchCtrl; } - //鏋勪欢鏄庣粏鎺т欢 - private Yw.WinFrmUI.HydroParterListCtrl _parterListCtrl = null; - //姘村姏鏋勪欢鍒楄〃 - private void barBtnHydroParterList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + //鏌ヨ鎺т欢鏄惁鍙 + private bool IsSearchCtrlVisible + { + get + { + if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) + { + if (this.controlContainerBottom.Controls.Count > 0) + { + if (this.controlContainerBottom.Controls[0] is HydroVisualSearchListCtrl) + { + return true; + } + } + } + return false; + } + } + + //鏄剧ず鏌ヨ鎺т欢 + private void ShowSearchCtrl(string content) + { + if (IsSearchCtrlVisible) + { + return; + } + var searchCtrl = GetSearchCtrl(); + searchCtrl.SetBindingData(content); + this.controlContainerBottom.Controls.Clear(); + this.controlContainerBottom.Controls.Add(searchCtrl); + this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; + this.docPnlBottom.Text = "鏋勪欢鏌ヨ"; + this.docPnlBottom.Height = 350; + } + + //鏄剧ず鏌ヨ绐椾綋 + private void ShowSearchDlg() + { + if (IsSearchCtrlVisible) + { + return; + } + var dlg = new InputHydroVisualSearchListDlg(); + dlg.SearchEvent += (content) => + { + if (string.IsNullOrEmpty(content)) + { + return; + } + ShowSearchCtrl(content); + }; + dlg.SetBindingData(); + dlg.ShowDialog(); + } + + //鏌ヨ + private void barBtnSearch_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + ShowSearchDlg(); + } + + #endregion + + #region 妯″瀷鏍囨敞 + + #region 鏍囨敞璁剧疆 + + //鎵�鏈夋爣娉ㄨ缃垪琛� + private List<HydroMarkSetViewModel> _allMarkSetList = null; + + //鑾峰彇鏍囨敞璁剧疆鍒楄〃 + private List<HydroMarkSetViewModel> GetMarkSetList() + { + if (_hydroInfo == null) + { + return default; + } + if (_allMarkSetList == null) + { + _allMarkSetList = HydroMarkHelper.GetSetList(_hydroInfo); + } + return _allMarkSetList; + } + + #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() { if (_hydroInfo == null) { return; } - this.controlContainerBottom.Controls.Clear(); - var parterListCtrl = GetParterListCtrl(); - parterListCtrl.SetBindingData(_hydroInfo); - this.controlContainerBottom.Controls.Add(parterListCtrl); - this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; - this.docPnlBottom.Text = "鏋勪欢鏄庣粏"; - this.docPnlBottom.Height = 350; + var allMarkSetList = GetMarkSetList(); + var dlg = new SetHydroMarkDlg(); + dlg.SetBindingData(allMarkSetList); + dlg.ReloadDataEvent += (list) => + { + _allMarkSetList = list; + ApplyMarkList(false); + }; + dlg.ShowDialog(); + } + + //璁剧疆鏍囨敞 + private void barBtnSetMark_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + ShowSetMarkDlg(); + } + + //鏄惁鏄剧ず + private void barCkMark_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + _isMarkVisible = this.barCkMark.Checked; + ApplyMarkList(true); + } + + #endregion + + #endregion + + #region 棰滆壊鍒嗙骇 + + #region 棰滆壊閰嶇疆 + + //鎵�鏈夐鑹插垎绾ч厤缃垪琛� + private List<HydroGradingVmo> _allGradingList = null; + + //鑾峰彇棰滆壊鍒嗙骇閰嶇疆鍒楄〃 + private async Task<List<HydroGradingVmo>> GetGradingList() + { + if (_hydroInfo == null) + { + return default; + } + if (_allGradingList == null) + { + _allGradingList = await HydroGradingHelper.GetGradingList(_hydroInfo); + } + return _allGradingList; + } + + //鏄剧ず棰滆壊鍒嗙骇绐椾綋 + private async void ShowGradingDlg() + { + if (_hydroInfo == null) + { + return; + } + var allGradingList = await GetGradingList(); + var dlg = new SetHydroGradingTreeDlg(); + dlg.SetBindingData(_hydroInfo, allGradingList); + dlg.ReloadDataEvent += (list) => + { + _allGradingList = list; + ApplyGradingResultList(false); + }; + dlg.ApplyDataEvent += (catalog, propName) => + { + UpdateGradingApplyList(catalog, propName); + ApplyGradingResultList(false); + }; + dlg.ShowDialog(); + } + + //閰嶇疆棰滆壊鍒嗙骇 + private void barBtnGradingSet_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + ShowGradingDlg(); + } + + #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() + { + if (_hydroInfo == null) + { + return; + } + var allGradingApplyList = GetGradingApplyList(); + if (allGradingApplyList == null || allGradingApplyList.Count < 1) + { + return; + } + var dlg = new ApplyHydroGradingDlg(); + dlg.SetBindingData(allGradingApplyList); + dlg.ReloadDataEvent += (obj) => + { + _allGradingApplyList = obj; + ApplyGradingResultList(false); + }; + dlg.ShowDialog(); + } + + //搴旂敤棰滆壊鍒嗙骇 + private void barBtnGradingApply_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)); + } + + //棰滆壊鍒嗙骇灞曠ず + private void barCkGrading_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + _isGradingVisible = this.barCkGrading.Checked; + ApplyGradingResultList(true); + } + + #endregion + + #endregion + + #region 浜哄伐鍒锋柊 + + //鍒锋柊 + private async void barBtnRefresh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + if (XtraMessageBox.Show("鍒锋柊鍚庡皢涓㈠け褰撳墠姘村姏淇℃伅鏇存敼锛屾槸鍚︾户缁埛鏂帮紵", "璇㈤棶", MessageBoxButtons.YesNo) == DialogResult.Yes) + { + if (_project == null) + { + return; + } + if (_projectSite == null) + { + return; + } + var hydroRelation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance + .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation); + Stopwatch sw = new Stopwatch(); + sw.Start(); + _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(hydroRelation.ModelID); + sw.Stop(); + TimeSpan ts2 = sw.Elapsed; + Console.WriteLine("Stopwatch鎬诲叡鑺辫垂{0}ms.", ts2.TotalMilliseconds); + _visual = null; + await _bimfaceCtrl?.ZoomAndSelectComponents(null); + //ShowSelectedProperty(); + TipFormHelper.ShowSucceed("鏁版嵁宸插埛鏂�"); + } + } + + #endregion + + #region 姘存祦鍔ㄧ敾 + + //姘存祦鍔ㄧ敾鏄惁鍙 + private bool _isFlowEffectVisible = false; + + //鎵�鏈夋按娴佸姩鐢诲垪琛� + private List<LogicFlowEffect> _allFlowEffectList = null; + + //鑾峰彇娴佸悜鍒楄〃 + private List<LogicFlowEffect> GetFlowEffectList() + { + if (_hydroInfo == null) + { + return default; + } + if (_allFlowEffectList == 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; + } + } + } + } + } + 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); + } + } + + //姘存祦鍔ㄧ敾鏄惁鍙 + private void barCkFlowEffect_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + _isFlowEffectVisible = this.barCkFlowEffect.Checked; + SetFlowEffect(); + } + + #endregion + + #region 鐩戞祴鍒楄〃 + + #region 鐩戞祴鐐� + + //鎵�鏈夌洃娴嬪垪琛� + private List<HydroMonitorVmo> _allMonitorList = null; + + //鑾峰彇鐩戞祴鍒楄〃 + private async Task<List<HydroMonitorVmo>> GetMonitorList() + { + if (_hydroInfo == null) + { + return default; + } + if (_allMonitorList == null) + { + _allMonitorList = await BLLFactory<Yw.BLL.HydroMonitor>.Instance.GetByModelID(_hydroInfo.ID); + if (_allMonitorList == null) + { + _allMonitorList = new List<HydroMonitorVmo>(); + } + } + return _allMonitorList; + } + + //鏇存柊鐩戞祴鍒楄〃 + 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) + { + if (_hydroInfo == null) + { + return; + } + if (visual == null) + { + return; + } + + var allMonitorList = await GetMonitorList(); + var dlg = new SetHydroMonitorListDlg(); + dlg.SetBindingData(_hydroInfo, visual, allMonitorList); + dlg.ReloadDataEvent += async (list) => + { + var bol = await BLLFactory<Yw.BLL.HydroMonitor>.Instance.Save(_hydroInfo.ID, visual.Code, list); + if (!bol) + { + TipFormHelper.ShowError("璁剧疆澶辫触"); + return; + } + TipFormHelper.ShowSucceed("璁剧疆鎴愬姛"); + var monitorList = await UpdateMonitorList(visual.Code); + UpdateMonitorValueList(visual.Code, monitorList); + SetLogicMonitorList(); + }; + dlg.ShowDialog(); + } + + //璁剧疆鐩戞祴鐐� + private void barBtnSetMonitor_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + SetMonitorListDlg(_visual); + } + + #endregion + + #region 鐩戞祴鍊� + + //鎵�鏈夌洃娴嬪�煎垪琛� + private List<HydroMonitorValueViewModel> _allMonitorValueList = null; + + //鑾峰彇鐩戞祴鍊煎垪琛� + private async Task<List<HydroMonitorValueViewModel>> GetMonitorValueList() + { + if (_allMonitorValueList == 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); + } + } + } + } + } + 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); + } + }); + } + + #endregion + + #region 鐩戞祴鍊煎垪琛ㄦ帶浠� + + //鐩戞祴鍊煎垪琛ㄦ帶浠� + private HydroMonitorValueListCtrl _monitorValueListCtrl = null; + + //鑾峰彇鐩戞祴鍊煎垪琛ㄦ帶浠� + private HydroMonitorValueListCtrl GetMonitorValueListCtrl() + { + if (_monitorValueListCtrl == null) + { + _monitorValueListCtrl = new HydroMonitorValueListCtrl(); + _monitorValueListCtrl.Dock = DockStyle.Fill; + _monitorValueListCtrl.HydroViewEvent += (code) => + { + var visual = GetVisual(code); + SelectVisual(visual, eVisualSource.Monitor); + }; + } + return _monitorValueListCtrl; + } + + //鐩戞祴鍊煎垪琛ㄦ帶浠舵槸鍚﹀彲瑙� + private bool IsMonitorValueListCtrlVisible + { + get + { + if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) + { + if (this.controlContainerBottom.Controls.Count > 0) + { + if (this.controlContainerBottom.Controls[0] is HydroMonitorValueListCtrl) + { + return true; + } + } + } + return false; + } + } + + //鏄剧ず鐩戞祴鍊煎垪琛ㄦ帶浠� + private async void ShowMonitorValueListCtrl() + { + var monitorValueListCtrl = GetMonitorValueListCtrl(); + if (!IsMonitorValueListCtrlVisible) + { + this.controlContainerBottom.Controls.Clear(); + this.controlContainerBottom.Controls.Add(monitorValueListCtrl); + this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; + this.docPnlBottom.Text = "鐩戞祴鍊�"; + this.docPnlBottom.Height = 350; + } + var allMonitorValueList = await GetMonitorValueList(); + monitorValueListCtrl.SetBindingData(allMonitorValueList); + } + + //璁剧疆鐩戞祴鍊� + private void barBtnSetMonitorValue_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + ShowMonitorValueListCtrl(); + } + + #endregion + + #region 鐩戞祴鍒楄〃鏄剧ず + + //鐩戞祴鏄惁鏄剧ず + private bool _isMonitorVisible = false; + + //鑾峰彇涓氬姟鐩戞祴鍒楄〃 + private async Task<List<LogicMonitor>> GetLogicMonitorList() + { + var allMonitorList = await GetMonitorList(); + var allLogicMonitorList = allMonitorList.Select(x => + { + 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); + } + else + { + await _bimfaceCtrl?.ClearLogicMonitors(); + } + } + + //鏄剧ず鐘舵�佹敼鍙� + private void barCkMonitor_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + _isMonitorVisible = this.barCkMonitor.Checked; + SetLogicMonitorList(); } #endregion - #region INP瀵煎嚭 + #endregion - //瀵煎嚭姘村姏INP鏂囦欢 - private void barBtnHydroExportInp_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + #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 (_checkCtrl == null) + { + _checkCtrl = new HydroCheckResultCtrl(); + _checkCtrl.Dock = DockStyle.Fill; + _checkCtrl.HydroClickEvent += (code) => + { + if (_hydroInfo == null) + { + return; + } + var visual = GetVisual(code); + SelectVisual(visual, eVisualSource.Check); + }; + } + return _checkCtrl; + } + + //妫�鏌ユ帶浠舵槸鍚﹀彲瑙� + private bool IsCheckCtrlVisible + { + get + { + if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) + { + if (this.controlContainerBottom.Controls.Count > 0) + { + if (this.controlContainerBottom.Controls[0] is HydroCheckResultCtrl) + { + return true; + } + } + } + return false; + } + } + + //鏄剧ず妫�鏌ユ帶浠� + private void ShowCheckCtrl(HydroCheckResult checkResult) + { + if (checkResult == null) + { + return; + } + var checkCtrl = GetCheckCtrl(); + if (!IsCheckCtrlVisible) + { + this.controlContainerBottom.Controls.Clear(); + this.controlContainerBottom.Controls.Add(checkCtrl); + this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; + this.docPnlBottom.Text = "妫�鏌ョ粨鏋�"; + this.docPnlBottom.Height = 350; + } + checkCtrl.SetBindingData(checkResult); + } + + //鏄剧ず妫�鏌ユ帶浠� + private void ShowCheckCtrl() + { + if (_checkResult == null) + { + return; + } + ShowCheckCtrl(_checkResult); + } + + //妫�鏌� + private void Check() { if (_hydroInfo == null) { return; } - var fileName = Yw.WinFrmUI.FileDialogHelper.SaveInp("瀵煎嚭Inp鏂囦欢"); + _checkResult = _hydroInfo.Check(); + ShowCheckCtrl(_checkResult); + } + + //妫�鏌� + private void barBtnCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + Check(); + } + + #endregion + + #endregion + + #region 妯″瀷璁$畻 + + #region 璁$畻缁撴灉 + + //璁$畻缁撴灉 + private HydroCalcuResult _calcuResult = null; + + //鑾峰彇璁$畻缁撴灉 + private HydroCalcuResult GetCalcuResult(string calcuMode, bool needCalcuAgain = false) + { + if (_hydroInfo == null) + { + return default; + } + 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); + } + + #endregion + + #region 璁$畻澶辫触 + + //璁$畻澶辫触鎺т欢 + private HydroCalcuFailedCtrl _calcuFailedCtrl = null; + + //鑾峰彇璁$畻澶辫触鎺т欢 + private HydroCalcuFailedCtrl GetCalcuFailedCtrl() + { + if (_calcuFailedCtrl == null) + { + _calcuFailedCtrl = new HydroCalcuFailedCtrl(); + _calcuFailedCtrl.Dock = DockStyle.Fill; + } + return _calcuFailedCtrl; + } + + //璁$畻澶辫触鎺т欢鏄惁鍙 + private bool IsCalcuFailedCtrlVisible + { + get + { + if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) + { + if (this.controlContainerBottom.Controls.Count > 0) + { + if (this.controlContainerBottom.Controls[0] is HydroCalcuFailedCtrl) + { + return true; + } + } + } + return false; + } + } + + //鏄剧ず璁$畻澶辫触鎺т欢 + private void ShowCalcuFailedCtrl(HydroCalcuResult calcuResult) + { + if (_hydroInfo == null) + { + return; + } + if (calcuResult == null) + { + return; + } + if (calcuResult.Succeed) + { + return; + } + var calcuFailedCtrl = GetCalcuFailedCtrl(); + if (!IsCalcuFailedCtrlVisible) + { + this.controlContainerBottom.Controls.Clear(); + this.controlContainerBottom.Controls.Add(calcuFailedCtrl); + this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; + this.docPnlBottom.Text = "璁$畻澶辫触鍘熷洜"; + this.docPnlBottom.Height = 350; + } + calcuFailedCtrl.SetBindingData(calcuResult.FailedList); + } + + //鏄剧ず璁$畻澶辫触鎺т欢 + private void ShowCalcuFailedCtrl() + { + if (_calcuResult == null) + { + return; + } + ShowCalcuFailedCtrl(_calcuResult); + } + + #endregion + + #region 璁$畻璀﹀憡 + + //璁$畻璀﹀憡鎺т欢 + private HydroCalcuWarningCtrl _calcuWarningCtrl = null; + + //鑾峰彇璁$畻璀﹀憡鎺т欢 + private HydroCalcuWarningCtrl GetCalcuWarningCtrl() + { + if (_calcuWarningCtrl == null) + { + _calcuWarningCtrl = new HydroCalcuWarningCtrl(); + _calcuWarningCtrl.Dock = DockStyle.Fill; + _calcuWarningCtrl.HydroClickEvent += (code) => + { + var visual = GetVisual(code); + SelectVisual(visual, eVisualSource.Warning); + }; + } + return _calcuWarningCtrl; + } + + //璁$畻璀﹀憡鎺т欢鏄惁鍙 + private bool IsCalcuWarningCtrlVisible + { + get + { + if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) + { + if (this.controlContainerBottom.Controls.Count > 0) + { + if (this.controlContainerBottom.Controls[0] is HydroCalcuWarningCtrl) + { + return true; + } + } + } + return false; + } + } + + //鏄剧ず璁$畻璀﹀憡鎺т欢 + private void ShowCalcuWarningCtrl(HydroCalcuResult calcuResult) + { + if (_hydroInfo == null) + { + return; + } + if (calcuResult == null) + { + return; + } + if (!calcuResult.Succeed) + { + return; + } + var calcuWaringCtrl = GetCalcuWarningCtrl(); + if (!IsCalcuWarningCtrlVisible) + { + this.controlContainerBottom.Controls.Clear(); + this.controlContainerBottom.Controls.Add(calcuWaringCtrl); + this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; + this.docPnlBottom.Text = "璁$畻璀﹀憡"; + this.docPnlBottom.Height = 350; + } + var dict = GetVisualDict(); + calcuWaringCtrl.SetBindingData(calcuResult.WainingList, dict); + } + + //鏄剧ず璁$畻璀﹀憡鎺т欢 + private void ShowCalcuWarningCtrl() + { + if (_calcuResult == null) + { + return; + } + ShowCalcuWarningCtrl(_calcuResult); + } + + #endregion + + #endregion + + #region 绠$綉淇 + + //淇绠$綉 + private void Repair() + { + if (_hydroInfo == null) + { + return; + } + var checkResult = _hydroInfo.Check(); + if (!checkResult.Succeed) + { + ShowCheckCtrl(checkResult); + TipFormHelper.ShowWarn("妫�鏌ュけ璐ュ鑷存棤娉曡繘琛岃瘯绠楋紝鍋滄绠$綉淇锛�"); + return; + } + var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.Simple); + if (!calcuResult.Succeed) + { + ShowCalcuFailedCtrl(calcuResult); + TipFormHelper.ShowWarn("璇曠畻澶辫触锛屽仠姝㈢缃戜慨澶嶏紒"); + return; + } + var allLinkList = GetLinkList(); + if (allLinkList != null && allLinkList.Count < 1) + { + TipFormHelper.ShowError("妯″瀷涓湭鍖呭惈绠℃淇℃伅锛屽仠姝㈢缃戜慨澶嶏紒"); + return; + } + int count = 0; + foreach (var link in allLinkList) + { + var calcuLink = calcuResult.LinkList?.Find(x => x.Code == link.Code); + if (calcuLink == null) + { + continue; + } + if (!calcuLink.CalcuFlow.HasValue) + { + continue; + } + if (calcuLink.CalcuFlow.Value < 0) + { + var tempCode = link.StartCode; + link.StartCode = link.EndCode; + link.EndCode = tempCode; + count++; + } + } + UpdateVisualViewModelProperty(); + UpdateVisualListCtrl(); + //UpdateSelectedProperty(); + TipFormHelper.ShowSucceed($"淇瀹屾垚锛屽叡淇绠℃({count})涓紒"); + } + + //绠$綉淇 + private void barBtnRepair_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + Repair(); + } + + #endregion + + #region 瀵煎嚭INP + + //瀵煎嚭INP鏂囦欢 + private void barBtnExportInp_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + if (_hydroInfo == null) + { + return; + } + var fileName = FileDialogHelper.SaveInp("瀵煎嚭Inp鏂囦欢"); if (string.IsNullOrEmpty(fileName)) { return; @@ -489,369 +2757,657 @@ #endregion - #region 涓氬姟鏂规硶 + #region 骞惰仈鍒嗘瀽 - //鏄剧ず灞炴�� - private void ShowProperty() + //骞惰仈鍒嗘瀽 + private void ParallelAnalysis() { if (_hydroInfo == null) - { - return; - } - - if (_parter == null) - { - this.xhsProjectSimulationPropertyCtrl1.SelectParter(null); - return; - } - - this.xhsProjectSimulationPropertyCtrl1.SelectParter(_parter.Code); - if (_calcuResult != null) - { - if (_calcuResult.Succeed) - { - var allCalcuParterList = _calcuResult.GetParterList(); - var calcuParter = allCalcuParterList.Find(x => x.Id == _parter.Code); - if (calcuParter != null) - { - IHydroCalcuResult calcuProperty = null; - if (calcuParter is Yw.EPAnet.CalcuNode calcuNode) - { - var calcuNodeProperty = new Yw.WinFrmUI.HydroCalcuNodeResult(); - calcuNodeProperty.Code = _parter.Code; - calcuNodeProperty.CalcuPress = calcuNode.Press; - calcuNodeProperty.CalcuDemand = calcuNode.Demand; - calcuNodeProperty.CalcuHead = calcuNode.Head; - calcuProperty = calcuNodeProperty; - } - else if (calcuParter is Yw.EPAnet.CalcuLink calcuLink) - { - var calcuLinkProperty = new Yw.WinFrmUI.HydroCalcuLinkResult(); - calcuLinkProperty.Code = _parter.Code; - calcuLinkProperty.CalcuHeadLoss = calcuLink.Headloss; - calcuLinkProperty.CalcuFlow = calcuLink.Flow; - calcuLinkProperty.CalcuVelocity = calcuLink.Velocity; - calcuProperty = calcuLinkProperty; - } - - if (calcuProperty != null) - { - this.xhsProjectSimulationPropertyCtrl1.UpdateCalcuProperty(calcuProperty); - } - } - } - } - - } - - #endregion - - #region 閰嶇疆 - - //鏄剧ずRadialMenu - private void barBtnSetList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) - { - this.rmSet.ShowPopup(MousePosition, true); - } - - #endregion - - #region 鎬ц兘鏇茬嚎 - - //鎬ц兘鏇茬嚎 - private void barBtnFeatCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) - { - if (_hydroInfo == null) - { - return; - } - if (_calcuResult == null) - { - return; - } - if (!_calcuResult.Succeed) { return; } var pumps = _hydroInfo.Pumps; - var curve_list = _hydroInfo.Curves; - if (curve_list == null || !curve_list.Any()) + if (pumps == null || pumps.Count < 1) { + XtraMessageBox.Show("鏃犳按娉典俊鎭�"); return; } - var vmList = new List<Yw.WinFrmUI.Phart.PumpSerialParallelViewModel>(); - foreach (var x in pumps) + var vmList = new List<XhsSinglePumpViewModel>(); + foreach (var pump in pumps) { - if (!x.RatedN.HasValue) + if (!pump.RatedN.HasValue) { continue; } - var qh = curve_list.Find(t => t.Code == x.CurveQH)?.CurveData; - var qe = curve_list.Find(t => t.Code == x.CurveQE)?.CurveData; - var qp = curve_list.Find(t => t.Code == x.CurveQP)?.CurveData; - + var qh = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQH)?.CurveData; + var qe = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQE)?.CurveData; + var qp = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQP)?.CurveData; if (qh == null) { continue; } - var rated_speed = x.RatedN.Value; - var speed_ratio = x.SpeedRatio ?? 1; + var qhPtList = qh.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); + var qePtList = qe?.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); + var qpPtList = qp?.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); - var qh_pt_list = qh.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); - var qe_pt_list = qe?.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); - var qp_pt_list = qp?.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); - - var vm = new Yw.WinFrmUI.Phart.PumpSerialParallelViewModel(); - vm.Id = x.Code; - vm.Name = x.Code; - //vm.IsBp = ; - vm.RatedSpeed = rated_speed; - vm.CurrentSpeed = Math.Round(rated_speed * speed_ratio); - vm.CurrentHz = Math.Round(vm.CurrentSpeed / vm.RatedSpeed * 50, 1); - - vm.Qh = new Yw.Geometry.CubicSpline2d(qh_pt_list); - vm.Qe = new Yw.Geometry.CubicSpline2d(qe_pt_list); - vm.Qp = new Yw.Geometry.CubicSpline2d(qp_pt_list); + var vm = new XhsSinglePumpViewModel(); vmList.Add(vm); + vm.ID = pump.ID; + vm.Name = pump.Name; + vm.Code = pump.Code; + vm.IsBp = true; + vm.RunStatus = pump.LinkStatus == Yw.Hydro.LinkStatus.Open; + vm.RatedHz = pump.RatedHz; + vm.CurrentHz = Math.Round(pump.RatedHz * pump.SpeedRatio, 1); + vm.RatedSpeed = pump.RatedN.Value; + vm.CurrentSpeed = Math.Round(pump.RatedN.Value * pump.SpeedRatio, 1); + vm.CurveQH = qhPtList; + vm.CurveQE = qePtList; + vm.CurveQP = qpPtList; + } - var dlg = new HStation.WinFrmUI.PhartRelation.PumpSerialParallelChartDlg(); - dlg.SetBindingData(vmList, null, true); + var dlg = new PumpParallelAnalyDlg(); + dlg.SetBindingData(vmList); + dlg.ReloadDataEvent += (list) => + { + list?.ForEach(x => + { + var pump = pumps.Find(t => t.Code == x.Code); + if (pump != null) + { + pump.LinkStatus = x.RunStatus ? Yw.Hydro.PumpStatus.Open : Yw.Hydro.PumpStatus.Closed; + pump.SpeedRatio = x.CurrentHz / pump.RatedHz; + } + }); + var codes = list?.Select(x => x.Code).ToList(); + UpdateVisualViewModelProperty(codes); + //ShowSelectedProperty(); + UpdateVisualListCtrl(); + return true; + }; dlg.ShowDialog(); + } + + //骞惰仈鍒嗘瀽 + private void barBtnParallel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + ParallelAnalysis(); } #endregion - #region 姘村姏璁$畻 + #region 宸ュ喌璁$畻 + //鎵�鏈夊伐鍐靛厓缁勫垪琛� + private List<Tuple<HydroWorkingVmo, HydroCheckResult, HydroCalcuResult>> _allWorkingTupleList = null; - //鑾峰彇璁$畻鎺т欢 - private XhsProjectSimulationCalcuCtrl GetCalcuCtrl() + //鑾峰彇宸ュ喌鍏冪粍鍒楄〃 + private async Task<List<Tuple<HydroWorkingVmo, HydroCheckResult, HydroCalcuResult>>> GetWorkingTupleList() { - if (_calcuCtrl == null) + if (_hydroInfo == null) { - _calcuCtrl = new XhsProjectSimulationCalcuCtrl(); - _calcuCtrl.Dock = DockStyle.Fill; - _calcuCtrl.CancelEvent += () => - { - this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; - }; - _calcuCtrl.OkEvent += async () => - { - if (_hydroInfo == null) - { - return; - } - _checkResult = _hydroInfo.Check(); - if (!_checkResult.Succeed) - { - this.controlContainerBottom.Controls.Clear(); - var checkResultCtrl = GetCheckResultCtrl(); - checkResultCtrl.SetBindingData(_checkResult); - this.controlContainerBottom.Controls.Add(checkResultCtrl); - TipFormHelper.ShowWarn("鏍¢獙澶辫触锛岃妫�鏌ュ悗閲嶈瘯"); - return; - } - - var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo); - _calcuResult = netWork.Calcu(); - if (_calcuResult.Succeed) - { - this.controlContainerBottom.Controls.Clear(); - var parterListCtrl = GetParterListCtrl(); - var calcuResultList = new List<IHydroCalcuResult>(); - _calcuResult.NodeList?.ForEach(x => - { - calcuResultList.Add(new HydroCalcuNodeResult() - { - Code = x.Id, - CalcuPress = x.Press, - CalcuHead = x.Head, - CalcuDemand = x.Demand, - }); - }); - _calcuResult.LinkList?.ForEach(x => - { - calcuResultList.Add(new HydroCalcuLinkResult() - { - Code = x.Id, - CalcuFlow = x.Flow, - CalcuVelocity = x.Velocity, - CalcuHeadLoss = x.Headloss - }); - }); - parterListCtrl.SetBindingData(_hydroInfo, calcuResultList); - parterListCtrl.SetCalcuView(); - this.controlContainerBottom.Controls.Add(parterListCtrl); - this.docPnlBottom.Text = "璁$畻缁撴灉"; - ShowProperty(); - await _bimfaceCtrl?.ShowCalcuCustomLabels(_calcuResult); - TipFormHelper.ShowSucceed("璁$畻鎴愬姛锛�"); - } - else - { - _calcuCtrl.SetBindingData(_calcuResult.FailedList); - this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; - this.docPnlBottom.Text = "璁$畻澶辫触鍘熷洜"; - this.docPnlBottom.Height = 350; - TipFormHelper.ShowError("璁$畻澶辫触"); - } - - }; + return default; } - return _calcuCtrl; + 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 XhsProjectSimulationCalcuCtrl _calcuCtrl = null;//璁$畻鎺т欢 + + //鑾峰彇宸ュ喌鍏冪粍 + 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 dlg = new SetHydroWorkingDlg(); + dlg.HydroViewEvent += (visual) => + { + SelectVisual(visual, eVisualSource.Calcu); + }; + dlg.HydroCalcuEvent += async (working) => + { + 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(working.WorkingInfo); + //鏍¢獙 + var checkResult = _hydroInfo.Check(); + if (!_checkResult.Succeed) + { + AppendWorkingTuple(vmo, checkResult, null); + AppendCurrentWorking(vmo); + ShowCheckCtrl(); + TipFormHelper.ShowWarn("鏍¢獙澶辫触锛岃妫�鏌ュ悗閲嶈瘯"); + return; + } + + WaitFormHelper.ShowWaitForm(this, "姝e湪璁$畻鍒嗘瀽涓紝璇风◢鍊�..."); + + + //await Task.Delay(5000); + var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss); + + + WaitFormHelper.HideWaitForm(); + if (calcuResult.Succeed) + { + AppendWorkingTuple(vmo, checkResult, calcuResult); + AppendCurrentWorking(vmo); + UpdateVisualViewModelProperty(); + UpdateVisualViewModelCalcuProperty(); + UpdateVisualListCtrl(); + SetCalcuLabels(); + //UpdateSelectedProperty(); + //await _bimfaceCtrl?.SetLogicCalcuCustomLabelsCalcuResult(_calcuResult); + TipFormHelper.ShowSucceed("璁$畻鎴愬姛锛�"); + var codes = _hydroInfo.Pumps.Select(x => x.Code).ToList(); + await _bimfaceCtrl?.ZoomAndSelectComponents(codes); + } + else + { + ShowCalcuFailedCtrl(); + TipFormHelper.ShowError("璁$畻澶辫触锛�"); + } + ApplyGradingResultList(false); + UpdateVisualListCtrl(); + //ShowSelectedProperty(); + }; + dlg.SetBindingData(_hydroInfo, allWorkingList, allMonitorValueList); + dlg.ShowDialog(); + } //姘村姏璁$畻 private void barBtnHydroCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { - if (_hydroInfo == null) - { - return; - } - - this.controlContainerBottom.Controls.Clear(); - var calcuCtrl = GetCalcuCtrl(); - calcuCtrl.SetBindingData(_hydroInfo); - this.controlContainerBottom.Controls.Add(calcuCtrl); - this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; - this.docPnlBottom.Text = "璁$畻鍓嶆彁鏉′欢"; - this.docPnlBottom.Height = 350; + SetHydroWorkingDlg(); } - - #endregion - #region 鏋勪欢鏌ヨ + #region 璁$畻鏍囩 - //鑾峰彇鏌ヨ缁勪欢 - private XhsProjectSimulationSearchCtrl GetSearchCtrl() + //鎵�鏈夎绠楁爣绛� + private List<LogicCalcuCustomLabel> _allCalcuLabels = null; + + //鑾峰彇璁$畻鏍囩 + private List<LogicCalcuCustomLabel> GetCalcuLabels() { - if (_searchCtrl == null) + if (_hydroInfo == null) { - _searchCtrl = new XhsProjectSimulationSearchCtrl(); - _searchCtrl.Dock = DockStyle.Fill; - _searchCtrl.InitialData(() => _hydroInfo); - _searchCtrl.ApplySearchEvent += async (list) => + 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) { - if (_hydroInfo == 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>() { - return; - } - var elementIds = new List<string>(); - if (list != null && list.Count > 0) + 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>() { - var first = list.First(); - var allParterList = _hydroInfo.GetAllParters(); - _parter = allParterList?.Find(x => x.Code == first.Code); - list.ForEach(x => elementIds.Add(x.Code)); - } - else - { - _parter = null; - } - await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); - ShowProperty(); - SetBimfaceLinkColor(); + 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; + } + + #endregion + + #region 褰撳墠宸ュ喌 + + //褰撳墠宸ュ喌 + private Yw.Vmo.HydroWorkingVmo _working = null; + + //鍒濆鍖栧綋鍓嶅伐鍐� + private async void InitialCurrentWorking() + { + var allWorkingList = await GetWorkingList(); + this.repositoryItemImageComboBox1.Items.BeginUpdate(); + this.repositoryItemImageComboBox1.Items.Clear(); + if (allWorkingList != null && allWorkingList.Count > 0) + { + allWorkingList.ForEach(x => this.repositoryItemImageComboBox1.Items.Add(x.Name, x, -1)); + this.barEditCurrentWorking.EditValue = allWorkingList.Last(); + } + this.repositoryItemImageComboBox1.Items.EndUpdate(); + } + + //澧炲姞褰撳墠宸ュ喌 + private void AppendCurrentWorking(HydroWorkingVmo working) + { + this.repositoryItemImageComboBox1.Items.BeginUpdate(); + this.repositoryItemImageComboBox1.Items.Add(working.Name, working, -1); + this.repositoryItemImageComboBox1.Items.EndUpdate(); + this.barEditCurrentWorking.EditValue = working; + } + + //璁剧疆褰撳墠宸ュ喌 + private async void SetCurrentWorking(HydroWorkingVmo working) + { + 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; + } + + //褰撳墠宸ュ喌鍙戠敓鏀瑰彉 + private void barEditCurrentWorking_EditValueChanged(object sender, EventArgs e) + { + var working = this.barEditCurrentWorking.EditValue as HydroWorkingVmo; + SetCurrentWorking(working); + } + + #endregion + + #region 宸ュ喌鎺т欢 + + //宸ュ喌鎺т欢 + private HydroWorkingTreeCtrl _workingCtrl = null; + + //鑾峰彇宸ュ喌鎺т欢 + private async Task<HydroWorkingTreeCtrl> GetWorkingCtrl() + { + if (_workingCtrl == null) + { + var allWorkingList = await GetWorkingList(); + _workingCtrl = new HydroWorkingTreeCtrl(); + _workingCtrl.Dock = DockStyle.Fill; + _workingCtrl.SetBindingData(allWorkingList); + _workingCtrl.FocusedChangedEvent += (vmo) => + { + SetCurrentWorking(vmo); }; } - return _searchCtrl; + return _workingCtrl; } - private XhsProjectSimulationSearchCtrl _searchCtrl = null;//鏌ヨ缁勪欢 - //鏌ヨ - private void barBtnSearch_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + //宸ュ喌鎺т欢鏄惁鍙 + private bool IsWorkingCtrlVisible { - if (_hydroInfo == null) + 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; + } - this.controlContainerBottom.Controls.Clear(); - var searchCtrl = GetSearchCtrl(); - this.controlContainerBottom.Controls.Add(searchCtrl); - this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; - this.docPnlBottom.Text = "妯″瀷鏋勪欢鏌ヨ"; - this.docPnlBottom.Height = 350; + //闅愯棌宸ュ喌鎺т欢 + 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 宸ュ喌璇勪及 - - #region 鏍囨敞 - - private List<HydroMarkSetViewModel> _allMarkList = null; - - //鏍囨敞 - private void barBtnMark_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + //璇勪及 + private async void Evaluate() { if (_hydroInfo == null) { return; } - if (_allMarkList == null) + if (_working == null) { - _allMarkList = new List<HydroMarkSetViewModel>(); - if (_hydroInfo.Waterboxs != null && _hydroInfo.Waterboxs.Count > 0) - { - _allMarkList.Add(new HydroMarkSetViewModel() - { - Code = Yw.Hydro.ParterCatalog.Waterbox, - Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Waterbox), - MarkType = (int)eWaterboxMarkType.None - }); - } - if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0) - { - _allMarkList.Add(new HydroMarkSetViewModel() - { - Code = Yw.Hydro.ParterCatalog.Pump, - Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pump), - MarkType = (int)eWaterboxMarkType.None - }); - } - if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0) - { - _allMarkList.Add(new HydroMarkSetViewModel() - { - Code = Yw.Hydro.ParterCatalog.Valve, - Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Valve), - MarkType = (int)eWaterboxMarkType.None - }); - } - if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) - { - _allMarkList.Add(new HydroMarkSetViewModel() - { - Code = Yw.Hydro.ParterCatalog.Pipe, - Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pipe), - MarkType = (int)eWaterboxMarkType.None - }); - } - if (_hydroInfo.Nozzles != null && _hydroInfo.Nozzles.Count > 0) - { - _allMarkList.Add(new HydroMarkSetViewModel() - { - Code = Yw.Hydro.ParterCatalog.Nozzle, - Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Nozzle), - MarkType = (int)eWaterboxMarkType.None - }); - } + TipFormHelper.ShowWarn("灏氭湭璁$畻锛岃璁$畻鍚庨噸璇曪紒"); + return; } - var dlg = new SetHydroMarkDlg(); - dlg.SetBindingData(() => _hydroInfo, _allMarkList); - dlg.ReloadDataEvent += async (obj) => + var checkResult = await GetWorkingCheckResult(_working); + if (checkResult == null) { - var leadLabels = obj?.Select(x => new LeadLabel() { Id = x.Code, Text = x.Text }).ToList(); - await _bimfaceCtrl?.SetLeadLabels(leadLabels); + 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); + dlg.ShowDialog(); + } + + //绮惧害璇勪及 + private void barBtnWorkingEvaluation_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + Evaluate(); + } + + #endregion + + #region 宸ュ喌骞惰仈 + + //骞惰仈鍒嗘瀽 + private void barBtnAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + if (_hydroInfo == null) + { + return; + } + if (_hydroInfo.Pumps == null || _hydroInfo.Pumps.Count < 1) + { + return; + } + var allCalcuResultList = GetCalcuVisualResultList(Yw.EPAnet.CalcuMode.MinorLoss, false); + var vmList = new List<XhsSinglePumpViewModel>(); + foreach (var pump in _hydroInfo.Pumps) + { + if (!pump.RatedN.HasValue) + { + continue; + } + var qh = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQH)?.CurveData; + var qe = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQE)?.CurveData; + var qp = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQP)?.CurveData; + if (qh == null) + { + continue; + } + + var qhPtList = qh.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); + var qePtList = qe?.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); + var qpPtList = qp?.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); + + var vm = new XhsSinglePumpViewModel(); + vmList.Add(vm); + vm.ID = pump.ID; + vm.Name = pump.Name; + vm.Code = pump.Code; + vm.IsBp = true; + vm.RunStatus = pump.LinkStatus == Yw.Hydro.LinkStatus.Open; + vm.RatedHz = pump.RatedHz; + vm.CurrentHz = Math.Round(pump.RatedHz * pump.SpeedRatio, 1); + vm.RatedSpeed = pump.RatedN.Value; + vm.CurrentSpeed = Math.Round(pump.RatedN.Value * pump.SpeedRatio); + vm.CurveQH = qhPtList; + vm.CurveQE = qePtList; + vm.CurveQP = qpPtList; + + if (allCalcuResultList != null && allCalcuResultList.Count > 0) + { + var calcuResult = allCalcuResultList.Find(x => x.Code == pump.Code) as HydroCalcuLinkResult; + if (calcuResult != null) + { + if (calcuResult.CalcuFlow.HasValue) + { + vm.CalcuQ = Math.Abs(calcuResult.CalcuFlow.Value); + } + + var calcuResultStart = allCalcuResultList.Find(x => x.Code == pump.StartCode) as HydroCalcuNodeResult; + var calcuResultEnd = allCalcuResultList.Find(x => x.Code == pump.EndCode) as HydroCalcuNodeResult; + if (calcuResultStart != null && calcuResultEnd != null) + { + if (calcuResultStart.CalcuHead.HasValue && calcuResultEnd.CalcuHead.HasValue) + { + vm.CalcuH = Math.Round(Math.Abs(calcuResultStart.CalcuHead.Value - calcuResultEnd.CalcuHead.Value), 4); + } + } + } + } + + } + + var dlg = new PumpParallelAnalyDlg(); + dlg.SetBindingData(vmList); + dlg.ReloadDataEvent += (list) => + { + list?.ForEach(x => + { + var pump = _hydroInfo.Pumps?.Find(t => t.Code == x.Code); + if (pump != null) + { + pump.LinkStatus = x.RunStatus ? Yw.Hydro.PumpStatus.Open : Yw.Hydro.PumpStatus.Closed; + pump.SpeedRatio = Math.Round(x.CurrentHz / pump.RatedHz, 1); + } + }); + //ShowSelectedProperty(); + return true; }; dlg.ShowDialog(); } #endregion + + #region 宸ュ喌鑳芥晥 + + private void barBtnWorkingPower_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + XtraMessageBox.Show("姝e湪寮�鍙戜腑锛屾暚璇锋湡寰咃紒"); + } + + #endregion + + #region 鎹熷け鏇茬嚎 + + private void barBtnWorkingLossCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + XtraMessageBox.Show("姝e湪寮�鍙戜腑锛屾暚璇锋湡寰咃紒"); + } + + #endregion + + #region 鎹熷け姣斾緥 + + private void barBtnWorkingLossScale_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + XtraMessageBox.Show("姝e湪寮�鍙戜腑锛屾暚璇锋湡寰咃紒"); + } + + #endregion + + #region 缁煎悎鍒嗘瀽 + private void barBtnWorkingAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + XtraMessageBox.Show("姝e湪寮�鍙戜腑锛屾暚璇锋湡寰咃紒"); + } + #endregion + + + + + } } \ No newline at end of file -- Gitblit v1.9.3