| | |
| | | using DevExpress.Diagram.Core.Native; |
| | | using DevExpress.Mvvm.Native; |
| | | using DevExpress.Utils.MVVM; |
| | | using DevExpress.XtraMap; |
| | | using HStation.WinFrmUI.PhartRelation; |
| | | using Mapster; |
| | | using NPOI.SS.Formula.Functions; |
| | | using System.Diagnostics; |
| | | using Yw.EPAnet; |
| | | using Yw.Hydro; |
| | | using Yw.Model; |
| | | using Yw.Vmo; |
| | |
| | | _projectSite = projectSite; |
| | | _hydroInfo = hydroInfo; |
| | | _allWorkingCheckedListDict = allWorkingCheckedListDict; |
| | | //this.PageTitle.Caption = $"{_project.Name}\r\n水力模拟"; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | } |
| | | if (_bimfaceCtrl == null) |
| | | { |
| | | var overlay = this.ShowOverlay(); |
| | | _bimfaceCtrl = new XhsProjectSimulationBimfaceCtrl(); |
| | | _bimfaceCtrl.Dock = DockStyle.Fill; |
| | | await _bimfaceCtrl.InitialData(_project, _projectSite); |
| | | _bimfaceCtrl.LoadCompletedEvent += () => |
| | | {//view加载完成事件 |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | overlay.Close(); |
| | | this.barCkDecorator.Checked = false; |
| | | this.barCkGrading.Checked = true; |
| | | }; |
| | | _bimfaceCtrl.HydroMouseLeftClickEvent += (code) => |
| | | {//鼠标左键点击事件 |
| | |
| | | Q3d, |
| | | Property, |
| | | List, |
| | | Set, |
| | | Search, |
| | | Monitor, |
| | | Check, |
| | |
| | | } |
| | | break; |
| | | case eVisualSource.List: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Set: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | |
| | | return; |
| | | } |
| | | _visualListCtrl?.UpdateBindingData(); |
| | | var calcuResult = GetCalcuResult(); |
| | | if (calcuResult != null && calcuResult.Succeed) |
| | | { |
| | | _visualListCtrl.SetCalcuView(); |
| | | } |
| | | else |
| | | { |
| | | _visualListCtrl.SetNormalView(); |
| | | } |
| | | } |
| | | |
| | | //构件明细 |
| | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | #region 自动匹配 |
| | | |
| | | //获取匹配列表控件 |
| | | private XhsProjectSimulationMatchingListCtrl GetMatchingListCtrl() |
| | | { |
| | | if (_matchingListCtrl == null) |
| | | { |
| | | _matchingListCtrl = new XhsProjectSimulationMatchingListCtrl(); |
| | | _matchingListCtrl.Dock = DockStyle.Fill; |
| | | _matchingListCtrl.HydroClickEvent += async (code) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllVisuals(); |
| | | _visual = allParterList?.Find(x => x.Code == code); |
| | | var elementIds = new List<string>(); |
| | | if (_visual != null) |
| | | { |
| | | elementIds.Add(_visual.Code); |
| | | } |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | //ShowSelectedProperty(); |
| | | }; |
| | | _matchingListCtrl.ApplyMatchingEvent += (output) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return false; |
| | | } |
| | | return AssetsMatchingParasHelper.Apply(_hydroInfo, output); |
| | | }; |
| | | } |
| | | return _matchingListCtrl; |
| | | } |
| | | |
| | | //匹配列表控件 |
| | | private XhsProjectSimulationMatchingListCtrl _matchingListCtrl = null; |
| | | |
| | | //自动匹配 |
| | | private void barBtnMatchingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | var matchingListCtrl = GetMatchingListCtrl(); |
| | | var input = AssetsMatchingParasHelper.Create(_hydroInfo, null); |
| | | matchingListCtrl.SetBindingData(input); |
| | | this.controlContainerBottom.Controls.Add(matchingListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "匹配列表"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 未匹列表 |
| | | |
| | | //获取未匹配列表控件 |
| | | private XhsProjectSimulationUnMatchingListCtrl GetUnMatchingListCtrl() |
| | | { |
| | | if (_unMatchingListCtrl == null) |
| | | { |
| | | _unMatchingListCtrl = new XhsProjectSimulationUnMatchingListCtrl(); |
| | | _unMatchingListCtrl.Dock = DockStyle.Fill; |
| | | _unMatchingListCtrl.HydroClickEvent += async (parter) =>//行点击 |
| | | { |
| | | if (parter == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllVisuals(); |
| | | _visual = allParterList?.Find(x => x.Code == parter.Code); |
| | | var elementIds = new List<string>() { parter.Code }; |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | //ShowSelectedProperty(); |
| | | }; |
| | | _unMatchingListCtrl.ViewModelEvent += async (parters) =>//查看模型 |
| | | { |
| | | var codes = parters?.Select(x => x.Code).Distinct().ToList(); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(codes); |
| | | _visual = null; |
| | | //ShowSelectedProperty(); |
| | | }; |
| | | } |
| | | return _unMatchingListCtrl; |
| | | } |
| | | |
| | | private XhsProjectSimulationUnMatchingListCtrl _unMatchingListCtrl = null;//未匹配列表 |
| | | |
| | | //未匹配列表 |
| | | private void barBtnUnMatchingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | var unMatchingListCtrl = GetUnMatchingListCtrl(); |
| | | unMatchingListCtrl.SetBindingData(_hydroInfo); |
| | | this.controlContainerBottom.Controls.Add(unMatchingListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "未匹配列表"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | |
| | | //水库 |
| | | this.barBtnSetReservoirList.ItemClick += delegate |
| | | { |
| | | //var dlg = new HydroReservoirBulkSetListDlg(); |
| | | //dlg.ShowDialog(); |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new SetHydroReservoirListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //水池 |
| | | this.barBtnSetTankList.ItemClick += delegate |
| | | { |
| | | //var dlg = new HydroTankBulkSetListDlg(); |
| | | //dlg.ShowDialog(); |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new SetHydroTankListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | }; |
| | | 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(); |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new SetHydroWaterboxListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //连接节点 |
| | | this.barBtnSetJunctionList.ItemClick += delegate |
| | | { |
| | | //var dlg = new HydroJunctionBulkSetListDlg(); |
| | | //dlg.ShowDialog(); |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new SetHydroJunctionListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | }; |
| | | 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(); |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new SetHydroBluntheadListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | }; |
| | | 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(); |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new SetHydroElbowListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //三通 |
| | | this.barBtnSetThreelinkList.ItemClick += delegate |
| | |
| | | } |
| | | var dlg = new SetHydroThreelinkListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //四通 |
| | |
| | | } |
| | | var dlg = new SetHydroFourlinkListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //水表 |
| | |
| | | } |
| | | var dlg = new SetHydroMeterListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //流量计 |
| | |
| | | } |
| | | var dlg = new SetHydroFlowmeterListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //压力表 |
| | |
| | | } |
| | | var dlg = new SetHydroPressmeterListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //管道 |
| | |
| | | } |
| | | var dlg = new SetHydroPipeListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //过渡件 |
| | | this.barBtnSetTranslationList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new SetHydroTranslationListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //水泵 |
| | |
| | | } |
| | | var dlg = new SetHydroPumpListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //阀门 |
| | |
| | | } |
| | | var dlg = new SetHydroValveListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //换热器 |
| | | this.barBtnSetExchangerList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new SetHydroExchangerListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //换热器 |
| | | this.barBtnSetCompressorList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new SetHydroCompressorListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | } |
| | |
| | | this.barBtnSetTranslationList.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; |
| | | } |
| | | |
| | | //换热器 |
| | | if (_hydroInfo.Exchangers == null || _hydroInfo.Exchangers.Count < 1) |
| | | { |
| | |
| | | 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; |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | _calcuResultHelper = new SimulationCalcuResultHelper(workingHelper); |
| | | var calcuResult = GetCalcuResult(); |
| | | _calcuResultHelper.InitialData(); |
| | | } |
| | | return _calcuResultHelper; |
| | | } |
| | |
| | | { |
| | | if (_calcuResultLabelHelper == null) |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var calcuResultHelper = GetCalcuResultHelper(); |
| | | var bimfaceCtrl = await GetBimfaceCtrl(); |
| | | _calcuResultLabelHelper = new SimulationCalcuResultLabelHelper(visualListHelper, calcuResultHelper, bimfaceCtrl); |
| | | _calcuResultLabelHelper = new SimulationCalcuResultLabelHelper(calcuResultHelper, bimfaceCtrl); |
| | | } |
| | | return _calcuResultLabelHelper; |
| | | } |
| | |
| | | return; |
| | | } |
| | | var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo); |
| | | var json = JsonHelper.Object2Json(netWork); |
| | | var result = netWork.ToInpString(); |
| | | File.WriteAllText(fileName, result); |
| | | TipFormHelper.ShowSucceed("导出成功"); |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 并联计算 |
| | | #region 水泵列表 |
| | | |
| | | //并联分析 |
| | | private void ParallelAnalysis() |
| | | //性能曲线 |
| | | private void barBtnPumpCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | |
| | | } |
| | | |
| | | #region 并联模拟 |
| | | |
| | | //并联模拟 |
| | | private void PumpParallel() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | |
| | | |
| | | } |
| | | |
| | | 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(); |
| | | //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) |
| | | //并联模拟 |
| | | private void barBtnPumpParallel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ParallelAnalysis(); |
| | | PumpParallel(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | |
| | | _hydroInfo.UpdateWorkingInfo(vm.WorkingInfo); |
| | | allMonitorValueList.UpdateMonitorValue(vm.MonitorInfo); |
| | | |
| | | var hydroInfo = _hydroInfo.Adapt<Yw.Model.HydroModelInfo>(); |
| | | |
| | | var working = new HydroWorkingVmo(); |
| | | working.ModelID = _hydroInfo.ID; |
| | | working.Name = working.Name; |
| | | working.WorkingInfo = JsonHelper.Object2Json(working.WorkingInfo); |
| | | working.MonitorInfo = JsonHelper.Object2Json(working.MonitorInfo); |
| | | working.SortCode = working.SortCode; |
| | | working.Description = working.Description; |
| | | working.ModelID = vm.ModelID; |
| | | working.Name = vm.Name; |
| | | working.WorkingInfo = JsonHelper.Object2Json(vm.WorkingInfo); |
| | | working.MonitorInfo = JsonHelper.Object2Json(vm.MonitorInfo); |
| | | working.SortCode = vm.SortCode; |
| | | working.Description = vm.Description; |
| | | |
| | | var workingHelper = GetWorkingHelper(); |
| | | |
| | | |
| | | //校验 |
| | | var checkResult = _hydroInfo.Check(); |
| | | if (!checkResult.Succeed) |
| | | { |
| | | ShowCheckCtrl(checkResult); |
| | | workingHelper.InitialData(working, checkResult, null); |
| | | workingHelper.InitialData(hydroInfo, working, checkResult, null); |
| | | TipFormHelper.ShowError("校验失败,请检查后重试"); |
| | | return; |
| | | } |
| | |
| | | //await Task.Delay(3000); |
| | | var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss); |
| | | WaitFormHelper.HideWaitForm(); |
| | | workingHelper.InitialData(working, checkResult, calcuResult); |
| | | workingHelper.InitialData(hydroInfo, working, checkResult, calcuResult); |
| | | if (calcuResult.Succeed) |
| | | { |
| | | if (calcuResult.WainingList != null && calcuResult.WainingList.Count > 0) |
| | |
| | | TipFormHelper.ShowError("计算失败!"); |
| | | } |
| | | |
| | | #region 计算结果 |
| | | |
| | | var calcuResultHelper = GetCalcuResultHelper(); |
| | | calcuResultHelper.InitialData(); |
| | | |
| | | #endregion |
| | | |
| | | #region 视图列表 |
| | | |
| | | var visualVmListHelper = GetVisualVmListHelper(); |
| | | visualVmListHelper.UpdateCalcuProperty(calcuResult); |
| | | |
| | | #endregion |
| | | |
| | | #region 构件明细 |
| | | |
| | | UpdateVisualListCtrl(); |
| | | |
| | | #endregion |
| | | |
| | |
| | | //水力计算 |
| | | private void barBtnCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var network = _hydroInfo.ToW3dNetworkViewModel(); |
| | | var json = JsonHelper.Object2Json(network); |
| | | Calcu(); |
| | | } |
| | | |
| | |
| | | dlg.SetBindingData(workingHelper.Working); |
| | | dlg.ReloadDataEvent += (rhs) => |
| | | { |
| | | workingHelper.Working = rhs; |
| | | this.barBtnAddWorking.Enabled = false; |
| | | workingHelper.ResetWorking(rhs); |
| | | this.AppendWorkingEvent?.Invoke(rhs); |
| | | }; |
| | | dlg.ShowDialog(); |
| | |
| | | |
| | | #region 工况分析 |
| | | |
| | | #region 工况评估 |
| | | |
| | | //评估 |
| | | private async void Evaluate() |
| | | //精度评估 |
| | | private async void barBtnWorkingEvaluation_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var working = GetWorking(); |
| | | if (working == null) |
| | | { |
| | | TipFormHelper.ShowWarn("尚未计算,请计算后重试!"); |
| | | return; |
| | | } |
| | | var checkResult = GetCheckResult(); |
| | | if (checkResult == null) |
| | | { |
| | | return; |
| | | } |
| | | if (!checkResult.Succeed) |
| | | { |
| | | ShowCheckCtrl(checkResult); |
| | | TipFormHelper.ShowWarn("检查失败,停止评估!"); |
| | | return; |
| | | } |
| | | var calcuResult = GetCalcuResult(); |
| | | if (!calcuResult.Succeed) |
| | | { |
| | | ShowCalcuFailedCtrl(calcuResult); |
| | | TipFormHelper.ShowWarn("计算失败,停止评估!"); |
| | | return; |
| | | } |
| | | if (calcuResult.WainingList != null && calcuResult.WainingList.Count > 0) |
| | | { |
| | | ShowCalcuWarningCtrl(calcuResult); |
| | | TipFormHelper.ShowWarn("请关注警告信息!"); |
| | | } |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var allVisualDict = visualListHelper.GetVisualDict(); |
| | | var monitorHelper = GetMonitorHelper(); |
| | | var allMonitorList = await monitorHelper.Get(); |
| | | var allWorkingMonitorList = JsonHelper.Json2Object<List<HydroWorkingMonitorViewModel>>(working.MonitorInfo); |
| | | var allCalcuResultDict = calcuResult.GetVisualDict(); |
| | | var dlg = new HydroWorkingEvaluationDlg(); |
| | | dlg.SetBindingData(allVisualDict, allMonitorList, allWorkingMonitorList, allCalcuResultDict); |
| | | dlg.ShowDialog(); |
| | | |
| | | var workingCheckedListHelper = GetWorkingCheckedListHelper(); |
| | | var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList(); |
| | | if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1) |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (!workingHelper.Initialized) |
| | | { |
| | | TipFormHelper.ShowWarn("请计算后重试!"); |
| | | return; |
| | | } |
| | | var dlg = new HydroSingleWorkingEvaluationDlg(); |
| | | dlg.SetBindingData(workingHelper.HydroInfo, allMonitorList, workingHelper.Working, workingHelper.CalcuResult); |
| | | dlg.ShowDialog(); |
| | | } |
| | | else |
| | | { |
| | | var dlg = new HydroMultiWorkingEvaluationDlg(); |
| | | dlg.SetBindingData(_hydroInfo, allMonitorList, allCheckedWorkingList); |
| | | dlg.ShowDialog(); |
| | | } |
| | | } |
| | | |
| | | //精度评估 |
| | | private void barBtnWorkingEvaluation_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | Evaluate(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 工况并联 |
| | | |
| | | //并联分析 |
| | | private void barBtnAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //水泵分析 |
| | | private void barBtnPumpAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | |
| | | |
| | | } |
| | | |
| | | 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(); |
| | | //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("正在开发中,敬请期待!"); |
| | | var workingCheckedListHelper = GetWorkingCheckedListHelper(); |
| | | var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList(); |
| | | if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1) |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (!workingHelper.Initialized) |
| | | { |
| | | TipFormHelper.ShowWarn("请计算后重试!"); |
| | | return; |
| | | } |
| | | var dlg = new SimulationSingleWorkingEnergyDlg(); |
| | | dlg.SetBindingData(workingHelper.HydroInfo, workingHelper.CalcuResult); |
| | | dlg.ShowDialog(); |
| | | } |
| | | else |
| | | { |
| | | var dlg = new SimulationMultiWorkingEnergyDlg(); |
| | | dlg.SetBindingData(_hydroInfo, allCheckedWorkingList); |
| | | dlg.ShowDialog(); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 损失曲线 |
| | | |
| | | //损失曲线 |
| | | private void barBtnWorkingLossCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | //if (_visual == null) |
| | | //{ |
| | | // XtraMessageBox.Show("请选择节点后重试!"); |
| | | // return; |
| | | //} |
| | | //if (!(_visual is Yw.Model.HydroNodeInfo)) |
| | | //{ |
| | | // XtraMessageBox.Show("请选择节点后重试!"); |
| | | // return; |
| | | //} |
| | | //var network = _hydroInfo.ToNetwork(); |
| | | //var calcuResult = network.Calcu(Yw.EPAnet.CalcuMode.MinorLoss); |
| | | //var allNodeList = network.GetAllNodes(); |
| | | //var node = allNodeList.Find(x => x.Id == _visual.Code); |
| | | //var allPathList = network.AnalyzeDownstreamPath(node, calcuResult); |
| | | //var allEpaLossList = network.GetChartNodeByPathLinks(allPathList, calcuResult); |
| | | //var allLossList = allEpaLossList?.Select(x => new HydroNodeLossViewModel(x)).ToList(); |
| | | var dlg = new HydroSingleLossCurveDlg(); |
| | | dlg.SetBindingData(null); |
| | | dlg.ShowDialog(); |
| | | if (_visual == null) |
| | | { |
| | | TipFormHelper.ShowWarn("请选择构件后重试!"); |
| | | return; |
| | | } |
| | | HydroVisualInfo visual = _visual; |
| | | if (_visual is HydroLinkInfo linkInfo) |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | visual = visualListHelper.GetVisual(linkInfo.StartCode); |
| | | } |
| | | |
| | | var workingCheckedListHelper = GetWorkingCheckedListHelper(); |
| | | var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList(); |
| | | if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1) |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (!workingHelper.Initialized) |
| | | { |
| | | TipFormHelper.ShowWarn("请计算后重试!"); |
| | | return; |
| | | } |
| | | var dlg = new HydroSingleWorkingLossCurveDlg(); |
| | | dlg.SetBindingData(workingHelper.HydroInfo, workingHelper.CalcuResult, visual); |
| | | dlg.ShowDialog(); |
| | | } |
| | | else |
| | | { |
| | | var dlg = new HydroMultiWorkingLossCurveDlg(); |
| | | dlg.SetBindingData(_hydroInfo, allCheckedWorkingList, visual); |
| | | dlg.ShowDialog(); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 损失比例 |
| | | |
| | | private void barBtnWorkingLossScale_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //损失统计 |
| | | private void barBtnWorkingLossStatistics_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var dlg = new HydroSingleLossScaleDlg(); |
| | | dlg.SetBindingData(); |
| | | dlg.ShowDialog(); |
| | | var workingCheckedListHelper = GetWorkingCheckedListHelper(); |
| | | var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList(); |
| | | if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1) |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (!workingHelper.Initialized) |
| | | { |
| | | TipFormHelper.ShowWarn("请计算后重试!"); |
| | | return; |
| | | } |
| | | var dlg = new HydroSingleWorkingLossStatisticsDlg(); |
| | | dlg.SetBindingData(workingHelper.HydroInfo); |
| | | dlg.ShowDialog(); |
| | | } |
| | | else |
| | | { |
| | | var dlg = new HydroMultiWorkingLossStatisticsDlg(); |
| | | dlg.SetBindingData(_hydroInfo, allCheckedWorkingList); |
| | | dlg.ShowDialog(); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 综合分析 |
| | | private void barBtnWorkingAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //综合分析 |
| | | private async void barBtnWorkingAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | XtraMessageBox.Show("正在开发中,敬请期待!"); |
| | | if (_visual == null) |
| | | { |
| | | TipFormHelper.ShowWarn("请选择构件后重试!"); |
| | | return; |
| | | } |
| | | HydroVisualInfo visual = _visual; |
| | | if (_visual is HydroLinkInfo linkInfo) |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | visual = visualListHelper.GetVisual(linkInfo.StartCode); |
| | | } |
| | | |
| | | var monitorHelper = GetMonitorHelper(); |
| | | var allMonitorList = await monitorHelper.Get(); |
| | | |
| | | var workingCheckedListHelper = GetWorkingCheckedListHelper(); |
| | | var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList(); |
| | | if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1) |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (!workingHelper.Initialized) |
| | | { |
| | | TipFormHelper.ShowWarn("请计算后重试!"); |
| | | return; |
| | | } |
| | | var dlg = new SimulationSingleWorkingAnalyDlg(); |
| | | dlg.SetBindingData(workingHelper.HydroInfo, allMonitorList, workingHelper.Working, workingHelper.CalcuResult, visual); |
| | | dlg.ShowDialog(); |
| | | } |
| | | else |
| | | { |
| | | var dlg = new SimulationMultiWorkingAnalyDlg(); |
| | | dlg.SetBindingData(_hydroInfo, allMonitorList, allCheckedWorkingList, visual); |
| | | dlg.ShowDialog(); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |