| | |
| | | using DevExpress.Diagram.Core.Native; |
| | | using Castle.Core.Logging; |
| | | using DevExpress.CodeParser; |
| | | using 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; |
| | |
| | | /// </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> |
| | |
| | | ShowBimfaceCtrl(); |
| | | ShowQ3dCtrl(); |
| | | ShowPropertyCtrl(); |
| | | InitialSvgImages(); |
| | | } |
| | | |
| | | //初始化Svg图片 |
| | | 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 BIM控件 |
| | | |
| | | //bimface控件 |
| | | private XhsProjectSimulationBimfaceCtrl _bimfaceCtrl = null; |
| | | private SimulationBimfaceCtrl _bimfaceCtrl = null; |
| | | |
| | | //获取 bimface 控件 |
| | | private async Task<XhsProjectSimulationBimfaceCtrl> GetBimfaceCtrl() |
| | | private async Task<SimulationBimfaceCtrl> GetBimfaceCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | |
| | | } |
| | | if (_bimfaceCtrl == null) |
| | | { |
| | | var overlay = this.ShowOverlay(); |
| | | _bimfaceCtrl = new XhsProjectSimulationBimfaceCtrl(); |
| | | _bimfaceCtrl = new SimulationBimfaceCtrl(); |
| | | _bimfaceCtrl.Dock = DockStyle.Fill; |
| | | WaitFormHelper.ShowWaitForm(this.FindForm(), "正在加载模型,请稍后..."); |
| | | await _bimfaceCtrl.InitialData(_project, _projectSite); |
| | | _bimfaceCtrl.LoadCompletedEvent += () => |
| | | {//view加载完成事件 |
| | | overlay.Close(); |
| | | WaitFormHelper.HideWaitForm(); |
| | | this.barCkDecorator.Checked = false; |
| | | this.barCkGrading.Checked = true; |
| | | }; |
| | |
| | | {//鼠标左键点击事件 |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visual = visualListHelper.GetVisual(code); |
| | | SelectVisual(visual, eVisualSource.Bimface); |
| | | SelectVisual(visual, eSimulationVisualSource.Bimface); |
| | | }; |
| | | } |
| | | return _bimfaceCtrl; |
| | |
| | | this.tabPageBimface.Controls.Add(bimfaceCtrl); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion BIM控件 |
| | | |
| | | #region Q3d控件 |
| | | |
| | |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visuals = visualListHelper.GetVisualList(codes); |
| | | SelectVisual(visuals?.LastOrDefault(), eVisualSource.Q3d); |
| | | SelectVisual(visuals?.LastOrDefault(), eSimulationVisualSource.Q3d); |
| | | }; |
| | | } |
| | | return _q3dCtrl; |
| | |
| | | this.tabPageQ3d.Controls.Add(q3dCtrl); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion Q3d控件 |
| | | |
| | | #region 属性控件 |
| | | |
| | | //属性控件 |
| | | private XhsProjectSimulationPropertyCtrl _propertyCtrl = null; |
| | | private SimulationPropertyCtrl _propertyCtrl = null; |
| | | |
| | | //获取属性控件 |
| | | private XhsProjectSimulationPropertyCtrl GetPropertyCtrl() |
| | | private SimulationPropertyCtrl GetPropertyCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | |
| | | } |
| | | if (_propertyCtrl == null) |
| | | { |
| | | _propertyCtrl = new XhsProjectSimulationPropertyCtrl(); |
| | | _propertyCtrl = new SimulationPropertyCtrl(); |
| | | _propertyCtrl.Dock = DockStyle.Fill; |
| | | _propertyCtrl.AllowEdit = true; |
| | | _propertyCtrl.CalcuResult = () => GetCalcuResult(); |
| | | _propertyCtrl.HydroViewEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eVisualSource.Property); |
| | | SelectVisual(visual, eSimulationVisualSource.Property); |
| | | }; |
| | | _propertyCtrl.BlinkLinkNodeEvent += async (link, linkNodeCode) => |
| | | { //强调连接节点 |
| | |
| | | { |
| | | return; |
| | | } |
| | | var linkList = allLinkList.Where(x => (x.StartCode == linkNodeCode || x.EndCode == linkNodeCode) && x.Code != linkNodeCode).ToList(); |
| | | var linkList = allLinkList.Where(x => (x.StartCode == linkNodeCode || x.EndCode == linkNodeCode) && x.Code != link.Code).ToList(); |
| | | if (linkList == null || linkList.Count < 1) |
| | | { |
| | | return; |
| | |
| | | var flowEffectHelper = await GetFlowEffectHelper(); |
| | | flowEffectHelper.Set(visual); |
| | | }; |
| | | |
| | | } |
| | | return _propertyCtrl; |
| | | } |
| | |
| | | { |
| | | if (this.controlContainerRight.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerRight.Controls[0] is XhsProjectSimulationPropertyCtrl) |
| | | if (this.controlContainerRight.Controls[0] is SimulationPropertyCtrl) |
| | | { |
| | | return true; |
| | | } |
| | |
| | | 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 |
| | | #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; |
| | | this.barBtnDockingMonitor.Enabled = visual != null; |
| | | this.barBtnAnalyseMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Bimface: |
| | | |
| | | case eSimulationVisualSource.Bimface: |
| | | { |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | this.barBtnDockingMonitor.Enabled = visual != null; |
| | | this.barBtnAnalyseMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Q3d: |
| | | |
| | | 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; |
| | | case eVisualSource.Property: |
| | | |
| | | case eSimulationVisualSource.Property: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | this.barBtnDockingMonitor.Enabled = visual != null; |
| | | this.barBtnAnalyseMonitor.Enabled = visual != null; |
| | | } |
| | | break; |
| | | case eVisualSource.List: |
| | | |
| | | 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; |
| | | case eVisualSource.Set: |
| | | |
| | | 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; |
| | | case eVisualSource.Search: |
| | | |
| | | 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; |
| | | case eVisualSource.Monitor: |
| | | |
| | | 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; |
| | | case eVisualSource.Check: |
| | | |
| | | 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; |
| | | case eVisualSource.Calcu: |
| | | |
| | | 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; |
| | | case eVisualSource.Warning: |
| | | |
| | | 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; |
| | | |
| | | default: break; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | //选择构件 |
| | | private void SelectVisual(string code, eSimulationVisualSource source) |
| | | { |
| | | var visual = GetVisual(code); |
| | | SelectVisual(visual, source); |
| | | } |
| | | |
| | | #endregion 选择构件 |
| | | |
| | | #region 构件明细 |
| | | |
| | |
| | | return _visualListHelper; |
| | | } |
| | | |
| | | #endregion |
| | | //重置可见列表 |
| | | 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 可见列表 |
| | | |
| | | #region 视图列表 |
| | | |
| | |
| | | return _visualVmListHelper; |
| | | } |
| | | |
| | | #endregion |
| | | //获取可见视图列表 |
| | | private List<HydroVisualViewModel> GetVisualViewModelList() |
| | | { |
| | | var helper = GetVisualVmListHelper(); |
| | | return helper.GetVisualList(); |
| | | } |
| | | |
| | | //获取可见视图 |
| | | private HydroVisualViewModel GetVisualViewModel(string code) |
| | | { |
| | | var helper = GetVisualVmListHelper(); |
| | | return helper.GetVisual(code); |
| | | } |
| | | |
| | | #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; |
| | |
| | | ShowVisualListCtrl(); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 明细控件 |
| | | |
| | | #region 构件显示 |
| | | |
| | |
| | | SetVisualVisible(); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 构件显示 |
| | | |
| | | #endregion |
| | | #endregion 构件明细 |
| | | |
| | | #region 一键显隐 |
| | | |
| | | private List<string> _allDecoratorCodes = null; |
| | | |
| | | //获取装饰件code列表 |
| | | 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); |
| | |
| | | SetDecoratorVisible(this.barCkDecorator.Checked); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 一键显隐 |
| | | |
| | | #region 保存信息 |
| | | |
| | |
| | | { |
| | | 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 |
| | | #endregion 保存信息 |
| | | |
| | | #region 批量配置 |
| | | |
| | |
| | | //水库 |
| | | this.barBtnSetReservoirList.ItemClick += delegate |
| | | { |
| | | //var dlg = new HydroReservoirBulkSetListDlg(); |
| | | //dlg.ShowDialog(); |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var dlg = new SetHydroReservoirListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //水池 |
| | | this.barBtnSetTankList.ItemClick += delegate |
| | | { |
| | | //var dlg = new HydroTankBulkSetListDlg(); |
| | | //dlg.ShowDialog(); |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var dlg = new SetHydroTankListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | 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.List); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.List); |
| | | 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.List); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.List); |
| | | 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.List); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.List); |
| | | 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.List); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.List); |
| | | 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.List); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.List); |
| | | 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.List); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.List); |
| | | 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.List); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.List); |
| | | 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.List); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.List); |
| | | 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.List); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.List); |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //喷嘴 |
| | | this.barBtnSetNozzleList.ItemClick += delegate |
| | | { |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var dlg = new SetHydroNozzleListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //冷却塔 |
| | | this.barBtnSetCoolingList.ItemClick += delegate |
| | | { |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var dlg = new SetHydroCoolingListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | 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.List); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.List); |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //过渡件 |
| | | this.barBtnSetTranslationList.ItemClick += delegate |
| | | { |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var dlg = new SetHydroTranslationListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | 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.List); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.List); |
| | | 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.List); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eVisualSource.List); |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //换热器 |
| | | this.barBtnSetExchangerList.ItemClick += delegate |
| | | { |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var dlg = new SetHydroExchangerListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //压缩机 |
| | | this.barBtnSetCompressorList.ItemClick += delegate |
| | | { |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var dlg = new SetHydroCompressorListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | } |
| | | |
| | | |
| | | //显示RadialMenu |
| | | private void barBtnSetList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | |
| | | else |
| | | { |
| | | this.barBtnSetHydrantList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | //冷却塔 |
| | | if (_hydroInfo.Coolings == null || _hydroInfo.Coolings.Count < 1) |
| | | { |
| | | this.barBtnSetCoolingList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetCoolingList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | //闷头 |
| | |
| | | this.barBtnSetTranslationList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | //换热器 |
| | | if (_hydroInfo.Exchangers == null || _hydroInfo.Exchangers.Count < 1) |
| | | { |
| | | this.barBtnSetExchangerList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetExchangerList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | //空压机 |
| | | if (_hydroInfo.Compressors == null || _hydroInfo.Compressors.Count < 1) |
| | | { |
| | | this.barBtnSetCompressorList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetCompressorList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | //水泵 |
| | | if (_hydroInfo.Pumps == null || _hydroInfo.Pumps.Count < 1) |
| | | { |
| | |
| | | this.barBtnSetValveList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | //换热器 |
| | | if (_hydroInfo.Exchangers == null || _hydroInfo.Exchangers.Count < 1) |
| | | { |
| | | this.barBtnSetExchangerList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetExchangerList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | //空压机 |
| | | if (_hydroInfo.Compressors == null || _hydroInfo.Compressors.Count < 1) |
| | | { |
| | | this.barBtnSetCompressorList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetCompressorList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 批量配置 |
| | | |
| | | #region 构件查询 |
| | | |
| | |
| | | _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; |
| | |
| | | ShowSearchDlg(); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 构件查询 |
| | | |
| | | #region 模型标注 |
| | | |
| | |
| | | markHelper.Set(); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 模型标注 |
| | | |
| | | #region 颜色分级 |
| | | |
| | |
| | | gradingHelper.Set(); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 颜色分级 |
| | | |
| | | #region 人工刷新 |
| | | |
| | | //刷新 |
| | | 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) |
| | | var hydroInfo = await this.RefreshModelEvent.Invoke(); |
| | | if (hydroInfo == null) |
| | | { |
| | | TipFormHelper.ShowError("刷新失败!"); |
| | | 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("数据已刷新"); |
| | | _hydroInfo = hydroInfo; |
| | | SelectVisual(visual: null, eSimulationVisualSource.None); |
| | | |
| | | var visualListHelper = GetVisualListHelper(); |
| | | visualListHelper.InitialData(_hydroInfo); |
| | | ResetVisualList(); |
| | | TipFormHelper.ShowSucceed("刷新成功!"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 人工刷新 |
| | | |
| | | #region 水流动画 |
| | | |
| | |
| | | private async void barCkFlowEffect_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var flowEffectHelper = await GetFlowEffectHelper(); |
| | | flowEffectHelper.Visible = this.barCkFlowEffect.Checked; |
| | | flowEffectHelper.Set(); |
| | | //flowEffectHelper.Visible = this.barCkFlowEffect.Checked; |
| | | //flowEffectHelper.Set(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 监测列表 |
| | | |
| | | #region 监测点 |
| | | |
| | |
| | | //获取监测点辅助类 |
| | | private SimulationMonitorHelper GetMonitorHelper() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_monitorHelper == null) |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | |
| | | return _monitorHelper; |
| | | } |
| | | |
| | | //设置监测点列表 |
| | | private async void SetMonitorList(HydroVisualInfo visual) |
| | | //获取监测点列表 |
| | | private async Task<List<HydroMonitorVmo>> GetMonitorList() |
| | | { |
| | | 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.GetAll(); |
| | | } |
| | | |
| | | //设置监测点 |
| | | private void barBtnSetMonitor_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //获取监测对接列表 |
| | | private async Task<List<HydroMonitorVmo>> GetMonitorDockingList() |
| | | { |
| | | SetMonitorList(_visual); |
| | | var helper = GetMonitorHelper(); |
| | | return await helper.GetDockingList(); |
| | | } |
| | | |
| | | #endregion |
| | | //获取监测分析列表 |
| | | private async Task<List<HydroMonitorVmo>> GetMonitorAnalyseList() |
| | | { |
| | | var helper = GetMonitorHelper(); |
| | | return await helper.GetAnalyseList(); |
| | | } |
| | | |
| | | #endregion 监测点 |
| | | |
| | | #region 监测值 |
| | | |
| | |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var monitorHelper = GetMonitorHelper(); |
| | | _monitorValueHelper = new SimulationMonitorValueHelper(visualListHelper, monitorHelper); |
| | | var calcuResultHelper = GetCalcuResultHelper(); |
| | | _monitorValueHelper = new SimulationMonitorValueHelper(visualListHelper, monitorHelper, calcuResultHelper); |
| | | } |
| | | return _monitorValueHelper; |
| | | } |
| | | |
| | | #endregion |
| | | //获取监测值列表 |
| | | private async Task<List<HydroMonitorValueViewModel>> GetMonitorValueList() |
| | | { |
| | | var helper = GetMonitorValueHelper(); |
| | | return await helper.GetAll(); |
| | | } |
| | | |
| | | #region 监测值控件 |
| | | //获取监测对接值列表 |
| | | 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(); |
| | | } |
| | | |
| | | //重置 |
| | | 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 传感器测点 |
| | | |
| | | //设置可见构件对接测点列表 |
| | | 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; |
| | |
| | | _monitorValueListCtrl.Dock = DockStyle.Fill; |
| | | _monitorValueListCtrl.HydroViewEvent += (code) => |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visual = visualListHelper.GetVisual(code); |
| | | SelectVisual(visual, eVisualSource.Monitor); |
| | | var visual = GetVisual(code); |
| | | SelectVisual(visual, eSimulationVisualSource.Monitor); |
| | | }; |
| | | } |
| | | return _monitorValueListCtrl; |
| | |
| | | } |
| | | } |
| | | |
| | | //显示监测值列表控件 |
| | | private async void ShowMonitorValueListCtrl() |
| | | //显示监测对接值列表控件 |
| | | private async void ShowMonitorDockingValueListCtrl() |
| | | { |
| | | var monitorValueListCtrl = GetMonitorValueListCtrl(); |
| | | if (!IsMonitorValueListCtrlVisible) |
| | |
| | | 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 monitorValueHelper = GetMonitorValueHelper(); |
| | | var allMonitorValueList = await monitorValueHelper.Get(); |
| | | monitorValueListCtrl.SetBindingData(allMonitorValueList); |
| | | 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; |
| | |
| | | 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 模型检查 |
| | | |
| | |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visual = visualListHelper.GetVisual(code); |
| | | SelectVisual(visual, eVisualSource.Check); |
| | | SelectVisual(visual, eSimulationVisualSource.Check); |
| | | }; |
| | | } |
| | | return _checkCtrl; |
| | |
| | | ShowCheckCtrl(checkResult); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 模型检查 |
| | | |
| | | #region 模型计算 |
| | | |
| | |
| | | return _calcuResultHelper; |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 计算结果 |
| | | |
| | | #region 计算失败 |
| | | |
| | |
| | | calcuFailedCtrl.SetBindingData(calcuResult.FailedList); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 计算失败 |
| | | |
| | | #region 计算警告 |
| | | |
| | |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visual = visualListHelper.GetVisual(code); |
| | | SelectVisual(visual, eVisualSource.Warning); |
| | | SelectVisual(visual, eSimulationVisualSource.Warning); |
| | | }; |
| | | } |
| | | return _calcuWarningCtrl; |
| | |
| | | calcuWaringCtrl.SetBindingData(calcuResult.WainingList, allVisualDict); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 计算警告 |
| | | |
| | | #region 计算标签 |
| | | |
| | |
| | | calcuResultLabelHelper.Set(); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 计算标签 |
| | | |
| | | #endregion |
| | | |
| | | #region 管网修复 |
| | | |
| | | //修复管网 |
| | | private void Repair() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var checkResult = _hydroInfo.Check(); |
| | | if (!checkResult.Succeed) |
| | | { |
| | | ShowCheckCtrl(checkResult); |
| | | TipFormHelper.ShowWarn("检查失败导致无法进行试算,停止管网修复!"); |
| | | return; |
| | | } |
| | | var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.Simple); |
| | | if (!calcuResult.Succeed) |
| | | { |
| | | ShowCalcuFailedCtrl(calcuResult); |
| | | TipFormHelper.ShowWarn("试算失败,停止管网修复!"); |
| | | return; |
| | | } |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var allLinkList = visualListHelper.GetLinkList(); |
| | | if (allLinkList != null && allLinkList.Count < 1) |
| | | { |
| | | TipFormHelper.ShowError("模型中未包含管段信息,停止管网修复!"); |
| | | return; |
| | | } |
| | | int count = 0; |
| | | foreach (var link in allLinkList) |
| | | { |
| | | var calcuLink = calcuResult.LinkList?.Find(x => x.Code == link.Code); |
| | | if (calcuLink == null) |
| | | { |
| | | continue; |
| | | } |
| | | if (!calcuLink.CalcuFlow.HasValue) |
| | | { |
| | | continue; |
| | | } |
| | | if (calcuLink.CalcuFlow.Value < 0) |
| | | { |
| | | var tempCode = link.StartCode; |
| | | link.StartCode = link.EndCode; |
| | | link.EndCode = tempCode; |
| | | count++; |
| | | } |
| | | } |
| | | var visualVmListHelper = GetVisualVmListHelper(); |
| | | visualVmListHelper.UpdateProperty(); |
| | | UpdateVisualListCtrl(); |
| | | UpdatePropertyCtrl(); |
| | | TipFormHelper.ShowSucceed($"修复完成,共修复管段({count})个!"); |
| | | } |
| | | |
| | | //管网修复 |
| | | private void barBtnRepair_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | Repair(); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 模型计算 |
| | | |
| | | #region 导出INP |
| | | |
| | |
| | | TipFormHelper.ShowSucceed("导出成功"); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 导出INP |
| | | |
| | | #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, eSimulationVisualSource.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() |
| | |
| | | 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, eSimulationVisualSource.None); |
| | | var gradingHelper = await GetGradingHelper(); |
| | | gradingHelper.Set(); |
| | | }; |
| | | dlg.SetBindingData(_hydroInfo); |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | |
| | | PumpParallel(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | #endregion 水泵列表 |
| | | |
| | | #region 水力计算 |
| | | |
| | |
| | | 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) => |
| | | { |
| | | 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 |
| | |
| | | var visualVmListHelper = GetVisualVmListHelper(); |
| | | visualVmListHelper.UpdateCalcuProperty(calcuResult); |
| | | |
| | | #endregion |
| | | #endregion 视图列表 |
| | | |
| | | #region 当前构件 |
| | | |
| | | SelectVisual(_visual, eSimulationVisualSource.Calcu); |
| | | |
| | | #endregion 当前构件 |
| | | |
| | | #region 构件明细 |
| | | |
| | | UpdateVisualListCtrl(); |
| | | |
| | | #endregion |
| | | #endregion 构件明细 |
| | | |
| | | #region 颜色分级 |
| | | |
| | | var gradingHelper = await GetGradingHelper(); |
| | | gradingHelper.Set(); |
| | | |
| | | #endregion 颜色分级 |
| | | |
| | | #region 计算标签 |
| | | |
| | | var calcuResultLabelHelper = await GetCalcuResultLabelHelper(); |
| | | calcuResultLabelHelper.Set(); |
| | | |
| | | #endregion |
| | | |
| | | #endregion 计算标签 |
| | | }; |
| | | |
| | | dlg.ShowDialog(); |
| | | |
| | | } |
| | | |
| | | //水力计算 |
| | |
| | | Calcu(); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 水力计算 |
| | | |
| | | #region 导出报告 |
| | | |
| | | private async void barBtnExportWord_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 allMonitorList = await GetMonitorList(); |
| | | var working = GetWorking(); |
| | | var calcuResult = GetCalcuResult(); |
| | | |
| | | var dlg = new SimulationWorkingReportDlg(); |
| | | dlg.ReloadDataEvent += (vm) => |
| | | { |
| | | var fileName = FileDialogHelper.SaveWordDoc("导出Word报告"); |
| | | if (string.IsNullOrEmpty(fileName)) |
| | | { |
| | | return; |
| | | } |
| | | var reportHelper = new HStation.ReportFile.SimulationWorkingReportHelper(); |
| | | reportHelper.Create(fileName, vm); |
| | | TipFormHelper.ShowInfo("导出成功!"); |
| | | }; |
| | | dlg.SetBindingData(_project, _hydroInfo, allMonitorList, working, calcuResult, visual); |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | #endregion 导出报告 |
| | | |
| | | #region 当前工况 |
| | | |
| | |
| | | { |
| | | this.barBtnAddWorking.Enabled = false; |
| | | workingHelper.ResetWorking(rhs); |
| | | UpdateWorkingCheckedList(rhs, false); |
| | | this.AppendWorkingEvent?.Invoke(rhs); |
| | | }; |
| | | dlg.ShowDialog(); |
| | |
| | | AddWorking(); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 当前工况 |
| | | |
| | | #region 选择工况 |
| | | |
| | |
| | | return _workingCheckedListHelper; |
| | | } |
| | | |
| | | //获取工况列表 |
| | | private List<HydroWorkingVmo> GetWorkingList() |
| | | { |
| | | var helper = GetWorkingCheckedListHelper(); |
| | | return helper.GetWorkingList(); |
| | | } |
| | | |
| | | //获取选择工况列表 |
| | | private List<HydroWorkingVmo> GetCheckedWorkingList() |
| | | { |
| | | var helper = GetWorkingCheckedListHelper(); |
| | | return helper.GetCheckedWorkingList(); |
| | | } |
| | | |
| | | //更新工况选择列表 |
| | | 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 |
| | | #endregion 选择工况 |
| | | |
| | | #region 监测分析 |
| | | |
| | | //监测分析列表控件 |
| | | private HydroWorkingMonitorAnalyListCtrl _monitorAnalyListCtrl = null; |
| | | |
| | | //获取监测分析列表控件 |
| | | private HydroWorkingMonitorAnalyListCtrl GetMonitorAnalyListCtrl() |
| | | { |
| | | if (_monitorAnalyListCtrl == null) |
| | | { |
| | | _monitorAnalyListCtrl = new HydroWorkingMonitorAnalyListCtrl(); |
| | | _monitorAnalyListCtrl.Dock = DockStyle.Fill; |
| | | _monitorAnalyListCtrl.HydroViewEvent += (code) => |
| | | { |
| | | var visual = GetVisual(code); |
| | | SelectVisual(visual, eSimulationVisualSource.Monitor); |
| | | }; |
| | | } |
| | | return _monitorAnalyListCtrl; |
| | | } |
| | | |
| | | //监测分析列表控件是否可见 |
| | | private bool IsMonitorAnalyListCtrlVisible |
| | | { |
| | | get |
| | | { |
| | | if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | if (this.controlContainerBottom.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerBottom.Controls[0] is HydroWorkingMonitorAnalyListCtrl) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //显示监测值列表控件 |
| | | private async void ShowMonitorAnalyListCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allWorkingList = GetCheckedWorkingList(); |
| | | if (allWorkingList == null || allWorkingList.Count < 1) |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (!workingHelper.Initialized) |
| | | { |
| | | TipFormHelper.ShowWarn("请计算后重试!"); |
| | | return; |
| | | } |
| | | } |
| | | var monitorAnalyListCtrl = GetMonitorAnalyListCtrl(); |
| | | if (!IsMonitorAnalyListCtrlVisible) |
| | | { |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(monitorAnalyListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "监测分析"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | var allMontorList = await GetMonitorAnalyseList(); |
| | | if (allWorkingList == null || allWorkingList.Count < 1) |
| | | { |
| | | monitorAnalyListCtrl.SetBindingData(_hydroInfo, allMontorList, GetCalcuResult()); |
| | | } |
| | | else |
| | | { |
| | | monitorAnalyListCtrl.SetBindingData(_hydroInfo, allMontorList, allWorkingList); |
| | | } |
| | | } |
| | | |
| | | //监测分析 |
| | | private void barBtnWorkingMonitorAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowMonitorAnalyListCtrl(); |
| | | } |
| | | |
| | | #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) |
| | | { |
| | | var monitorHelper = GetMonitorHelper(); |
| | | var allMonitorList = await monitorHelper.Get(); |
| | | var allMonitorList = await GetMonitorDockingList(); |
| | | |
| | | var workingCheckedListHelper = GetWorkingCheckedListHelper(); |
| | | var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList(); |
| | |
| | | //水泵分析 |
| | | private void barBtnPumpAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | var workingCheckedListHelper = GetWorkingCheckedListHelper(); |
| | | var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList(); |
| | | if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | if (_hydroInfo.Pumps == null || _hydroInfo.Pumps.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | var calcuResultHelper = GetCalcuResultHelper(); |
| | | var vmList = new List<XhsSinglePumpViewModel>(); |
| | | foreach (var pump in _hydroInfo.Pumps) |
| | | { |
| | | if (!pump.RatedN.HasValue) |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (!workingHelper.Initialized) |
| | | { |
| | | continue; |
| | | TipFormHelper.ShowWarn("请计算后重试!"); |
| | | return; |
| | | } |
| | | 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); |
| | | vm.CurveQH = qhPtList; |
| | | vm.CurveQE = qePtList; |
| | | vm.CurveQP = qpPtList; |
| | | |
| | | var calcuResultVisualDict = calcuResultHelper.GetVisualDict(); |
| | | if (calcuResultVisualDict != null && calcuResultVisualDict.Count > 0) |
| | | { |
| | | //var calcuResult = allCalcuResultList.Find(x => x.Code == pump.Code) as HydroCalcuLinkResult; |
| | | //if (calcuResult != null) |
| | | //{ |
| | | // if (calcuResult.CalcuFlow.HasValue) |
| | | // { |
| | | // vm.CalcuQ = Math.Abs(calcuResult.CalcuFlow.Value); |
| | | // } |
| | | |
| | | // var calcuResultStart = allCalcuResultList.Find(x => x.Code == pump.StartCode) as HydroCalcuNodeResult; |
| | | // var calcuResultEnd = allCalcuResultList.Find(x => x.Code == pump.EndCode) as HydroCalcuNodeResult; |
| | | // if (calcuResultStart != null && calcuResultEnd != null) |
| | | // { |
| | | // if (calcuResultStart.CalcuHead.HasValue && calcuResultEnd.CalcuHead.HasValue) |
| | | // { |
| | | // vm.CalcuH = Math.Round(Math.Abs(calcuResultStart.CalcuHead.Value - calcuResultEnd.CalcuHead.Value), 4); |
| | | // } |
| | | // } |
| | | //} |
| | | } |
| | | |
| | | var dlg = new SimulationSingleWorkingPumpAnalyDlg(); |
| | | dlg.SetBindingData(workingHelper.HydroInfo, workingHelper.CalcuResult); |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | var dlg = new PumpParallelAnalyDlg(); |
| | | dlg.SetBindingData(vmList); |
| | | dlg.ReloadDataEvent += (list) => |
| | | else |
| | | { |
| | | 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 SimulationMultiWorkingPumpAnalyDlg(); |
| | | dlg.SetBindingData(_hydroInfo, allCheckedWorkingList); |
| | | dlg.ShowDialog(); |
| | | } |
| | | } |
| | | |
| | | //能效分析 |
| | | 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.ShowDialog(); |
| | | } |
| | | } |
| | | |
| | | //损失曲线 |
| | | private void barBtnWorkingLossCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_visual == null) |
| | | { |
| | | TipFormHelper.ShowWarn("请选择构件后重试!"); |
| | | return; |
| | | } |
| | | HydroVisualInfo visual = _visual; |
| | | if (_visual is HydroLinkInfo linkInfo) |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | visual = visualListHelper.GetVisual(linkInfo.StartCode); |
| | | } |
| | | |
| | | var workingCheckedListHelper = GetWorkingCheckedListHelper(); |
| | | var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList(); |
| | | if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1) |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (!workingHelper.Initialized) |
| | | { |
| | | TipFormHelper.ShowWarn("请计算后重试!"); |
| | | return; |
| | | } |
| | | var dlg = new HydroSingleWorkingLossCurveDlg(); |
| | | dlg.SetBindingData(workingHelper.HydroInfo, workingHelper.CalcuResult, visual); |
| | | dlg.ShowDialog(); |
| | | } |
| | | else |
| | | { |
| | | var dlg = new HydroMultiWorkingLossCurveDlg(); |
| | | dlg.SetBindingData(_hydroInfo, allCheckedWorkingList, visual); |
| | | dlg.SetBindingData(_hydroInfo, allMonitorList, allCheckedWorkingList); |
| | | 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) |
| | |
| | | } |
| | | |
| | | var monitorHelper = GetMonitorHelper(); |
| | | var allMonitorList = await monitorHelper.Get(); |
| | | var allMonitorList = await monitorHelper.GetAll(); |
| | | |
| | | var workingCheckedListHelper = GetWorkingCheckedListHelper(); |
| | | var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList(); |
| | |
| | | } |
| | | } |
| | | |
| | | #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 方案管理 |
| | | |
| | | //更新方案 |
| | | 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 方案管理 |
| | | } |
| | | } |