| | |
| | | global using Yw.EPAnet; |
| | | using DevExpress.Diagram.Core.Native; |
| | | using DevExpress.Mvvm.Native; |
| | | using Yw.WinFrmUI.Bimface; |
| | | using Yw.WinFrmUI.Hydro; |
| | | using DevExpress.Pdf.Native; |
| | | using Mapster; |
| | | using Yw.EPAnet; |
| | | using Yw.Hydro; |
| | | using Yw.Model; |
| | | using Yw.Vmo; |
| | | |
| | | namespace HStation.WinFrmUI |
| | | { |
| | |
| | | this.PageTitle.Caption = "水力模拟"; |
| | | this.PageTitle.HeaderSvgImage = this.svgImg32[0]; |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; |
| | | this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; |
| | | RegistBulkSetEvents(); |
| | | } |
| | | |
| | | #region 模型事件 |
| | | |
| | | /// <summary> |
| | | /// 获取模型事件 |
| | | /// </summary> |
| | | public event Func<XhsSchemeVmo, Task<Yw.Model.HydroModelInfo>> GetModelEvent; |
| | | |
| | | /// <summary> |
| | | /// 刷新模型事件 |
| | | /// </summary> |
| | | public event Func<Task<Yw.Model.HydroModelInfo>> RefreshModelEvent; |
| | | |
| | | #endregion 模型事件 |
| | | |
| | | #region 方案事件 |
| | | |
| | | /// <summary> |
| | | /// 更新方案事件 |
| | | /// </summary> |
| | | public event Action<XhsSchemeVmo> UpdateSchemeEvent; |
| | | |
| | | /// <summary> |
| | | /// 移除方案事件 |
| | | /// </summary> |
| | | public event Action<XhsSchemeVmo> RemoveSchemeEvent; |
| | | |
| | | #endregion 方案事件 |
| | | |
| | | #region 工况事件 |
| | | |
| | | /// <summary> |
| | | /// 新增工况事件 |
| | | /// </summary> |
| | | public event Action<HydroWorkingVmo> AppendWorkingEvent; |
| | | |
| | | /// <summary> |
| | | /// 更新工况事件 |
| | | /// </summary> |
| | | public event Action<HydroWorkingVmo> UpdateWorkingEvent; |
| | | |
| | | /// <summary> |
| | | /// 移除工况事件 |
| | | /// </summary> |
| | | public event Action<HydroWorkingVmo> RemoveWorkingEvent; |
| | | |
| | | /// <summary> |
| | | /// 重载工况事件 |
| | | /// </summary> |
| | | public event Action<Dictionary<HydroWorkingVmo, bool>> ReloadWorkingEvent; |
| | | |
| | | #endregion 工况事件 |
| | | |
| | | 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 Yw.Model.HydroParterInfo _parter = null; |
| | | private Yw.WinFrmUI.HydroCheckResult _checkResult = null; |
| | | private Yw.EPAnet.CalcuResult _calcuResult = null; |
| | | private Dictionary<HydroWorkingVmo, bool> _allWorkingCheckedListDict = null;//所有工况选择列表字典 |
| | | |
| | | /// <summary> |
| | | /// 绑定数据 |
| | | /// </summary> |
| | | public async Task SetBindingData |
| | | public void SetBindingData |
| | | ( |
| | | HStation.Vmo.XhsProjectVmo project, |
| | | HStation.Vmo.XhsProjectSiteVmo projectSite, |
| | | Yw.Model.HydroModelInfo hydroInfo |
| | | XhsProjectVmo project, |
| | | XhsProjectSiteVmo projectSite, |
| | | XhsSchemeVmo scheme, |
| | | Yw.Model.HydroModelInfo hydroInfo, |
| | | Dictionary<HydroWorkingVmo, bool> allWorkingCheckedListDict |
| | | ) |
| | | { |
| | | if (project == null) |
| | | { |
| | | return; |
| | | } |
| | | _project = project; |
| | | _projectSite = projectSite; |
| | | _scheme = scheme; |
| | | _hydroInfo = hydroInfo; |
| | | if (_projectSite == null) |
| | | _allWorkingCheckedListDict = allWorkingCheckedListDict; |
| | | ResetMonitorValue(); |
| | | if (_scheme == null) |
| | | { |
| | | _projectSite = await BLLFactory<HStation.BLL.XhsProjectSite>.Instance.GetDefaultByProjectID(_project.ID); |
| | | this.ribPageGroupForScheme.Visible = false; |
| | | this.PageTitle.Caption = $"水力模拟"; |
| | | } |
| | | if (_hydroInfo == null) |
| | | else |
| | | { |
| | | var hydroRelation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance |
| | | .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation); |
| | | _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(hydroRelation.ModelID); |
| | | this.ribPageGroupForScheme.Visible = true; |
| | | this.PageTitle.Caption = $"模拟方案\r\n{_scheme.Name}"; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化数据 |
| | | /// </summary> |
| | | public override async void InitialDataSource() |
| | | public override void InitialDataSource() |
| | | { |
| | | base.InitialDataSource(); |
| | | if (_project == null) |
| | | { |
| | | return; |
| | | } |
| | | this.PageTitle.Caption = $"{_project.Name}\r\n水力模拟"; |
| | | var bimfaceCtrl = GetBimfaceCtrl(); |
| | | this.tabPageBimface.Controls.Clear(); |
| | | this.tabPageBimface.Controls.Add(bimfaceCtrl); |
| | | await bimfaceCtrl.InitialData(_project, _projectSite, () => _hydroInfo); |
| | | var q3dCtrl = GetQ3dCtrl(); |
| | | this.tabPageQ3d.Controls.Clear(); |
| | | this.tabPageQ3d.Controls.Add(q3dCtrl); |
| | | q3dCtrl.InitialData(() => _hydroInfo); |
| | | ShowBimfaceCtrl(); |
| | | ShowQ3dCtrl(); |
| | | ShowPropertyCtrl(); |
| | | |
| | | InitialSvgImages(); |
| | | } |
| | | |
| | | #region Bimface |
| | | //初始化Svg图片 |
| | | private void InitialSvgImages() |
| | | { |
| | | //监测 |
| | | this.barBtnSetMonitorList.ImageOptions.SvgImage = HydroMonitorSvgImageHelper.Docking; |
| | | |
| | | //水库 |
| | | 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.barBtnSetJunctionList.ImageOptions.SvgImage = HydroMainSvgImageHelper.Junction; |
| | | this.barBtnSetJunctionList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetJunctionList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetJunctionList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //闷头 |
| | | this.barBtnSetBluntheadList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Blunthead; |
| | | this.barBtnSetBluntheadList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetBluntheadList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetBluntheadList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //弯头 |
| | | this.barBtnSetElbowsList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Elbow; |
| | | this.barBtnSetElbowsList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetElbowsList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetElbowsList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //三通 |
| | | this.barBtnSetThreelinkList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Threelink; |
| | | this.barBtnSetThreelinkList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetThreelinkList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetThreelinkList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //四通 |
| | | this.barBtnSetFourlinkList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Fourlink; |
| | | this.barBtnSetFourlinkList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetFourlinkList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetFourlinkList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //消火栓 |
| | | this.barBtnSetHydrantList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Hydrant; |
| | | this.barBtnSetHydrantList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetHydrantList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetHydrantList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //喷头 |
| | | this.barBtnSetNozzleList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Nozzle; |
| | | this.barBtnSetNozzleList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetNozzleList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetNozzleList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //冷却塔 |
| | | this.barBtnSetCoolingList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Cooling; |
| | | this.barBtnSetCoolingList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetCoolingList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetCoolingList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //水表 |
| | | this.barBtnSetMeterList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Meter; |
| | | this.barBtnSetMeterList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetMeterList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetMeterList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //流量计 |
| | | this.barBtnSetFlowmeterList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Flowmeter; |
| | | this.barBtnSetFlowmeterList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetFlowmeterList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetFlowmeterList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //压力表 |
| | | this.barBtnSetPressmeterList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Pressmeter; |
| | | this.barBtnSetPressmeterList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetMeterList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetMeterList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //管道 |
| | | this.barBtnSetPipeList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Pipe; |
| | | this.barBtnSetPipeList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetPipeList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetPipeList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //过渡件 |
| | | this.barBtnSetTranslationList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Translation; |
| | | this.barBtnSetTranslationList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetTranslationList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetTranslationList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //水泵 |
| | | this.barBtnSetPumpList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Pump; |
| | | this.barBtnSetPumpList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetPumpList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetPumpList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //阀门 |
| | | this.barBtnSetValveList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Valve; |
| | | this.barBtnSetValveList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetValveList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetValveList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //换热器 |
| | | this.barBtnSetExchangerList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Exchanger; |
| | | this.barBtnSetExchangerList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetExchangerList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetExchangerList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //压缩机 |
| | | this.barBtnSetCompressorList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Compressor; |
| | | this.barBtnSetCompressorList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetCompressorList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetCompressorList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | } |
| | | |
| | | #region 属性状态 |
| | | |
| | | //属性状态辅助类 |
| | | private HydroPropStatusHelper _propStatusHelper = null; |
| | | |
| | | //获取属性状态辅助类 |
| | | private async Task<HydroPropStatusHelper> GetPropStatusHelper() |
| | | { |
| | | if (_propStatusHelper == null) |
| | | { |
| | | var allPropStatusList = await BLLFactory<Yw.BLL.HydroParterPropStatusInfo>.Instance.GetByModelID(_hydroInfo.ID); |
| | | _propStatusHelper = new HydroPropStatusHelper(_hydroInfo, allPropStatusList); |
| | | } |
| | | return _propStatusHelper; |
| | | } |
| | | |
| | | //获取属性状态Db列表 |
| | | private async Task<List<HydroParterPropStatusInfo>> GetPropStatusDbList() |
| | | { |
| | | var helper = await GetPropStatusHelper(); |
| | | return helper.GetPropStatusDbList(); |
| | | } |
| | | |
| | | #endregion 属性状态 |
| | | |
| | | #region 更改状态 |
| | | |
| | | //改变辅助类 |
| | | private HydroChangeHelper _changeHelper = null; |
| | | |
| | | //获取改变辅助类 |
| | | private HydroChangeHelper GetChangeHelper() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_changeHelper == null) |
| | | { |
| | | _changeHelper = new HydroChangeHelper(_hydroInfo); |
| | | } |
| | | return _changeHelper; |
| | | } |
| | | |
| | | //附加改变构件 |
| | | private void AppendChangeParter(HydroParterInfo parter, eChangeType changeType) |
| | | { |
| | | var helper = GetChangeHelper(); |
| | | helper.Append(parter, changeType); |
| | | } |
| | | |
| | | //获取增加构件列表 |
| | | private List<HydroParterInfo> GetAddParterList() |
| | | { |
| | | var helper = GetChangeHelper(); |
| | | return helper.GetAddParterList(); |
| | | } |
| | | |
| | | //获取更新构件列表 |
| | | private List<HydroParterInfo> GetUpdateParterList() |
| | | { |
| | | var helper = GetChangeHelper(); |
| | | return helper.GetUpdateParterList(); |
| | | } |
| | | |
| | | //获取移除构件列表 |
| | | private List<string> GetRemoveParters() |
| | | { |
| | | var helper = GetChangeHelper(); |
| | | return helper.GetRemoveParters(); |
| | | } |
| | | |
| | | #endregion 更改状态 |
| | | |
| | | #region BIM控件 |
| | | |
| | | //bimface控件 |
| | | private XhsProjectSimulationBimfaceCtrl _bimfaceCtrl = null; |
| | | private SimulationBimfaceCtrl _bimfaceCtrl = null; |
| | | |
| | | //获取 bimface 控件 |
| | | private XhsProjectSimulationBimfaceCtrl GetBimfaceCtrl() |
| | | private async Task<SimulationBimfaceCtrl> GetBimfaceCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_bimfaceCtrl == null) |
| | | { |
| | | _bimfaceCtrl = new XhsProjectSimulationBimfaceCtrl(); |
| | | _bimfaceCtrl = new SimulationBimfaceCtrl(); |
| | | _bimfaceCtrl.Dock = DockStyle.Fill; |
| | | _bimfaceCtrl.LoadCompletedEvent += async () => |
| | | WaitFormHelper.ShowWaitForm(this.FindForm(), "正在加载模型,请稍后..."); |
| | | await _bimfaceCtrl.InitialData(_project, _projectSite); |
| | | _bimfaceCtrl.LoadCompletedEvent += () => |
| | | {//view加载完成事件 |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var elementIds = new List<string>(); |
| | | var pumps = _hydroInfo.Pumps?.Where(x => x.LinkStatus == Yw.Hydro.PumpStatus.Open).ToList(); |
| | | pumps?.ForEach(x => elementIds.Add(x.Code)); |
| | | var valves = _hydroInfo.Valves?.Where(x => x.LinkStatus == Yw.Hydro.ValveStatus.Open).ToList(); |
| | | valves?.ForEach(x => elementIds.Add(x.Code)); |
| | | await _bimfaceCtrl?.SetOpenComponentsColor(elementIds); |
| | | WaitFormHelper.HideWaitForm(); |
| | | this.barCkDecorator.Checked = false; |
| | | this.barCkGrading.Checked = true; |
| | | }; |
| | | _bimfaceCtrl.HydroMouseLeftClickEvent += (obj) => |
| | | _bimfaceCtrl.HydroMouseLeftClickEvent += (code) => |
| | | {//鼠标左键点击事件 |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | _parter = obj; |
| | | ShowProperty(); |
| | | SetBimfaceLinkColor(); |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visual = visualListHelper.GetVisual(code); |
| | | SelectVisual(visual, eSimulationVisualSource.Bimface); |
| | | }; |
| | | } |
| | | return _bimfaceCtrl; |
| | | } |
| | | |
| | | //显示 bimface 控件 |
| | | private async void ShowBimfaceCtrl() |
| | | { |
| | | var bimfaceCtrl = await GetBimfaceCtrl(); |
| | | this.tabPageBimface.Controls.Clear(); |
| | | this.tabPageBimface.Controls.Add(bimfaceCtrl); |
| | | } |
| | | |
| | | #endregion BIM控件 |
| | | |
| | | //设置Bimface连接颜色 |
| | | private async void SetBimfaceLinkColor() |
| | | #region Q3d控件 |
| | | |
| | | //Q3d 控件 |
| | | private XhsProjectSimulationQ3dCtrl _q3dCtrl = null; |
| | | |
| | | //获取 Q3d 控件 |
| | | private XhsProjectSimulationQ3dCtrl GetQ3dCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | return default; |
| | | } |
| | | if (_parter != null) |
| | | { |
| | | if (_parter is Yw.Model.HydroLinkInfo link) |
| | | { |
| | | await _bimfaceCtrl?.RestoreLinkComponentsColor(); |
| | | |
| | | var allVisualList = _hydroInfo.GetAllVisuals(); |
| | | var allLinkList = _hydroInfo.GetAllLinks(); |
| | | var startParter = allVisualList?.Find(x => x.Code == link.StartCode); |
| | | if (startParter != null) |
| | | { |
| | | var startElementIds = new List<string>(); |
| | | if (startParter.GetType() == typeof(Yw.Model.HydroJunctionInfo)) |
| | | { |
| | | var startLinkList = allLinkList?.Where(x => x.StartCode == startParter.Code || x.EndCode == startParter.Code && x.Code != _parter.Code).ToList(); |
| | | if (startLinkList != null && startLinkList.Count > 0) |
| | | { |
| | | startElementIds.AddRange(startLinkList.Select(x => x.Code)); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | startElementIds.Add(startParter.Code); |
| | | } |
| | | if (startElementIds.Count > 0) |
| | | { |
| | | await _bimfaceCtrl?.SetLinkStartComponentsColor(startElementIds); |
| | | } |
| | | } |
| | | var endParter = allVisualList?.Find(x => x.Code == link.EndCode); |
| | | if (endParter != null) |
| | | { |
| | | var endElementIds = new List<string>(); |
| | | if (endParter.GetType() == typeof(Yw.Model.HydroJunctionInfo)) |
| | | { |
| | | var endLinkList = allLinkList?.Where(x => x.StartCode == endParter.Code || x.EndCode == endParter.Code && x.Code != _parter.Code).ToList(); |
| | | if (endLinkList != null && endLinkList.Count > 0) |
| | | { |
| | | endElementIds.AddRange(endLinkList.Select(x => x.Code)); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | endElementIds.Add(endParter.Code); |
| | | } |
| | | if (endElementIds.Count > 0) |
| | | { |
| | | await _bimfaceCtrl?.SetLinkEndComponentsColor(endElementIds); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Q3d |
| | | |
| | | //获取Q3d控件 |
| | | private XhsProjectSimulationQ3dCtrl GetQ3dCtrl() |
| | | { |
| | | if (_q3dCtrl == null) |
| | | { |
| | | _q3dCtrl = new XhsProjectSimulationQ3dCtrl(); |
| | | _q3dCtrl.Dock = DockStyle.Fill; |
| | | _q3dCtrl.SelectedPartersChangedEvent += (obj) => |
| | | _q3dCtrl.InitialData(() => _hydroInfo); |
| | | _q3dCtrl.SelectedPartersChangedEvent += (codes) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _parter = allParterList?.Find(x => x.Code == obj?.FirstOrDefault()); |
| | | ShowProperty(); |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visuals = visualListHelper.GetVisualList(codes); |
| | | SelectVisual(visuals?.LastOrDefault(), eSimulationVisualSource.Q3d); |
| | | }; |
| | | } |
| | | return _q3dCtrl; |
| | | } |
| | | |
| | | //Q3d控件 |
| | | private XhsProjectSimulationQ3dCtrl _q3dCtrl = null; |
| | | //显示 Q3d 控件 |
| | | private void ShowQ3dCtrl() |
| | | { |
| | | var q3dCtrl = GetQ3dCtrl(); |
| | | this.tabPageQ3d.Controls.Clear(); |
| | | this.tabPageQ3d.Controls.Add(q3dCtrl); |
| | | } |
| | | |
| | | #endregion Q3d |
| | | #endregion Q3d控件 |
| | | |
| | | #region 属性面板 |
| | | #region 属性控件 |
| | | |
| | | //属性控件 |
| | | private XhsProjectSimulationPropertyCtrl _propertyCtrl = null; |
| | | private SimulationPropertyCtrl _propertyCtrl = null; |
| | | |
| | | //获取属性控件 |
| | | private XhsProjectSimulationPropertyCtrl GetPropertyCtrl() |
| | | private async Task<SimulationPropertyCtrl> GetPropertyCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_propertyCtrl == null) |
| | | { |
| | | _propertyCtrl = new XhsProjectSimulationPropertyCtrl(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | _propertyCtrl = new SimulationPropertyCtrl(); |
| | | _propertyCtrl.Dock = DockStyle.Fill; |
| | | _propertyCtrl.InitialData(() => _hydroInfo, () => GetAllCalcuResult()); |
| | | _propertyCtrl.BlinkLinkParterEvent += async (code, linkCode) => |
| | | { //强调连接组件 |
| | | if (string.IsNullOrEmpty(code)) |
| | | _propertyCtrl.AllowEdit = true; |
| | | _propertyCtrl.InitialData(changeHelper, propStatusHelper); |
| | | _propertyCtrl.CalcuResult = () => GetCalcuResult(); |
| | | _propertyCtrl.HydroViewEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Property); |
| | | }; |
| | | _propertyCtrl.BlinkLinkNodeEvent += async (link, linkNodeCode) => |
| | | { //强调连接节点 |
| | | if (link == null) |
| | | { |
| | | return; |
| | | } |
| | | if (string.IsNullOrEmpty(linkCode)) |
| | | { |
| | | return; |
| | | } |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualList = _hydroInfo.GetAllVisuals(); |
| | | if (allVisualList == null || allVisualList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var linkParter = allVisualList.Find(x => x.Code == linkCode); |
| | | if (linkParter == null) |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var linkNode = visualListHelper.GetVisual(linkNodeCode); |
| | | if (linkNode == null) |
| | | { |
| | | return; |
| | | } |
| | | var blinkCodes = new List<string>(); |
| | | if (linkParter.GetType() == typeof(Yw.Model.HydroJunctionInfo)) |
| | | if (linkNode.GetType() == typeof(HydroJunctionInfo)) |
| | | { |
| | | var allLinkList = _hydroInfo.GetAllLinks(); |
| | | var allLinkList = visualListHelper.GetLinkList(); |
| | | if (allLinkList == null || allLinkList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var linkList = allLinkList.Where(x => (x.StartCode == linkParter.Code || x.EndCode == linkParter.Code) && x.Code != code).ToList(); |
| | | var linkList = allLinkList.Where(x => (x.StartCode == linkNodeCode || x.EndCode == linkNodeCode) && x.Code != link.Code).ToList(); |
| | | if (linkList == null || linkList.Count < 1) |
| | | { |
| | | return; |
| | |
| | | } |
| | | else |
| | | { |
| | | blinkCodes.Add(linkCode); |
| | | blinkCodes.Add(linkNodeCode); |
| | | } |
| | | |
| | | await _bimfaceCtrl?.ClearBlinkComponents(); |
| | | await _bimfaceCtrl?.SetBlinkComponents(blinkCodes); |
| | | await Task.Delay(5000); |
| | | await _bimfaceCtrl?.ClearBlinkComponents(); |
| | | }; |
| | | _propertyCtrl.PropertyValueChangedEvent += async (visual) => |
| | | { |
| | | if (visual == null) |
| | | { |
| | | return; |
| | | } |
| | | UpdateVisualListCtrl(); |
| | | var gradingHelper = await GetGradingHelper(); |
| | | gradingHelper.Set(); |
| | | }; |
| | | _propertyCtrl.MarkPropertyValueChangedEvent += async (visual) => |
| | | { |
| | | //标注属性发生改变 |
| | | //判断当前是否有标注展示,若有则更新标注,最好是更新单个标注 |
| | | var markHelper = await GetMarkHelper(); |
| | | markHelper.Set(visual); |
| | | }; |
| | | _propertyCtrl.GradingPropertyValueChangedEvent += async (visual) => |
| | | { |
| | | //分级属性发生改变 |
| | | //判断当前是否有分级展示,若有则更新分级,最好是更新单个分级 |
| | | var gradingHelper = await GetGradingHelper(); |
| | | gradingHelper.Set(visual); |
| | | }; |
| | | } |
| | | return _propertyCtrl; |
| | | } |
| | | |
| | | //显示属性面板 |
| | | private void ShowPropertyCtrl() |
| | | //属性控件是否可见 |
| | | private bool IsPropertyCtrlVisible |
| | | { |
| | | var propertyCtrl = GetPropertyCtrl(); |
| | | get |
| | | { |
| | | if (this.docPnlRight.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | if (this.controlContainerRight.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerRight.Controls[0] is SimulationPropertyCtrl) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //显示属性控件 |
| | | private async void ShowPropertyCtrl() |
| | | { |
| | | if (IsPropertyCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | | var propertyCtrl = await GetPropertyCtrl(); |
| | | this.controlContainerRight.Controls.Clear(); |
| | | this.controlContainerRight.Controls.Add(propertyCtrl); |
| | | this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | |
| | | this.docPnlRight.Width = 300; |
| | | } |
| | | |
| | | //属性面板按钮 |
| | | private void barBtnProperty_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //设置属性控件 |
| | | private void SetPropertyCtrl(HydroVisualInfo visual) |
| | | { |
| | | ShowPropertyCtrl(); |
| | | var visualVmListHelper = GetVisualVmListHelper(); |
| | | var vm = visualVmListHelper.GetVisual(visual); |
| | | _propertyCtrl.SelectedObject = vm; |
| | | _propertyCtrl.UpdateRows(); |
| | | } |
| | | |
| | | //显示属性 |
| | | private void ShowProperty() |
| | | //更新属性控件 |
| | | private void UpdatePropertyCtrl() |
| | | { |
| | | _propertyCtrl?.UpdateRows(); |
| | | } |
| | | |
| | | #endregion 属性控件 |
| | | |
| | | #region 选择构件 |
| | | |
| | | //选择构件 |
| | | private Yw.Model.HydroVisualInfo _visual = null; |
| | | |
| | | //选择构件 |
| | | private void SelectVisual(HydroVisualInfo visual, eSimulationVisualSource source) |
| | | { |
| | | _visual = visual; |
| | | switch (source) |
| | | { |
| | | case eSimulationVisualSource.None: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitorList.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | |
| | | case eSimulationVisualSource.Bimface: |
| | | { |
| | | this.barBtnSetMonitorList.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | |
| | | case eSimulationVisualSource.Q3d: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitorList.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | |
| | | case eSimulationVisualSource.Property: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitorList.Enabled = visual != null; |
| | | } |
| | | break; |
| | | |
| | | case eSimulationVisualSource.List: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitorList.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | |
| | | case eSimulationVisualSource.Set: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitorList.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | |
| | | case eSimulationVisualSource.Search: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitorList.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | |
| | | case eSimulationVisualSource.Monitor: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitorList.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | |
| | | case eSimulationVisualSource.Check: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitorList.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | |
| | | case eSimulationVisualSource.Calcu: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitorList.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | |
| | | case eSimulationVisualSource.Warning: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitorList.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | |
| | | default: break; |
| | | } |
| | | } |
| | | |
| | | //选择构件 |
| | | private void SelectVisual(string code, eSimulationVisualSource source) |
| | | { |
| | | var visual = GetVisual(code); |
| | | SelectVisual(visual, source); |
| | | } |
| | | |
| | | #endregion 选择构件 |
| | | |
| | | #region 构件明细 |
| | | |
| | | #region 可见列表 |
| | | |
| | | //可见列表辅助类 |
| | | private SimulationVisualListHelper _visualListHelper = null; |
| | | |
| | | //获取可见列表辅助类 |
| | | private SimulationVisualListHelper GetVisualListHelper() |
| | | { |
| | | if (_visualListHelper == null) |
| | | { |
| | | _visualListHelper = new SimulationVisualListHelper(); |
| | | _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 可见列表 |
| | | |
| | | #region 视图列表 |
| | | |
| | | //可见视图列表辅助类 |
| | | private SimulationVisualVmListHelper _visualVmListHelper = null; |
| | | |
| | | //获取可见视图列表辅助类 |
| | | private SimulationVisualVmListHelper GetVisualVmListHelper() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | return default; |
| | | } |
| | | if (this.docPnlRight.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Hidden) |
| | | if (_visualVmListHelper == null) |
| | | { |
| | | ShowPropertyCtrl(); |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var calcuResultHelper = GetCalcuResultHelper(); |
| | | _visualVmListHelper = new SimulationVisualVmListHelper(visualListHelper, calcuResultHelper); |
| | | } |
| | | return _visualVmListHelper; |
| | | } |
| | | |
| | | if (_parter == null) |
| | | { |
| | | _propertyCtrl?.SelectParter(null); |
| | | return; |
| | | } |
| | | //获取可见视图列表 |
| | | private List<HydroVisualViewModel> GetVisualViewModelList() |
| | | { |
| | | var helper = GetVisualVmListHelper(); |
| | | return helper.GetVisualList(); |
| | | } |
| | | |
| | | _propertyCtrl?.SelectParter(_parter.Code); |
| | | if (_calcuResult != null) |
| | | //获取可见视图 |
| | | private HydroVisualViewModel GetVisualViewModel(string code) |
| | | { |
| | | var helper = GetVisualVmListHelper(); |
| | | return helper.GetVisual(code); |
| | | } |
| | | |
| | | #endregion 视图列表 |
| | | |
| | | #region 明细控件 |
| | | |
| | | //构件明细控件 |
| | | private Yw.WinFrmUI.HydroVisualListCtrl _visualListCtrl = null; |
| | | |
| | | //获取构件明细控件 |
| | | private Yw.WinFrmUI.HydroVisualListCtrl GetVisualListCtrl() |
| | | { |
| | | if (_visualListCtrl == null) |
| | | { |
| | | if (_calcuResult.Succeed) |
| | | _visualListCtrl = new HydroVisualListCtrl(); |
| | | _visualListCtrl.Dock = DockStyle.Fill; |
| | | _visualListCtrl.HydroClickInfoEvent += (visual) => |
| | | { |
| | | var allCalcuParterList = _calcuResult.GetParterList(); |
| | | var calcuParter = allCalcuParterList.Find(x => x.Id == _parter.Code); |
| | | if (calcuParter != null) |
| | | { |
| | | IHydroCalcuResult calcuProperty = null; |
| | | if (calcuParter is Yw.EPAnet.CalcuNode calcuNode) |
| | | { |
| | | var calcuNodeProperty = new Yw.WinFrmUI.HydroCalcuNodeResult(); |
| | | calcuNodeProperty.Code = _parter.Code; |
| | | calcuNodeProperty.CalcuPress = calcuNode.Press; |
| | | calcuNodeProperty.CalcuDemand = calcuNode.Demand; |
| | | calcuNodeProperty.CalcuHead = calcuNode.Head; |
| | | calcuProperty = calcuNodeProperty; |
| | | } |
| | | else if (calcuParter is Yw.EPAnet.CalcuLink calcuLink) |
| | | { |
| | | var calcuLinkProperty = new Yw.WinFrmUI.HydroCalcuLinkResult(); |
| | | calcuLinkProperty.Code = _parter.Code; |
| | | calcuLinkProperty.CalcuHeadLoss = calcuLink.Headloss; |
| | | calcuLinkProperty.CalcuFlow = calcuLink.Flow; |
| | | calcuLinkProperty.CalcuVelocity = calcuLink.Velocity; |
| | | calcuProperty = calcuLinkProperty; |
| | | } |
| | | SelectVisual(visual, eSimulationVisualSource.List); |
| | | }; |
| | | _visualListCtrl.HydroChangedInfoEvent += (visualList) => |
| | | { |
| | | SelectVisual(_visual, eSimulationVisualSource.List); |
| | | }; |
| | | } |
| | | return _visualListCtrl; |
| | | } |
| | | |
| | | if (calcuProperty != null) |
| | | //构件明细控件是否可见 |
| | | private bool IsVisualListCtrlVisible |
| | | { |
| | | get |
| | | { |
| | | if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | if (this.controlContainerBottom.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerBottom.Controls[0] is HydroVisualListCtrl) |
| | | { |
| | | _propertyCtrl?.UpdateCalcuProperty(calcuProperty); |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 自动匹配 |
| | | |
| | | //获取匹配列表控件 |
| | | private XhsProjectSimulationMatchingListCtrl GetMatchingListCtrl() |
| | | { |
| | | if (_matchingListCtrl == null) |
| | | { |
| | | _matchingListCtrl = new XhsProjectSimulationMatchingListCtrl(); |
| | | _matchingListCtrl.Dock = DockStyle.Fill; |
| | | _matchingListCtrl.HydroClickEvent += async (code) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _parter = allParterList?.Find(x => x.Code == code); |
| | | var elementIds = new List<string>(); |
| | | if (_parter != null) |
| | | { |
| | | elementIds.Add(_parter.Code); |
| | | } |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowProperty(); |
| | | SetBimfaceLinkColor(); |
| | | }; |
| | | _matchingListCtrl.ApplyMatchingEvent += (output) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return false; |
| | | } |
| | | return AssetsMatchingParasHelper.Apply(_hydroInfo, output); |
| | | }; |
| | | } |
| | | return _matchingListCtrl; |
| | | } |
| | | |
| | | //匹配列表控件 |
| | | private XhsProjectSimulationMatchingListCtrl _matchingListCtrl = null; |
| | | |
| | | //自动匹配 |
| | | private void barBtnMatchingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //显示构件明细控件 |
| | | private async void ShowVisualListCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | var matchingListCtrl = GetMatchingListCtrl(); |
| | | var input = AssetsMatchingParasHelper.Create(_hydroInfo, GetAllCalcuResult()); |
| | | matchingListCtrl.SetBindingData(input); |
| | | this.controlContainerBottom.Controls.Add(matchingListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "匹配列表"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | |
| | | #endregion 自动匹配 |
| | | |
| | | #region 未匹配列表 |
| | | |
| | | //获取未匹配列表控件 |
| | | private XhsProjectSimulationUnMatchingListCtrl GetUnMatchingListCtrl() |
| | | { |
| | | if (_unMatchingListCtrl == null) |
| | | var visualListCtrl = GetVisualListCtrl(); |
| | | if (!IsVisualListCtrlVisible) |
| | | { |
| | | _unMatchingListCtrl = new XhsProjectSimulationUnMatchingListCtrl(); |
| | | _unMatchingListCtrl.Dock = DockStyle.Fill; |
| | | _unMatchingListCtrl.HydroClickEvent += async (parter) =>//行点击 |
| | | { |
| | | if (parter == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _parter = allParterList?.Find(x => x.Code == parter.Code); |
| | | var elementIds = new List<string>() { parter.Code }; |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowProperty(); |
| | | SetBimfaceLinkColor(); |
| | | }; |
| | | _unMatchingListCtrl.ViewModelEvent += async (parters) =>//查看模型 |
| | | { |
| | | var codes = parters?.Select(x => x.Code).Distinct().ToList(); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(codes); |
| | | _parter = null; |
| | | ShowProperty(); |
| | | }; |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(visualListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "构件明细"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | return _unMatchingListCtrl; |
| | | } |
| | | |
| | | private XhsProjectSimulationUnMatchingListCtrl _unMatchingListCtrl = null;//未匹配列表 |
| | | |
| | | //未匹配列表 |
| | | private void barBtnUnMatchingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | var visualVmListHelper = GetVisualVmListHelper(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var allVisualVmList = visualVmListHelper.GetVisualList(); |
| | | visualListCtrl.SetBindingData(allVisualVmList, changeHelper, propStatusHelper); |
| | | var calcuResult = GetCalcuResult(); |
| | | if (calcuResult != null && calcuResult.Succeed) |
| | | { |
| | | return; |
| | | } |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | var unMatchingListCtrl = GetUnMatchingListCtrl(); |
| | | unMatchingListCtrl.SetBindingData(_hydroInfo); |
| | | this.controlContainerBottom.Controls.Add(unMatchingListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "未匹配列表"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | |
| | | #endregion 未匹配列表 |
| | | |
| | | #region 一键显隐 |
| | | |
| | | //一键显隐 |
| | | private async Task FastShowHidden() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_hydroInfo.Decorators == null || _hydroInfo.Decorators.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | if (_fastShowHiddenCodeList == null) |
| | | { |
| | | _fastShowHiddenCodeList = _hydroInfo.Decorators.Select(x => x.Code).ToList(); |
| | | await _bimfaceCtrl?.HideComponents(_fastShowHiddenCodeList); |
| | | visualListCtrl.SetCalcuView(); |
| | | } |
| | | else |
| | | { |
| | | await _bimfaceCtrl?.ShowComponents(_fastShowHiddenCodeList); |
| | | _fastShowHiddenCodeList = null; |
| | | visualListCtrl.SetNormalView(); |
| | | } |
| | | } |
| | | |
| | | //显隐编码列表 |
| | | private List<string> _fastShowHiddenCodeList = null; |
| | | |
| | | //触发一键显隐 |
| | | private async void barBtnFastShowHidden_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //更新构件明细控件 |
| | | private void UpdateVisualListCtrl() |
| | | { |
| | | await FastShowHidden(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 水力校验 |
| | | |
| | | //校验控件 |
| | | private XhsProjectSimulationHydroCheckResultCtrl _checkCtrl = null; |
| | | |
| | | //获取校验控件 |
| | | private XhsProjectSimulationHydroCheckResultCtrl GetCheckCtrl() |
| | | { |
| | | if (_checkCtrl == null) |
| | | { |
| | | _checkCtrl = new XhsProjectSimulationHydroCheckResultCtrl(); |
| | | _checkCtrl.Dock = DockStyle.Fill; |
| | | _checkCtrl.HydroClickEvent += async (code) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var elementIds = new List<string>(); |
| | | if (string.IsNullOrEmpty(code)) |
| | | { |
| | | _parter = null; |
| | | } |
| | | else |
| | | { |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _parter = allParterList?.Find(x => x.Code == code); |
| | | if (_parter != null) |
| | | { |
| | | elementIds.Add(_parter.Code); |
| | | } |
| | | } |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowProperty(); |
| | | SetBimfaceLinkColor(); |
| | | }; |
| | | } |
| | | return _checkCtrl; |
| | | } |
| | | |
| | | //显示校验控件 |
| | | private void ShowCheckCtrl() |
| | | { |
| | | if (_checkResult == null) |
| | | if (!IsVisualListCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | | var checkCtrl = GetCheckCtrl(); |
| | | checkCtrl.SetBindingData(_checkResult); |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(checkCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "校验结果"; |
| | | this.docPnlBottom.Height = 350; |
| | | |
| | | _visualListCtrl?.UpdateBindingData(); |
| | | var calcuResult = GetCalcuResult(); |
| | | if (calcuResult != null && calcuResult.Succeed) |
| | | { |
| | | _visualListCtrl.SetCalcuView(); |
| | | } |
| | | else |
| | | { |
| | | _visualListCtrl.SetNormalView(); |
| | | } |
| | | } |
| | | |
| | | //水力验证 |
| | | private void barBtnHydroCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //构件明细 |
| | | private void barBtnVisualList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowVisualListCtrl(); |
| | | } |
| | | |
| | | #endregion 明细控件 |
| | | |
| | | #region 构件显示 |
| | | |
| | | //构件可见辅助类 |
| | | private SimulationVisualVisibleHelper _visualVisibleHelper = null; |
| | | |
| | | //获取构件可见辅助类 |
| | | private async Task<SimulationVisualVisibleHelper> GetVisualVisibleHelper() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_visualVisibleHelper == null) |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var bimfaceCtrl = await GetBimfaceCtrl(); |
| | | _visualVisibleHelper = new SimulationVisualVisibleHelper(visualListHelper, bimfaceCtrl); |
| | | _visualVisibleHelper.InitialData(_hydroInfo); |
| | | } |
| | | return _visualVisibleHelper; |
| | | } |
| | | |
| | | //设置构件可见性 |
| | | private async void SetVisualVisible() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | _checkResult = _hydroInfo.Check(); |
| | | ShowCheckCtrl(); |
| | | var visualVisibleHelper = await GetVisualVisibleHelper(); |
| | | var allVisibleList = visualVisibleHelper.Items; |
| | | var dlg = new SetHydroVisualVisibleDlg(); |
| | | dlg.SetBindingData(allVisibleList); |
| | | dlg.ReloadDataEvent += (list) => |
| | | { |
| | | visualVisibleHelper.Items = list; |
| | | visualVisibleHelper.Set(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | #endregion 水力校验 |
| | | //设置构件显示 |
| | | private void barBtnSetVisualVisible_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | SetVisualVisible(); |
| | | } |
| | | |
| | | #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 = await GetDecoratorCodes(); |
| | | if (isDecoratorVisible) |
| | | { |
| | | await _bimfaceCtrl?.ShowComponents(codes); |
| | | } |
| | | else |
| | | { |
| | | await _bimfaceCtrl?.HideComponents(codes); |
| | | } |
| | | } |
| | | |
| | | //设置 |
| | | private void barCkDecorator_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | SetDecoratorVisible(this.barCkDecorator.Checked); |
| | | } |
| | | |
| | | #endregion 一键显隐 |
| | | |
| | | #region 保存信息 |
| | | |
| | | //保存锁定对象 |
| | | private object _locker_save = new(); |
| | | |
| | | private bool _isSaving = false;//正在保存 |
| | | |
| | | //保存 |
| | | private async void barBtnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | |
| | | { |
| | | return; |
| | | } |
| | | var id = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.Save(_hydroInfo); |
| | | if (id < 1) |
| | | |
| | | lock (_locker_save) |
| | | { |
| | | TipFormHelper.ShowError("保存失败!"); |
| | | return; |
| | | } |
| | | _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(id); |
| | | TipFormHelper.ShowSucceed("保存成功!"); |
| | | } |
| | | |
| | | #endregion 保存水力信息 |
| | | |
| | | #region 构件明细 |
| | | |
| | | //构件明细控件 |
| | | private Yw.WinFrmUI.HydroParterListCtrl _parterListCtrl = null; |
| | | |
| | | //获取构件明细控件 |
| | | private Yw.WinFrmUI.HydroParterListCtrl GetParterListCtrl() |
| | | { |
| | | if (_parterListCtrl == null) |
| | | { |
| | | _parterListCtrl = new HydroParterListCtrl(); |
| | | _parterListCtrl.Dock = DockStyle.Fill; |
| | | _parterListCtrl.HydroClickEvent += async (parter) => |
| | | if (_isSaving) |
| | | { |
| | | if (_hydroInfo == null) |
| | | this.FindForm().ShowAlertInfo("保存", "正在保存,请稍后重试!"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | _isSaving = true; |
| | | |
| | | var changeHelper = GetChangeHelper(); |
| | | |
| | | var addParterList = changeHelper.GetAddParterList(); |
| | | var updateParterList = changeHelper.GetUpdateParterList(); |
| | | var removeParters = changeHelper.GetRemoveParters(); |
| | | |
| | | if (addParterList == null || addParterList.Count < 1) |
| | | { |
| | | if (updateParterList == null || updateParterList.Count < 1) |
| | | { |
| | | if (removeParters == null || removeParters.Count < 1) |
| | | { |
| | | TipFormHelper.ShowWarn("未检测到修改,无需保存!"); |
| | | _isSaving = false; |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _parter = allParterList?.Find(x => x.Code == parter.Code); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(new List<string>() { _parter.Code }); |
| | | ShowProperty(); |
| | | SetBimfaceLinkColor(); |
| | | }; |
| | | } |
| | | } |
| | | return _parterListCtrl; |
| | | } |
| | | |
| | | //显示构件明细控件 |
| | | private void ShowParterListCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | WaitFormHelper.ShowWaitForm("正在保存,请稍后..."); |
| | | |
| | | bool bol = false; |
| | | |
| | | try |
| | | { |
| | | bol = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance |
| | | .Update(_hydroInfo, addParterList, updateParterList, removeParters); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | XtraMessageBox.Show(ex.Message); |
| | | _isSaving = false; |
| | | } |
| | | |
| | | if (!bol) |
| | | { |
| | | WaitFormHelper.HideWaitForm(); |
| | | TipFormHelper.ShowError("水力信息更新失败!"); |
| | | _isSaving = false; |
| | | return; |
| | | } |
| | | var parterListCtrl = GetParterListCtrl(); |
| | | parterListCtrl.SetBindingData(_hydroInfo, GetAllCalcuResult()); |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(parterListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "构件明细"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | changeHelper.Reset(); |
| | | |
| | | //构件明细 |
| | | private void barBtnHydroParterList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowParterListCtrl(); |
| | | } |
| | | |
| | | #endregion 构件明细 |
| | | |
| | | #region INP导出 |
| | | |
| | | //导出水力INP文件 |
| | | private void barBtnHydroExportInp_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var updatePropStatusList = propStatusHelper.GetUpdatePropStatusDbList(); |
| | | if (updatePropStatusList != null && updatePropStatusList.Count > 0) |
| | | { |
| | | return; |
| | | bol = await BLLFactory<Yw.BLL.HydroParterPropStatusInfo>.Instance.Update(_hydroInfo.ID, updatePropStatusList); |
| | | if (!bol) |
| | | { |
| | | WaitFormHelper.HideWaitForm(); |
| | | TipFormHelper.ShowWarn("属性状态更新失败!"); |
| | | _isSaving = false; |
| | | return; |
| | | } |
| | | } |
| | | var fileName = Yw.WinFrmUI.FileDialogHelper.SaveInp("导出Inp文件"); |
| | | if (string.IsNullOrEmpty(fileName)) |
| | | { |
| | | return; |
| | | } |
| | | var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo); |
| | | var result = netWork.ToInpString(); |
| | | File.WriteAllText(fileName, result); |
| | | TipFormHelper.ShowSucceed("导出成功"); |
| | | propStatusHelper.Reset(); |
| | | |
| | | WaitFormHelper.HideWaitForm(); |
| | | TipFormHelper.ShowSucceed("保存成功!"); |
| | | _isSaving = false; |
| | | |
| | | //Stopwatch sw = new Stopwatch(); |
| | | //sw.Start(); |
| | | //耗时巨大的代码 |
| | | //sw.Stop(); |
| | | //TimeSpan ts2 = sw.Elapsed; |
| | | //Console.WriteLine("Stopwatch总共花费{0}ms.", ts2.TotalMilliseconds); |
| | | } |
| | | |
| | | #endregion INP导出 |
| | | #endregion 保存信息 |
| | | |
| | | #region 批量配置 |
| | | |
| | |
| | | private void RegistBulkSetEvents() |
| | | { |
| | | //水库 |
| | | this.barBtnSetReservoirList.ItemClick += delegate |
| | | this.barBtnSetReservoirList.ItemClick += async delegate |
| | | { |
| | | var dlg = new HydroReservoirBulkSetListDlg(); |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroReservoirListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //水池 |
| | | this.barBtnSetTankList.ItemClick += delegate |
| | | this.barBtnSetTankList.ItemClick += async delegate |
| | | { |
| | | var dlg = new HydroTankBulkSetListDlg(); |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroTankListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //水箱 |
| | | this.barBtnSetWaterboxList.ItemClick += delegate |
| | | this.barBtnSetWaterboxList.ItemClick += async delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroWaterboxListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new HydroWaterboxBulkSetListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //连接节点 |
| | | this.barBtnSetJunctionList.ItemClick += delegate |
| | | this.barBtnSetJunctionList.ItemClick += async delegate |
| | | { |
| | | var dlg = new HydroJunctionBulkSetListDlg(); |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroJunctionListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //闷头 |
| | | this.barBtnSetBluntheadList.ItemClick += delegate |
| | | this.barBtnSetBluntheadList.ItemClick += async delegate |
| | | { |
| | | var dlg = new HydroBluntheadBulkSetListDlg(); |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroBluntheadListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //弯头 |
| | | this.barBtnSetElbowsList.ItemClick += delegate |
| | | this.barBtnSetElbowsList.ItemClick += async delegate |
| | | { |
| | | var dlg = new HydroElbowBulkSetListDlg(); |
| | | var allVisualVmList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroElbowListDlg(); |
| | | dlg.SetBindingData(allVisualVmList, changeHelper, propStatusHelper); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //三通 |
| | | this.barBtnSetThreelinkList.ItemClick += delegate |
| | | this.barBtnSetThreelinkList.ItemClick += async delegate |
| | | { |
| | | var dlg = new HydroThreelinkBulkSetListDlg(); |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroThreelinkListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //四通 |
| | | this.barBtnSetFourlinkList.ItemClick += delegate |
| | | this.barBtnSetFourlinkList.ItemClick += async delegate |
| | | { |
| | | |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroFourlinkListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //水表 |
| | | this.barBtnSetMeterList.ItemClick += async delegate |
| | | { |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroMeterListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //流量计 |
| | | this.barBtnSetFlowmeterList.ItemClick += async delegate |
| | | { |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroFlowmeterListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //压力表 |
| | | this.barBtnSetPressmeterList.ItemClick += async delegate |
| | | { |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroPressmeterListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //喷嘴 |
| | | this.barBtnSetNozzleList.ItemClick += async delegate |
| | | { |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroNozzleListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //冷却塔 |
| | | this.barBtnSetCoolingList.ItemClick += async delegate |
| | | { |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroCoolingListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //管道 |
| | | this.barBtnSetPipeList.ItemClick += async delegate |
| | | { |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroPipeListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //过渡件 |
| | | this.barBtnSetTranslationList.ItemClick += async delegate |
| | | { |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroTranslationListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //水泵 |
| | | this.barBtnSetPumpList.ItemClick += async delegate |
| | | { |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroPumpListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //阀门 |
| | | this.barBtnSetValveList.ItemClick += async delegate |
| | | { |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroValveListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //换热器 |
| | | this.barBtnSetExchangerList.ItemClick += async delegate |
| | | { |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroExchangerListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Set); |
| | | }; |
| | | dlg.HydroChangedInfoEvent += visuals => |
| | | { |
| | | SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set); |
| | | UpdateVisualListCtrl(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | }; |
| | | //压缩机 |
| | | this.barBtnSetCompressorList.ItemClick += async delegate |
| | | { |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroCompressorListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); |
| | | 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 配置 |
| | | |
| | | #region 性能曲线 |
| | | |
| | | //性能曲线 |
| | | private void barBtnFeatCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | //if (_calcuResult == null) |
| | | //{ |
| | | // return; |
| | | //} |
| | | //if (!_calcuResult.Succeed) |
| | | //{ |
| | | // return; |
| | | //} |
| | | var pumps = _hydroInfo.Pumps?.Where(x => x.LinkStatus == Yw.Hydro.LinkStatus.Open).ToList(); |
| | | |
| | | var curve_list = _hydroInfo.Curves; |
| | | if (curve_list == null || !curve_list.Any()) |
| | | { |
| | | return; |
| | | } |
| | | var vmList = new List<Yw.WinFrmUI.Phart.PumpSerialParallelViewModel>(); |
| | | foreach (var x in pumps) |
| | | { |
| | | if (!x.RatedN.HasValue) |
| | | { |
| | | continue; |
| | | } |
| | | var qh = curve_list.Find(t => t.Code == x.CurveQH)?.CurveData; |
| | | var qe = curve_list.Find(t => t.Code == x.CurveQE)?.CurveData; |
| | | var qp = curve_list.Find(t => t.Code == x.CurveQP)?.CurveData; |
| | | |
| | | if (qh == null) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | var rated_speed = x.RatedN.Value; |
| | | var speed_ratio = x.SpeedRatio; |
| | | |
| | | var qh_pt_list = qh.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); |
| | | var qe_pt_list = qe?.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); |
| | | var qp_pt_list = qp?.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); |
| | | |
| | | var vm = new Yw.WinFrmUI.Phart.PumpSerialParallelViewModel(); |
| | | vm.Id = x.Code; |
| | | vm.Name = x.Name; |
| | | //vm.IsBp = ; |
| | | vm.RatedSpeed = rated_speed; |
| | | vm.CurrentSpeed = Math.Round(rated_speed * speed_ratio); |
| | | vm.CurrentHz = Math.Round(vm.CurrentSpeed / vm.RatedSpeed * 50, 1); |
| | | |
| | | vm.Qh = new Yw.Geometry.CubicSpline2d(qh_pt_list); |
| | | vm.Qe = new Yw.Geometry.CubicSpline2d(qe_pt_list); |
| | | vm.Qp = new Yw.Geometry.CubicSpline2d(qp_pt_list); |
| | | vmList.Add(vm); |
| | | } |
| | | |
| | | var dlg = new HStation.WinFrmUI.PhartRelation.PumpSerialParallelChartDlg(); |
| | | dlg.SetBindingData(vmList, null, true); |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 水力计算 |
| | | |
| | | //计算控件 |
| | | private SetHydroCalcuPrefixCtrl _calcuCtrl = null; |
| | | |
| | | //获取计算控件 |
| | | private SetHydroCalcuPrefixCtrl GetCalcuCtrl() |
| | | { |
| | | if (_calcuCtrl == null) |
| | | { |
| | | _calcuCtrl = new SetHydroCalcuPrefixCtrl(); |
| | | _calcuCtrl.Dock = DockStyle.Fill; |
| | | _calcuCtrl.InitialData(() => _hydroInfo); |
| | | _calcuCtrl.HydroViewEvent += async (parter) => |
| | | {//水力查看事件 |
| | | if (parter == null) |
| | | { |
| | | return; |
| | | } |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(new List<string>() { parter.Code }); |
| | | }; |
| | | _calcuCtrl.HydroCalcuEvent += async () => |
| | | {//水力计算事件 |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | //校验 |
| | | _checkResult = _hydroInfo.Check(); |
| | | if (!_checkResult.Succeed) |
| | | { |
| | | ShowCheckCtrl(); |
| | | TipFormHelper.ShowWarn("校验失败,请检查后重试"); |
| | | return; |
| | | } |
| | | |
| | | var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo); |
| | | _calcuResult = netWork.Calcu(); |
| | | if (_calcuResult.Succeed) |
| | | { |
| | | this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; |
| | | await _bimfaceCtrl?.SetLogicCalcuCustomLabels(_calcuResult); |
| | | TipFormHelper.ShowSucceed("计算成功!"); |
| | | } |
| | | else |
| | | { |
| | | _calcuCtrl.SetFailedList(_calcuResult.FailedList); |
| | | this.docPnlRight.Text = "失败原因"; |
| | | this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | TipFormHelper.ShowError("计算失败"); |
| | | } |
| | | }; |
| | | } |
| | | return _calcuCtrl; |
| | | } |
| | | |
| | | //获取计算结果 |
| | | private List<IHydroCalcuResult> GetAllCalcuResult() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_calcuResult == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (!_calcuResult.Succeed) |
| | | { |
| | | return default; |
| | | } |
| | | var list = new List<IHydroCalcuResult>(); |
| | | |
| | | var allNodeList = _hydroInfo.GetAllNodes(); |
| | | if (allNodeList != null && allNodeList.Count > 0) |
| | | { |
| | | var allCalcuNodeList = _calcuResult.NodeList; |
| | | if (allCalcuNodeList != null && allCalcuNodeList.Count > 0) |
| | | { |
| | | foreach (var node in allNodeList) |
| | | { |
| | | var calcuNode = allCalcuNodeList.Find(x => x.Id == node.Code); |
| | | if (calcuNode != null) |
| | | { |
| | | var calcuResult = new HydroCalcuNodeResult() |
| | | { |
| | | Code = node.Code, |
| | | CalcuPress = calcuNode.Press, |
| | | CalcuHead = calcuNode.Head, |
| | | CalcuDemand = calcuNode.Demand |
| | | }; |
| | | list.Add(calcuResult); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | var allListList = _hydroInfo.GetAllLinks(); |
| | | if (allListList != null && allListList.Count > 0) |
| | | { |
| | | var allCalcuLinkList = _calcuResult.LinkList; |
| | | if (allCalcuLinkList != null && allCalcuLinkList.Count > 0) |
| | | { |
| | | foreach (var link in allListList) |
| | | { |
| | | var calcuLink = allCalcuLinkList.Find(x => x.Id == link.Code); |
| | | if (calcuLink != null) |
| | | { |
| | | var calcuResult = new HydroCalcuLinkResult() |
| | | { |
| | | Code = link.Code, |
| | | CalcuFlow = calcuLink.Flow, |
| | | CalcuVelocity = calcuLink.Velocity, |
| | | CalcuHeadLoss = calcuLink.Headloss |
| | | }; |
| | | list.Add(calcuResult); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | //水力计算 |
| | | private void barBtnHydroCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var calcuPrefixCtrl = GetCalcuCtrl(); |
| | | calcuPrefixCtrl.SetBindingData(); |
| | | this.controlContainerRight.Controls.Clear(); |
| | | this.controlContainerRight.Controls.Add(calcuPrefixCtrl); |
| | | this.docPnlRight.Text = "前提条件"; |
| | | this.docPnlRight.Width = SetHydroCalcuPrefixCtrl.ControlMinWidth; |
| | | this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 批量配置 |
| | | |
| | | #region 构件查询 |
| | | |
| | | //查询组件 |
| | | private XhsProjectSimulationSearchCtrl _searchCtrl = null; |
| | | private HydroVisualSearchListCtrl _searchCtrl = null; |
| | | |
| | | //获取查询组件 |
| | | private XhsProjectSimulationSearchCtrl GetSearchCtrl() |
| | | private HydroVisualSearchListCtrl GetSearchCtrl() |
| | | { |
| | | if (_searchCtrl == null) |
| | | { |
| | | _searchCtrl = new XhsProjectSimulationSearchCtrl(); |
| | | var visualVmListHelper = GetVisualVmListHelper(); |
| | | var allVisualVmList = visualVmListHelper.GetVisualList(); |
| | | _searchCtrl = new HydroVisualSearchListCtrl(); |
| | | _searchCtrl.Dock = DockStyle.Fill; |
| | | _searchCtrl.InitialData(() => _hydroInfo); |
| | | _searchCtrl.ApplySearchEvent += async (list) => |
| | | _searchCtrl.InitialData(allVisualVmList); |
| | | _searchCtrl.HydroClickInfoEvent += (visual) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var elementIds = new List<string>(); |
| | | if (list != null && list.Count > 0) |
| | | { |
| | | var first = list.First(); |
| | | var allParterList = _hydroInfo.GetAllParters(); |
| | | _parter = allParterList?.Find(x => x.Code == first.Code); |
| | | list.ForEach(x => elementIds.Add(x.Code)); |
| | | } |
| | | else |
| | | { |
| | | _parter = null; |
| | | } |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowProperty(); |
| | | SetBimfaceLinkColor(); |
| | | SelectVisual(visual, eSimulationVisualSource.Check); |
| | | }; |
| | | _searchCtrl.HydroSearchInfoEvent += (list) => |
| | | { |
| | | var visual = list?.FirstOrDefault(); |
| | | SelectVisual(visual, eSimulationVisualSource.Search); |
| | | }; |
| | | } |
| | | return _searchCtrl; |
| | | } |
| | | |
| | | //显示查询控件 |
| | | private void ShowSearchCtrl() |
| | | //查询控件是否可见 |
| | | private bool IsSearchCtrlVisible |
| | | { |
| | | if (_hydroInfo == null) |
| | | get |
| | | { |
| | | if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | if (this.controlContainerBottom.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerBottom.Controls[0] is HydroVisualSearchListCtrl) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //显示查询控件 |
| | | private void ShowSearchCtrl(string content) |
| | | { |
| | | if (IsSearchCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | | var searchCtrl = GetSearchCtrl(); |
| | | searchCtrl.SetBindingData(content); |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(searchCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | |
| | | //显示查询窗体 |
| | | private void ShowSearchDlg() |
| | | { |
| | | if (IsSearchCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new InputHydroVisualSearchListDlg(); |
| | | dlg.SearchEvent += (content) => |
| | | { |
| | | if (string.IsNullOrEmpty(content)) |
| | | { |
| | | return; |
| | | } |
| | | ShowSearchCtrl(content); |
| | | }; |
| | | dlg.SetBindingData(); |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //查询 |
| | | private void barBtnSearch_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowSearchCtrl(); |
| | | ShowSearchDlg(); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 构件查询 |
| | | |
| | | #region 模型标注 |
| | | |
| | | //所有标注列表 |
| | | private List<HydroMarkSetViewModel> _allMarkList = null; |
| | | //标注辅助类 |
| | | private SimulationMarkHelper _markHelper = null; |
| | | |
| | | //显示标注窗体 |
| | | private async void ShowMarkDlg() |
| | | //获取标注辅助类 |
| | | private async Task<SimulationMarkHelper> GetMarkHelper() |
| | | { |
| | | if (_markHelper == null) |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var calcuResultHelper = GetCalcuResultHelper(); |
| | | var bimfaceCtrl = await GetBimfaceCtrl(); |
| | | _markHelper = new SimulationMarkHelper(visualListHelper, calcuResultHelper, bimfaceCtrl); |
| | | } |
| | | return _markHelper; |
| | | } |
| | | |
| | | //显示标注列表 |
| | | private async void ShowMarkList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_allMarkList == null) |
| | | { |
| | | _allMarkList = new List<HydroMarkSetViewModel>(); |
| | | if (_hydroInfo.Waterboxs != null && _hydroInfo.Waterboxs.Count > 0) |
| | | { |
| | | _allMarkList.Add(new HydroMarkSetViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Waterbox, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Waterbox), |
| | | MarkType = (int)eWaterboxMarkType.None |
| | | }); |
| | | } |
| | | if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0) |
| | | { |
| | | _allMarkList.Add(new HydroMarkSetViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Pump, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pump), |
| | | MarkType = (int)eWaterboxMarkType.None |
| | | }); |
| | | } |
| | | if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0) |
| | | { |
| | | _allMarkList.Add(new HydroMarkSetViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Valve, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Valve), |
| | | MarkType = (int)eWaterboxMarkType.None |
| | | }); |
| | | } |
| | | if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) |
| | | { |
| | | _allMarkList.Add(new HydroMarkSetViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Pipe, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pipe), |
| | | MarkType = (int)eWaterboxMarkType.None |
| | | }); |
| | | } |
| | | if (_hydroInfo.Nozzles != null && _hydroInfo.Nozzles.Count > 0) |
| | | { |
| | | _allMarkList.Add(new HydroMarkSetViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Nozzle, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Nozzle), |
| | | MarkType = (int)eWaterboxMarkType.None |
| | | }); |
| | | } |
| | | } |
| | | var markHelper = await GetMarkHelper(); |
| | | var dlg = new SetHydroMarkDlg(); |
| | | dlg.InitialData(() => _hydroInfo); |
| | | dlg.SetBindingData(_allMarkList); |
| | | dlg.ReloadDataEvent += async (allResultList) => |
| | | dlg.SetBindingData(markHelper.Sets); |
| | | dlg.ReloadDataEvent += (list) => |
| | | { |
| | | var leadLabels = allResultList?.Select(x => new LogicMarkLeadLabel(x.Code, x.Text)).ToList(); |
| | | await _bimfaceCtrl?.SetLogicMarkLeadLabels(leadLabels); |
| | | markHelper.Sets = list; |
| | | markHelper.Set(); |
| | | }; |
| | | if (dlg.ShowDialog() != DialogResult.OK) |
| | | { |
| | | await _bimfaceCtrl?.ClearLogicMarkLeadLabels(); |
| | | } |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //设置标注 |
| | | private void barBtnSetMark_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowMarkDlg(); |
| | | ShowMarkList(); |
| | | } |
| | | |
| | | #endregion |
| | | //是否显示 |
| | | private async void barCkMark_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var markHelper = await GetMarkHelper(); |
| | | markHelper.Visible = this.barCkMark.Checked; |
| | | markHelper.Set(); |
| | | } |
| | | |
| | | #endregion 模型标注 |
| | | |
| | | #region 颜色分级 |
| | | |
| | | private List<HydroGradingApplyViewModel> _allGradingApplyList = null; |
| | | private List<string> _allGradingCodeList = null; |
| | | //颜色分级辅助类 |
| | | private SimulationGradingHelper _gradingHelper = null; |
| | | |
| | | //设置 |
| | | private void barBtnGradingSet_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //获取颜色分级辅助类 |
| | | private async Task<SimulationGradingHelper> GetGradingHelper() |
| | | { |
| | | if (_hydroInfo == null) |
| | | if (_gradingHelper == null) |
| | | { |
| | | return; |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var calcuResultHelper = GetCalcuResultHelper(); |
| | | var bimfaceCtrl = await GetBimfaceCtrl(); |
| | | _gradingHelper = new SimulationGradingHelper(visualListHelper, calcuResultHelper, bimfaceCtrl); |
| | | } |
| | | var dlg = new SetHydroGradingModelDlg(); |
| | | dlg.SetBindingData(_hydroInfo.ID); |
| | | dlg.ShowDialog(); |
| | | return _gradingHelper; |
| | | } |
| | | |
| | | //应用 |
| | | private void barBtnGradingApply_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //设置颜色分级列表 |
| | | private async void SetGradingList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_allGradingApplyList == null) |
| | | var gradingHelper = await GetGradingHelper(); |
| | | var allGradingList = await gradingHelper.GetGradingList(); |
| | | var dlg = new SetHydroGradingTreeDlg(); |
| | | dlg.SetBindingData(_hydroInfo, allGradingList); |
| | | dlg.ReloadDataEvent += (list) => |
| | | { |
| | | _allGradingApplyList = new List<HydroGradingApplyViewModel>(); |
| | | if (_hydroInfo.Waterboxs != null && _hydroInfo.Waterboxs.Count > 0) |
| | | { |
| | | _allGradingApplyList.Add(new HydroGradingApplyViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Waterbox, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Waterbox), |
| | | PropName = string.Empty |
| | | }); |
| | | } |
| | | if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0) |
| | | { |
| | | _allGradingApplyList.Add(new HydroGradingApplyViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Pump, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pump), |
| | | PropName = string.Empty |
| | | }); |
| | | } |
| | | if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0) |
| | | { |
| | | _allGradingApplyList.Add(new HydroGradingApplyViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Valve, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Valve), |
| | | PropName = string.Empty |
| | | }); |
| | | } |
| | | if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) |
| | | { |
| | | _allGradingApplyList.Add(new HydroGradingApplyViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Pipe, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pipe), |
| | | PropName = string.Empty |
| | | }); |
| | | } |
| | | if (_hydroInfo.Nozzles != null && _hydroInfo.Nozzles.Count > 0) |
| | | { |
| | | _allGradingApplyList.Add(new HydroGradingApplyViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Nozzle, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Nozzle), |
| | | PropName = string.Empty |
| | | }); |
| | | } |
| | | } |
| | | var dlg = new ApplyHydroGradingDlg(); |
| | | dlg.SetBindingData(() => _hydroInfo, _allGradingApplyList, GetAllCalcuResult()); |
| | | dlg.ReloadDataEvent += (obj) => |
| | | gradingHelper.SetGradingList(list); |
| | | gradingHelper.Set(); |
| | | }; |
| | | dlg.ApplyDataEvent += (catalog, propName) => |
| | | { |
| | | _allGradingCodeList = obj?.Select(x => x.Code).Distinct().ToList(); |
| | | var objGroupList = obj?.GroupBy(x => x.Color).ToList(); |
| | | objGroupList.ForEach(async x => |
| | | { |
| | | await _bimfaceCtrl?.OverrideComponentsColor(x.Select(t => t.Code).Distinct().ToList(), x.Key, 1); |
| | | }); |
| | | gradingHelper.UpdateApply(catalog, propName); |
| | | gradingHelper.Set(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //取消 |
| | | private async void barBtnGradingCancel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //配置颜色分级 |
| | | private void barBtnSetGradingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | await _bimfaceCtrl?.RestoreComponentsColor(_allGradingCodeList); |
| | | SetGradingList(); |
| | | } |
| | | |
| | | //应用颜色分级列表 |
| | | private async void ApplyGradingList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var gradingHelper = await GetGradingHelper(); |
| | | var dlg = new ApplyHydroGradingDlg(); |
| | | dlg.SetBindingData(gradingHelper.Applies); |
| | | dlg.ReloadDataEvent += (list) => |
| | | { |
| | | gradingHelper.Applies = list; |
| | | gradingHelper.Set(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //应用颜色分级 |
| | | private void barBtnApplyGradingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ApplyGradingList(); |
| | | } |
| | | |
| | | //颜色分级展示 |
| | | private async void barCkGrading_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var gradingHelper = await GetGradingHelper(); |
| | | gradingHelper.Visible = this.barCkGrading.Checked; |
| | | gradingHelper.Set(); |
| | | } |
| | | |
| | | #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) |
| | | { |
| | | var hydroInfo = await this.RefreshModelEvent.Invoke(); |
| | | if (hydroInfo == null) |
| | | { |
| | | TipFormHelper.ShowError("刷新失败!"); |
| | | return; |
| | | } |
| | | _hydroInfo = hydroInfo; |
| | | SelectVisual(visual: null, eSimulationVisualSource.None); |
| | | |
| | | ResetVisualList(); |
| | | TipFormHelper.ShowSucceed("刷新成功!"); |
| | | } |
| | | } |
| | | |
| | | #endregion 人工刷新 |
| | | |
| | | #region 监测点 |
| | | |
| | | //监测点辅助类 |
| | | private SimulationMonitorHelper _monitorHelper = null; |
| | | |
| | | //获取监测点辅助类 |
| | | private SimulationMonitorHelper GetMonitorHelper() |
| | | { |
| | | if (_monitorHelper == null) |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | _monitorHelper = new SimulationMonitorHelper(visualListHelper); |
| | | } |
| | | return _monitorHelper; |
| | | } |
| | | |
| | | //获取监测点列表 |
| | | private async Task<List<HydroMonitorVmo>> GetMonitorList() |
| | | { |
| | | var helper = GetMonitorHelper(); |
| | | return await helper.GetAll(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 监测值 |
| | | |
| | | //监测值辅助类 |
| | | private SimulationMonitorValueHelper _monitorValueHelper = null; |
| | | |
| | | //获取监测值辅助类 |
| | | private SimulationMonitorValueHelper GetMonitorValueHelper() |
| | | { |
| | | if (_monitorValueHelper == null) |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var monitorHelper = GetMonitorHelper(); |
| | | _monitorValueHelper = new SimulationMonitorValueHelper(visualListHelper, monitorHelper); |
| | | } |
| | | return _monitorValueHelper; |
| | | } |
| | | |
| | | //获取监测值列表 |
| | | private async Task<List<HydroMonitorValueViewModel>> GetMonitorValueList() |
| | | { |
| | | var helper = GetMonitorValueHelper(); |
| | | return await helper.GetAll(); |
| | | } |
| | | |
| | | //重置监测值 |
| | | 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 SetMonitorList(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 dlg = new SetHydroMonitorListDlg(); |
| | | dlg.ReloadDataEvent += async (list) => |
| | | { |
| | | var monitorList = list?.Select(x => x.Vmo).ToList(); |
| | | await monitorHelper.Update(visual.Code, monitorList); |
| | | await monitorValueHelper.Update(visual.Code, list); |
| | | var monitorMarkerHelper = await GetMonitorMarkerHelper(); |
| | | monitorMarkerHelper.Set(); |
| | | }; |
| | | dlg.SetBindingData(_hydroInfo, visual, allMonitorList, allMonitorValueList); |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //设置测点列表 |
| | | private void barBtnSetMonitorList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_visual == null) |
| | | { |
| | | TipFormHelper.ShowWarn("请选择构件后重试!"); |
| | | return; |
| | | } |
| | | SetMonitorList(_visual); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 设置测值 |
| | | |
| | | //监测值列表控件 |
| | | private HydroMonitorValueListCtrl _monitorValueListCtrl = null; |
| | | |
| | | //获取监测值列表控件 |
| | | private HydroMonitorValueListCtrl GetMonitorValueListCtrl() |
| | | { |
| | | if (_monitorValueListCtrl == null) |
| | | { |
| | | _monitorValueListCtrl = new HydroMonitorValueListCtrl(); |
| | | _monitorValueListCtrl.Dock = DockStyle.Fill; |
| | | _monitorValueListCtrl.HydroViewEvent += (code) => |
| | | { |
| | | var visual = GetVisual(code); |
| | | SelectVisual(visual, eSimulationVisualSource.Monitor); |
| | | }; |
| | | } |
| | | return _monitorValueListCtrl; |
| | | } |
| | | |
| | | //监测值列表控件是否可见 |
| | | private bool IsMonitorValueListCtrlVisible |
| | | { |
| | | get |
| | | { |
| | | if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | if (this.controlContainerBottom.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerBottom.Controls[0] is HydroMonitorValueListCtrl) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //显示监测值列表控件 |
| | | private async void ShowMonitorValueListCtrl() |
| | | { |
| | | 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.Height = 350; |
| | | } |
| | | var allValueList = await GetMonitorValueList(); |
| | | monitorValueListCtrl.SetBindingData(allValueList); |
| | | } |
| | | |
| | | //设置测值 |
| | | private void barBtnSetMonitorValueList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowMonitorValueListCtrl(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 测点标记 |
| | | |
| | | //监测标记辅助类 |
| | | private SimulationMonitorMarkerHelper _monitorMarkerHelper = null; |
| | | |
| | | //获取监测标记辅助类 |
| | | private async Task<SimulationMonitorMarkerHelper> GetMonitorMarkerHelper() |
| | | { |
| | | if (_monitorMarkerHelper == null) |
| | | { |
| | | var monitorHelper = GetMonitorHelper(); |
| | | var bimfaceCtrl = await GetBimfaceCtrl(); |
| | | _monitorMarkerHelper = new SimulationMonitorMarkerHelper(monitorHelper, bimfaceCtrl); |
| | | } |
| | | return _monitorMarkerHelper; |
| | | } |
| | | |
| | | //测点显示状态改变 |
| | | private async void barCkMonitorVisible_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var monitorMarkerHelper = await GetMonitorMarkerHelper(); |
| | | monitorMarkerHelper.Visible = this.barCkMonitorVisible.Checked; |
| | | monitorMarkerHelper.Set(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 模型检查 |
| | | |
| | | //检查控件 |
| | | private HydroCheckResultCtrl _checkCtrl = null; |
| | | |
| | | //获取检查控件 |
| | | private HydroCheckResultCtrl GetCheckCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_checkCtrl == null) |
| | | { |
| | | _checkCtrl = new HydroCheckResultCtrl(); |
| | | _checkCtrl.Dock = DockStyle.Fill; |
| | | _checkCtrl.HydroClickEvent += (code) => |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visual = visualListHelper.GetVisual(code); |
| | | SelectVisual(visual, eSimulationVisualSource.Check); |
| | | }; |
| | | } |
| | | return _checkCtrl; |
| | | } |
| | | |
| | | //检查控件是否可见 |
| | | private bool IsCheckCtrlVisible |
| | | { |
| | | get |
| | | { |
| | | if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | if (this.controlContainerBottom.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerBottom.Controls[0] is HydroCheckResultCtrl) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //显示检查控件 |
| | | private void ShowCheckCtrl(HydroCheckResult checkResult) |
| | | { |
| | | if (checkResult == null) |
| | | { |
| | | return; |
| | | } |
| | | var checkCtrl = GetCheckCtrl(); |
| | | if (!IsCheckCtrlVisible) |
| | | { |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(checkCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "检查结果"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | checkCtrl.SetBindingData(checkResult); |
| | | } |
| | | |
| | | //显示检查控件 |
| | | private void ShowCheckCtrl() |
| | | { |
| | | var checkResult = GetCheckResult(); |
| | | ShowCheckCtrl(checkResult); |
| | | } |
| | | |
| | | //检查 |
| | | private void barBtnCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var checkResult = _hydroInfo.Check(); |
| | | ShowCheckCtrl(checkResult); |
| | | } |
| | | |
| | | #endregion 模型检查 |
| | | |
| | | #region 模型计算 |
| | | |
| | | #region 计算结果 |
| | | |
| | | //计算结果辅助类 |
| | | private SimulationCalcuResultHelper _calcuResultHelper = null; |
| | | |
| | | //获取计算结果辅助类 |
| | | private SimulationCalcuResultHelper GetCalcuResultHelper() |
| | | { |
| | | if (_calcuResultHelper == null) |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | _calcuResultHelper = new SimulationCalcuResultHelper(workingHelper); |
| | | } |
| | | return _calcuResultHelper; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 计算失败 |
| | | |
| | | //计算失败控件 |
| | | private HydroCalcuFailedCtrl _calcuFailedCtrl = null; |
| | | |
| | | //获取计算失败控件 |
| | | private HydroCalcuFailedCtrl GetCalcuFailedCtrl() |
| | | { |
| | | if (_calcuFailedCtrl == null) |
| | | { |
| | | _calcuFailedCtrl = new HydroCalcuFailedCtrl(); |
| | | _calcuFailedCtrl.Dock = DockStyle.Fill; |
| | | } |
| | | return _calcuFailedCtrl; |
| | | } |
| | | |
| | | //计算失败控件是否可见 |
| | | private bool IsCalcuFailedCtrlVisible |
| | | { |
| | | get |
| | | { |
| | | if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | if (this.controlContainerBottom.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerBottom.Controls[0] is HydroCalcuFailedCtrl) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //显示计算失败控件 |
| | | private void ShowCalcuFailedCtrl(HydroCalcuResult calcuResult) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (calcuResult == null) |
| | | { |
| | | return; |
| | | } |
| | | if (calcuResult.Succeed) |
| | | { |
| | | return; |
| | | } |
| | | var calcuFailedCtrl = GetCalcuFailedCtrl(); |
| | | if (!IsCalcuFailedCtrlVisible) |
| | | { |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(calcuFailedCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "计算失败原因"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | calcuFailedCtrl.SetBindingData(calcuResult.FailedList); |
| | | } |
| | | |
| | | #endregion 计算失败 |
| | | |
| | | #region 计算警告 |
| | | |
| | | //计算警告控件 |
| | | private HydroCalcuWarningCtrl _calcuWarningCtrl = null; |
| | | |
| | | //获取计算警告控件 |
| | | private HydroCalcuWarningCtrl GetCalcuWarningCtrl() |
| | | { |
| | | if (_calcuWarningCtrl == null) |
| | | { |
| | | _calcuWarningCtrl = new HydroCalcuWarningCtrl(); |
| | | _calcuWarningCtrl.Dock = DockStyle.Fill; |
| | | _calcuWarningCtrl.HydroClickEvent += (code) => |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visual = visualListHelper.GetVisual(code); |
| | | SelectVisual(visual, eSimulationVisualSource.Warning); |
| | | }; |
| | | } |
| | | return _calcuWarningCtrl; |
| | | } |
| | | |
| | | //计算警告控件是否可见 |
| | | private bool IsCalcuWarningCtrlVisible |
| | | { |
| | | get |
| | | { |
| | | if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | if (this.controlContainerBottom.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerBottom.Controls[0] is HydroCalcuWarningCtrl) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //显示计算警告控件 |
| | | private void ShowCalcuWarningCtrl(HydroCalcuResult calcuResult) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (calcuResult == null) |
| | | { |
| | | return; |
| | | } |
| | | if (!calcuResult.Succeed) |
| | | { |
| | | return; |
| | | } |
| | | var calcuWaringCtrl = GetCalcuWarningCtrl(); |
| | | if (!IsCalcuWarningCtrlVisible) |
| | | { |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(calcuWaringCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "计算警告"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var allVisualDict = visualListHelper.GetVisualDict(); |
| | | calcuWaringCtrl.SetBindingData(calcuResult.WainingList, allVisualDict); |
| | | } |
| | | |
| | | #endregion 计算警告 |
| | | |
| | | #region 计算标签 |
| | | |
| | | //计算标签辅助类 |
| | | private SimulationCalcuResultLabelHelper _calcuResultLabelHelper = null; |
| | | |
| | | //获取计算标签辅助类 |
| | | private async Task<SimulationCalcuResultLabelHelper> GetCalcuResultLabelHelper() |
| | | { |
| | | if (_calcuResultLabelHelper == null) |
| | | { |
| | | var calcuResultHelper = GetCalcuResultHelper(); |
| | | var bimfaceCtrl = await GetBimfaceCtrl(); |
| | | _calcuResultLabelHelper = new SimulationCalcuResultLabelHelper(calcuResultHelper, bimfaceCtrl); |
| | | } |
| | | return _calcuResultLabelHelper; |
| | | } |
| | | |
| | | //设置计算标签是否显示 |
| | | private async void barCkCalcu_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var calcuResultLabelHelper = await GetCalcuResultLabelHelper(); |
| | | calcuResultLabelHelper.Visible = this.barCkCalcu.Checked; |
| | | calcuResultLabelHelper.Set(); |
| | | } |
| | | |
| | | #endregion 计算标签 |
| | | |
| | | #endregion |
| | | |
| | | #region 导出INP |
| | | |
| | | //导出INP文件 |
| | | private void barBtnExportInp_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var fileName = FileDialogHelper.SaveInp("导出Inp文件"); |
| | | if (string.IsNullOrEmpty(fileName)) |
| | | { |
| | | return; |
| | | } |
| | | var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo); |
| | | var result = netWork.ToInpString(); |
| | | File.WriteAllText(fileName, result); |
| | | TipFormHelper.ShowSucceed("导出成功"); |
| | | } |
| | | |
| | | #endregion 导出INP |
| | | |
| | | #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() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var pumps = _hydroInfo.Pumps; |
| | | if (pumps == null || pumps.Count < 1) |
| | | { |
| | | XtraMessageBox.Show("无水泵信息"); |
| | | return; |
| | | } |
| | | 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.LinkStatus; |
| | | pump.SpeedRatio = x.SpeedRatio; |
| | | } |
| | | }); |
| | | 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 barBtnPumpParallel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | PumpParallel(); |
| | | } |
| | | |
| | | #endregion 水泵列表 |
| | | |
| | | #region 压力切换 |
| | | |
| | | //计算压力是否为绝对压力 |
| | | private bool _calcuPressModeIsHead = false; |
| | | |
| | | //计算结果压力切换 |
| | | private void barToggleSwitchPress_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | _calcuPressModeIsHead = !this.barToggleSwitchPress.Checked; |
| | | this.barToggleSwitchPress.Caption = _calcuPressModeIsHead ? "绝对压力" : "自由压力"; |
| | | var workingHelper = GetWorkingHelper(); |
| | | workingHelper.ResetResult(_calcuPressModeIsHead); |
| | | UpdateVisualListCtrl(); |
| | | UpdatePropertyCtrl(); |
| | | } |
| | | |
| | | #endregion 压力切换 |
| | | |
| | | #region 评价规则 |
| | | |
| | | //评价规则辅助类 |
| | | private SimulationEvaluationHelper _evaluationHelper = null; |
| | | |
| | | //获取评价规则辅助类 |
| | | private SimulationEvaluationHelper GetEvaluationHelper() |
| | | { |
| | | if (_evaluationHelper == null) |
| | | { |
| | | _evaluationHelper = new SimulationEvaluationHelper(_hydroInfo.ID); |
| | | } |
| | | return _evaluationHelper; |
| | | } |
| | | |
| | | //获取评价规则列表 |
| | | private async Task<List<Yw.Vmo.HydroEvaluationVmo>> GetEvaluationList() |
| | | { |
| | | var helper = GetEvaluationHelper(); |
| | | return await helper.GetEvaluationList(); |
| | | } |
| | | |
| | | //设置评价规则列表 |
| | | private void SetEvaluationList(List<Yw.Vmo.HydroEvaluationVmo> allEvaluationList) |
| | | { |
| | | var helper = GetEvaluationHelper(); |
| | | helper.SetEvaluationList(allEvaluationList); |
| | | } |
| | | |
| | | //显示评价窗体 |
| | | private void ShowEvaluationDlg() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var dlg = new SetHydroEvaluationModelDlg(); |
| | | dlg.SetBindingData(_hydroInfo.ID); |
| | | dlg.ReloadDataEvent += (rhs) => |
| | | { |
| | | SetEvaluationList(rhs); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //评价规则 |
| | | private void barBtnEvaluation_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowEvaluationDlg(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 水力计算 |
| | | |
| | | //计算 |
| | | private async void Calcu() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var workingCheckedListHelper = GetWorkingCheckedListHelper(); |
| | | var allWorkingList = workingCheckedListHelper.GetWorkingList(); |
| | | var monitorValueHelper = GetMonitorValueHelper(); |
| | | var allMonitorValueList = await monitorValueHelper.GetAll(); |
| | | var dlg = new SetHydroWorkingDlg(); |
| | | dlg.SetBindingData(_hydroInfo, allWorkingList, allMonitorValueList); |
| | | dlg.HydroViewEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.Calcu); |
| | | }; |
| | | dlg.HydroCalcuEvent += async (vm) => |
| | | { |
| | | _hydroInfo.UpdateWorkingInfo(vm.WorkingInfo); |
| | | allMonitorValueList.UpdateMonitorValue(vm.MonitorInfo); |
| | | |
| | | var hydroInfo = _hydroInfo.Adapt<Yw.Model.HydroModelInfo>(); |
| | | |
| | | var working = new HydroWorkingVmo(); |
| | | working.ModelID = vm.ModelID; |
| | | working.Name = vm.Name; |
| | | working.WorkingInfo = JsonHelper.Object2Json(vm.WorkingInfo); |
| | | 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; |
| | | |
| | | var workingHelper = GetWorkingHelper(); |
| | | //校验 |
| | | var checkResult = _hydroInfo.Check(); |
| | | if (!checkResult.Succeed) |
| | | { |
| | | ShowCheckCtrl(checkResult); |
| | | workingHelper.InitialData(hydroInfo, working, checkResult, null); |
| | | TipFormHelper.ShowError("校验失败,请检查后重试"); |
| | | return; |
| | | } |
| | | |
| | | var isHead = _calcuPressModeIsHead; |
| | | var allEvaluationList = await GetEvaluationList(); |
| | | |
| | | WaitFormHelper.ShowWaitForm(this, "正在计算分析中,请稍候..."); |
| | | await Task.Delay(3000); |
| | | var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss, isHead, allEvaluationList); |
| | | WaitFormHelper.HideWaitForm(); |
| | | workingHelper.InitialData(hydroInfo, working, checkResult, calcuResult); |
| | | if (calcuResult.Succeed) |
| | | { |
| | | if (calcuResult.WainingList != null && calcuResult.WainingList.Count > 0) |
| | | { |
| | | ShowCalcuWarningCtrl(calcuResult); |
| | | } |
| | | this.barBtnAddWorking.Enabled = true; |
| | | this.barBtnExportWord.Enabled = true; |
| | | TipFormHelper.ShowSucceed("计算成功!"); |
| | | } |
| | | else |
| | | { |
| | | ShowCalcuFailedCtrl(calcuResult); |
| | | TipFormHelper.ShowError("计算失败!"); |
| | | } |
| | | |
| | | #region 视图列表 |
| | | |
| | | var visualVmListHelper = GetVisualVmListHelper(); |
| | | visualVmListHelper.UpdateCalcuProperty(calcuResult); |
| | | |
| | | #endregion 视图列表 |
| | | |
| | | #region 当前构件 |
| | | |
| | | SelectVisual(_visual, eSimulationVisualSource.Calcu); |
| | | |
| | | #endregion 当前构件 |
| | | |
| | | #region 构件明细 |
| | | |
| | | UpdateVisualListCtrl(); |
| | | |
| | | #endregion 构件明细 |
| | | |
| | | #region 颜色分级 |
| | | |
| | | var gradingHelper = await GetGradingHelper(); |
| | | gradingHelper.Set(); |
| | | |
| | | #endregion 颜色分级 |
| | | |
| | | #region 计算标签 |
| | | |
| | | var calcuResultLabelHelper = await GetCalcuResultLabelHelper(); |
| | | calcuResultLabelHelper.Set(); |
| | | |
| | | #endregion 计算标签 |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //水力计算 |
| | | private void barBtnCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | Calcu(); |
| | | } |
| | | |
| | | #endregion 水力计算 |
| | | |
| | | #region 导出报告 |
| | | |
| | | //创建打印信息 |
| | | private async Task<SimulationPrintViewModel> CreatePrintInfo() |
| | | { |
| | | if (_project == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | #region 工况列表 |
| | | |
| | | var allWorkingList = GetCheckedWorkingList(); |
| | | if (allWorkingList == null || allWorkingList.Count < 1) |
| | | { |
| | | var working = GetWorking(); |
| | | if (working == null) |
| | | { |
| | | TipFormHelper.ShowWarn("请计算或选择工况后重试!"); |
| | | return default; |
| | | } |
| | | allWorkingList = new List<HydroWorkingVmo>() { working }; |
| | | } |
| | | |
| | | #endregion 工况列表 |
| | | |
| | | #region 选择节点 |
| | | |
| | | var selectedNode = GetSelectNode(); |
| | | if (selectedNode == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | #endregion 选择节点 |
| | | |
| | | var vm = new SimulationPrintViewModel(); |
| | | |
| | | #region 项目 |
| | | |
| | | vm.Project = new SimulationPrintProjectViewModel(_project); |
| | | if (_hydroInfo == null) |
| | | { |
| | | return vm; |
| | | } |
| | | |
| | | #endregion 项目 |
| | | |
| | | #region 水泵列表 |
| | | |
| | | vm.PumpList = _hydroInfo.Pumps?.Select(x => |
| | | { |
| | | var pump = new SimulationPrintPumpViewModel(x); |
| | | return pump; |
| | | }).ToList(); |
| | | |
| | | #endregion 水泵列表 |
| | | |
| | | #region 附加信息 |
| | | |
| | | var allMonitorList = await GetMonitorList(); |
| | | var allEvaluationList = await GetEvaluationList(); |
| | | |
| | | #endregion 附加信息 |
| | | |
| | | #region 基础模型 |
| | | |
| | | var baseHydroInfo = _hydroInfo; |
| | | if (_scheme != null) |
| | | { |
| | | baseHydroInfo = await GetModelEvent?.Invoke(null); |
| | | } |
| | | var baseHydroInfoRhs = baseHydroInfo.Adapt<Yw.Model.HydroModelInfo>(); |
| | | |
| | | #endregion 基础模型 |
| | | |
| | | #region 遍历工况 |
| | | |
| | | vm.WorkingList = new List<SimulationPrintWorkingViewModel>(); |
| | | foreach (var working in allWorkingList) |
| | | { |
| | | baseHydroInfoRhs.UpdateWorkingInfo(working.WorkingInfo); |
| | | var calcuResult = baseHydroInfoRhs.Calcu(Yw.EPAnet.CalcuMode.MinorLoss, _calcuPressModeIsHead, allEvaluationList); |
| | | |
| | | var printWorking = new SimulationPrintWorkingViewModel(working); |
| | | vm.WorkingList.Add(printWorking); |
| | | |
| | | //精度评估 |
| | | printWorking.Accuracy = HydroAccuracyHelper.Create(baseHydroInfoRhs, allMonitorList, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); |
| | | //水泵分析 |
| | | printWorking.PumpAnaly = HydroPumpAnalyHelper.Create(baseHydroInfoRhs, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); |
| | | //监测分析 |
| | | printWorking.MonitorAnaly = HydroMonitorAnalyHelper.Create(baseHydroInfoRhs, allMonitorList, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); |
| | | //能耗分析 |
| | | printWorking.EnergyAnaly = HydroEnergyAnalyHelper.Create(baseHydroInfoRhs, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); |
| | | //损失统计 |
| | | printWorking.LossStatistics = HydroLossStatisticsHelper.Create(baseHydroInfoRhs, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); |
| | | //损失曲线 |
| | | printWorking.LossCurve = HydroLossCurveHelper.Create(baseHydroInfoRhs, working, selectedNode, calcuResult, _calcuPressModeIsHead, allEvaluationList); |
| | | } |
| | | |
| | | #endregion 遍历工况 |
| | | |
| | | #region 方案处理 |
| | | |
| | | if (_scheme != null) |
| | | { |
| | | var hydroInfo = _hydroInfo; |
| | | var hydroInfoRhs = hydroInfo.Adapt<Yw.Model.HydroModelInfo>(); |
| | | vm.Scheme = new SimulationPrintSchemeViewModel(_scheme); |
| | | foreach (var working in allWorkingList) |
| | | { |
| | | hydroInfoRhs.UpdateWorkingInfo(working.WorkingInfo); |
| | | var calcuResult = hydroInfoRhs.Calcu(Yw.EPAnet.CalcuMode.MinorLoss, _calcuPressModeIsHead, allEvaluationList); |
| | | |
| | | var printWorking = new SimulationPrintWorkingViewModel(working); |
| | | vm.Scheme.WorkingList.Add(printWorking); |
| | | |
| | | //精度评估 |
| | | printWorking.Accuracy = HydroAccuracyHelper.Create(hydroInfoRhs, allMonitorList, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); |
| | | //水泵分析 |
| | | printWorking.PumpAnaly = HydroPumpAnalyHelper.Create(hydroInfoRhs, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); |
| | | //监测分析 |
| | | printWorking.MonitorAnaly = HydroMonitorAnalyHelper.Create(hydroInfoRhs, allMonitorList, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); |
| | | //能耗分析 |
| | | printWorking.EnergyAnaly = HydroEnergyAnalyHelper.Create(hydroInfoRhs, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); |
| | | //损失统计 |
| | | printWorking.LossStatistics = HydroLossStatisticsHelper.Create(hydroInfoRhs, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); |
| | | //损失曲线 |
| | | printWorking.LossCurve = HydroLossCurveHelper.Create(hydroInfoRhs, working, selectedNode, calcuResult, _calcuPressModeIsHead, allEvaluationList); |
| | | } |
| | | } |
| | | |
| | | #endregion 方案处理 |
| | | |
| | | return vm; |
| | | } |
| | | |
| | | //导出word |
| | | private async void barBtnExportWord_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var printInfo = await CreatePrintInfo(); |
| | | var printDlg = new HStation.WinFrmUI.SimulationCommonReportDlg(); |
| | | printDlg.SetBindingData(printInfo); |
| | | printDlg.ShowDialog(); |
| | | /* 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 当前工况 |
| | | |
| | | //工况辅助类 |
| | | private SimulationWorkingHelper _workingHelper = null; |
| | | |
| | | //获取工况辅助类 |
| | | private SimulationWorkingHelper GetWorkingHelper() |
| | | { |
| | | if (_workingHelper == null) |
| | | { |
| | | _workingHelper = new SimulationWorkingHelper(); |
| | | } |
| | | return _workingHelper; |
| | | } |
| | | |
| | | //获取工况 |
| | | private HydroWorkingVmo GetWorking() |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | return workingHelper.Working; |
| | | } |
| | | |
| | | //获取检查结果 |
| | | private HydroCheckResult GetCheckResult() |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | return workingHelper.CheckResult; |
| | | } |
| | | |
| | | //获取计算结果 |
| | | private HydroCalcuResult GetCalcuResult() |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | return workingHelper.CalcuResult; |
| | | } |
| | | |
| | | //新增工况 |
| | | private void AddWorking() |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (workingHelper.Working == null) |
| | | { |
| | | TipFormHelper.ShowWarn("尚未计算,请计算后重试!"); |
| | | return; |
| | | } |
| | | var dlg = new AddHydroWorkingDlg(); |
| | | dlg.SetBindingData(workingHelper.Working); |
| | | dlg.ReloadDataEvent += (rhs) => |
| | | { |
| | | this.barBtnAddWorking.Enabled = false; |
| | | workingHelper.ResetWorking(rhs); |
| | | UpdateWorkingCheckedList(rhs, false); |
| | | this.AppendWorkingEvent?.Invoke(rhs); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //增加工况 |
| | | private void barBtnAddWorking_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | AddWorking(); |
| | | } |
| | | |
| | | #endregion 当前工况 |
| | | |
| | | #region 选择工况 |
| | | |
| | | //工况选择列表辅助类 |
| | | private SimulationWorkingCheckedListHelper _workingCheckedListHelper = null; |
| | | |
| | | //获取工况元组辅助类 |
| | | private SimulationWorkingCheckedListHelper GetWorkingCheckedListHelper() |
| | | { |
| | | if (_workingCheckedListHelper == null) |
| | | { |
| | | _workingCheckedListHelper = new SimulationWorkingCheckedListHelper(); |
| | | _workingCheckedListHelper.InitialData(_allWorkingCheckedListDict); |
| | | } |
| | | return _workingCheckedListHelper; |
| | | } |
| | | |
| | | //获取工况字典 |
| | | private Dictionary<HydroWorkingVmo, bool> GetWorkingDict() |
| | | { |
| | | var helper = GetWorkingCheckedListHelper(); |
| | | return helper.GetWorkingDict(); |
| | | } |
| | | |
| | | //获取工况列表 |
| | | 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) |
| | | { |
| | | var helper = GetWorkingCheckedListHelper(); |
| | | helper.Update(working, hasChecked); |
| | | } |
| | | |
| | | //移除工况选择列表 |
| | | public void RemoveWorkingCheckedList(HydroWorkingVmo working) |
| | | { |
| | | var helper = GetWorkingCheckedListHelper(); |
| | | helper.Remove(working); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 重载工况选择列表 |
| | | /// </summary> |
| | | public void ReloadWorkingCheckedList(Dictionary<HydroWorkingVmo, bool> dict) |
| | | { |
| | | var helper = GetWorkingCheckedListHelper(); |
| | | helper.InitialData(dict); |
| | | } |
| | | |
| | | //管理工况 |
| | | private void barBtnMgrWorking_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var dict = GetWorkingDict(); |
| | | var dlg = new HydroWorkingMgrDlg(); |
| | | dlg.ReloadDataEvent += (dict) => |
| | | { |
| | | this.ReloadWorkingEvent?.Invoke(dict); |
| | | }; |
| | | dlg.UpdateDataEvent += (rhs) => |
| | | { |
| | | this.UpdateWorkingEvent?.Invoke(rhs); |
| | | }; |
| | | dlg.ApplyDataEvent += async (rhs) => |
| | | { |
| | | _hydroInfo.UpdateWorkingInfo(rhs.WorkingInfo); |
| | | var monitorValueHelper = GetMonitorValueHelper(); |
| | | var allMonitorValueList = await monitorValueHelper.GetAll(); |
| | | allMonitorValueList.UpdateMonitorValue(rhs.MonitorInfo); |
| | | var gradingHelper = await GetGradingHelper(); |
| | | gradingHelper.Set(); |
| | | }; |
| | | dlg.DeleteDataEvent += (rhs) => |
| | | { |
| | | this.RemoveWorkingEvent?.Invoke(rhs); |
| | | }; |
| | | dlg.SetBindingData(dict); |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | #endregion 选择工况 |
| | | |
| | | #region 监测分析 |
| | | |
| | | //监测分析列表控件 |
| | | private HydroMonitorAnalyListCtrl _monitorAnalyListCtrl = null; |
| | | |
| | | //获取监测分析列表控件 |
| | | private HydroMonitorAnalyListCtrl GetMonitorAnalyListCtrl() |
| | | { |
| | | if (_monitorAnalyListCtrl == null) |
| | | { |
| | | _monitorAnalyListCtrl = new HydroMonitorAnalyListCtrl(); |
| | | _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 HydroMonitorAnalyListCtrl) |
| | | { |
| | | 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 allMonitorList = await GetMonitorList(); |
| | | var isHead = _calcuPressModeIsHead; |
| | | var allEvaluationList = await GetEvaluationList(); |
| | | |
| | | if (allWorkingList == null || allWorkingList.Count < 1) |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | monitorAnalyListCtrl.SetBindingData(workingHelper.HydroInfo, allMonitorList, workingHelper.Working, workingHelper.CalcuResult, isHead, allEvaluationList); |
| | | } |
| | | else |
| | | { |
| | | monitorAnalyListCtrl.SetBindingData(_hydroInfo, allMonitorList, allWorkingList, isHead, allEvaluationList); |
| | | } |
| | | } |
| | | |
| | | //监测分析 |
| | | 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 HydroNodeInfo GetSelectNode() |
| | | { |
| | | if (_visual == null) |
| | | { |
| | | SelectInputSource(); |
| | | if (_visual == null) |
| | | { |
| | | TipFormHelper.ShowWarn("请选择构件后重试!"); |
| | | return null; |
| | | } |
| | | } |
| | | HydroVisualInfo visual = _visual; |
| | | if (_visual is HydroLinkInfo linkInfo) |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | visual = visualListHelper.GetVisual(linkInfo.StartCode); |
| | | } |
| | | return visual as HydroNodeInfo; |
| | | } |
| | | |
| | | //精度评估 |
| | | private async void barBtnAccuracy_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | var allMonitorList = await GetMonitorList(); |
| | | if (allMonitorList == null || allMonitorList.Count < 1) |
| | | { |
| | | TipFormHelper.ShowWarn("请设置监测点后重试!"); |
| | | return; |
| | | } |
| | | |
| | | var isHead = _calcuPressModeIsHead; |
| | | var allEvaluationList = await GetEvaluationList(); |
| | | |
| | | var workingList = GetCheckedWorkingList(); |
| | | if (workingList == null || workingList.Count < 1) |
| | | { |
| | | var allMonitorValueList = await GetMonitorValueList(); |
| | | allMonitorValueList = allMonitorValueList?.Where(x => x.PropValue.HasValue).ToList(); |
| | | if (allMonitorValueList == null || allMonitorValueList.Count < 1) |
| | | { |
| | | TipFormHelper.ShowWarn("请设置监测值后,重新计算!"); |
| | | return; |
| | | } |
| | | |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (!workingHelper.Initialized) |
| | | { |
| | | TipFormHelper.ShowWarn("请计算后重试!"); |
| | | return; |
| | | } |
| | | var dlg = new HydroAccuracyDlg(); |
| | | dlg.SetBindingData(workingHelper.HydroInfo, allMonitorList, workingHelper.Working, workingHelper.CalcuResult, isHead, allEvaluationList); |
| | | dlg.ShowDialog(); |
| | | return; |
| | | } |
| | | |
| | | var workingDlg = new HydroAccuracyWorkingDlg(); |
| | | workingDlg.SetBindingData(_hydroInfo, allMonitorList, workingList, isHead, allEvaluationList); |
| | | workingDlg.ShowDialog(); |
| | | } |
| | | |
| | | //水泵分析 |
| | | private async void barBtnPumpAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var isHead = _calcuPressModeIsHead; |
| | | var allEvaluationList = await GetEvaluationList(); |
| | | |
| | | var workingList = GetCheckedWorkingList(); |
| | | if (workingList == null || workingList.Count < 1) |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (!workingHelper.Initialized) |
| | | { |
| | | TipFormHelper.ShowWarn("请计算后重试!"); |
| | | return; |
| | | } |
| | | var dlg = new SimulationPumpAnalyDlg(); |
| | | dlg.SetBindingData(workingHelper.HydroInfo, workingHelper.Working, workingHelper.CalcuResult, isHead, allEvaluationList); |
| | | dlg.ShowDialog(); |
| | | return; |
| | | } |
| | | |
| | | var workingDlg = new SimulationPumpAnalyWorkingDlg(); |
| | | workingDlg.SetBindingData(_hydroInfo, workingList, isHead, allEvaluationList); |
| | | workingDlg.ShowDialog(); |
| | | } |
| | | |
| | | //能效分析 |
| | | private async void barBtnEnergyAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | var isHead = _calcuPressModeIsHead; |
| | | var allEvaluationList = await GetEvaluationList(); |
| | | |
| | | var workingList = GetCheckedWorkingList(); |
| | | if (workingList == null || workingList.Count < 1) |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (!workingHelper.Initialized) |
| | | { |
| | | TipFormHelper.ShowWarn("请计算后重试!"); |
| | | return; |
| | | } |
| | | var dlg = new SimulationEnergyAnalyDlg(); |
| | | dlg.SetBindingData(workingHelper.HydroInfo, workingHelper.Working, workingHelper.CalcuResult, isHead, allEvaluationList); |
| | | dlg.ShowDialog(); |
| | | return; |
| | | } |
| | | var workingDlg = new SimulationEnergyAnalyWorkingDlg(); |
| | | workingDlg.SetBindingData(_hydroInfo, workingList, isHead, allEvaluationList); |
| | | workingDlg.ShowDialog(); |
| | | } |
| | | |
| | | //损失统计 |
| | | private async void barBtnWorkingLossStatistics_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var hydroInfo = _hydroInfo.Adapt<Yw.Model.HydroModelInfo>(); |
| | | var isHead = _calcuPressModeIsHead; |
| | | var allEvaluationList = await GetEvaluationList(); |
| | | |
| | | var workingList = GetCheckedWorkingList(); |
| | | if (workingList == null || workingList.Count < 1) |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (!workingHelper.Initialized) |
| | | { |
| | | TipFormHelper.ShowWarn("请计算后重试!"); |
| | | return; |
| | | } |
| | | var dlg = new HydroLossStatisticsDlg(); |
| | | dlg.SetBindingData(hydroInfo, workingHelper.Working, workingHelper.CalcuResult, isHead, allEvaluationList); |
| | | dlg.ShowDialog(); |
| | | return; |
| | | } |
| | | |
| | | var workingDlg = new HydroLossStatisticsWorkingDlg(); |
| | | workingDlg.SetBindingData(hydroInfo, workingList, isHead, allEvaluationList); |
| | | workingDlg.ShowDialog(); |
| | | } |
| | | |
| | | //综合分析 |
| | | private async void barBtnWorkingAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | var selectNode = GetSelectNode(); |
| | | if (selectNode == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | var allMonitorList = await GetMonitorList(); |
| | | var isHead = _calcuPressModeIsHead; |
| | | var allEvaluationList = await GetEvaluationList(); |
| | | |
| | | var workingList = GetCheckedWorkingList(); |
| | | if (workingList == null || workingList.Count < 1) |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (!workingHelper.Initialized) |
| | | { |
| | | TipFormHelper.ShowWarn("请计算后重试!"); |
| | | return; |
| | | } |
| | | var dlg = new SimulationMultiAnalyDlg(); |
| | | dlg.SetBindingData(workingHelper.HydroInfo, allMonitorList, workingHelper.Working, selectNode, workingHelper.CalcuResult, isHead, allEvaluationList); |
| | | dlg.ShowDialog(); |
| | | return; |
| | | } |
| | | |
| | | var workingDlg = new SimulationMultiAnalyWorkingDlg(); |
| | | workingDlg.SetBindingData(_hydroInfo, allMonitorList, workingList, selectNode, isHead, allEvaluationList); |
| | | workingDlg.ShowDialog(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 损失曲线 |
| | | |
| | | //损失曲线交互控件 |
| | | private HydroLossCurveInteropCtrl _lossCurveInteropCtrl = null; |
| | | |
| | | //获取损失曲线交互控件 |
| | | private HydroLossCurveInteropCtrl GetLossCurveInteropCtrl() |
| | | { |
| | | if (_lossCurveInteropCtrl == null) |
| | | { |
| | | _lossCurveInteropCtrl = new HydroLossCurveInteropCtrl(); |
| | | _lossCurveInteropCtrl.Dock = DockStyle.Fill; |
| | | _lossCurveInteropCtrl.HydroClickEvent += (code) => |
| | | { |
| | | var visual = GetVisual(code); |
| | | SelectVisual(visual, eSimulationVisualSource.None); |
| | | }; |
| | | _lossCurveInteropCtrl.HydroSpecialDisplayEvent += (list) => |
| | | { |
| | | _bimfaceCtrl?.SetLogicOutlineGlowEffect(list); |
| | | }; |
| | | _lossCurveInteropCtrl.HydroCancelSpecialDisplayEvent += () => |
| | | { |
| | | _bimfaceCtrl?.RemoveLogicOutlineGlowEffect(); |
| | | }; |
| | | } |
| | | return _lossCurveInteropCtrl; |
| | | } |
| | | |
| | | //损失曲线控件是否可见 |
| | | private bool IsLossCurveInteropCtrlVisible |
| | | { |
| | | get |
| | | { |
| | | if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | if (this.controlContainerBottom.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerBottom.Controls[0] is HydroLossCurveInteropCtrl) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //显示损失曲线控件 |
| | | private void ShowLossCurveInteropCtrl |
| | | ( |
| | | Yw.Model.HydroModelInfo hydroInfo, |
| | | HydroWorkingVmo working, |
| | | HydroNodeInfo node, |
| | | HydroCalcuResult calcuResult = null, |
| | | bool isHead = false, |
| | | List<HydroEvaluationVmo> allEvaluationList = null |
| | | ) |
| | | { |
| | | var ctrl = GetLossCurveInteropCtrl(); |
| | | if (!IsLossCurveInteropCtrlVisible) |
| | | { |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(ctrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "损失曲线"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | ctrl.SetBindingData(hydroInfo, working, node, calcuResult, isHead, allEvaluationList); |
| | | } |
| | | |
| | | //损失曲线 |
| | | private async void barBtnLossCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var node = GetSelectNode(); |
| | | if (node == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | var isHead = _calcuPressModeIsHead; |
| | | var allEvaluationList = await GetEvaluationList(); |
| | | |
| | | var workingList = GetCheckedWorkingList(); |
| | | if (workingList == null || workingList.Count < 1) |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (!workingHelper.Initialized) |
| | | { |
| | | TipFormHelper.ShowWarn("请计算后重试!"); |
| | | return; |
| | | } |
| | | ShowLossCurveInteropCtrl(workingHelper.HydroInfo, workingHelper.Working, node, workingHelper.CalcuResult, isHead, allEvaluationList); |
| | | return; |
| | | } |
| | | |
| | | var dlg = new HydroLossCurveMultiWorkingDlg(); |
| | | dlg.SetBindingData(_hydroInfo, workingList, node, _calcuPressModeIsHead, allEvaluationList); |
| | | 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.HydroModelInfo>.Instance.DeleteByID(relation.ModelID)) |
| | | { |
| | | 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 方案管理 |
| | | } |
| | | } |