From 4da9b8277d8ef7567dfc9ca47f1251849b7234de Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期二, 03 十二月 2024 14:33:49 +0800 Subject: [PATCH] 增加过渡件上下游直径修复 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs | 813 +++++++++++++++++++++++++++++++-------------------------- 1 files changed, 436 insertions(+), 377 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 c95b15d..5353bc2 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 @@ -50,7 +50,6 @@ _projectSite = projectSite; _hydroInfo = hydroInfo; _allWorkingCheckedListDict = allWorkingCheckedListDict; - //this.PageTitle.Caption = $"{_project.Name}\r\n姘村姏妯℃嫙"; } /// <summary> @@ -308,6 +307,7 @@ Q3d, Property, List, + Set, Search, Monitor, Check, @@ -351,6 +351,13 @@ } 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; @@ -522,6 +529,15 @@ return; } _visualListCtrl?.UpdateBindingData(); + var calcuResult = GetCalcuResult(); + if (calcuResult != null && calcuResult.Succeed) + { + _visualListCtrl.SetCalcuView(); + } + else + { + _visualListCtrl.SetNormalView(); + } } //鏋勪欢鏄庣粏 @@ -580,121 +596,6 @@ } #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 @@ -761,95 +662,116 @@ //姘村簱 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 @@ -860,6 +782,14 @@ } var dlg = new SetHydroThreelinkListDlg(); dlg.SetBindingData(_hydroInfo); + dlg.HydroClickInfoEvent += (visual) => + { + SelectVisual(visual, eVisualSource.Set); + }; + dlg.HydroChangedInfoEvent += visuals => + { + SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + }; dlg.ShowDialog(); }; //鍥涢�� @@ -871,6 +801,14 @@ } var dlg = new SetHydroFourlinkListDlg(); dlg.SetBindingData(_hydroInfo); + dlg.HydroClickInfoEvent += (visual) => + { + SelectVisual(visual, eVisualSource.Set); + }; + dlg.HydroChangedInfoEvent += visuals => + { + SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + }; dlg.ShowDialog(); }; //姘磋〃 @@ -882,6 +820,14 @@ } var dlg = new SetHydroMeterListDlg(); dlg.SetBindingData(_hydroInfo); + dlg.HydroClickInfoEvent += (visual) => + { + SelectVisual(visual, eVisualSource.Set); + }; + dlg.HydroChangedInfoEvent += visuals => + { + SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + }; dlg.ShowDialog(); }; //娴侀噺璁� @@ -893,6 +839,14 @@ } var dlg = new SetHydroFlowmeterListDlg(); dlg.SetBindingData(_hydroInfo); + dlg.HydroClickInfoEvent += (visual) => + { + SelectVisual(visual, eVisualSource.Set); + }; + dlg.HydroChangedInfoEvent += visuals => + { + SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + }; dlg.ShowDialog(); }; //鍘嬪姏琛� @@ -904,6 +858,14 @@ } var dlg = new SetHydroPressmeterListDlg(); dlg.SetBindingData(_hydroInfo); + dlg.HydroClickInfoEvent += (visual) => + { + SelectVisual(visual, eVisualSource.Set); + }; + dlg.HydroChangedInfoEvent += visuals => + { + SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + }; dlg.ShowDialog(); }; //绠¢亾 @@ -915,6 +877,33 @@ } 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(); }; //姘存车 @@ -926,6 +915,14 @@ } var dlg = new SetHydroPumpListDlg(); dlg.SetBindingData(_hydroInfo); + dlg.HydroClickInfoEvent += (visual) => + { + SelectVisual(visual, eVisualSource.Set); + }; + dlg.HydroChangedInfoEvent += visuals => + { + SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); + }; dlg.ShowDialog(); }; //闃�闂� @@ -937,6 +934,52 @@ } 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(); }; } @@ -1106,6 +1149,26 @@ 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) { @@ -1126,25 +1189,6 @@ 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; - } } @@ -1966,7 +2010,6 @@ return; } var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo); - var json = JsonHelper.Object2Json(netWork); var result = netWork.ToInpString(); File.WriteAllText(fileName, result); TipFormHelper.ShowSucceed("瀵煎嚭鎴愬姛"); @@ -1976,7 +2019,38 @@ #region 姘存车鍒楄〃 - #region 骞惰仈妯℃嫙 + //鎬ц兘鏇茬嚎 + private void PumpFeat() + { + if (_hydroInfo == null) + { + return; + } + var pumps = _hydroInfo.Pumps; + if (pumps == null || pumps.Count < 1) + { + XtraMessageBox.Show("鏃犳按娉典俊鎭�"); + return; + } + var dlg = new SimulationPumpFeatDlg(); + dlg.SaveEvent += async (list) => + { + pumps.ForEach(x => x.UpdateWorkingInfo(list)); + var visualVmListHelper = GetVisualVmListHelper(); + visualVmListHelper.UpdateProperty(pumps.Select(x => x as Yw.Model.HydroVisualInfo).ToList()); + SelectVisual(_visual, eVisualSource.None); + var gradingHelper = await GetGradingHelper(); + gradingHelper.Set(); + }; + dlg.SetBindingData(_hydroInfo); + dlg.ShowDialog(); + } + + //鎬ц兘鏇茬嚎 + private void barBtnPumpCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + PumpFeat(); + } //骞惰仈妯℃嫙 private void PumpParallel() @@ -1991,71 +2065,34 @@ XtraMessageBox.Show("鏃犳按娉典俊鎭�"); return; } - var vmList = new List<XhsSinglePumpViewModel>(); - foreach (var pump in pumps) - { - if (!pump.RatedN.HasValue) - { - continue; - } - var qh = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQH)?.CurveData; - var qe = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQE)?.CurveData; - var qp = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQP)?.CurveData; - if (qh == null) - { - continue; - } - - var qhPtList = qh.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); - var qePtList = qe?.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); - var qpPtList = qp?.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); - - var vm = new XhsSinglePumpViewModel(); - vmList.Add(vm); - vm.ID = pump.ID; - vm.Name = pump.Name; - vm.Code = pump.Code; - vm.IsBp = true; - vm.RunStatus = pump.LinkStatus == Yw.Hydro.LinkStatus.Open; - vm.RatedHz = pump.RatedHz; - vm.CurrentHz = Math.Round(pump.RatedHz * pump.SpeedRatio, 1); - vm.RatedSpeed = pump.RatedN.Value; - vm.CurrentSpeed = Math.Round(pump.RatedN.Value * pump.SpeedRatio, 1); - vm.CurveQH = qhPtList; - vm.CurveQE = qePtList; - vm.CurveQP = qpPtList; - - } - - var dlg = new PumpParallelAnalyDlg(); - dlg.SetBindingData(vmList); - dlg.ReloadDataEvent += (list) => + var dlg = new SimulationPumpParallelDlg(); + dlg.SaveEvent += async (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; + pump.LinkStatus = x.LinkStatus; + pump.SpeedRatio = x.SpeedRatio; } }); - var codes = list?.Select(x => x.Code).ToList(); - //UpdateVisualViewModelProperty(codes); - //ShowSelectedProperty(); - UpdateVisualListCtrl(); - return true; + var visualVmListHelper = GetVisualVmListHelper(); + visualVmListHelper.UpdateProperty(pumps.Select(x => x as Yw.Model.HydroVisualInfo).ToList()); + SelectVisual(_visual, eVisualSource.None); + var gradingHelper = await GetGradingHelper(); + gradingHelper.Set(); }; + dlg.SetBindingData(_hydroInfo); dlg.ShowDialog(); } //骞惰仈妯℃嫙 private void barBtnPumpParallel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { + PumpParallel(); } - - #endregion #endregion @@ -2086,12 +2123,12 @@ 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(); //鏍¢獙 @@ -2131,6 +2168,18 @@ #endregion + #region 褰撳墠鏋勪欢 + + SelectVisual(_visual, eVisualSource.Calcu); + + #endregion + + #region 鏋勪欢鏄庣粏 + + UpdateVisualListCtrl(); + + #endregion + #region 璁$畻鏍囩 var calcuResultLabelHelper = await GetCalcuResultLabelHelper(); @@ -2147,8 +2196,6 @@ //姘村姏璁$畻 private void barBtnCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { - var network = _hydroInfo.ToW3dNetworkViewModel(); - var json = JsonHelper.Object2Json(network); Calcu(); } @@ -2247,67 +2294,36 @@ #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) { @@ -2378,76 +2394,90 @@ } - 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) { - var workingHelper = GetWorkingHelper(); - var dlg = new SimulationSingleWorkingEnergyDlg(); - dlg.SetBindingData(workingHelper.HydroInfo, workingHelper.CalcuResult); - 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 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("璇烽�夋嫨鑺傜偣鍚庨噸璇曪紒"); + TipFormHelper.ShowWarn("璇烽�夋嫨鏋勪欢鍚庨噸璇曪紒"); return; } - if (!(_visual is Yw.Model.HydroNodeInfo)) + HydroVisualInfo visual = _visual; + if (_visual is HydroLinkInfo linkInfo) { - XtraMessageBox.Show("璇烽�夋嫨鑺傜偣鍚庨噸璇曪紒"); - return; + var visualListHelper = GetVisualListHelper(); + visual = visualListHelper.GetVisual(linkInfo.StartCode); } - var network = _hydroInfo.ToNetwork(); - var calcuResult = network.Calcu(Yw.EPAnet.CalcuMode.Simple); - 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(allLossList); - 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 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 barBtnWorkingLossStatistics_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { - if (_hydroInfo == null) - { - return; - } var workingCheckedListHelper = GetWorkingCheckedListHelper(); var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList(); if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1) @@ -2468,21 +2498,50 @@ 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("姝e湪寮�鍙戜腑锛屾暚璇锋湡寰咃紒"); + 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 -- Gitblit v1.9.3