From 2b31b7e3926134da96d384ab3bdac345691a179c Mon Sep 17 00:00:00 2001 From: duheng <2784771470@qq.com> Date: 星期五, 10 一月 2025 10:48:45 +0800 Subject: [PATCH] 优化权限 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs | 897 ++++++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 636 insertions(+), 261 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 e5f6f59..c4beacc 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,17 +1,10 @@ 锘縰sing DevExpress.Diagram.Core.Native; using DevExpress.Mvvm.Native; -using DevExpress.Utils.MVVM; -using DevExpress.XtraMap; -using HStation.WinFrmUI.PhartRelation; using Mapster; -using NPOI.OpenXmlFormats.Dml; -using NPOI.SS.Formula.Functions; -using System.Diagnostics; using Yw.EPAnet; using Yw.Hydro; using Yw.Model; using Yw.Vmo; -using Yw.WinFrmUI.Q3d; namespace HStation.WinFrmUI { @@ -30,11 +23,6 @@ /// 鏂板宸ュ喌浜嬩欢 /// </summary> public event Action<HydroWorkingVmo> AppendWorkingEvent; - - /// <summary> - /// 淇濆瓨妯″瀷浜嬩欢 - /// </summary> - public event Func<Yw.Model.HydroModelInfo, Task<Yw.Model.HydroModelInfo>> SaveModelEvent; /// <summary> /// 鍒锋柊妯″瀷浜嬩欢 @@ -96,7 +84,204 @@ ShowBimfaceCtrl(); ShowQ3dCtrl(); ShowPropertyCtrl(); + InitialSvgImages(); } + + //鍒濆鍖朣vg鍥剧墖 + private void InitialSvgImages() + { + //鐩戞祴 + this.barBtnDockingMonitor.ImageOptions.SvgImage = HydroMonitorSvgImageHelper.Docking; + this.barBtnAnalyseMonitor.ImageOptions.SvgImage = HydroMonitorSvgImageHelper.Analyse; + + //姘村簱 + this.barBtnSetReservoirList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Tank; + this.barBtnSetReservoirList.ImageOptions.SvgImageSize = new Size(32, 32); + this.barBtnSetReservoirList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); + this.barBtnSetReservoirList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; + + //姘存睜 + this.barBtnSetTankList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Tank; + this.barBtnSetTankList.ImageOptions.SvgImageSize = new Size(32, 32); + this.barBtnSetTankList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); + this.barBtnSetTankList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; + + //姘寸 + this.barBtnSetWaterboxList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Tank; + this.barBtnSetWaterboxList.ImageOptions.SvgImageSize = new Size(32, 32); + this.barBtnSetWaterboxList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); + this.barBtnSetWaterboxList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; + + //闂峰ご + this.barBtnSetBluntheadList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Blunthead; + this.barBtnSetBluntheadList.ImageOptions.SvgImageSize = new Size(32, 32); + this.barBtnSetBluntheadList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); + this.barBtnSetBluntheadList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; + + //寮ご + this.barBtnSetElbowsList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Elbow; + this.barBtnSetElbowsList.ImageOptions.SvgImageSize = new Size(32, 32); + this.barBtnSetElbowsList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); + this.barBtnSetElbowsList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; + + //涓夐�� + this.barBtnSetThreelinkList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Threelink; + this.barBtnSetThreelinkList.ImageOptions.SvgImageSize = new Size(32, 32); + this.barBtnSetThreelinkList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); + this.barBtnSetThreelinkList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; + + //鍥涢�� + this.barBtnSetFourlinkList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Fourlink; + this.barBtnSetFourlinkList.ImageOptions.SvgImageSize = new Size(32, 32); + this.barBtnSetFourlinkList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); + this.barBtnSetFourlinkList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; + + //娑堢伀鏍� + this.barBtnSetHydrantList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Hydrant; + this.barBtnSetHydrantList.ImageOptions.SvgImageSize = new Size(32, 32); + this.barBtnSetHydrantList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); + this.barBtnSetHydrantList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; + + //鍠峰ご + this.barBtnSetNozzleList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Nozzle; + this.barBtnSetNozzleList.ImageOptions.SvgImageSize = new Size(32, 32); + this.barBtnSetNozzleList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); + this.barBtnSetNozzleList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; + + //鍐峰嵈濉� + this.barBtnSetCoolingList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Cooling; + this.barBtnSetCoolingList.ImageOptions.SvgImageSize = new Size(32, 32); + this.barBtnSetCoolingList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); + this.barBtnSetCoolingList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; + + //姘磋〃 + this.barBtnSetMeterList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Meter; + this.barBtnSetMeterList.ImageOptions.SvgImageSize = new Size(32, 32); + this.barBtnSetMeterList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); + this.barBtnSetMeterList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; + + //娴侀噺璁� + this.barBtnSetFlowmeterList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Flowmeter; + this.barBtnSetFlowmeterList.ImageOptions.SvgImageSize = new Size(32, 32); + this.barBtnSetFlowmeterList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); + this.barBtnSetFlowmeterList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; + + //鍘嬪姏琛� + this.barBtnSetPressmeterList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Pressmeter; + this.barBtnSetPressmeterList.ImageOptions.SvgImageSize = new Size(32, 32); + this.barBtnSetMeterList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); + this.barBtnSetMeterList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; + + //绠¢亾 + this.barBtnSetPipeList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Pipe; + this.barBtnSetPipeList.ImageOptions.SvgImageSize = new Size(32, 32); + this.barBtnSetPipeList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); + this.barBtnSetPipeList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; + + //杩囨浮浠� + this.barBtnSetTranslationList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Translation; + this.barBtnSetTranslationList.ImageOptions.SvgImageSize = new Size(32, 32); + this.barBtnSetTranslationList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); + this.barBtnSetTranslationList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; + + //姘存车 + this.barBtnSetPumpList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Pump; + this.barBtnSetPumpList.ImageOptions.SvgImageSize = new Size(32, 32); + this.barBtnSetPumpList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); + this.barBtnSetPumpList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; + + //闃�闂� + this.barBtnSetValveList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Valve; + this.barBtnSetValveList.ImageOptions.SvgImageSize = new Size(32, 32); + this.barBtnSetValveList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); + this.barBtnSetValveList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; + + //鎹㈢儹鍣� + this.barBtnSetExchangerList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Exchanger; + this.barBtnSetExchangerList.ImageOptions.SvgImageSize = new Size(32, 32); + this.barBtnSetExchangerList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); + this.barBtnSetExchangerList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; + + //鍘嬬缉鏈� + this.barBtnSetCompressorList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Compressor; + this.barBtnSetCompressorList.ImageOptions.SvgImageSize = new Size(32, 32); + this.barBtnSetCompressorList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); + this.barBtnSetCompressorList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; + } + + #region 灞炴�х姸鎬� + + //灞炴�х姸鎬佽緟鍔╃被 + private HydroPropStatusHelper _propStatusHelper = null; + + //鑾峰彇灞炴�х姸鎬佽緟鍔╃被 + private async Task<HydroPropStatusHelper> GetPropStatusHelper() + { + if (_propStatusHelper == null) + { + var allPropStatusList = await BLLFactory<Yw.BLL.HydroParterPropStatusInfo>.Instance.GetByModelID(_hydroInfo.ID); + _propStatusHelper = new HydroPropStatusHelper(_hydroInfo, allPropStatusList); + } + return _propStatusHelper; + } + + //鑾峰彇灞炴�х姸鎬丏b鍒楄〃 + private async Task<List<HydroParterPropStatusInfo>> GetPropStatusDbList() + { + var helper = await GetPropStatusHelper(); + return helper.GetPropStatusDbList(); + } + + #endregion + + #region 鏇存敼鐘舵�� + + //鏀瑰彉杈呭姪绫� + private HydroChangeHelper _changeHelper = null; + + //鑾峰彇鏀瑰彉杈呭姪绫� + private HydroChangeHelper GetChangeHelper() + { + if (_hydroInfo == null) + { + return default; + } + if (_changeHelper == null) + { + _changeHelper = new HydroChangeHelper(_hydroInfo); + } + return _changeHelper; + } + + //闄勫姞鏀瑰彉鏋勪欢 + private void AppendChangeParter(HydroParterInfo parter, eChangeType changeType) + { + var helper = GetChangeHelper(); + helper.Append(parter, changeType); + } + + //鑾峰彇澧炲姞鏋勪欢鍒楄〃 + private List<HydroParterInfo> GetAddParterList() + { + var helper = GetChangeHelper(); + return helper.GetAddParterList(); + } + + //鑾峰彇鏇存柊鏋勪欢鍒楄〃 + private List<HydroParterInfo> GetUpdateParterList() + { + var helper = GetChangeHelper(); + return helper.GetUpdateParterList(); + } + + //鑾峰彇绉婚櫎鏋勪欢鍒楄〃 + private List<string> GetRemoveParters() + { + var helper = GetChangeHelper(); + return helper.GetRemoveParters(); + } + + #endregion #region BIM鎺т欢 @@ -112,13 +297,13 @@ } if (_bimfaceCtrl == null) { - var overlay = this.ShowOverlay(); _bimfaceCtrl = new SimulationBimfaceCtrl(); _bimfaceCtrl.Dock = DockStyle.Fill; + WaitFormHelper.ShowWaitForm(this.FindForm(), "姝e湪鍔犺浇妯″瀷锛岃绋嶅悗..."); await _bimfaceCtrl.InitialData(_project, _projectSite); _bimfaceCtrl.LoadCompletedEvent += () => {//view鍔犺浇瀹屾垚浜嬩欢 - overlay.Close(); + WaitFormHelper.HideWaitForm(); this.barCkDecorator.Checked = false; this.barCkGrading.Checked = true; }; @@ -140,7 +325,7 @@ this.tabPageBimface.Controls.Add(bimfaceCtrl); } - #endregion BIM鎺т欢 + #endregion #region Q3d鎺т欢 @@ -177,7 +362,7 @@ this.tabPageQ3d.Controls.Add(q3dCtrl); } - #endregion Q3d鎺т欢 + #endregion #region 灞炴�ф帶浠� @@ -185,7 +370,7 @@ private SimulationPropertyCtrl _propertyCtrl = null; //鑾峰彇灞炴�ф帶浠� - private SimulationPropertyCtrl GetPropertyCtrl() + private async Task<SimulationPropertyCtrl> GetPropertyCtrl() { if (_hydroInfo == null) { @@ -193,9 +378,13 @@ } if (_propertyCtrl == null) { + var changeHelper = GetChangeHelper(); + var propStatusHelper = await GetPropStatusHelper(); _propertyCtrl = new SimulationPropertyCtrl(); _propertyCtrl.Dock = DockStyle.Fill; _propertyCtrl.AllowEdit = true; + _propertyCtrl.InitialData(changeHelper, propStatusHelper); + _propertyCtrl.CalcuResult = () => GetCalcuResult(); _propertyCtrl.HydroViewEvent += (visual) => { SelectVisual(visual, eSimulationVisualSource.Property); @@ -261,13 +450,6 @@ var gradingHelper = await GetGradingHelper(); gradingHelper.Set(visual); }; - _propertyCtrl.FlowEffectPropertyValueChangedEvent += async (visual) => - { - //娴佸悜灞炴�у彂鐢熸敼鍙� - //鍒ゆ柇娴佸悜鏄惁鍔犺浇锛屽鏋滃姞杞藉垯鏇存柊娴佸悜锛屾渶濂芥槸鏇存柊鍗曚釜娴佸悜 - var flowEffectHelper = await GetFlowEffectHelper(); - flowEffectHelper.Set(visual); - }; } return _propertyCtrl; } @@ -292,13 +474,13 @@ } //鏄剧ず灞炴�ф帶浠� - private void ShowPropertyCtrl() + private async void ShowPropertyCtrl() { if (IsPropertyCtrlVisible) { return; } - var propertyCtrl = GetPropertyCtrl(); + var propertyCtrl = await GetPropertyCtrl(); this.controlContainerRight.Controls.Clear(); this.controlContainerRight.Controls.Add(propertyCtrl); this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; @@ -322,7 +504,7 @@ _propertyCtrl?.UpdateRows(); } - #endregion 灞炴�ф帶浠� + #endregion #region 閫夋嫨鏋勪欢 @@ -338,14 +520,16 @@ case eSimulationVisualSource.None: { _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); - this.barBtnSetMonitor.Enabled = visual != null; + this.barBtnDockingMonitor.Enabled = visual != null; + this.barBtnAnalyseMonitor.Enabled = visual != null; SetPropertyCtrl(visual); } break; case eSimulationVisualSource.Bimface: { - this.barBtnSetMonitor.Enabled = visual != null; + this.barBtnDockingMonitor.Enabled = visual != null; + this.barBtnAnalyseMonitor.Enabled = visual != null; SetPropertyCtrl(visual); } break; @@ -353,7 +537,8 @@ case eSimulationVisualSource.Q3d: { _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); - this.barBtnSetMonitor.Enabled = visual != null; + this.barBtnDockingMonitor.Enabled = visual != null; + this.barBtnAnalyseMonitor.Enabled = visual != null; SetPropertyCtrl(visual); } break; @@ -361,14 +546,16 @@ case eSimulationVisualSource.Property: { _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); - this.barBtnSetMonitor.Enabled = visual != null; + this.barBtnDockingMonitor.Enabled = visual != null; + this.barBtnAnalyseMonitor.Enabled = visual != null; } break; case eSimulationVisualSource.List: { _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); - this.barBtnSetMonitor.Enabled = visual != null; + this.barBtnDockingMonitor.Enabled = visual != null; + this.barBtnAnalyseMonitor.Enabled = visual != null; SetPropertyCtrl(visual); } break; @@ -376,7 +563,8 @@ case eSimulationVisualSource.Set: { _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); - this.barBtnSetMonitor.Enabled = visual != null; + this.barBtnDockingMonitor.Enabled = visual != null; + this.barBtnAnalyseMonitor.Enabled = visual != null; SetPropertyCtrl(visual); } break; @@ -384,7 +572,8 @@ case eSimulationVisualSource.Search: { _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); - this.barBtnSetMonitor.Enabled = visual != null; + this.barBtnDockingMonitor.Enabled = visual != null; + this.barBtnAnalyseMonitor.Enabled = visual != null; SetPropertyCtrl(visual); } break; @@ -392,7 +581,8 @@ case eSimulationVisualSource.Monitor: { _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); - this.barBtnSetMonitor.Enabled = visual != null; + this.barBtnDockingMonitor.Enabled = visual != null; + this.barBtnAnalyseMonitor.Enabled = visual != null; SetPropertyCtrl(visual); } break; @@ -400,7 +590,8 @@ case eSimulationVisualSource.Check: { _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); - this.barBtnSetMonitor.Enabled = visual != null; + this.barBtnDockingMonitor.Enabled = visual != null; + this.barBtnAnalyseMonitor.Enabled = visual != null; SetPropertyCtrl(visual); } break; @@ -408,7 +599,8 @@ case eSimulationVisualSource.Calcu: { _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); - this.barBtnSetMonitor.Enabled = visual != null; + this.barBtnDockingMonitor.Enabled = visual != null; + this.barBtnAnalyseMonitor.Enabled = visual != null; SetPropertyCtrl(visual); } break; @@ -416,7 +608,8 @@ case eSimulationVisualSource.Warning: { _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); - this.barBtnSetMonitor.Enabled = visual != null; + this.barBtnDockingMonitor.Enabled = visual != null; + this.barBtnAnalyseMonitor.Enabled = visual != null; SetPropertyCtrl(visual); } break; @@ -564,7 +757,7 @@ } //鏄剧ず鏋勪欢鏄庣粏鎺т欢 - private void ShowVisualListCtrl() + private async void ShowVisualListCtrl() { if (_hydroInfo == null) { @@ -580,8 +773,10 @@ this.docPnlBottom.Height = 350; } var visualVmListHelper = GetVisualVmListHelper(); + var changeHelper = GetChangeHelper(); + var propStatusHelper = await GetPropStatusHelper(); var allVisualVmList = visualVmListHelper.GetVisualList(); - visualListCtrl.SetBindingData(allVisualVmList); + visualListCtrl.SetBindingData(allVisualVmList, changeHelper, propStatusHelper); var calcuResult = GetCalcuResult(); if (calcuResult != null && calcuResult.Succeed) { @@ -618,7 +813,7 @@ ShowVisualListCtrl(); } - #endregion 鏄庣粏鎺т欢 + #endregion #region 鏋勪欢鏄剧ず @@ -669,14 +864,34 @@ #endregion 鏋勪欢鏄剧ず - #endregion 鏋勪欢鏄庣粏 + #endregion #region 涓�閿樉闅� + + private List<string> _allDecoratorCodes = null; + + //鑾峰彇瑁呴グ浠禼ode鍒楄〃 + private async Task<List<string>> GetDecoratorCodes() + { + if (_hydroInfo == null) + { + return default; + } + if (_allDecoratorCodes == null) + { + _allDecoratorCodes = await BLLFactory<Yw.BLL.HydroDecoratorInfo>.Instance.GetCodeListByModelID(_hydroInfo.ID, null); + } + if (_allDecoratorCodes == null) + { + _allDecoratorCodes = new List<string>(); + } + return _allDecoratorCodes; + } //璁剧疆瑁呴グ浠跺彲瑙佹�� private async void SetDecoratorVisible(bool isDecoratorVisible) { - var codes = _hydroInfo.Decorators?.Select(x => x.Code).Distinct().ToList(); + var codes = await GetDecoratorCodes(); if (isDecoratorVisible) { await _bimfaceCtrl?.ShowComponents(codes); @@ -697,6 +912,10 @@ #region 淇濆瓨淇℃伅 + //淇濆瓨閿佸畾瀵硅薄 + private object _locker_save = new(); + private bool _isSaving = false;//姝e湪淇濆瓨 + //淇濆瓨 private async void barBtnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { @@ -704,19 +923,68 @@ { return; } - if (this.SaveModelEvent == null) - { - return; - } - var hydroInfo = await this.SaveModelEvent.Invoke(_hydroInfo); - if (hydroInfo == null) - { - TipFormHelper.ShowError("淇濆瓨澶辫触锛�"); - return; - } - _hydroInfo = hydroInfo; + lock (_locker_save) + { + if (_isSaving) + { + this.FindForm().ShowAlertInfo("淇濆瓨", "姝e湪淇濆瓨锛岃绋嶅悗閲嶈瘯锛�"); + return; + } + } + + _isSaving = true; + + var changeHelper = GetChangeHelper(); + + var addParterList = changeHelper.GetAddParterList(); + var updateParterList = changeHelper.GetUpdateParterList(); + var removeParters = changeHelper.GetRemoveParters(); + + if (addParterList == null || addParterList.Count < 1) + { + if (updateParterList == null || updateParterList.Count < 1) + { + if (removeParters == null || removeParters.Count < 1) + { + TipFormHelper.ShowWarn("鏈娴嬪埌淇敼锛屾棤闇�淇濆瓨锛�"); + _isSaving = false; + return; + } + } + } + + WaitFormHelper.ShowWaitForm("姝e湪淇濆瓨锛岃绋嶅悗..."); + + var bol = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance + .Update(_hydroInfo, addParterList, updateParterList, removeParters); + if (!bol) + { + WaitFormHelper.HideWaitForm(); + TipFormHelper.ShowError("姘村姏淇℃伅鏇存柊澶辫触锛�"); + _isSaving = false; + return; + } + changeHelper.Reset(); + + var propStatusHelper = await GetPropStatusHelper(); + var updatePropStatusList = propStatusHelper.GetUpdatePropStatusDbList(); + if (updatePropStatusList != null && updatePropStatusList.Count > 0) + { + bol = await BLLFactory<Yw.BLL.HydroParterPropStatusInfo>.Instance.Update(_hydroInfo.ID, updatePropStatusList); + if (!bol) + { + WaitFormHelper.HideWaitForm(); + TipFormHelper.ShowWarn("灞炴�х姸鎬佹洿鏂板け璐ワ紒"); + _isSaving = false; + return; + } + } + propStatusHelper.Reset(); + + WaitFormHelper.HideWaitForm(); TipFormHelper.ShowSucceed("淇濆瓨鎴愬姛锛�"); + _isSaving = false; //Stopwatch sw = new Stopwatch(); //sw.Start(); @@ -734,11 +1002,13 @@ private void RegistBulkSetEvents() { //姘村簱 - this.barBtnSetReservoirList.ItemClick += delegate + this.barBtnSetReservoirList.ItemClick += async delegate { var allVisualViewModelList = GetVisualViewModelList(); + var changeHelper = GetChangeHelper(); + var propStatusHelper = await GetPropStatusHelper(); var dlg = new SetHydroReservoirListDlg(); - dlg.SetBindingData(allVisualViewModelList); + dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eSimulationVisualSource.Set); @@ -751,11 +1021,13 @@ dlg.ShowDialog(); }; //姘存睜 - this.barBtnSetTankList.ItemClick += delegate + this.barBtnSetTankList.ItemClick += async delegate { var allVisualViewModelList = GetVisualViewModelList(); + var changeHelper = GetChangeHelper(); + var propStatusHelper = await GetPropStatusHelper(); var dlg = new SetHydroTankListDlg(); - dlg.SetBindingData(allVisualViewModelList); + dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eSimulationVisualSource.Set); @@ -768,11 +1040,13 @@ dlg.ShowDialog(); }; //姘寸 - this.barBtnSetWaterboxList.ItemClick += delegate + this.barBtnSetWaterboxList.ItemClick += async delegate { var allVisualViewModelList = GetVisualViewModelList(); + var changeHelper = GetChangeHelper(); + var propStatusHelper = await GetPropStatusHelper(); var dlg = new SetHydroWaterboxListDlg(); - dlg.SetBindingData(allVisualViewModelList); + dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eSimulationVisualSource.Set); @@ -785,11 +1059,13 @@ dlg.ShowDialog(); }; //杩炴帴鑺傜偣 - this.barBtnSetJunctionList.ItemClick += delegate + this.barBtnSetJunctionList.ItemClick += async delegate { var allVisualViewModelList = GetVisualViewModelList(); + var changeHelper = GetChangeHelper(); + var propStatusHelper = await GetPropStatusHelper(); var dlg = new SetHydroJunctionListDlg(); - dlg.SetBindingData(allVisualViewModelList); + dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eSimulationVisualSource.Set); @@ -802,11 +1078,13 @@ dlg.ShowDialog(); }; //闂峰ご - this.barBtnSetBluntheadList.ItemClick += delegate + this.barBtnSetBluntheadList.ItemClick += async delegate { var allVisualViewModelList = GetVisualViewModelList(); + var changeHelper = GetChangeHelper(); + var propStatusHelper = await GetPropStatusHelper(); var dlg = new SetHydroBluntheadListDlg(); - dlg.SetBindingData(allVisualViewModelList); + dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eSimulationVisualSource.Set); @@ -819,11 +1097,13 @@ dlg.ShowDialog(); }; //寮ご - this.barBtnSetElbowsList.ItemClick += delegate + this.barBtnSetElbowsList.ItemClick += async delegate { var allVisualVmList = GetVisualViewModelList(); + var changeHelper = GetChangeHelper(); + var propStatusHelper = await GetPropStatusHelper(); var dlg = new SetHydroElbowListDlg(); - dlg.SetBindingData(allVisualVmList); + dlg.SetBindingData(allVisualVmList, changeHelper, propStatusHelper); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eSimulationVisualSource.Set); @@ -836,11 +1116,13 @@ dlg.ShowDialog(); }; //涓夐�� - this.barBtnSetThreelinkList.ItemClick += delegate + this.barBtnSetThreelinkList.ItemClick += async delegate { var allVisualViewModelList = GetVisualViewModelList(); + var changeHelper = GetChangeHelper(); + var propStatusHelper = await GetPropStatusHelper(); var dlg = new SetHydroThreelinkListDlg(); - dlg.SetBindingData(allVisualViewModelList); + dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eSimulationVisualSource.Set); @@ -853,11 +1135,13 @@ dlg.ShowDialog(); }; //鍥涢�� - this.barBtnSetFourlinkList.ItemClick += delegate + this.barBtnSetFourlinkList.ItemClick += async delegate { var allVisualViewModelList = GetVisualViewModelList(); + var changeHelper = GetChangeHelper(); + var propStatusHelper = await GetPropStatusHelper(); var dlg = new SetHydroFourlinkListDlg(); - dlg.SetBindingData(allVisualViewModelList); + dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eSimulationVisualSource.Set); @@ -870,11 +1154,13 @@ dlg.ShowDialog(); }; //姘磋〃 - this.barBtnSetMeterList.ItemClick += delegate + this.barBtnSetMeterList.ItemClick += async delegate { var allVisualViewModelList = GetVisualViewModelList(); + var changeHelper = GetChangeHelper(); + var propStatusHelper = await GetPropStatusHelper(); var dlg = new SetHydroMeterListDlg(); - dlg.SetBindingData(allVisualViewModelList); + dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eSimulationVisualSource.Set); @@ -887,11 +1173,13 @@ dlg.ShowDialog(); }; //娴侀噺璁� - this.barBtnSetFlowmeterList.ItemClick += delegate + this.barBtnSetFlowmeterList.ItemClick += async delegate { var allVisualViewModelList = GetVisualViewModelList(); + var changeHelper = GetChangeHelper(); + var propStatusHelper = await GetPropStatusHelper(); var dlg = new SetHydroFlowmeterListDlg(); - dlg.SetBindingData(allVisualViewModelList); + dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eSimulationVisualSource.Set); @@ -904,15 +1192,13 @@ dlg.ShowDialog(); }; //鍘嬪姏琛� - this.barBtnSetPressmeterList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); - this.barBtnSetPressmeterList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Pressmeter; - this.barBtnSetPressmeterList.ImageOptions.SvgImageSize = new Size(32, 32); - this.barBtnSetPressmeterList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; - this.barBtnSetPressmeterList.ItemClick += delegate + this.barBtnSetPressmeterList.ItemClick += async delegate { var allVisualViewModelList = GetVisualViewModelList(); + var changeHelper = GetChangeHelper(); + var propStatusHelper = await GetPropStatusHelper(); var dlg = new SetHydroPressmeterListDlg(); - dlg.SetBindingData(allVisualViewModelList); + dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eSimulationVisualSource.Set); @@ -925,15 +1211,13 @@ dlg.ShowDialog(); }; //鍠峰槾 - this.barBtnSetNozzleList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); - this.barBtnSetNozzleList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Nozzle; - this.barBtnSetNozzleList.ImageOptions.SvgImageSize = new Size(32, 32); - this.barBtnSetNozzleList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; - this.barBtnSetNozzleList.ItemClick += delegate + this.barBtnSetNozzleList.ItemClick += async delegate { var allVisualViewModelList = GetVisualViewModelList(); + var changeHelper = GetChangeHelper(); + var propStatusHelper = await GetPropStatusHelper(); var dlg = new SetHydroNozzleListDlg(); - dlg.SetBindingData(allVisualViewModelList); + dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eSimulationVisualSource.Set); @@ -946,15 +1230,13 @@ dlg.ShowDialog(); }; //鍐峰嵈濉� - this.barBtnSetCoolingList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); - this.barBtnSetCoolingList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Cooling; - this.barBtnSetCoolingList.ImageOptions.SvgImageSize = new Size(32, 32); - this.barBtnSetCoolingList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; - this.barBtnSetCoolingList.ItemClick += delegate + this.barBtnSetCoolingList.ItemClick += async delegate { var allVisualViewModelList = GetVisualViewModelList(); + var changeHelper = GetChangeHelper(); + var propStatusHelper = await GetPropStatusHelper(); var dlg = new SetHydroCoolingListDlg(); - dlg.SetBindingData(allVisualViewModelList); + dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eSimulationVisualSource.Set); @@ -967,11 +1249,13 @@ dlg.ShowDialog(); }; //绠¢亾 - this.barBtnSetPipeList.ItemClick += delegate + this.barBtnSetPipeList.ItemClick += async delegate { var allVisualViewModelList = GetVisualViewModelList(); + var changeHelper = GetChangeHelper(); + var propStatusHelper = await GetPropStatusHelper(); var dlg = new SetHydroPipeListDlg(); - dlg.SetBindingData(allVisualViewModelList); + dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eSimulationVisualSource.Set); @@ -984,11 +1268,13 @@ dlg.ShowDialog(); }; //杩囨浮浠� - this.barBtnSetTranslationList.ItemClick += delegate + this.barBtnSetTranslationList.ItemClick += async delegate { var allVisualViewModelList = GetVisualViewModelList(); + var changeHelper = GetChangeHelper(); + var propStatusHelper = await GetPropStatusHelper(); var dlg = new SetHydroTranslationListDlg(); - dlg.SetBindingData(allVisualViewModelList); + dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eSimulationVisualSource.Set); @@ -1001,11 +1287,13 @@ dlg.ShowDialog(); }; //姘存车 - this.barBtnSetPumpList.ItemClick += delegate + this.barBtnSetPumpList.ItemClick += async delegate { var allVisualViewModelList = GetVisualViewModelList(); + var changeHelper = GetChangeHelper(); + var propStatusHelper = await GetPropStatusHelper(); var dlg = new SetHydroPumpListDlg(); - dlg.SetBindingData(allVisualViewModelList); + dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eSimulationVisualSource.Set); @@ -1018,11 +1306,13 @@ dlg.ShowDialog(); }; //闃�闂� - this.barBtnSetValveList.ItemClick += delegate + this.barBtnSetValveList.ItemClick += async delegate { var allVisualViewModelList = GetVisualViewModelList(); + var changeHelper = GetChangeHelper(); + var propStatusHelper = await GetPropStatusHelper(); var dlg = new SetHydroValveListDlg(); - dlg.SetBindingData(allVisualViewModelList); + dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eSimulationVisualSource.Set); @@ -1035,11 +1325,13 @@ dlg.ShowDialog(); }; //鎹㈢儹鍣� - this.barBtnSetExchangerList.ItemClick += delegate + this.barBtnSetExchangerList.ItemClick += async delegate { var allVisualViewModelList = GetVisualViewModelList(); + var changeHelper = GetChangeHelper(); + var propStatusHelper = await GetPropStatusHelper(); var dlg = new SetHydroExchangerListDlg(); - dlg.SetBindingData(allVisualViewModelList); + dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eSimulationVisualSource.Set); @@ -1052,11 +1344,13 @@ dlg.ShowDialog(); }; //鍘嬬缉鏈� - this.barBtnSetCompressorList.ItemClick += delegate + this.barBtnSetCompressorList.ItemClick += async delegate { var allVisualViewModelList = GetVisualViewModelList(); + var changeHelper = GetChangeHelper(); + var propStatusHelper = await GetPropStatusHelper(); var dlg = new SetHydroCompressorListDlg(); - dlg.SetBindingData(allVisualViewModelList); + dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); dlg.HydroClickInfoEvent += (visual) => { SelectVisual(visual, eSimulationVisualSource.Set); @@ -1285,7 +1579,7 @@ } } - #endregion 鎵归噺閰嶇疆 + #endregion #region 鏋勪欢鏌ヨ @@ -1428,7 +1722,7 @@ markHelper.Set(); } - #endregion 妯″瀷鏍囨敞 + #endregion #region 棰滆壊鍒嗙骇 @@ -1539,41 +1833,6 @@ #endregion 浜哄伐鍒锋柊 - #region 姘存祦鍔ㄧ敾 - - //姘存祦鍔ㄧ敾杈呭姪绫� - private SimulationFlowEffectHelper _flowEffectHelper = null; - - //鑾峰彇姘存祦鍔ㄧ敾杈呭姪绫� - private async Task<SimulationFlowEffectHelper> GetFlowEffectHelper() - { - if (_hydroInfo == null) - { - return default; - } - if (_flowEffectHelper == null) - { - var visualListHelper = GetVisualListHelper(); - var bimfaceCtrl = await GetBimfaceCtrl(); - _flowEffectHelper = new SimulationFlowEffectHelper(visualListHelper, bimfaceCtrl); - var calcuResult = GetCalcuResult(); - _flowEffectHelper.InitialData(calcuResult); - } - return _flowEffectHelper; - } - - //姘存祦鍔ㄧ敾鏄惁鍙 - private async void barCkFlowEffect_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) - { - var flowEffectHelper = await GetFlowEffectHelper(); - flowEffectHelper.Visible = this.barCkFlowEffect.Checked; - flowEffectHelper.Set(); - } - - #endregion 姘存祦鍔ㄧ敾 - - #region 鐩戞祴鍒楄〃 - #region 鐩戞祴鐐� //鐩戞祴鐐硅緟鍔╃被 @@ -1582,10 +1841,6 @@ //鑾峰彇鐩戞祴鐐硅緟鍔╃被 private SimulationMonitorHelper GetMonitorHelper() { - if (_hydroInfo == null) - { - return default; - } if (_monitorHelper == null) { var visualListHelper = GetVisualListHelper(); @@ -1598,43 +1853,21 @@ private async Task<List<HydroMonitorVmo>> GetMonitorList() { var helper = GetMonitorHelper(); - return await helper.Get(); + return await helper.GetAll(); } - //璁剧疆鐩戞祴鐐瑰垪琛� - private async void SetMonitorList(HydroVisualInfo visual) + //鑾峰彇鐩戞祴瀵规帴鍒楄〃 + private async Task<List<HydroMonitorVmo>> GetMonitorDockingList() { - if (_hydroInfo == null) - { - return; - } - var monitorHelper = GetMonitorHelper(); - var allMonitorList = await monitorHelper.Get(); - var dlg = new SetHydroMonitorListDlg(); - dlg.SetBindingData(_hydroInfo, visual, allMonitorList); - dlg.ReloadDataEvent += async (list) => - { - var bol = await BLLFactory<Yw.BLL.HydroMonitor>.Instance.Save(_hydroInfo.ID, visual.Code, list); - if (!bol) - { - TipFormHelper.ShowError("璁剧疆澶辫触锛�"); - return; - } - TipFormHelper.ShowSucceed("璁剧疆鎴愬姛锛�"); - var monitorList = await monitorHelper.Update(visual.Code); - var monitorValueHelper = GetMonitorValueHelper(); - monitorValueHelper.Update(visual.Code, monitorList); - var monitorMarkerHelper = await GetMonitorMarkerHelper(); - monitorMarkerHelper.Update(visual.Code, monitorList); - monitorMarkerHelper.Set(); - }; - dlg.ShowDialog(); + var helper = GetMonitorHelper(); + return await helper.GetDockingList(); } - //璁剧疆鐩戞祴鐐� - private void barBtnSetMonitor_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + //鑾峰彇鐩戞祴鍒嗘瀽鍒楄〃 + private async Task<List<HydroMonitorVmo>> GetMonitorAnalyseList() { - SetMonitorList(_visual); + var helper = GetMonitorHelper(); + return await helper.GetAnalyseList(); } #endregion 鐩戞祴鐐� @@ -1651,7 +1884,8 @@ { var visualListHelper = GetVisualListHelper(); var monitorHelper = GetMonitorHelper(); - _monitorValueHelper = new SimulationMonitorValueHelper(visualListHelper, monitorHelper); + var calcuResultHelper = GetCalcuResultHelper(); + _monitorValueHelper = new SimulationMonitorValueHelper(visualListHelper, monitorHelper, calcuResultHelper); } return _monitorValueHelper; } @@ -1660,7 +1894,21 @@ private async Task<List<HydroMonitorValueViewModel>> GetMonitorValueList() { var helper = GetMonitorValueHelper(); - return await helper.Get(); + return await helper.GetAll(); + } + + //鑾峰彇鐩戞祴瀵规帴鍊煎垪琛� + private async Task<List<HydroMonitorValueViewModel>> GetMonitorDockingValueList() + { + var helper = GetMonitorValueHelper(); + return await helper.GetDockingList(); + } + + //鑾峰彇鐩戞祴鍒嗘瀽鍊煎垪琛� + private async Task<List<HydroMonitorValueViewModel>> GetMonitorAnalyseValueList() + { + var helper = GetMonitorValueHelper(); + return await helper.GetAnalyseList(); } //閲嶇疆 @@ -1675,9 +1923,52 @@ } } - #endregion + #endregion 鐩戞祴鍊� - #region 鐩戞祴鍊兼帶浠� + #region 浼犳劅鍣ㄦ祴鐐� + + //璁剧疆鍙鏋勪欢瀵规帴娴嬬偣鍒楄〃 + private async void SetMonitorDockingList(HydroVisualInfo visual) + { + if (_hydroInfo == null) + { + return; + } + if (visual == null) + { + return; + } + var monitorHelper = GetMonitorHelper(); + var allMonitorList = await monitorHelper.GetAll(); + var monitorValueHelper = GetMonitorValueHelper(); + var allMonitorValueList = await monitorValueHelper.GetAll(); + var calcuResult = GetCalcuResult(); + var dlg = new SetHydroMonitorDockingListDlg(); + dlg.ReloadDataEvent += async (list) => + { + var monitorList = list?.Select(x => x.Vmo).ToList(); + await monitorHelper.Update(visual.Code, eSourceType.Docking, monitorList); + await monitorValueHelper.Update(visual.Code, eSourceType.Docking, list); + var monitorMarkerHelper = await GetMonitorMarkerHelper(); + monitorMarkerHelper.Set(); + }; + dlg.SetBindingData(_hydroInfo, visual, allMonitorList, allMonitorValueList, calcuResult); + dlg.ShowDialog(); + } + + //璁剧疆浼犳劅鍣ㄦ祴鐐� + private void barBtnDockingMonitor_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + if (_visual == null) + { + return; + } + SetMonitorDockingList(_visual); + } + + #endregion 浼犳劅鍣ㄦ祴鐐� + + #region 浼犳劅鍣ㄦ祴鍊� //鐩戞祴鍊煎垪琛ㄦ帶浠� private HydroMonitorValueListCtrl _monitorValueListCtrl = null; @@ -1717,8 +2008,8 @@ } } - //鏄剧ず鐩戞祴鍊煎垪琛ㄦ帶浠� - private async void ShowMonitorValueListCtrl() + //鏄剧ず鐩戞祴瀵规帴鍊煎垪琛ㄦ帶浠� + private async void ShowMonitorDockingValueListCtrl() { var monitorValueListCtrl = GetMonitorValueListCtrl(); if (!IsMonitorValueListCtrlVisible) @@ -1726,22 +2017,62 @@ this.controlContainerBottom.Controls.Clear(); this.controlContainerBottom.Controls.Add(monitorValueListCtrl); this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; - this.docPnlBottom.Text = "鐩戞祴鍊�"; + this.docPnlBottom.Text = "浼犳劅鍣ㄦ祴鍊�"; this.docPnlBottom.Height = 350; } - var allMonitorValueList = await GetMonitorValueList(); - monitorValueListCtrl.SetBindingData(allMonitorValueList, _visual); + var allValueList = await GetMonitorDockingValueList(); + var calcuResult = GetCalcuResult(); + monitorValueListCtrl.SetBindingData(allValueList); } - //璁剧疆鐩戞祴鍊� - private void barBtnSetMonitorValue_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + //璁剧疆浼犳劅鍣ㄦ祴鍊� + private void barBtnDockingMonitorValue_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { - ShowMonitorValueListCtrl(); + ShowMonitorDockingValueListCtrl(); } - #endregion + #endregion 浼犳劅鍣ㄦ祴鍊� - #region 鐩戞祴鐐规爣璁� + #region 鍒嗘瀽娴嬬偣 + + //璁剧疆鍙鏋勪欢鍒嗘瀽娴嬬偣鍒楄〃 + private async void SetMonitorAnalyseList(HydroVisualInfo visual) + { + if (_hydroInfo == null) + { + return; + } + if (visual == null) + { + return; + } + var monitorHelper = GetMonitorHelper(); + var allMonitorList = await monitorHelper.GetAnalyseList(); + var dlg = new SetHydroMonitorAnalyseListDlg(); + dlg.ReloadDataEvent += async (list) => + { + await monitorHelper.Update(visual.Code, eSourceType.Analyse, list); + //var monitorMarkerHelper = await GetMonitorMarkerHelper(); + //monitorMarkerHelper.Update(visual.Code, monitorList); + //monitorMarkerHelper.Set(); + }; + dlg.SetBindingData(_hydroInfo, visual, allMonitorList); + dlg.ShowDialog(); + } + + //璁剧疆鍒嗘瀽娴嬬偣 + private void barBtnAnalyseMonitor_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + if (_visual == null) + { + return; + } + SetMonitorAnalyseList(_visual); + } + + #endregion 鍒嗘瀽娴嬬偣 + + #region 娴嬬偣鏍囪 //鐩戞祴鏍囪杈呭姪绫� private SimulationMonitorMarkerHelper _monitorMarkerHelper = null; @@ -1758,17 +2089,15 @@ return _monitorMarkerHelper; } - //鏄剧ず鐘舵�佹敼鍙� - private async void barCkMonitor_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + //娴嬬偣鏄剧ず鐘舵�佹敼鍙� + private async void barCkMonitorVisible_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { var monitorMarkerHelper = await GetMonitorMarkerHelper(); - monitorMarkerHelper.Visible = this.barCkMonitor.Checked; + monitorMarkerHelper.Visible = this.barCkMonitorVisible.Checked; monitorMarkerHelper.Set(); } - #endregion - - #endregion 鐩戞祴鍒楄〃 + #endregion 娴嬬偣鏍囪 #region 妯″瀷妫�鏌� @@ -2037,7 +2366,7 @@ #endregion 璁$畻鏍囩 - #endregion + #endregion 妯″瀷璁$畻 #region 瀵煎嚭INP @@ -2151,7 +2480,7 @@ var workingCheckedListHelper = GetWorkingCheckedListHelper(); var allWorkingList = workingCheckedListHelper.GetWorkingList(); var monitorValueHelper = GetMonitorValueHelper(); - var allMonitorValueList = await monitorValueHelper.Get(); + var allMonitorValueList = await monitorValueHelper.GetAll(); var dlg = new SetHydroWorkingDlg(); dlg.SetBindingData(_hydroInfo, allWorkingList, allMonitorValueList); dlg.HydroViewEvent += (visual) => @@ -2285,7 +2614,7 @@ { return; } - var reportHelper = new SimulationWorkingReportHelper(); + var reportHelper = new HStation.ReportFile.SimulationWorkingReportHelper(); reportHelper.Create(fileName, vm); TipFormHelper.ShowInfo("瀵煎嚭鎴愬姛锛�"); }; @@ -2358,7 +2687,7 @@ AddWorking(); } - #endregion 褰撳墠宸ュ喌 + #endregion #region 閫夋嫨宸ュ喌 @@ -2480,16 +2809,14 @@ this.docPnlBottom.Text = "鐩戞祴鍒嗘瀽"; this.docPnlBottom.Height = 350; } - var allMontorList = await GetMonitorList(); - var allMonitorValueList = await GetMonitorValueList(); - + var allMontorList = await GetMonitorAnalyseList(); if (allWorkingList == null || allWorkingList.Count < 1) { - monitorAnalyListCtrl.SetBindingData(_hydroInfo, allMontorList, allMonitorValueList, GetWorking(), GetCalcuResult(), _visual); + monitorAnalyListCtrl.SetBindingData(_hydroInfo, allMontorList, GetCalcuResult()); } else { - monitorAnalyListCtrl.SetBindingData(_hydroInfo, allMontorList, allMonitorValueList, allWorkingList, _visual); + monitorAnalyListCtrl.SetBindingData(_hydroInfo, allMontorList, allWorkingList); } } @@ -2527,8 +2854,7 @@ //绮惧害璇勪及 private async void barBtnWorkingEvaluation_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { - var monitorHelper = GetMonitorHelper(); - var allMonitorList = await monitorHelper.Get(); + var allMonitorList = await GetMonitorDockingList(); var workingCheckedListHelper = GetWorkingCheckedListHelper(); var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList(); @@ -2603,55 +2929,6 @@ } } - //鎹熷け鏇茬嚎 - private void barBtnWorkingLossCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) - { - if (_visual == null) - { - SelectInputSource(); - 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.HydroClickEvent += (code) => - { - SelectVisual(code, eSimulationVisualSource.None); - }; - dlg.SetBindingData(workingHelper.HydroInfo, workingHelper.CalcuResult, visual); - dlg.ShowDialog(); - } - else - { - var dlg = new HydroMultiWorkingLossCurveDlg(); - dlg.HydroClickEvent += (code) => - { - SelectVisual(code, eSimulationVisualSource.None); - }; - dlg.SetBindingData(_hydroInfo, allCheckedWorkingList, visual); - dlg.ShowDialog(); - } - } - //鎹熷け缁熻 private void barBtnWorkingLossStatistics_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { @@ -2700,7 +2977,7 @@ } var monitorHelper = GetMonitorHelper(); - var allMonitorList = await monitorHelper.Get(); + var allMonitorList = await monitorHelper.GetAll(); var workingCheckedListHelper = GetWorkingCheckedListHelper(); var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList(); @@ -2724,7 +3001,107 @@ } } - #endregion + #endregion 宸ュ喌鍒嗘瀽 + + #region 鎹熷け鏇茬嚎 + + //鍗曞伐鍐垫崯澶辨洸绾挎帶浠� + private HydroSingleWorkingLossCurveCtrl _singleWorkingLossCurveCtrl = null; + + //鑾峰彇鍗曞伐鍐垫崯澶辨洸绾挎帶浠� + private HydroSingleWorkingLossCurveCtrl GetSingleWorkingLossCurveCtrl() + { + if (_singleWorkingLossCurveCtrl == null) + { + _singleWorkingLossCurveCtrl = new HydroSingleWorkingLossCurveCtrl(); + _singleWorkingLossCurveCtrl.Dock = DockStyle.Fill; + _singleWorkingLossCurveCtrl.HydroClickEvent += (code) => + { + var visual = GetVisual(code); + SelectVisual(visual, eSimulationVisualSource.None); + }; + } + return _singleWorkingLossCurveCtrl; + } + + //鍗曞伐鍐垫崯澶辨洸绾挎帶浠舵槸鍚﹀彲瑙� + private bool IsSingleWorkingLossCurveCtrlVisible + { + get + { + if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) + { + if (this.controlContainerBottom.Controls.Count > 0) + { + if (this.controlContainerBottom.Controls[0] is HydroSingleWorkingLossCurveCtrl) + { + return true; + } + } + } + return false; + } + } + + //鏄剧ず鍗曞伐鍐垫崯澶辨洸绾挎帶浠� + private void ShowSingleWorkingLossCurveCtrl(Yw.Model.HydroModelInfo hydroInfo, HydroCalcuResult calcuResult, HydroVisualInfo visual) + { + var singleWorkingLossCurveCtrl = GetSingleWorkingLossCurveCtrl(); + if (!IsSingleWorkingLossCurveCtrlVisible) + { + this.controlContainerBottom.Controls.Clear(); + this.controlContainerBottom.Controls.Add(singleWorkingLossCurveCtrl); + this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; + this.docPnlBottom.Text = "鎹熷け鏇茬嚎"; + this.docPnlBottom.Height = 350; + } + singleWorkingLossCurveCtrl.SetBindingData(hydroInfo, calcuResult, visual); + } + + //鎹熷け鏇茬嚎 + private void barBtnWorkingLossCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + { + if (_visual == null) + { + SelectInputSource(); + 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; + } + ShowSingleWorkingLossCurveCtrl(workingHelper.HydroInfo, workingHelper.CalcuResult, visual); + } + else + { + var dlg = new HydroMultiWorkingLossCurveDlg(); + dlg.HydroClickEvent += (code) => + { + SelectVisual(code, eSimulationVisualSource.None); + }; + dlg.SetBindingData(_hydroInfo, allCheckedWorkingList, visual); + dlg.ShowDialog(); + } + } + + #endregion 鎹熷け鏇茬嚎 #region 鏂规绠$悊 @@ -2777,7 +3154,7 @@ TipFormHelper.ShowError("姘村姏妯℃嫙鏂规鍒犻櫎澶辫触锛岃閲嶈瘯锛�"); return; } - if (!await BLLFactory<Yw.BLL.HydroModelRelation>.Instance.DeleteAllByID(relation.ID)) + if (!await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.DeleteByID(relation.ModelID)) { TipFormHelper.ShowError("姘村姏妯℃嫙鏂规鍒犻櫎澶辫触锛岃閲嶈瘯锛�"); return; @@ -2800,7 +3177,5 @@ } #endregion 鏂规绠$悊 - - } } \ No newline at end of file -- Gitblit v1.9.3