| | |
| | | using DevExpress.XtraMap; |
| | | using HStation.WinFrmUI.PhartRelation; |
| | | using Mapster; |
| | | using NPOI.OpenXmlFormats.Dml; |
| | | using NPOI.SS.Formula.Functions; |
| | | using System.Diagnostics; |
| | | using Yw.EPAnet; |
| | |
| | | /// 新增工况事件 |
| | | /// </summary> |
| | | public event Action<HydroWorkingVmo> AppendWorkingEvent; |
| | | /// <summary> |
| | | /// 保存模型事件 |
| | | /// </summary> |
| | | public event Func<Yw.Model.HydroModelInfo, Task<Yw.Model.HydroModelInfo>> SaveModelEvent; |
| | | /// <summary> |
| | | /// 刷新模型事件 |
| | | /// </summary> |
| | | public event Func<Task<Yw.Model.HydroModelInfo>> RefreshModelEvent; |
| | | /// <summary> |
| | | /// 更新方案事件 |
| | | /// </summary> |
| | | public event Action<XhsSchemeVmo> UpdateSchemeEvent; |
| | | /// <summary> |
| | | /// 移除方案事件 |
| | | /// </summary> |
| | | public event Action<XhsSchemeVmo> RemoveSchemeEvent; |
| | | |
| | | |
| | | |
| | | private HStation.Vmo.XhsProjectVmo _project = null;//项目 |
| | | private HStation.Vmo.XhsProjectSiteVmo _projectSite = null;//项目站 |
| | | private HStation.Vmo.XhsSchemeVmo _scheme = null;//方案 |
| | | private Yw.Model.HydroModelInfo _hydroInfo = null;//水力信息 |
| | | private Dictionary<HydroWorkingVmo, bool> _allWorkingCheckedListDict = null;//所有工况选择列表字典 |
| | | |
| | |
| | | ( |
| | | XhsProjectVmo project, |
| | | XhsProjectSiteVmo projectSite, |
| | | XhsSchemeVmo scheme, |
| | | Yw.Model.HydroModelInfo hydroInfo, |
| | | Dictionary<HydroWorkingVmo, bool> allWorkingCheckedListDict |
| | | ) |
| | | { |
| | | _project = project; |
| | | _projectSite = projectSite; |
| | | _scheme = scheme; |
| | | _hydroInfo = hydroInfo; |
| | | _allWorkingCheckedListDict = allWorkingCheckedListDict; |
| | | ResetMonitorValue(); |
| | | if (_scheme == null) |
| | | { |
| | | this.ribPageGroupForScheme.Visible = false; |
| | | this.PageTitle.Caption = $"水力模拟"; |
| | | } |
| | | else |
| | | { |
| | | this.ribPageGroupForScheme.Visible = true; |
| | | this.PageTitle.Caption = $"模拟方案\r\n{_scheme.Name}"; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | {//鼠标左键点击事件 |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visual = visualListHelper.GetVisual(code); |
| | | SelectVisual(visual, eVisualSource.Bimface); |
| | | SelectVisual(visual, eSimulationVisualSource.Bimface); |
| | | }; |
| | | } |
| | | return _bimfaceCtrl; |
| | |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visuals = visualListHelper.GetVisualList(codes); |
| | | SelectVisual(visuals?.LastOrDefault(), eVisualSource.Q3d); |
| | | SelectVisual(visuals?.LastOrDefault(), eSimulationVisualSource.Q3d); |
| | | }; |
| | | } |
| | | return _q3dCtrl; |
| | |
| | | { |
| | | _propertyCtrl = new SimulationPropertyCtrl(); |
| | | _propertyCtrl.Dock = DockStyle.Fill; |
| | | _propertyCtrl.AllowEdit = true; |
| | | _propertyCtrl.HydroViewEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Property); |
| | | SelectVisual(visual, eSimulationVisualSource.Property); |
| | | }; |
| | | _propertyCtrl.BlinkLinkNodeEvent += async (link, linkNodeCode) => |
| | | { //强调连接节点 |
| | |
| | | var visualVmListHelper = GetVisualVmListHelper(); |
| | | var vm = visualVmListHelper.GetVisual(visual); |
| | | _propertyCtrl.SelectedObject = vm; |
| | | _propertyCtrl.UpdateRows(); |
| | | } |
| | | |
| | | //更新属性控件 |
| | |
| | | _propertyCtrl?.UpdateRows(); |
| | | } |
| | | |
| | | //清理属性控件 |
| | | private void ClearPropertyCtrl() |
| | | { |
| | | if (_propertyCtrl != null) |
| | | { |
| | | _propertyCtrl.SelectedObject = null; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 选择构件 |
| | | |
| | | //可见来源 |
| | | protected enum eVisualSource |
| | | { |
| | | None, |
| | | Bimface, |
| | | Q3d, |
| | | Property, |
| | | List, |
| | | Set, |
| | | Search, |
| | | Monitor, |
| | | Check, |
| | | Calcu, |
| | | Warning, |
| | | } |
| | | |
| | | //选择构件 |
| | | private Yw.Model.HydroVisualInfo _visual = null; |
| | | |
| | | //选择构件 |
| | | private void SelectVisual(HydroVisualInfo visual, eVisualSource source) |
| | | private void SelectVisual(HydroVisualInfo visual, eSimulationVisualSource source) |
| | | { |
| | | _visual = visual; |
| | | switch (source) |
| | | { |
| | | case eVisualSource.None: |
| | | case eSimulationVisualSource.None: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Bimface: |
| | | case eSimulationVisualSource.Bimface: |
| | | { |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Q3d: |
| | | case eSimulationVisualSource.Q3d: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Property: |
| | | case eSimulationVisualSource.Property: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | } |
| | | break; |
| | | case eVisualSource.List: |
| | | case eSimulationVisualSource.List: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Set: |
| | | case eSimulationVisualSource.Set: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Search: |
| | | case eSimulationVisualSource.Search: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Monitor: |
| | | case eSimulationVisualSource.Monitor: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Check: |
| | | case eSimulationVisualSource.Check: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Calcu: |
| | | case eSimulationVisualSource.Calcu: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Warning: |
| | | case eSimulationVisualSource.Warning: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | |
| | | //选择构件 |
| | | private void SelectVisual(string code, eSimulationVisualSource source) |
| | | { |
| | | var visual = GetVisual(code); |
| | | SelectVisual(visual, source); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | _visualListHelper.InitialData(_hydroInfo); |
| | | } |
| | | return _visualListHelper; |
| | | } |
| | | |
| | | //重置可见列表 |
| | | private void ResetVisualList() |
| | | { |
| | | var helper = GetVisualListHelper(); |
| | | helper.InitialData(_hydroInfo); |
| | | } |
| | | |
| | | //获取可见构件 |
| | | private Yw.Model.HydroVisualInfo GetVisual(string code) |
| | | { |
| | | var helper = GetVisualListHelper(); |
| | | var visual = helper.GetVisual(code); |
| | | return visual; |
| | | } |
| | | |
| | | //获取可见列表 |
| | | private List<Yw.Model.HydroVisualInfo> GetVisualList() |
| | | { |
| | | var helper = GetVisualListHelper(); |
| | | return helper.GetVisualList(); |
| | | } |
| | | |
| | | //获取水源列表 |
| | | private List<Yw.Model.HydroSourceInfo> GetSourceList() |
| | | { |
| | | var helper = GetVisualListHelper(); |
| | | return helper.GetSourceList(); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | return _visualVmListHelper; |
| | | } |
| | | |
| | | //获取可见视图列表 |
| | | private List<HydroVisualViewModel> GetVisualViewModelList() |
| | | { |
| | | var helper = GetVisualVmListHelper(); |
| | | return helper.GetVisualList(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 明细控件 |
| | |
| | | _visualListCtrl.Dock = DockStyle.Fill; |
| | | _visualListCtrl.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.List); |
| | | SelectVisual(visual, eSimulationVisualSource.List); |
| | | }; |
| | | _visualListCtrl.HydroChangedInfoEvent += (visualList) => |
| | | { |
| | | SelectVisual(_visual, eVisualSource.List); |
| | | SelectVisual(_visual, eSimulationVisualSource.List); |
| | | }; |
| | | } |
| | | return _visualListCtrl; |
| | |
| | | { |
| | | return; |
| | | } |
| | | Stopwatch sw = new Stopwatch(); |
| | | sw.Start(); |
| | | |
| | | |
| | | var id = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.Save(_hydroInfo); |
| | | |
| | | //耗时巨大的代码 |
| | | |
| | | sw.Stop(); |
| | | TimeSpan ts2 = sw.Elapsed; |
| | | Console.WriteLine("Stopwatch总共花费{0}ms.", ts2.TotalMilliseconds); |
| | | if (id < 1) |
| | | if (this.SaveModelEvent == null) |
| | | { |
| | | return; |
| | | } |
| | | var hydroInfo = await this.SaveModelEvent.Invoke(_hydroInfo); |
| | | if (hydroInfo == null) |
| | | { |
| | | TipFormHelper.ShowError("保存失败!"); |
| | | return; |
| | | } |
| | | _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(id); |
| | | _hydroInfo = hydroInfo; |
| | | |
| | | TipFormHelper.ShowSucceed("保存成功!"); |
| | | |
| | | |
| | | //Stopwatch sw = new Stopwatch(); |
| | | //sw.Start(); |
| | | //耗时巨大的代码 |
| | | //sw.Stop(); |
| | | //TimeSpan ts2 = sw.Elapsed; |
| | | //Console.WriteLine("Stopwatch总共花费{0}ms.", ts2.TotalMilliseconds); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | //水库 |
| | | this.barBtnSetReservoirList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var dlg = new SetHydroReservoirListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.SetBindingData(allVisualViewModelList); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //水池 |
| | | this.barBtnSetTankList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var dlg = new SetHydroTankListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.SetBindingData(allVisualViewModelList); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //水箱 |
| | | this.barBtnSetWaterboxList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var dlg = new SetHydroWaterboxListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.SetBindingData(allVisualViewModelList); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //连接节点 |
| | | this.barBtnSetJunctionList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var dlg = new SetHydroJunctionListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.SetBindingData(allVisualViewModelList); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //闷头 |
| | | this.barBtnSetBluntheadList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var dlg = new SetHydroBluntheadListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.SetBindingData(allVisualViewModelList); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //弯头 |
| | | this.barBtnSetElbowsList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualVmList = GetVisualViewModelList(); |
| | | var dlg = new SetHydroElbowListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.SetBindingData(allVisualVmList); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //三通 |
| | | this.barBtnSetThreelinkList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var dlg = new SetHydroThreelinkListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.SetBindingData(allVisualViewModelList); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //四通 |
| | | this.barBtnSetFourlinkList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var dlg = new SetHydroFourlinkListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.SetBindingData(allVisualViewModelList); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //水表 |
| | | this.barBtnSetMeterList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var dlg = new SetHydroMeterListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.SetBindingData(allVisualViewModelList); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //流量计 |
| | | this.barBtnSetFlowmeterList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var dlg = new SetHydroFlowmeterListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.SetBindingData(allVisualViewModelList); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //压力表 |
| | | this.barBtnSetPressmeterList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var dlg = new SetHydroPressmeterListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.SetBindingData(allVisualViewModelList); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //管道 |
| | | this.barBtnSetPipeList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var dlg = new SetHydroPipeListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.SetBindingData(allVisualViewModelList); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //过渡件 |
| | | this.barBtnSetTranslationList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var dlg = new SetHydroTranslationListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.SetBindingData(allVisualViewModelList); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //水泵 |
| | | this.barBtnSetPumpList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var dlg = new SetHydroPumpListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.SetBindingData(allVisualViewModelList); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //阀门 |
| | | this.barBtnSetValveList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var dlg = new SetHydroValveListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.SetBindingData(allVisualViewModelList); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //换热器 |
| | | this.barBtnSetExchangerList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var dlg = new SetHydroExchangerListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.SetBindingData(allVisualViewModelList); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //换热器 |
| | | this.barBtnSetCompressorList.ItemClick += delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var dlg = new SetHydroCompressorListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.SetBindingData(allVisualViewModelList); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Set); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set); |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | |
| | | _searchCtrl.InitialData(allVisualVmList); |
| | | _searchCtrl.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Check); |
| | | SelectVisual(visual, eSimulationVisualSource.Check); |
| | | }; |
| | | _searchCtrl.HydroSearchInfoEvent += (list) => |
| | | { |
| | | var visual = list?.FirstOrDefault(); |
| | | SelectVisual(visual, eVisualSource.Search); |
| | | SelectVisual(visual, eSimulationVisualSource.Search); |
| | | }; |
| | | } |
| | | return _searchCtrl; |
| | |
| | | //刷新 |
| | | private async void barBtnRefresh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (this.RefreshModelEvent == null) |
| | | { |
| | | return; |
| | | } |
| | | if (XtraMessageBox.Show("刷新后将丢失当前水力信息更改,是否继续刷新?", "询问", MessageBoxButtons.YesNo) == DialogResult.Yes) |
| | | { |
| | | if (_project == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_projectSite == null) |
| | | { |
| | | return; |
| | | } |
| | | var hydroRelation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance |
| | | .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation); |
| | | Stopwatch sw = new Stopwatch(); |
| | | sw.Start(); |
| | | _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(hydroRelation.ModelID); |
| | | sw.Stop(); |
| | | TimeSpan ts2 = sw.Elapsed; |
| | | Console.WriteLine("Stopwatch总共花费{0}ms.", ts2.TotalMilliseconds); |
| | | _visual = null; |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(null); |
| | | //ShowSelectedProperty(); |
| | | TipFormHelper.ShowSucceed("数据已刷新"); |
| | | |
| | | var visualListHelper = GetVisualListHelper(); |
| | | visualListHelper.InitialData(_hydroInfo); |
| | | var hydroInfo = await this.RefreshModelEvent.Invoke(); |
| | | if (hydroInfo == null) |
| | | { |
| | | TipFormHelper.ShowError("刷新失败!"); |
| | | return; |
| | | } |
| | | _hydroInfo = hydroInfo; |
| | | SelectVisual(visual: null, eSimulationVisualSource.None); |
| | | |
| | | ResetVisualList(); |
| | | TipFormHelper.ShowSucceed("刷新成功!"); |
| | | } |
| | | } |
| | | |
| | |
| | | return _monitorHelper; |
| | | } |
| | | |
| | | //获取监测点列表 |
| | | private async Task<List<HydroMonitorVmo>> GetMonitorList() |
| | | { |
| | | var helper = GetMonitorHelper(); |
| | | return await helper.Get(); |
| | | } |
| | | |
| | | //设置监测点列表 |
| | | private async void SetMonitorList(HydroVisualInfo visual) |
| | | { |
| | |
| | | return _monitorValueHelper; |
| | | } |
| | | |
| | | //重置 |
| | | private void ResetMonitorValue() |
| | | { |
| | | var allWorkingList = GetWorkingList(); |
| | | var working = allWorkingList?.LastOrDefault(x => !string.IsNullOrEmpty(x.MonitorInfo)); |
| | | if (working != null) |
| | | { |
| | | var helper = GetMonitorValueHelper(); |
| | | helper.Reset(working.MonitorInfo); |
| | | } |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 监测值控件 |
| | |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visual = visualListHelper.GetVisual(code); |
| | | SelectVisual(visual, eVisualSource.Monitor); |
| | | SelectVisual(visual, eSimulationVisualSource.Monitor); |
| | | }; |
| | | } |
| | | return _monitorValueListCtrl; |
| | |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visual = visualListHelper.GetVisual(code); |
| | | SelectVisual(visual, eVisualSource.Check); |
| | | SelectVisual(visual, eSimulationVisualSource.Check); |
| | | }; |
| | | } |
| | | return _checkCtrl; |
| | |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visual = visualListHelper.GetVisual(code); |
| | | SelectVisual(visual, eVisualSource.Warning); |
| | | SelectVisual(visual, eSimulationVisualSource.Warning); |
| | | }; |
| | | } |
| | | return _calcuWarningCtrl; |
| | |
| | | pumps.ForEach(x => x.UpdateWorkingInfo(list)); |
| | | var visualVmListHelper = GetVisualVmListHelper(); |
| | | visualVmListHelper.UpdateProperty(pumps.Select(x => x as Yw.Model.HydroVisualInfo).ToList()); |
| | | SelectVisual(_visual, eVisualSource.None); |
| | | SelectVisual(_visual, eSimulationVisualSource.None); |
| | | var gradingHelper = await GetGradingHelper(); |
| | | gradingHelper.Set(); |
| | | }; |
| | |
| | | }); |
| | | var visualVmListHelper = GetVisualVmListHelper(); |
| | | visualVmListHelper.UpdateProperty(pumps.Select(x => x as Yw.Model.HydroVisualInfo).ToList()); |
| | | SelectVisual(_visual, eVisualSource.None); |
| | | SelectVisual(_visual, eSimulationVisualSource.None); |
| | | var gradingHelper = await GetGradingHelper(); |
| | | gradingHelper.Set(); |
| | | }; |
| | |
| | | dlg.SetBindingData(_hydroInfo, allWorkingList, allMonitorValueList); |
| | | dlg.HydroViewEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Calcu); |
| | | SelectVisual(visual, eSimulationVisualSource.Calcu); |
| | | }; |
| | | dlg.HydroCalcuEvent += async (vm) => |
| | | { |
| | |
| | | working.ModelID = vm.ModelID; |
| | | working.Name = vm.Name; |
| | | working.WorkingInfo = JsonHelper.Object2Json(vm.WorkingInfo); |
| | | working.MonitorInfo = JsonHelper.Object2Json(vm.MonitorInfo); |
| | | var useWorkingMonitorInfo = vm.MonitorInfo?.Where(x => x.PropValue.HasValue).ToList(); |
| | | if (useWorkingMonitorInfo != null && useWorkingMonitorInfo.Count > 0) |
| | | { |
| | | working.MonitorInfo = JsonHelper.Object2Json(useWorkingMonitorInfo); |
| | | } |
| | | working.SortCode = vm.SortCode; |
| | | working.Description = vm.Description; |
| | | |
| | |
| | | } |
| | | |
| | | WaitFormHelper.ShowWaitForm(this, "正在计算分析中,请稍候..."); |
| | | //await Task.Delay(3000); |
| | | await Task.Delay(3000); |
| | | var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss); |
| | | WaitFormHelper.HideWaitForm(); |
| | | workingHelper.InitialData(hydroInfo, working, checkResult, calcuResult); |
| | |
| | | ShowCalcuWarningCtrl(calcuResult); |
| | | } |
| | | this.barBtnAddWorking.Enabled = true; |
| | | this.barBtnExportWord.Enabled = true; |
| | | TipFormHelper.ShowSucceed("计算成功!"); |
| | | } |
| | | else |
| | |
| | | |
| | | #region 当前构件 |
| | | |
| | | SelectVisual(_visual, eVisualSource.Calcu); |
| | | SelectVisual(_visual, eSimulationVisualSource.Calcu); |
| | | |
| | | #endregion |
| | | |
| | | #region 构件明细 |
| | | |
| | | UpdateVisualListCtrl(); |
| | | |
| | | #endregion |
| | | |
| | | #region 颜色分级 |
| | | |
| | | var gradingHelper = await GetGradingHelper(); |
| | | gradingHelper.Set(); |
| | | |
| | | #endregion |
| | | |
| | |
| | | #endregion |
| | | |
| | | }; |
| | | |
| | | dlg.ShowDialog(); |
| | | |
| | | } |
| | | |
| | | //水力计算 |
| | | private void barBtnCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | Calcu(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 导出报告 |
| | | |
| | | private async void barBtnExportWord_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var fileName = FileDialogHelper.SaveWordDoc("导出Word报告"); |
| | | if (string.IsNullOrEmpty(fileName)) |
| | | { |
| | | return; |
| | | } |
| | | var vm = new SimulationWorkingReportViewModel(); |
| | | vm.ReportType = "模拟工况运行报告"; |
| | | vm.Info = new SimulationReportInfoItemViewModel() |
| | | { |
| | | Name = _project.Name, |
| | | Description = _project.Description, |
| | | }; |
| | | vm.Pumps = new List<SimulationReportPumpItemViewModel>(); |
| | | var pumps = _hydroInfo.Pumps; |
| | | foreach (var pump in _hydroInfo.Pumps) |
| | | { |
| | | var pumpItem = new SimulationReportPumpItemViewModel(); |
| | | pumpItem.Name = pump.Name; |
| | | pumpItem.ModelType = pumpItem.ModelType; |
| | | pumpItem.SerialNO = (_hydroInfo.Pumps.IndexOf(pump) + 1).ToString(); |
| | | pumpItem.RatedQ = $"{pump.RatedQ ?? 0}m³/h"; |
| | | pumpItem.RatedH = $"{pump.RatedH ?? 0}m"; |
| | | pumpItem.RatedP = $"{pump.RatedP}kW"; |
| | | pumpItem.RatedN = $"{pump.RatedN ?? 0}r/min"; |
| | | vm.Pumps.Add(pumpItem); |
| | | var pumpDb = await BLLFactory<HStation.BLL.AssetsPumpMain>.Instance.GetByIDEx(long.Parse(pump.DbId)); |
| | | if (pumpDb != null) |
| | | { |
| | | if (pumpDb.PropContent != null && pumpDb.PropContent.Count > 0) |
| | | { |
| | | var ratedUProp = pumpDb.PropContent.Find(x => x.TagName == HStation.Assets.PumpDataType.RatedVoltage); |
| | | if (ratedUProp != null) |
| | | { |
| | | pumpItem.RatedU = ratedUProp.PropValue; |
| | | } |
| | | var ratedIProp = pumpDb.PropContent.Find(x => x.TagName == HStation.Assets.PumpDataType.RatedCurrent); |
| | | if (ratedIProp != null) |
| | | { |
| | | pumpItem.RatedI = ratedIProp.PropValue; |
| | | } |
| | | var ratedFProp = pumpDb.PropContent.Find(x => x.TagName == HStation.Assets.PumpDataType.RatedFactor); |
| | | if (ratedFProp != null) |
| | | { |
| | | pumpItem.RatedF = ratedFProp.PropValue; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | var reportHelper = new SimulationWorkingReportHelper(); |
| | | reportHelper.Create(fileName, vm); |
| | | |
| | | TipFormHelper.ShowInfo("导出成功!"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | return _workingCheckedListHelper; |
| | | } |
| | | |
| | | //获取工况列表 |
| | | private List<HydroWorkingVmo> GetWorkingList() |
| | | { |
| | | var helper = GetWorkingCheckedListHelper(); |
| | | return helper.GetWorkingList(); |
| | | } |
| | | |
| | | //更新工况选择列表 |
| | | public void UpdateWorkingCheckedList(HydroWorkingVmo working) |
| | | { |
| | | var helper = GetWorkingCheckedListHelper(); |
| | | helper.Update(working); |
| | | } |
| | | |
| | | //更新工况选择列表 |
| | | public void UpdateWorkingCheckedList(HydroWorkingVmo working, bool hasChecked) |
| | | { |
| | |
| | | helper.Update(working, hasChecked); |
| | | } |
| | | |
| | | //移除工况选择列表 |
| | | public void RemoveWorkingCheckedList(HydroWorkingVmo working) |
| | | { |
| | | var helper = GetWorkingCheckedListHelper(); |
| | | helper.Remove(working); |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region 工况分析 |
| | | |
| | | //选择进口水源 |
| | | private void SelectInputSource() |
| | | { |
| | | var sources = GetSourceList(); |
| | | if (sources != null) |
| | | { |
| | | if (sources.Count == 1) |
| | | { |
| | | SelectVisual(sources[0], eSimulationVisualSource.None); |
| | | } |
| | | else |
| | | { |
| | | var source = sources.FirstOrDefault(x => x.Flags.Contains(HStation.Xhs.Flags.进口)); |
| | | if (source != null) |
| | | { |
| | | SelectVisual(source, eSimulationVisualSource.None); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //精度评估 |
| | | private async void barBtnWorkingEvaluation_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | |
| | | } |
| | | |
| | | //能效分析 |
| | | private void barBtnWorkingPower_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | private async void barBtnWorkingPower_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var allMonitorList = await GetMonitorList(); |
| | | var workingCheckedListHelper = GetWorkingCheckedListHelper(); |
| | | var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList(); |
| | | if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1) |
| | |
| | | return; |
| | | } |
| | | var dlg = new SimulationSingleWorkingEnergyDlg(); |
| | | dlg.SetBindingData(workingHelper.HydroInfo, workingHelper.CalcuResult); |
| | | dlg.SetBindingData(workingHelper.Working, workingHelper.HydroInfo, allMonitorList, workingHelper.CalcuResult); |
| | | dlg.ShowDialog(); |
| | | } |
| | | else |
| | | { |
| | | |
| | | var dlg = new SimulationMultiWorkingEnergyDlg(); |
| | | dlg.SetBindingData(_hydroInfo, allCheckedWorkingList); |
| | | dlg.SetBindingData(_hydroInfo, allMonitorList, allCheckedWorkingList); |
| | | dlg.ShowDialog(); |
| | | } |
| | | } |
| | |
| | | { |
| | | if (_visual == null) |
| | | { |
| | | TipFormHelper.ShowWarn("请选择构件后重试!"); |
| | | return; |
| | | SelectInputSource(); |
| | | if (_visual == null) |
| | | { |
| | | TipFormHelper.ShowWarn("请选择构件后重试!"); |
| | | return; |
| | | } |
| | | } |
| | | HydroVisualInfo visual = _visual; |
| | | if (_visual is HydroLinkInfo linkInfo) |
| | |
| | | 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(); |
| | | } |
| | |
| | | { |
| | | if (_visual == null) |
| | | { |
| | | TipFormHelper.ShowWarn("请选择构件后重试!"); |
| | | return; |
| | | if (_visual == null) |
| | | { |
| | | SelectInputSource(); |
| | | if (_visual == null) |
| | | { |
| | | TipFormHelper.ShowWarn("请选择构件后重试!"); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | HydroVisualInfo visual = _visual; |
| | | if (_visual is HydroLinkInfo linkInfo) |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 方案管理 |
| | | |
| | | //更新方案 |
| | | private void UpdateScheme() |
| | | { |
| | | if (_scheme == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | var dlg = new EditXhsSchemeDlg(); |
| | | dlg.SetBindingData(_scheme, _hydroInfo); |
| | | dlg.ReloadDataEvent += (rhs) => |
| | | { |
| | | _scheme = rhs; |
| | | this.PageTitle.Caption = $"模拟方案\r\n{_scheme.Name}"; |
| | | UpdatePageTitle(this.PageGuid, this.PageTitle); |
| | | this.UpdateSchemeEvent?.Invoke(_scheme); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //编辑方案 |
| | | private void barBtnEditScheme_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | UpdateScheme(); |
| | | } |
| | | |
| | | //删除方案 |
| | | private async void DeleteScheme() |
| | | { |
| | | var bol = XtraMessageBox.Show("请问是否删除当前方案?", "询问", MessageBoxButtons.YesNo) == DialogResult.Yes; |
| | | if (!bol) |
| | | { |
| | | return; |
| | | } |
| | | if (_scheme == null) |
| | | { |
| | | return; |
| | | } |
| | | var relation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance |
| | | .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsScheme, _scheme.ID, HStation.Xhs.Purpose.Simulation); |
| | | if (relation == null) |
| | | { |
| | | TipFormHelper.ShowError("水力模拟方案删除失败,请重试!"); |
| | | return; |
| | | } |
| | | if (!await BLLFactory<Yw.BLL.HydroModelRelation>.Instance.DeleteAllByID(relation.ID)) |
| | | { |
| | | TipFormHelper.ShowError("水力模拟方案删除失败,请重试!"); |
| | | return; |
| | | } |
| | | |
| | | if (!await BLLFactory<HStation.BLL.XhsScheme>.Instance.DeleteByID(_scheme.ID)) |
| | | { |
| | | TipFormHelper.ShowError("水力模拟方案删除失败,请重试!"); |
| | | return; |
| | | } |
| | | this.RemoveSchemeEvent?.Invoke(_scheme); |
| | | TipFormHelper.ShowSucceed("水力模拟方案删除成功!"); |
| | | ClosePage(this.PageGuid); |
| | | } |
| | | |
| | | //删除方案 |
| | | private void barBtnDeleteScheme_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | DeleteScheme(); |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |