From 428f8be3a056b598df8205ddd2722b546260c22e Mon Sep 17 00:00:00 2001 From: duheng <2784771470@qq.com> Date: 星期日, 03 十一月 2024 16:04:33 +0800 Subject: [PATCH] 初始化数据库 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs | 1174 ++++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 898 insertions(+), 276 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 79007e5..a138d6c 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,6 +1,11 @@ 锘縢lobal using Yw.EPAnet; using DevExpress.Mvvm.Native; +using DevExpress.XtraRichEdit.Layout; +using DevExpress.XtraSpreadsheet.Commands; using HStation.WinFrmUI.PhartRelation; +using System.Windows.Media.Media3D; +using Yw.Pump; +using Yw.Vmo; using Yw.WinFrmUI.Bimface; using Yw.WinFrmUI.Hydro; @@ -14,7 +19,6 @@ this.PageTitle.Caption = "姘村姏妯℃嫙"; this.PageTitle.HeaderSvgImage = this.svgImg32[0]; this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; - this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; RegistBulkSetEvents(); } @@ -58,7 +62,7 @@ /// <summary> /// 鍒濆鍖栨暟鎹� /// </summary> - public override async void InitialDataSource() + public override void InitialDataSource() { base.InitialDataSource(); if (_project == null) @@ -66,14 +70,8 @@ return; } this.PageTitle.Caption = $"{_project.Name}\r\n姘村姏妯℃嫙"; - var bimfaceCtrl = GetBimfaceCtrl(); - this.tabPageBimface.Controls.Clear(); - this.tabPageBimface.Controls.Add(bimfaceCtrl); - await bimfaceCtrl.InitialData(_project, _projectSite, () => _hydroInfo); - var q3dCtrl = GetQ3dCtrl(); - this.tabPageQ3d.Controls.Clear(); - this.tabPageQ3d.Controls.Add(q3dCtrl); - q3dCtrl.InitialData(() => _hydroInfo); + ShowBimfaceCtrl(); + ShowQ3dCtrl(); ShowPropertyCtrl(); } @@ -84,24 +82,19 @@ private XhsProjectSimulationBimfaceCtrl _bimfaceCtrl = null; //鑾峰彇 bimface 鎺т欢 - private XhsProjectSimulationBimfaceCtrl GetBimfaceCtrl() + private async Task<XhsProjectSimulationBimfaceCtrl> GetBimfaceCtrl() { if (_bimfaceCtrl == null) { _bimfaceCtrl = new XhsProjectSimulationBimfaceCtrl(); _bimfaceCtrl.Dock = DockStyle.Fill; - _bimfaceCtrl.LoadCompletedEvent += async () => + await _bimfaceCtrl.InitialData(_project, _projectSite, () => _hydroInfo); + _bimfaceCtrl.LoadCompletedEvent += () => {//view鍔犺浇瀹屾垚浜嬩欢 if (_hydroInfo == null) { return; } - var elementIds = new List<string>(); - var pumps = _hydroInfo.Pumps?.Where(x => x.LinkStatus == Yw.Hydro.PumpStatus.Open).ToList(); - pumps?.ForEach(x => elementIds.Add(x.Code)); - var valves = _hydroInfo.Valves?.Where(x => x.LinkStatus == Yw.Hydro.ValveStatus.Open).ToList(); - valves?.ForEach(x => elementIds.Add(x.Code)); - await _bimfaceCtrl?.SetOpenComponentsColor(elementIds); }; _bimfaceCtrl.HydroMouseLeftClickEvent += (obj) => {//榧犳爣宸﹂敭鐐瑰嚮浜嬩欢 @@ -111,86 +104,34 @@ } _parter = obj; ShowProperty(); - SetBimfaceLinkColor(); }; } return _bimfaceCtrl; } - - - //璁剧疆Bimface杩炴帴棰滆壊 - private async void SetBimfaceLinkColor() + //鏄剧ず bimface 鎺т欢 + private async void ShowBimfaceCtrl() { - if (_hydroInfo == null) - { - return; - } - if (_parter != null) - { - if (_parter is Yw.Model.HydroLinkInfo link) - { - await _bimfaceCtrl?.RestoreLinkComponentsColor(); - - var allVisualList = _hydroInfo.GetAllVisuals(); - var allLinkList = _hydroInfo.GetAllLinks(); - var startParter = allVisualList?.Find(x => x.Code == link.StartCode); - if (startParter != null) - { - var startElementIds = new List<string>(); - if (startParter.GetType() == typeof(Yw.Model.HydroJunctionInfo)) - { - var startLinkList = allLinkList?.Where(x => x.StartCode == startParter.Code || x.EndCode == startParter.Code && x.Code != _parter.Code).ToList(); - if (startLinkList != null && startLinkList.Count > 0) - { - startElementIds.AddRange(startLinkList.Select(x => x.Code)); - } - } - else - { - startElementIds.Add(startParter.Code); - } - if (startElementIds.Count > 0) - { - await _bimfaceCtrl?.SetLinkStartComponentsColor(startElementIds); - } - } - var endParter = allVisualList?.Find(x => x.Code == link.EndCode); - if (endParter != null) - { - var endElementIds = new List<string>(); - if (endParter.GetType() == typeof(Yw.Model.HydroJunctionInfo)) - { - var endLinkList = allLinkList?.Where(x => x.StartCode == endParter.Code || x.EndCode == endParter.Code && x.Code != _parter.Code).ToList(); - if (endLinkList != null && endLinkList.Count > 0) - { - endElementIds.AddRange(endLinkList.Select(x => x.Code)); - } - } - else - { - endElementIds.Add(endParter.Code); - } - if (endElementIds.Count > 0) - { - await _bimfaceCtrl?.SetLinkEndComponentsColor(endElementIds); - } - } - } - } + var bimfaceCtrl = await GetBimfaceCtrl(); + this.tabPageBimface.Controls.Clear(); + this.tabPageBimface.Controls.Add(bimfaceCtrl); } #endregion #region Q3d - //鑾峰彇Q3d鎺т欢 + //Q3d 鎺т欢 + private XhsProjectSimulationQ3dCtrl _q3dCtrl = null; + + //鑾峰彇 Q3d 鎺т欢 private XhsProjectSimulationQ3dCtrl GetQ3dCtrl() { if (_q3dCtrl == null) { _q3dCtrl = new XhsProjectSimulationQ3dCtrl(); _q3dCtrl.Dock = DockStyle.Fill; + _q3dCtrl.InitialData(() => _hydroInfo); _q3dCtrl.SelectedPartersChangedEvent += (obj) => { if (_hydroInfo == null) @@ -205,12 +146,17 @@ return _q3dCtrl; } - //Q3d鎺т欢 - private XhsProjectSimulationQ3dCtrl _q3dCtrl = null; + //鏄剧ず Q3d 鎺т欢 + private void ShowQ3dCtrl() + { + var q3dCtrl = GetQ3dCtrl(); + this.tabPageQ3d.Controls.Clear(); + this.tabPageQ3d.Controls.Add(q3dCtrl); + } - #endregion Q3d + #endregion - #region 灞炴�ч潰鏉� + #region 鏋勪欢灞炴�� //灞炴�ф帶浠� private XhsProjectSimulationPropertyCtrl _propertyCtrl = null; @@ -222,7 +168,7 @@ { _propertyCtrl = new XhsProjectSimulationPropertyCtrl(); _propertyCtrl.Dock = DockStyle.Fill; - _propertyCtrl.InitialData(() => _hydroInfo, () => GetAllCalcuResultList()); + _propertyCtrl.InitialData(() => _hydroInfo, () => GetCalcuResultList()); _propertyCtrl.BlinkLinkParterEvent += async (code, linkCode) => { //寮鸿皟杩炴帴缁勪欢 if (string.IsNullOrEmpty(code)) @@ -303,50 +249,22 @@ { ShowPropertyCtrl(); } - if (_parter == null) { _propertyCtrl?.SelectParter(null); return; } - _propertyCtrl?.SelectParter(_parter.Code); - if (_calcuResult != null) - { - if (_calcuResult.Succeed) - { - var allCalcuParterList = _calcuResult.GetParterList(); - var calcuParter = allCalcuParterList.Find(x => x.Id == _parter.Code); - if (calcuParter != null) - { - IHydroCalcuResult calcuProperty = null; - if (calcuParter is Yw.EPAnet.CalcuNode calcuNode) - { - var calcuNodeProperty = new Yw.WinFrmUI.HydroCalcuNodeResult(); - calcuNodeProperty.Code = _parter.Code; - calcuNodeProperty.CalcuPress = calcuNode.Press; - calcuNodeProperty.CalcuDemand = calcuNode.Demand; - calcuNodeProperty.CalcuHead = calcuNode.Head; - calcuProperty = calcuNodeProperty; - } - else if (calcuParter is Yw.EPAnet.CalcuLink calcuLink) - { - var calcuLinkProperty = new Yw.WinFrmUI.HydroCalcuLinkResult(); - calcuLinkProperty.Code = _parter.Code; - calcuLinkProperty.CalcuHeadLoss = calcuLink.Headloss; - calcuLinkProperty.CalcuFlow = calcuLink.Flow; - calcuLinkProperty.CalcuVelocity = calcuLink.Velocity; - calcuProperty = calcuLinkProperty; - } - if (calcuProperty != null) - { - _propertyCtrl?.UpdateCalcuProperty(calcuProperty); - } - } + var allCalcuResultList = GetCalcuResultList(); + if (allCalcuResultList != null && allCalcuResultList.Count > 0) + { + var calcuResult = allCalcuResultList.Find(x => x.Code == _parter.Code); + if (calcuResult != null) + { + _propertyCtrl?.UpdateCalcuProperty(calcuResult); } } - } #endregion @@ -375,7 +293,6 @@ } await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); ShowProperty(); - SetBimfaceLinkColor(); }; _matchingListCtrl.ApplyMatchingEvent += (output) => { @@ -401,7 +318,7 @@ } this.controlContainerBottom.Controls.Clear(); var matchingListCtrl = GetMatchingListCtrl(); - var input = AssetsMatchingParasHelper.Create(_hydroInfo, GetAllCalcuResultList()); + var input = AssetsMatchingParasHelper.Create(_hydroInfo, GetCalcuResultList()); matchingListCtrl.SetBindingData(input); this.controlContainerBottom.Controls.Add(matchingListCtrl); this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; @@ -409,7 +326,7 @@ this.docPnlBottom.Height = 350; } - #endregion 鑷姩鍖归厤 + #endregion #region 鏈尮閰嶅垪琛� @@ -435,7 +352,6 @@ var elementIds = new List<string>() { parter.Code }; await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); ShowProperty(); - SetBimfaceLinkColor(); }; _unMatchingListCtrl.ViewModelEvent += async (parters) =>//鏌ョ湅妯″瀷 { @@ -466,7 +382,7 @@ this.docPnlBottom.Height = 350; } - #endregion 鏈尮閰嶅垪琛� + #endregion #region 涓�閿樉闅� @@ -538,13 +454,12 @@ } await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); ShowProperty(); - SetBimfaceLinkColor(); }; } return _checkCtrl; } - //鏄剧ず鏍¢獙鎺т欢 + //鏄剧ず妫�鏌ユ帶浠� private void ShowCheckCtrl() { if (_checkResult == null) @@ -556,12 +471,12 @@ this.controlContainerBottom.Controls.Clear(); this.controlContainerBottom.Controls.Add(checkCtrl); this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; - this.docPnlBottom.Text = "鏍¢獙缁撴灉"; + this.docPnlBottom.Text = "妫�鏌ョ粨鏋�"; this.docPnlBottom.Height = 350; } - //姘村姏楠岃瘉 + //姘村姏妫�鏌� private void barBtnHydroCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (_hydroInfo == null) @@ -572,7 +487,7 @@ ShowCheckCtrl(); } - #endregion 姘村姏鏍¢獙 + #endregion #region 淇濆瓨淇℃伅 @@ -593,7 +508,7 @@ TipFormHelper.ShowSucceed("淇濆瓨鎴愬姛锛�"); } - #endregion 淇濆瓨姘村姏淇℃伅 + #endregion #region 鏋勪欢鏄庣粏 @@ -617,7 +532,6 @@ _parter = allParterList?.Find(x => x.Code == parter.Code); await _bimfaceCtrl?.ZoomAndSelectComponents(new List<string>() { _parter.Code }); ShowProperty(); - SetBimfaceLinkColor(); }; } return _parterListCtrl; @@ -631,7 +545,7 @@ return; } var parterListCtrl = GetParterListCtrl(); - parterListCtrl.SetBindingData(_hydroInfo, GetAllCalcuResultList()); + parterListCtrl.SetBindingData(_hydroInfo, GetCalcuResultList()); this.controlContainerBottom.Controls.Clear(); this.controlContainerBottom.Controls.Add(parterListCtrl); this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; @@ -645,7 +559,7 @@ ShowParterListCtrl(); } - #endregion 鏋勪欢鏄庣粏 + #endregion #region INP瀵煎嚭 @@ -706,25 +620,111 @@ //闂峰ご this.barBtnSetBluntheadList.ItemClick += delegate { + if (_hydroInfo == null) + { + return; + } var dlg = new HydroBluntheadBulkSetListDlg(); dlg.ShowDialog(); }; //寮ご this.barBtnSetElbowsList.ItemClick += delegate { + if (_hydroInfo == null) + { + return; + } var dlg = new HydroElbowBulkSetListDlg(); + dlg.SetBindingData(_hydroInfo); dlg.ShowDialog(); }; //涓夐�� this.barBtnSetThreelinkList.ItemClick += delegate { + if (_hydroInfo == null) + { + return; + } var dlg = new HydroThreelinkBulkSetListDlg(); + dlg.SetBindingData(_hydroInfo); dlg.ShowDialog(); }; //鍥涢�� this.barBtnSetFourlinkList.ItemClick += delegate { - + if (_hydroInfo == null) + { + return; + } + var dlg = new HydroFourlinkBulkSetListDlg(); + dlg.SetBindingData(_hydroInfo); + dlg.ShowDialog(); + }; + //姘磋〃 + this.barBtnSetMeterList.ItemClick += delegate + { + if (_hydroInfo == null) + { + return; + } + var dlg = new HydroMeterBulkSetListDlg(); + dlg.SetBindingData(_hydroInfo); + dlg.ShowDialog(); + }; + //娴侀噺璁� + this.barBtnSetFlowmeterList.ItemClick += delegate + { + if (_hydroInfo == null) + { + return; + } + var dlg = new HydroFlowmeterBulkSetListDlg(); + dlg.SetBindingData(_hydroInfo); + dlg.ShowDialog(); + }; + //鍘嬪姏琛� + this.barBtnSetPressmeterList.ItemClick += delegate + { + if (_hydroInfo == null) + { + return; + } + var dlg = new HydroPressmeterBulkSetListDlg(); + dlg.SetBindingData(_hydroInfo); + dlg.ShowDialog(); + }; + //绠¢亾 + this.barBtnSetPipeList.ItemClick += delegate + { + if (_hydroInfo == null) + { + return; + } + var dlg = new HydroPipeBulkSetListDlg(); + dlg.SetBindingData(_hydroInfo); + dlg.ShowDialog(); + }; + //姘存车 + this.barBtnSetPumpList.ItemClick += delegate + { + if (_hydroInfo == null) + { + return; + } + var dlg = new HydroPumpBulkSetListDlg(); + dlg.SetBindingData(_hydroInfo); + dlg.ShowDialog(); + }; + //闃�闂� + this.barBtnSetValveList.ItemClick += delegate + { + if (_hydroInfo == null) + { + return; + } + var dlg = new HydroValveBulkSetListDlg(); + dlg.SetBindingData(_hydroInfo); + dlg.ShowDialog(); }; } @@ -950,7 +950,7 @@ { return; } - var allCalcuResultList = GetAllCalcuResultList(); + var allCalcuResultList = GetCalcuResultList(); var vmList = new List<XhsSinglePumpViewModel>(); foreach (var pump in _hydroInfo.Pumps) { @@ -1009,8 +1009,22 @@ } - var dlg = new PumpParallelChartDlg(); + 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); + } + }); + ShowProperty(); + return true; + }; dlg.ShowDialog(); } @@ -1018,63 +1032,119 @@ #region 姘村姏璁$畻 - //璁$畻鎺т欢 - private SetHydroCalcuPrefixCtrl _calcuCtrl = null; - //鑾峰彇璁$畻鎺т欢 - private SetHydroCalcuPrefixCtrl GetCalcuCtrl() + #region 鍓嶆彁鏉′欢 + + //鏄剧ず璁$畻鍓嶆彁鏉′欢绐椾綋 + private void ShowCalcuPrefixDlg() { - if (_calcuCtrl == null) + if (_hydroInfo == null) { - _calcuCtrl = new SetHydroCalcuPrefixCtrl(); - _calcuCtrl.Dock = DockStyle.Fill; - _calcuCtrl.InitialData(() => _hydroInfo); - _calcuCtrl.HydroViewEvent += async (parter) => - {//姘村姏鏌ョ湅浜嬩欢 - if (parter == null) - { - return; - } - await _bimfaceCtrl?.ZoomAndSelectComponents(new List<string>() { parter.Code }); - }; - _calcuCtrl.HydroCalcuEvent += async () => - {//姘村姏璁$畻浜嬩欢 - if (_hydroInfo == null) - { - return; - } - - //鏍¢獙 - _checkResult = _hydroInfo.Check(); - if (!_checkResult.Succeed) - { - ShowCheckCtrl(); - TipFormHelper.ShowWarn("鏍¢獙澶辫触锛岃妫�鏌ュ悗閲嶈瘯"); - return; - } - - var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo); - _calcuResult = netWork.Calcu(); - if (_calcuResult.Succeed) - { - this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; - await _bimfaceCtrl?.SetLogicCalcuCustomLabels(_calcuResult); - TipFormHelper.ShowSucceed("璁$畻鎴愬姛锛�"); - } - else - { - _calcuCtrl.SetFailedList(_calcuResult.FailedList); - this.docPnlRight.Text = "澶辫触鍘熷洜"; - this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; - TipFormHelper.ShowError("璁$畻澶辫触"); - } - }; + return; } - return _calcuCtrl; + var dlg = new HStation.WinFrmUI.SetHydroCalcuPrefixDlg1(); + dlg.SetBindingData(_hydroInfo); + dlg.HydroViewEvent += async (parter) => + { + _parter = parter; + if (_parter != null) + { + await _bimfaceCtrl?.ZoomAndSelectComponents(new List<string>() { _parter.Code }); + } + ShowProperty(); + }; + dlg.HydroCalcuEvent += async () => + { + if (_hydroInfo == null) + { + return; + } + + //鏍¢獙 + _checkResult = _hydroInfo.Check(); + if (!_checkResult.Succeed) + { + ShowCheckCtrl(); + TipFormHelper.ShowWarn("鏍¢獙澶辫触锛岃妫�鏌ュ悗閲嶈瘯"); + return; + } + + WaitFormHelper.ShowWaitForm(this, "姝e湪璁$畻鍒嗘瀽涓紝璇风◢鍊�..."); + + await Task.Delay(5000); + + var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo); + _calcuResult = netWork.Calcu(); + + WaitFormHelper.HideWaitForm(); + if (_calcuResult.Succeed) + { + GetCalcuResultList(false); + await _bimfaceCtrl?.SetLogicCalcuCustomLabels(_calcuResult); + TipFormHelper.ShowSucceed("璁$畻鎴愬姛锛�"); + } + else + { + ShowCalcuFailedCtrl(); + TipFormHelper.ShowError("璁$畻澶辫触锛�"); + } + + }; + dlg.ShowDialog(); } + #endregion + + #region 璁$畻澶辫触 + + //璁$畻澶辫触鎺т欢 + private HydroCalcuFailedCtrl _calcuFailedCtrl = null; + + //鑾峰彇璁$畻澶辫触鎺т欢 + private HydroCalcuFailedCtrl GetCalcuFailedCtrl() + { + if (_calcuFailedCtrl == null) + { + _calcuFailedCtrl = new HydroCalcuFailedCtrl(); + _calcuFailedCtrl.Dock = DockStyle.Fill; + } + return _calcuFailedCtrl; + } + + //鏄剧ず璁$畻澶辫触鎺т欢 + private void ShowCalcuFailedCtrl() + { + if (_hydroInfo == null) + { + return; + } + if (_calcuResult == null) + { + return; + } + if (_calcuResult.Succeed) + { + return; + } + var calcuFailedCtrl = GetCalcuFailedCtrl(); + calcuFailedCtrl.SetBindingData(_calcuResult.FailedList); + this.controlContainerBottom.Controls.Clear(); + this.controlContainerBottom.Controls.Add(calcuFailedCtrl); + this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; + this.docPnlBottom.Text = "璁$畻澶辫触鍘熷洜"; + this.docPnlBottom.Height = 350; + } + + #endregion + + #region 璁$畻缁撴灉 + + //鎵�鏈夎绠楃粨鏋滃垪琛� + private List<HydroCalcuResult> _allCalcuResultList = null; + //鑾峰彇璁$畻缁撴灉 - private List<IHydroCalcuResult> GetAllCalcuResultList() + //true 浣跨敤缂撳瓨锛宖alse 涓嶄娇鐢ㄧ紦瀛� + private List<HydroCalcuResult> GetCalcuResultList(bool isCache = true) { if (_hydroInfo == null) { @@ -1088,73 +1158,161 @@ { return default; } - var list = new List<IHydroCalcuResult>(); + if (isCache) + { + return _allCalcuResultList; + } + _allCalcuResultList = new List<HydroCalcuResult>(); + + //鑺傜偣 var allNodeList = _hydroInfo.GetAllNodes(); if (allNodeList != null && allNodeList.Count > 0) { - var allCalcuNodeList = _calcuResult.NodeList; - if (allCalcuNodeList != null && allCalcuNodeList.Count > 0) + foreach (var node in allNodeList) { - foreach (var node in allNodeList) + var calcuNode = _calcuResult.NodeList?.Find(x => x.Id == node.Code); + if (calcuNode != null) { - var calcuNode = allCalcuNodeList.Find(x => x.Id == node.Code); - if (calcuNode != null) + var calcuResult = new HydroCalcuNodeResult() { - var calcuResult = new HydroCalcuNodeResult() - { - Code = node.Code, - CalcuPress = calcuNode.Press, - CalcuHead = calcuNode.Head, - CalcuDemand = calcuNode.Demand - }; - list.Add(calcuResult); - } + Code = node.Code, + CalcuPress = calcuNode.Press, + CalcuHead = calcuNode.Head, + CalcuDemand = calcuNode.Demand + }; + _allCalcuResultList.Add(calcuResult); } } } - var allListList = _hydroInfo.GetAllLinks(); - if (allListList != null && allListList.Count > 0) + //绠℃ + var allLinkList = _hydroInfo.GetAllLinks(); + if (allLinkList != null && allLinkList.Count > 0) { - var allCalcuLinkList = _calcuResult.LinkList; - if (allCalcuLinkList != null && allCalcuLinkList.Count > 0) + foreach (var link in allLinkList) { - foreach (var link in allListList) + var calcuLink = _calcuResult.LinkList?.Find(x => x.Id == link.Code); + if (calcuLink != null) { - var calcuLink = allCalcuLinkList.Find(x => x.Id == link.Code); - if (calcuLink != null) + var calcuResult = new HydroCalcuLinkResult() { - var calcuResult = new HydroCalcuLinkResult() - { - Code = link.Code, - CalcuFlow = calcuLink.Flow, - CalcuVelocity = calcuLink.Velocity, - CalcuHeadLoss = calcuLink.Headloss - }; - list.Add(calcuResult); - } + Code = link.Code, + CalcuFlow = calcuLink.Flow, + CalcuVelocity = calcuLink.Velocity, + CalcuHeadLoss = calcuLink.Headloss + }; + _allCalcuResultList.Add(calcuResult); } } } - return list; + //娴侀噺璁� + var allFlowmeterList = _hydroInfo.Flowmeters; + if (allFlowmeterList != null && allFlowmeterList.Count > 0) + { + foreach (var flowmeter in allFlowmeterList) + { + var calcuFlowmeterResult = _allCalcuResultList.Find(x => x.Code == flowmeter.Code) as HydroCalcuNodeResult; + if (calcuFlowmeterResult != null) + { + var calcuFlowmeterNewResult = new HydroCalcuFlowmeterResult(calcuFlowmeterResult); + var calcuFlowmeterLinkResultList = new List<HydroCalcuLinkResult>(); + var flowmeterLinkList = allLinkList?.Where(x => x.StartCode == flowmeter.Code || x.EndCode == flowmeter.Code).ToList(); + if (flowmeterLinkList != null && flowmeterLinkList.Count > 0) + { + foreach (var flowmeterLink in flowmeterLinkList) + { + var calcuFlowmeterLinkResult = _allCalcuResultList.Find(x => x.Code == flowmeterLink.Code) as HydroCalcuLinkResult; + if (calcuFlowmeterLinkResult != null) + { + calcuFlowmeterLinkResultList.Add(calcuFlowmeterLinkResult); + } + } + } + if (calcuFlowmeterLinkResultList.Exists(x => x.CalcuFlow.HasValue)) + { + calcuFlowmeterNewResult.CalcuQ = calcuFlowmeterLinkResultList.Where(x => x.CalcuFlow.HasValue).Average(x => x.CalcuFlow.Value); + } + _allCalcuResultList.Remove(calcuFlowmeterResult); + _allCalcuResultList.Add(calcuFlowmeterNewResult); + } + } + } + + //鍘嬪姏琛� + var allPressmeterList = _hydroInfo.Pressmeters; + if (allPressmeterList != null && allPressmeterList.Count > 0) + { + foreach (var pressmeter in allPressmeterList) + { + var calcuPressmeterResult = _allCalcuResultList.Find(x => x.Code == pressmeter.Code) as HydroCalcuNodeResult; + if (calcuPressmeterResult != null) + { + var calcuPressmeterNewResult = new HydroCalcuPressmeterResult(calcuPressmeterResult); + calcuPressmeterNewResult.CalcuPr = calcuPressmeterResult.CalcuPress; + _allCalcuResultList.Remove(calcuPressmeterResult); + _allCalcuResultList.Add(calcuPressmeterNewResult); + } + } + } + + //姘存车 + var allPumpList = _hydroInfo.Pumps; + if (allPumpList != null && allPumpList.Count > 0) + { + foreach (var pump in allPumpList) + { + var calcuPumpResult = _allCalcuResultList.Find(x => x.Code == pump.Code) as HydroCalcuLinkResult; + if (calcuPumpResult != null) + { + var calcuPumpNewResult = new HydroCalcuPumpResult(calcuPumpResult); + calcuPumpNewResult.CalcuQ = calcuPumpResult.CalcuFlow; + if (calcuPumpNewResult.CalcuQ.HasValue) + { + var calcuNodeStartResult = _allCalcuResultList.Find(x => x.Code == pump.StartCode) as HydroCalcuNodeResult; + var calcuNodeEndResult = _allCalcuResultList.Find(x => x.Code == pump.EndCode) as HydroCalcuNodeResult; + if (calcuNodeStartResult != null && calcuNodeEndResult != null) + { + if (calcuNodeStartResult.CalcuPress.HasValue && calcuNodeEndResult.CalcuPress.HasValue) + { + calcuPumpNewResult.CalcuH = Math.Abs(calcuNodeStartResult.CalcuPress.Value - calcuNodeEndResult.CalcuPress.Value); + } + if (pump.LinkStatus == Yw.Hydro.PumpStatus.Open && pump.RatedN.HasValue) + { + var curveqp = _hydroInfo.Curves?.Find(x => x.Code == pump.CurveQP); + if (curveqp != null) + { + if (curveqp.CurveData != null && curveqp.CurveData.Count > 3) + { + var point2dList = curveqp.CurveData.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); + var point2dSimularList = point2dList.GetQPPointListByN(pump.RatedN.Value, pump.RatedN.Value * pump.SpeedRatio); + var pumpCurveQp = new Yw.Pump.CurveQP(eFeatType.Cubic, point2dSimularList); + calcuPumpNewResult.CalcuP = pumpCurveQp.FeatCurve.GetPointY(calcuPumpNewResult.CalcuQ.Value); + } + } + } + if (calcuPumpNewResult.CalcuH.HasValue && calcuPumpNewResult.CalcuP.HasValue) + { + calcuPumpNewResult.CalcuE = Yw.Pump.CalculationHelper.CalcuE(calcuPumpNewResult.CalcuQ.Value, calcuPumpNewResult.CalcuH.Value, calcuPumpNewResult.CalcuP.Value); + } + } + } + _allCalcuResultList.Remove(calcuPumpResult); + _allCalcuResultList.Add(calcuPumpNewResult); + } + } + } + + return _allCalcuResultList; } + + #endregion //姘村姏璁$畻 private void barBtnHydroCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { - if (_hydroInfo == null) - { - return; - } - var calcuPrefixCtrl = GetCalcuCtrl(); - calcuPrefixCtrl.SetBindingData(); - this.controlContainerRight.Controls.Clear(); - this.controlContainerRight.Controls.Add(calcuPrefixCtrl); - this.docPnlRight.Text = "鍓嶆彁鏉′欢"; - this.docPnlRight.Width = SetHydroCalcuPrefixCtrl.ControlMinWidth; - this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; + ShowCalcuPrefixDlg(); } #endregion @@ -1192,7 +1350,6 @@ } await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); ShowProperty(); - SetBimfaceLinkColor(); }; } return _searchCtrl; @@ -1227,7 +1384,7 @@ private List<HydroMarkSetViewModel> _allMarkList = null; //鏄剧ず鏍囨敞绐椾綋 - private async void ShowMarkDlg() + private void ShowMarkDlg() { if (_hydroInfo == null) { @@ -1283,17 +1440,13 @@ } } var dlg = new SetHydroMarkDlg(); - dlg.InitialData(() => _hydroInfo); - dlg.SetBindingData(_allMarkList); + dlg.SetBindingData(_hydroInfo, _allMarkList); dlg.ReloadDataEvent += async (allResultList) => { - var leadLabels = allResultList?.Select(x => new LogicMarkLeadLabel(x.Code, x.Text)).ToList(); + var leadLabels = allResultList?.Select(x => new LogicMarkLeadLabel(x.Code, x.Text, 100000)).ToList(); await _bimfaceCtrl?.SetLogicMarkLeadLabels(leadLabels); }; - if (dlg.ShowDialog() != DialogResult.OK) - { - await _bimfaceCtrl?.ClearLogicMarkLeadLabels(); - } + dlg.ShowDialog(); } //璁剧疆鏍囨敞 @@ -1306,30 +1459,85 @@ #region 棰滆壊鍒嗙骇 - //棰滆壊鍒嗙骇搴旂敤鍒楄〃 - private List<HydroGradingApplyViewModel> _allGradingApplyList = null; - //棰滆壊鍒嗙骇缂栫爜鍒楄〃 - private List<string> _allGradingCodeList = null; + #region 棰滆壊閰嶇疆 - //璁剧疆棰滆壊鍒嗙骇 - private void SetGrading() + //鎵�鏈夊垎绾у垪琛� + private List<HydroGradingVmo> _allGradingList = null; + + //鑾峰彇鍒嗙骇鍒楄〃 + private async Task<List<HydroGradingVmo>> GetGradingList() + { + if (_hydroInfo == null) + { + return default; + } + if (_allGradingList == null) + { + _allGradingList = await BLLFactory<Yw.BLL.HydroGrading>.Instance.GetByModelID(_hydroInfo.ID); + if (_allGradingList == null || _allGradingList.Count < 1) + { + var config = Yw.Settings.HydroParasHelper.Hydro.Grading; + if (config != null && config.Items != null && config.Items.Count > 0) + { + _allGradingList = new List<HydroGradingVmo>(); + config.Items.ForEach(x => + { + var vmo = new HydroGradingVmo() + { + ModelID = _hydroInfo.ID, + Catalog = x.Catalog, + PropName = x.PropName, + SetValue = x.SetValue, + MinValue = x.MinValue, + MaxValue = x.MaxValue, + Color = x.Color, + SortCode = config.Items.IndexOf(x) + }; + _allGradingList.Add(vmo); + }); + } + } + } + return _allGradingList; + } + + //鏄剧ず閰嶇疆棰滆壊鍒嗙骇绐椾綋 + private async void ShowSetGradingDlg() { if (_hydroInfo == null) { return; } - var dlg = new SetHydroGradingModelDlg(); - dlg.SetBindingData(_hydroInfo.ID); + var allGradingList = await GetGradingList(); + var dlg = new SetHydroGradingTreeDlg(); + dlg.SetBindingData(_hydroInfo, allGradingList); + dlg.ReloadDataEvent += (list) => + { + _allGradingList = list; + }; + dlg.ApplyDataEvent += () => + { + ShowApplyGradingDlg(); + }; dlg.ShowDialog(); } - //搴旂敤棰滆壊鍒嗙骇 - private async void ApplyGrading() + //閰嶇疆棰滆壊鍒嗙骇 + private void barBtnGradingSet_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { - if (_hydroInfo == null) - { - return; - } + ShowSetGradingDlg(); + } + + #endregion + + #region 搴旂敤鍒嗙骇 + + //棰滆壊鍒嗙骇搴旂敤鍒楄〃 + private List<HydroGradingApplyViewModel> _allGradingApplyList = null; + + //鑾峰彇棰滆壊鍒嗙骇搴旂敤鍒楄〃 + private List<HydroGradingApplyViewModel> GetGradingApplyList() + { if (_allGradingApplyList == null) { _allGradingApplyList = new List<HydroGradingApplyViewModel>(); @@ -1340,7 +1548,7 @@ { Code = Yw.Hydro.ParterCatalog.Pump, Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pump), - PropName = string.Empty + PropName = Yw.Hydro.ParterProp.LinkStatus }); } if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0) @@ -1349,7 +1557,7 @@ { Code = Yw.Hydro.ParterCatalog.Valve, Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Valve), - PropName = string.Empty + PropName = Yw.Hydro.ParterProp.LinkStatus }); } if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) @@ -1358,44 +1566,458 @@ { Code = Yw.Hydro.ParterCatalog.Pipe, Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pipe), - PropName = string.Empty + PropName = Yw.Hydro.ParterProp.CalcuFlow }); } } - var dlg = new ApplyHydroGradingDlg(); - dlg.SetBindingData(() => _hydroInfo, _allGradingApplyList, GetAllCalcuResultList()); - dlg.ReloadDataEvent += (obj) => - { - _allGradingCodeList = obj?.Select(x => x.Code).Distinct().ToList(); - var objGroupList = obj?.GroupBy(x => x.Color).ToList(); - objGroupList.ForEach(async x => - { - await _bimfaceCtrl?.OverrideComponentsColor(x.Select(t => t.Code).Distinct().ToList(), x.Key, 1); - }); - }; - if (dlg.ShowDialog() != DialogResult.OK) - { - await _bimfaceCtrl?.RestoreComponentsColor(_allGradingCodeList); - } + return _allGradingApplyList; } - //璁剧疆 - private void barBtnGradingSet_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + //棰滆壊鍒嗙骇搴旂敤缁撴灉鍒楄〃 + private List<HydroGradingApplyResultViewModel> _allGradingApplyResultList = null; + + //鑾峰彇棰滆壊鍒嗙骇搴旂敤缁撴灉鍒楄〃 + private async Task<List<HydroGradingApplyResultViewModel>> GetGradingApplyResultList() { - SetGrading(); + if (_hydroInfo == null) + { + return default; + } + + //鎵�鏈夊垎绾у垪琛� + var allGradingList = await GetGradingList(); + if (allGradingList == null || allGradingList.Count < 1) + { + return default; + } + + //鎵�鏈夊垎绾у簲鐢ㄥ垪琛� + var allGradingApplyList = GetGradingApplyList(); + if (allGradingApplyList == null || allGradingApplyList.Count < 1) + { + return default; + } + + var allCalcuResultList = GetCalcuResultList(); + + _allGradingApplyResultList = new List<HydroGradingApplyResultViewModel>(); + allGradingApplyList.ForEach(x => + { + var allCatalogGradingList = allGradingList.Where(t => t.Catalog == x.Code).ToList(); + if (allCatalogGradingList != null || allCatalogGradingList.Count > 0) + { + switch (x.Code) + { + case Yw.Hydro.ParterCatalog.Pump: + { + if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0) + { + foreach (var pump in _hydroInfo.Pumps) + { + switch (x.PropName) + { + case Yw.Hydro.ParterProp.LinkStatus: + { + var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.LinkStatus).OrderBy(t => t.SortCode).ToList(); + if (gradingList != null && gradingList.Count > 0) + { + var grading = gradingList.Meet(pump.LinkStatus); + if (grading != null) + { + var result = new HydroGradingApplyResultViewModel() + { + Code = pump.Code, + Color = grading.Color + }; + _allGradingApplyResultList.Add(result); + } + } + } + break; + case Yw.Hydro.ParterProp.CalcuFlow: + { + var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuFlow).OrderBy(t => t.SortCode).ToList(); + if (gradingList != null && gradingList.Count > 0) + { + var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code); + if (calcuResult is HydroCalcuLinkResult calcuLinkResult) + { + if (calcuLinkResult.CalcuFlow.HasValue) + { + var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value)); + if (grading != null) + { + var result = new HydroGradingApplyResultViewModel() + { + Code = pump.Code, + Color = grading.Color + }; + _allGradingApplyResultList.Add(result); + } + } + } + } + } + break; + case Yw.Hydro.ParterProp.CalcuVelocity: + { + var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList(); + if (gradingList != null && gradingList.Count > 0) + { + var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code); + if (calcuResult is HydroCalcuLinkResult calcuLinkResult) + { + if (calcuLinkResult.CalcuVelocity.HasValue) + { + var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value)); + if (grading != null) + { + var result = new HydroGradingApplyResultViewModel() + { + Code = pump.Code, + Color = grading.Color + }; + _allGradingApplyResultList.Add(result); + } + } + } + } + } + break; + case Yw.Hydro.ParterProp.CalcuHeadLoss: + { + var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList(); + if (gradingList != null && gradingList.Count > 0) + { + var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code); + if (calcuResult is HydroCalcuLinkResult calcuLinkResult) + { + if (calcuLinkResult.CalcuHeadLoss.HasValue) + { + var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value)); + if (grading != null) + { + var result = new HydroGradingApplyResultViewModel() + { + Code = pump.Code, + Color = grading.Color + }; + _allGradingApplyResultList.Add(result); + } + } + } + } + } + break; + default: break; + } + } + } + } + break; + case Yw.Hydro.ParterCatalog.Valve: + { + if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0) + { + foreach (var valve in _hydroInfo.Valves) + { + switch (x.PropName) + { + case Yw.Hydro.ParterProp.LinkStatus: + { + var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.LinkStatus).OrderBy(t => t.SortCode).ToList(); + if (gradingList != null && gradingList.Count > 0) + { + var grading = gradingList.Meet(valve.LinkStatus); + if (grading != null) + { + var result = new HydroGradingApplyResultViewModel() + { + Code = valve.Code, + Color = grading.Color + }; + _allGradingApplyResultList.Add(result); + } + } + } + break; + case Yw.Hydro.ParterProp.CalcuFlow: + { + var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuFlow).OrderBy(t => t.SortCode).ToList(); + if (gradingList != null && gradingList.Count > 0) + { + var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code); + if (calcuResult is HydroCalcuLinkResult calcuLinkResult) + { + if (calcuLinkResult.CalcuFlow.HasValue) + { + var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value)); + if (grading != null) + { + var result = new HydroGradingApplyResultViewModel() + { + Code = valve.Code, + Color = grading.Color + }; + _allGradingApplyResultList.Add(result); + } + } + } + } + } + break; + case Yw.Hydro.ParterProp.CalcuVelocity: + { + var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList(); + if (gradingList != null && gradingList.Count > 0) + { + var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code); + if (calcuResult is HydroCalcuLinkResult calcuLinkResult) + { + if (calcuLinkResult.CalcuVelocity.HasValue) + { + var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value)); + if (grading != null) + { + var result = new HydroGradingApplyResultViewModel() + { + Code = valve.Code, + Color = grading.Color + }; + _allGradingApplyResultList.Add(result); + } + } + } + } + } + break; + case Yw.Hydro.ParterProp.CalcuHeadLoss: + { + var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList(); + if (gradingList != null && gradingList.Count > 0) + { + var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code); + if (calcuResult is HydroCalcuLinkResult calcuLinkResult) + { + if (calcuLinkResult.CalcuHeadLoss.HasValue) + { + var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value)); + if (grading != null) + { + var result = new HydroGradingApplyResultViewModel() + { + Code = valve.Code, + Color = grading.Color + }; + _allGradingApplyResultList.Add(result); + } + } + } + } + } + break; + default: break; + } + } + } + } + break; + case Yw.Hydro.ParterCatalog.Pipe: + { + if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) + { + foreach (var pipe in _hydroInfo.Pipes) + { + switch (x.PropName) + { + case Yw.Hydro.ParterProp.CalcuFlow: + { + var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuFlow).OrderBy(t => t.SortCode).ToList(); + if (gradingList != null && gradingList.Count > 0) + { + var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code); + if (calcuResult is HydroCalcuLinkResult calcuLinkResult) + { + if (calcuLinkResult.CalcuFlow.HasValue) + { + var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value)); + if (grading != null) + { + var result = new HydroGradingApplyResultViewModel() + { + Code = pipe.Code, + Color = grading.Color + }; + _allGradingApplyResultList.Add(result); + } + } + } + } + } + break; + case Yw.Hydro.ParterProp.CalcuVelocity: + { + var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList(); + if (gradingList != null && gradingList.Count > 0) + { + var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code); + if (calcuResult is HydroCalcuLinkResult calcuLinkResult) + { + if (calcuLinkResult.CalcuVelocity.HasValue) + { + var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value)); + if (grading != null) + { + var result = new HydroGradingApplyResultViewModel() + { + Code = pipe.Code, + Color = grading.Color + }; + _allGradingApplyResultList.Add(result); + } + } + } + } + } + break; + case Yw.Hydro.ParterProp.CalcuHeadLoss: + { + var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList(); + if (gradingList != null && gradingList.Count > 0) + { + var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code); + if (calcuResult is HydroCalcuLinkResult calcuLinkResult) + { + if (calcuLinkResult.CalcuHeadLoss.HasValue) + { + var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value)); + if (grading != null) + { + var result = new HydroGradingApplyResultViewModel() + { + Code = pipe.Code, + Color = grading.Color + }; + _allGradingApplyResultList.Add(result); + } + } + } + } + } + break; + default: break; + } + } + } + } + break; + default: break; + } + } + }); + + return _allGradingApplyResultList; } - //搴旂敤 + //棰滆壊鍒嗙骇缂栫爜鍒楄〃 + private List<string> _allGradingCodeList = null; + + //搴旂敤棰滆壊鍒嗙骇 + private async void ApplyGrading() + { + if (_hydroInfo == null) + { + return; + } + var allGradingApplyResultList = await GetGradingApplyResultList(); + _allGradingCodeList = allGradingApplyResultList?.Select(x => x.Code).Distinct().ToList(); + var objGroupList = allGradingApplyResultList?.GroupBy(x => x.Color).ToList(); + objGroupList?.ForEach(async x => + { + await _bimfaceCtrl?.OverrideComponentsColor(x.Select(t => t.Code).Distinct().ToList(), x.Key, 1); + }); + } + + //鏄剧ず搴旂敤棰滆壊鍒嗙骇绐椾綋 + private void ShowApplyGradingDlg() + { + if (_hydroInfo == null) + { + return; + } + var allGradingApplyList = GetGradingApplyList(); + if (allGradingApplyList == null || allGradingApplyList.Count < 1) + { + return; + } + var dlg = new ApplyHydroGradingDlg(); + dlg.SetBindingData(allGradingApplyList); + dlg.ReloadDataEvent += async (obj) => + { + _allGradingApplyList = obj; + ApplyGrading(); + }; + dlg.ShowDialog(); + } + + //搴旂敤棰滆壊鍒嗙骇 private void barBtnGradingApply_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { - ApplyGrading(); + ShowApplyGradingDlg(); } #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); + _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(hydroRelation.ModelID); + _parter = null; + await _bimfaceCtrl?.ZoomAndSelectComponents(null); + ShowProperty(); + TipFormHelper.ShowSucceed("鏁版嵁宸插埛鏂�"); + } + } + #endregion + private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + var pipes = _hydroInfo.Pipes; + var list = pipes.Select(x => + { + return new Yw.WinFrmUI.Bimface.LogicFlowEffect() + { + Id = x.Code, + Rotation = 90, + Speed = 0.1d + }; + }).ToList(); + _bimfaceCtrl?.LoadFlowEffectList(list); + //var obj = new LogicFlowEffect() + //{ + // Id = "757125", + // Rotation = 90, + // Speed = 0.1d + //}; + + //_bimfaceCtrl?.LoadFlowEffect(obj); + } } } \ No newline at end of file -- Gitblit v1.9.3