| | |
| | | global using Yw.EPAnet; |
| | | using DevExpress.Diagram.Core.Native; |
| | | using DevExpress.Mvvm.Native; |
| | | using DevExpress.Office.Utils; |
| | | using DevExpress.Utils.Extensions; |
| | | using DevExpress.Xpo.Helpers; |
| | | using DevExpress.XtraBars.Ribbon; |
| | | using DevExpress.XtraRichEdit.Layout; |
| | | using DevExpress.XtraSpreadsheet.Commands; |
| | | using HStation.WinFrmUI.PhartRelation; |
| | | using System.Diagnostics; |
| | | using System.Windows.Media; |
| | | using System.Windows.Media.Media3D; |
| | | using DevExpress.Pdf.Native; |
| | | using Mapster; |
| | | using Yw.EPAnet; |
| | | using Yw.Hydro; |
| | | using Yw.Pump; |
| | | using Yw.Model; |
| | | using Yw.Vmo; |
| | | using Yw.WinFrmUI.Bimface; |
| | | using Yw.WinFrmUI.Hydro; |
| | | |
| | | namespace HStation.WinFrmUI |
| | | { |
| | |
| | | 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 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}"; |
| | | } |
| | | } |
| | | |
| | |
| | | public override void InitialDataSource() |
| | | { |
| | | base.InitialDataSource(); |
| | | if (_project == null) |
| | | { |
| | | return; |
| | | } |
| | | this.PageTitle.Caption = $"{_project.Name}\r\n水力模拟"; |
| | | ShowBimfaceCtrl(); |
| | | ShowQ3dCtrl(); |
| | | ShowPropertyCtrl(); |
| | | |
| | | InitialSvgImages(); |
| | | } |
| | | |
| | | //初始化Svg图片 |
| | | private void InitialSvgImages() |
| | | { |
| | | //监测 |
| | | this.barBtnDockingMonitor.ImageOptions.SvgImage = HydroMonitorSvgImageHelper.Docking; |
| | | this.barBtnAnalyseMonitor.ImageOptions.SvgImage = HydroMonitorSvgImageHelper.Analyse; |
| | | |
| | | #region Bimface |
| | | //水库 |
| | | this.barBtnSetReservoirList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Tank; |
| | | this.barBtnSetReservoirList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetReservoirList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetReservoirList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //水池 |
| | | this.barBtnSetTankList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Tank; |
| | | this.barBtnSetTankList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetTankList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetTankList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //水箱 |
| | | this.barBtnSetWaterboxList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Tank; |
| | | this.barBtnSetWaterboxList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetWaterboxList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetWaterboxList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //闷头 |
| | | this.barBtnSetBluntheadList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Blunthead; |
| | | this.barBtnSetBluntheadList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetBluntheadList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetBluntheadList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //弯头 |
| | | this.barBtnSetElbowsList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Elbow; |
| | | this.barBtnSetElbowsList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetElbowsList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetElbowsList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //三通 |
| | | this.barBtnSetThreelinkList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Threelink; |
| | | this.barBtnSetThreelinkList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetThreelinkList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetThreelinkList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //四通 |
| | | this.barBtnSetFourlinkList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Fourlink; |
| | | this.barBtnSetFourlinkList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetFourlinkList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetFourlinkList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //消火栓 |
| | | this.barBtnSetHydrantList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Hydrant; |
| | | this.barBtnSetHydrantList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetHydrantList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetHydrantList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //喷头 |
| | | this.barBtnSetNozzleList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Nozzle; |
| | | this.barBtnSetNozzleList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetNozzleList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetNozzleList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //冷却塔 |
| | | this.barBtnSetCoolingList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Cooling; |
| | | this.barBtnSetCoolingList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetCoolingList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetCoolingList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //水表 |
| | | this.barBtnSetMeterList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Meter; |
| | | this.barBtnSetMeterList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetMeterList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetMeterList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //流量计 |
| | | this.barBtnSetFlowmeterList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Flowmeter; |
| | | this.barBtnSetFlowmeterList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetFlowmeterList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetFlowmeterList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //压力表 |
| | | this.barBtnSetPressmeterList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Pressmeter; |
| | | this.barBtnSetPressmeterList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetMeterList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetMeterList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //管道 |
| | | this.barBtnSetPipeList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Pipe; |
| | | this.barBtnSetPipeList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetPipeList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetPipeList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //过渡件 |
| | | this.barBtnSetTranslationList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Translation; |
| | | this.barBtnSetTranslationList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetTranslationList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetTranslationList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //水泵 |
| | | this.barBtnSetPumpList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Pump; |
| | | this.barBtnSetPumpList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetPumpList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetPumpList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //阀门 |
| | | this.barBtnSetValveList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Valve; |
| | | this.barBtnSetValveList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetValveList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetValveList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //换热器 |
| | | this.barBtnSetExchangerList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Exchanger; |
| | | this.barBtnSetExchangerList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetExchangerList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetExchangerList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | |
| | | //压缩机 |
| | | this.barBtnSetCompressorList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Compressor; |
| | | this.barBtnSetCompressorList.ImageOptions.SvgImageSize = new Size(32, 32); |
| | | this.barBtnSetCompressorList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204); |
| | | this.barBtnSetCompressorList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True; |
| | | } |
| | | |
| | | #region 属性状态 |
| | | |
| | | //属性状态辅助类 |
| | | private HydroPropStatusHelper _propStatusHelper = null; |
| | | |
| | | //获取属性状态辅助类 |
| | | private async Task<HydroPropStatusHelper> GetPropStatusHelper() |
| | | { |
| | | if (_propStatusHelper == null) |
| | | { |
| | | var allPropStatusList = await BLLFactory<Yw.BLL.HydroParterPropStatusInfo>.Instance.GetByModelID(_hydroInfo.ID); |
| | | _propStatusHelper = new HydroPropStatusHelper(_hydroInfo, allPropStatusList); |
| | | } |
| | | return _propStatusHelper; |
| | | } |
| | | |
| | | //获取属性状态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 async Task<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; |
| | | await _bimfaceCtrl.InitialData(_project, _projectSite, () => _hydroInfo); |
| | | WaitFormHelper.ShowWaitForm(this.FindForm(), "正在加载模型,请稍后..."); |
| | | await _bimfaceCtrl.InitialData(_project, _projectSite); |
| | | _bimfaceCtrl.LoadCompletedEvent += () => |
| | | {//view加载完成事件 |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | ApplyGrading(); |
| | | WaitFormHelper.HideWaitForm(); |
| | | this.barCkDecorator.Checked = false; |
| | | this.barCkGrading.Checked = true; |
| | | }; |
| | | _bimfaceCtrl.HydroMouseLeftClickEvent += (obj) => |
| | | _bimfaceCtrl.HydroMouseLeftClickEvent += (code) => |
| | | {//鼠标左键点击事件 |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | _selectedVisual = obj; |
| | | ShowSelectedProperty(); |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visual = visualListHelper.GetVisual(code); |
| | | SelectVisual(visual, eSimulationVisualSource.Bimface); |
| | | }; |
| | | } |
| | | return _bimfaceCtrl; |
| | |
| | | this.tabPageBimface.Controls.Add(bimfaceCtrl); |
| | | } |
| | | |
| | | private void SelectBimfaceParter() |
| | | { |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Q3d |
| | | #region Q3d控件 |
| | | |
| | | //Q3d 控件 |
| | | private XhsProjectSimulationQ3dCtrl _q3dCtrl = null; |
| | |
| | | //获取 Q3d 控件 |
| | | private XhsProjectSimulationQ3dCtrl GetQ3dCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_q3dCtrl == null) |
| | | { |
| | | _q3dCtrl = new XhsProjectSimulationQ3dCtrl(); |
| | | _q3dCtrl.Dock = DockStyle.Fill; |
| | | _q3dCtrl.InitialData(() => _hydroInfo); |
| | | _q3dCtrl.SelectedPartersChangedEvent += (obj) => |
| | | _q3dCtrl.SelectedPartersChangedEvent += (codes) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllVisuals(); |
| | | _selectedVisual = allParterList?.Find(x => x.Code == obj?.FirstOrDefault()); |
| | | ShowSelectedProperty(); |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visuals = visualListHelper.GetVisualList(codes); |
| | | SelectVisual(visuals?.LastOrDefault(), eSimulationVisualSource.Q3d); |
| | | }; |
| | | } |
| | | return _q3dCtrl; |
| | |
| | | #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, () => GetCalcuResultList()); |
| | | _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.ViewParterEvent += (parter) => |
| | | _propertyCtrl.PropertyValueChangedEvent += async (visual) => |
| | | { |
| | | if (parter == null) |
| | | { |
| | | return; |
| | | } |
| | | _bimfaceCtrl?.ZoomToComponent(parter.Code); |
| | | }; |
| | | _propertyCtrl.PropertyValueChangedEvent += (parter) => |
| | | { |
| | | if (parter == null) |
| | | if (visual == null) |
| | | { |
| | | return; |
| | | } |
| | | UpdateVisualListCtrl(); |
| | | AutoApplyGrading(); |
| | | var gradingHelper = await GetGradingHelper(); |
| | | gradingHelper.Set(); |
| | | }; |
| | | _propertyCtrl.MarkPropertyValueChangedEvent += (visual) => |
| | | _propertyCtrl.MarkPropertyValueChangedEvent += async (visual) => |
| | | { |
| | | //标注属性发生改变 |
| | | //判断当前是否有标注展示,若有则更新标注,最好是更新单个标注 |
| | | UpdateMark(visual); |
| | | var markHelper = await GetMarkHelper(); |
| | | markHelper.Set(visual); |
| | | }; |
| | | _propertyCtrl.GradingPropertyValueChangedEvent += (parter) => |
| | | _propertyCtrl.GradingPropertyValueChangedEvent += async (visual) => |
| | | { |
| | | //分级属性发生改变 |
| | | //判断当前是否有分级展示,若有则更新分级,最好是更新单个分级 |
| | | var gradingHelper = await GetGradingHelper(); |
| | | gradingHelper.Set(visual); |
| | | }; |
| | | _propertyCtrl.FlowDirectionPropertyValueChangedEvent += (visual) => |
| | | { |
| | | //流向属性发生改变 |
| | | //判断流向是否加载,如果加载则更新流向,最好是更新单个流向 |
| | | UpdateFlowEffect(visual); |
| | | }; |
| | | |
| | | } |
| | | return _propertyCtrl; |
| | | } |
| | |
| | | { |
| | | if (this.controlContainerRight.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerRight.Controls[0] is XhsProjectSimulationPropertyCtrl) |
| | | if (this.controlContainerRight.Controls[0] is SimulationPropertyCtrl) |
| | | { |
| | | return true; |
| | | } |
| | |
| | | } |
| | | |
| | | //显示属性控件 |
| | | private void ShowPropertyCtrl() |
| | | private async void ShowPropertyCtrl() |
| | | { |
| | | if (IsPropertyCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | | var propertyCtrl = GetPropertyCtrl(); |
| | | var propertyCtrl = await GetPropertyCtrl(); |
| | | this.controlContainerRight.Controls.Clear(); |
| | | this.controlContainerRight.Controls.Add(propertyCtrl); |
| | | this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | |
| | | this.docPnlRight.Width = 300; |
| | | } |
| | | |
| | | //显示选择属性 |
| | | private void ShowSelectedProperty() |
| | | //设置属性控件 |
| | | private void SetPropertyCtrl(HydroVisualInfo visual) |
| | | { |
| | | ShowSelectedProperty(_selectedVisual); |
| | | } |
| | | |
| | | //显示选择属性 |
| | | private void ShowSelectedProperty(Yw.Model.HydroVisualInfo visual) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | ShowPropertyCtrl(); |
| | | _selectedVisual = visual; |
| | | if (_selectedVisual == null) |
| | | { |
| | | _propertyCtrl.SelectedObject = null; |
| | | return; |
| | | } |
| | | _propertyCtrl.SelectedObject = GetVisualViewModel(_selectedVisual); |
| | | var visualVmListHelper = GetVisualVmListHelper(); |
| | | var vm = visualVmListHelper.GetVisual(visual); |
| | | _propertyCtrl.SelectedObject = vm; |
| | | _propertyCtrl.UpdateRows(); |
| | | } |
| | | |
| | | //更新选择属性 |
| | | private void UpdateSelectedProperty() |
| | | //更新属性控件 |
| | | private void UpdatePropertyCtrl() |
| | | { |
| | | if (!IsPropertyCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | | if (_selectedVisual == null) |
| | | { |
| | | return; |
| | | } |
| | | _propertyCtrl?.UpdateRows(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 选择构件 |
| | | |
| | | //选择构件 |
| | | private Yw.Model.HydroVisualInfo _visual = null; |
| | | |
| | | #region 自动匹配 |
| | | |
| | | //获取匹配列表控件 |
| | | private XhsProjectSimulationMatchingListCtrl GetMatchingListCtrl() |
| | | //选择构件 |
| | | private void SelectVisual(HydroVisualInfo visual, eSimulationVisualSource source) |
| | | { |
| | | if (_matchingListCtrl == null) |
| | | _visual = visual; |
| | | switch (source) |
| | | { |
| | | _matchingListCtrl = new XhsProjectSimulationMatchingListCtrl(); |
| | | _matchingListCtrl.Dock = DockStyle.Fill; |
| | | _matchingListCtrl.HydroClickEvent += async (code) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | case eSimulationVisualSource.None: |
| | | { |
| | | return; |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnDockingMonitor.Enabled = visual != null; |
| | | this.barBtnAnalyseMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | var allParterList = _hydroInfo.GetAllVisuals(); |
| | | _selectedVisual = allParterList?.Find(x => x.Code == code); |
| | | var elementIds = new List<string>(); |
| | | if (_selectedVisual != null) |
| | | break; |
| | | |
| | | case eSimulationVisualSource.Bimface: |
| | | { |
| | | elementIds.Add(_selectedVisual.Code); |
| | | this.barBtnDockingMonitor.Enabled = visual != null; |
| | | this.barBtnAnalyseMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowSelectedProperty(); |
| | | }; |
| | | _matchingListCtrl.ApplyMatchingEvent += (output) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | break; |
| | | |
| | | case eSimulationVisualSource.Q3d: |
| | | { |
| | | return false; |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnDockingMonitor.Enabled = visual != null; |
| | | this.barBtnAnalyseMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | return AssetsMatchingParasHelper.Apply(_hydroInfo, output); |
| | | }; |
| | | break; |
| | | |
| | | case eSimulationVisualSource.Property: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnDockingMonitor.Enabled = visual != null; |
| | | this.barBtnAnalyseMonitor.Enabled = visual != null; |
| | | } |
| | | break; |
| | | |
| | | case eSimulationVisualSource.List: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnDockingMonitor.Enabled = visual != null; |
| | | this.barBtnAnalyseMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | |
| | | case eSimulationVisualSource.Set: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnDockingMonitor.Enabled = visual != null; |
| | | this.barBtnAnalyseMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | |
| | | case eSimulationVisualSource.Search: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnDockingMonitor.Enabled = visual != null; |
| | | this.barBtnAnalyseMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | |
| | | case eSimulationVisualSource.Monitor: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnDockingMonitor.Enabled = visual != null; |
| | | this.barBtnAnalyseMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | |
| | | case eSimulationVisualSource.Check: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnDockingMonitor.Enabled = visual != null; |
| | | this.barBtnAnalyseMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | |
| | | case eSimulationVisualSource.Calcu: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnDockingMonitor.Enabled = visual != null; |
| | | this.barBtnAnalyseMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | |
| | | case eSimulationVisualSource.Warning: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnDockingMonitor.Enabled = visual != null; |
| | | this.barBtnAnalyseMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | |
| | | default: break; |
| | | } |
| | | return _matchingListCtrl; |
| | | } |
| | | |
| | | //匹配列表控件 |
| | | private XhsProjectSimulationMatchingListCtrl _matchingListCtrl = null; |
| | | |
| | | //自动匹配 |
| | | private void barBtnMatchingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //选择构件 |
| | | private void SelectVisual(string code, eSimulationVisualSource source) |
| | | { |
| | | if (_hydroInfo == null) |
| | | var visual = GetVisual(code); |
| | | SelectVisual(visual, source); |
| | | } |
| | | |
| | | #endregion 选择构件 |
| | | |
| | | #region 构件明细 |
| | | |
| | | #region 可见列表 |
| | | |
| | | //可见列表辅助类 |
| | | private SimulationVisualListHelper _visualListHelper = null; |
| | | |
| | | //获取可见列表辅助类 |
| | | private SimulationVisualListHelper GetVisualListHelper() |
| | | { |
| | | if (_visualListHelper == null) |
| | | { |
| | | return; |
| | | _visualListHelper = new SimulationVisualListHelper(); |
| | | _visualListHelper.InitialData(_hydroInfo); |
| | | } |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | var matchingListCtrl = GetMatchingListCtrl(); |
| | | var input = AssetsMatchingParasHelper.Create(_hydroInfo, GetCalcuResultList()); |
| | | matchingListCtrl.SetBindingData(input); |
| | | this.controlContainerBottom.Controls.Add(matchingListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "匹配列表"; |
| | | this.docPnlBottom.Height = 350; |
| | | 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 未匹配列表 |
| | | #region 视图列表 |
| | | |
| | | //获取未匹配列表控件 |
| | | private XhsProjectSimulationUnMatchingListCtrl GetUnMatchingListCtrl() |
| | | //可见视图列表辅助类 |
| | | private SimulationVisualVmListHelper _visualVmListHelper = null; |
| | | |
| | | //获取可见视图列表辅助类 |
| | | private SimulationVisualVmListHelper GetVisualVmListHelper() |
| | | { |
| | | if (_unMatchingListCtrl == null) |
| | | if (_hydroInfo == null) |
| | | { |
| | | _unMatchingListCtrl = new XhsProjectSimulationUnMatchingListCtrl(); |
| | | _unMatchingListCtrl.Dock = DockStyle.Fill; |
| | | _unMatchingListCtrl.HydroClickEvent += async (parter) =>//行点击 |
| | | { |
| | | if (parter == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allParterList = _hydroInfo.GetAllVisuals(); |
| | | _selectedVisual = allParterList?.Find(x => x.Code == parter.Code); |
| | | var elementIds = new List<string>() { parter.Code }; |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowSelectedProperty(); |
| | | }; |
| | | _unMatchingListCtrl.ViewModelEvent += async (parters) =>//查看模型 |
| | | { |
| | | var codes = parters?.Select(x => x.Code).Distinct().ToList(); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(codes); |
| | | _selectedVisual = null; |
| | | ShowSelectedProperty(); |
| | | }; |
| | | return default; |
| | | } |
| | | return _unMatchingListCtrl; |
| | | if (_visualVmListHelper == null) |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var calcuResultHelper = GetCalcuResultHelper(); |
| | | _visualVmListHelper = new SimulationVisualVmListHelper(visualListHelper, calcuResultHelper); |
| | | } |
| | | return _visualVmListHelper; |
| | | } |
| | | |
| | | private XhsProjectSimulationUnMatchingListCtrl _unMatchingListCtrl = null;//未匹配列表 |
| | | //获取可见视图列表 |
| | | private List<HydroVisualViewModel> GetVisualViewModelList() |
| | | { |
| | | var helper = GetVisualVmListHelper(); |
| | | return helper.GetVisualList(); |
| | | } |
| | | |
| | | //未匹配列表 |
| | | private void barBtnUnMatchingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //获取可见视图 |
| | | 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) |
| | | { |
| | | _visualListCtrl = new HydroVisualListCtrl(); |
| | | _visualListCtrl.Dock = DockStyle.Fill; |
| | | _visualListCtrl.HydroClickInfoEvent += (visual) => |
| | | { |
| | | SelectVisual(visual, eSimulationVisualSource.List); |
| | | }; |
| | | _visualListCtrl.HydroChangedInfoEvent += (visualList) => |
| | | { |
| | | SelectVisual(_visual, eSimulationVisualSource.List); |
| | | }; |
| | | } |
| | | return _visualListCtrl; |
| | | } |
| | | |
| | | //构件明细控件是否可见 |
| | | 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) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //显示构件明细控件 |
| | | private async void ShowVisualListCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | var unMatchingListCtrl = GetUnMatchingListCtrl(); |
| | | unMatchingListCtrl.SetBindingData(_hydroInfo); |
| | | this.controlContainerBottom.Controls.Add(unMatchingListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "未匹配列表"; |
| | | this.docPnlBottom.Height = 350; |
| | | var visualListCtrl = GetVisualListCtrl(); |
| | | if (!IsVisualListCtrlVisible) |
| | | { |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(visualListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "构件明细"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | 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) |
| | | { |
| | | visualListCtrl.SetCalcuView(); |
| | | } |
| | | else |
| | | { |
| | | visualListCtrl.SetNormalView(); |
| | | } |
| | | } |
| | | |
| | | //更新构件明细控件 |
| | | private void UpdateVisualListCtrl() |
| | | { |
| | | if (!IsVisualListCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | | _visualListCtrl?.UpdateBindingData(); |
| | | var calcuResult = GetCalcuResult(); |
| | | if (calcuResult != null && calcuResult.Succeed) |
| | | { |
| | | _visualListCtrl.SetCalcuView(); |
| | | } |
| | | else |
| | | { |
| | | _visualListCtrl.SetNormalView(); |
| | | } |
| | | } |
| | | |
| | | //构件明细 |
| | | 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; |
| | | } |
| | | 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(); |
| | | } |
| | | |
| | | //设置构件显示 |
| | | private void barBtnSetVisualVisible_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | SetVisualVisible(); |
| | | } |
| | | |
| | | #endregion 构件显示 |
| | | |
| | | #endregion |
| | | |
| | | #region 一键显隐 |
| | | |
| | | //显隐编码列表 |
| | | private List<string> _fastShowHiddenCodeList = null; |
| | | private List<string> _allDecoratorCodes = null; |
| | | |
| | | //一键显隐 |
| | | private async void FastShowHidden() |
| | | //获取装饰件code列表 |
| | | private async Task<List<string>> GetDecoratorCodes() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | return default; |
| | | } |
| | | if (_hydroInfo.Decorators == null || _hydroInfo.Decorators.Count < 1) |
| | | if (_allDecoratorCodes == null) |
| | | { |
| | | return; |
| | | _allDecoratorCodes = await BLLFactory<Yw.BLL.HydroDecoratorInfo>.Instance.GetCodeListByModelID(_hydroInfo.ID, null); |
| | | } |
| | | if (_fastShowHiddenCodeList == null) |
| | | if (_allDecoratorCodes == null) |
| | | { |
| | | _fastShowHiddenCodeList = _hydroInfo.Decorators.Select(x => x.Code).ToList(); |
| | | await _bimfaceCtrl?.HideComponents(_fastShowHiddenCodeList); |
| | | _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?.ShowComponents(_fastShowHiddenCodeList); |
| | | _fastShowHiddenCodeList = null; |
| | | await _bimfaceCtrl?.HideComponents(codes); |
| | | } |
| | | } |
| | | |
| | | //触发一键显隐 |
| | | private void barBtnFastShowHidden_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //设置 |
| | | private void barCkDecorator_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | FastShowHidden(); |
| | | SetDecoratorVisible(this.barCkDecorator.Checked); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #endregion 一键显隐 |
| | | |
| | | #region 保存信息 |
| | | |
| | | //保存锁定对象 |
| | | private object _locker_save = new(); |
| | | private bool _isSaving = false;//正在保存 |
| | | |
| | | //保存 |
| | | private async void barBtnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | |
| | | { |
| | | return; |
| | | } |
| | | Stopwatch sw = new Stopwatch(); |
| | | sw.Start(); |
| | | |
| | | |
| | | var id = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.Save(_hydroInfo); |
| | | |
| | | //耗时巨大的代码 |
| | | |
| | | sw.Stop(); |
| | | TimeSpan ts2 = sw.Elapsed; |
| | | Console.WriteLine("Stopwatch总共花费{0}ms.", ts2.TotalMilliseconds); |
| | | if (id < 1) |
| | | lock (_locker_save) |
| | | { |
| | | TipFormHelper.ShowError("保存失败!"); |
| | | if (_isSaving) |
| | | { |
| | | 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; |
| | | } |
| | | } |
| | | } |
| | | |
| | | WaitFormHelper.ShowWaitForm("正在保存,请稍后..."); |
| | | |
| | | |
| | | var bol = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance |
| | | .Update(_hydroInfo, addParterList, updateParterList, removeParters); |
| | | |
| | | |
| | | if (!bol) |
| | | { |
| | | WaitFormHelper.HideWaitForm(); |
| | | TipFormHelper.ShowError("水力信息更新失败!"); |
| | | _isSaving = false; |
| | | return; |
| | | } |
| | | _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(id); |
| | | changeHelper.Reset(); |
| | | |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var updatePropStatusList = propStatusHelper.GetUpdatePropStatusDbList(); |
| | | if (updatePropStatusList != null && updatePropStatusList.Count > 0) |
| | | { |
| | | bol = await BLLFactory<Yw.BLL.HydroParterPropStatusInfo>.Instance.Update(_hydroInfo.ID, updatePropStatusList); |
| | | if (!bol) |
| | | { |
| | | WaitFormHelper.HideWaitForm(); |
| | | TipFormHelper.ShowWarn("属性状态更新失败!"); |
| | | _isSaving = false; |
| | | return; |
| | | } |
| | | } |
| | | propStatusHelper.Reset(); |
| | | |
| | | WaitFormHelper.HideWaitForm(); |
| | | TipFormHelper.ShowSucceed("保存成功!"); |
| | | _isSaving = false; |
| | | |
| | | //Stopwatch sw = new Stopwatch(); |
| | | //sw.Start(); |
| | | //耗时巨大的代码 |
| | | //sw.Stop(); |
| | | //TimeSpan ts2 = sw.Elapsed; |
| | | //Console.WriteLine("Stopwatch总共花费{0}ms.", ts2.TotalMilliseconds); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | #endregion 保存信息 |
| | | |
| | | #region 批量配置 |
| | | |
| | |
| | | private void RegistBulkSetEvents() |
| | | { |
| | | //水库 |
| | | this.barBtnSetReservoirList.ItemClick += delegate |
| | | this.barBtnSetReservoirList.ItemClick += async delegate |
| | | { |
| | | //var dlg = new HydroReservoirBulkSetListDlg(); |
| | | //dlg.ShowDialog(); |
| | | 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(); |
| | | //dlg.ShowDialog(); |
| | | 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) |
| | | //{ |
| | | // return; |
| | | //} |
| | | //var dlg = new SetHydroWaterboxListDlg(); |
| | | //dlg.SetBindingData(_hydroInfo); |
| | | //dlg.HydroClickEvent += async (obj) => |
| | | //{ |
| | | // if (obj == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // _selectedParter = obj; |
| | | // await _bimfaceCtrl?.ZoomAndSelectComponent(obj.Code); |
| | | // ShowProperty(); |
| | | //}; |
| | | //dlg.HydroChangedEvent += (obj) => |
| | | //{ |
| | | |
| | | //}; |
| | | //dlg.ShowDialog(); |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroWaterboxListDlg(); |
| | | dlg.SetBindingData(allVisualViewModelList, changeHelper, propStatusHelper); |
| | | dlg.HydroClickInfoEvent += (visual) => |
| | | { |
| | | 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(); |
| | | //dlg.ShowDialog(); |
| | | 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 |
| | | { |
| | | //if (_hydroInfo == null) |
| | | //{ |
| | | // return; |
| | | //} |
| | | //var dlg = new SetHydroBluntheadListDlg(); |
| | | //dlg.SetBindingData(_hydroInfo); |
| | | //dlg.HydroClickEvent += async (obj) => |
| | | //{ |
| | | // if (obj == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // _selectedParter = obj; |
| | | // await _bimfaceCtrl?.ZoomAndSelectComponent(obj.Code); |
| | | // ShowProperty(); |
| | | //}; |
| | | //dlg.HydroChangedEvent += (obj) => |
| | | //{ |
| | | |
| | | //}; |
| | | //dlg.ShowDialog(); |
| | | 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 |
| | | { |
| | | //if (_hydroInfo == null) |
| | | //{ |
| | | // return; |
| | | //} |
| | | //var dlg = new SetHydroElbowListDlg(); |
| | | //dlg.SetBindingData(_hydroInfo); |
| | | //dlg.HydroClickEvent += async (obj) => |
| | | //{ |
| | | // if (obj == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // _selectedParter = obj; |
| | | // await _bimfaceCtrl?.ZoomAndSelectComponent(obj.Code); |
| | | // ShowProperty(); |
| | | //}; |
| | | //dlg.HydroChangedEvent += (obj) => |
| | | //{ |
| | | |
| | | //}; |
| | | //dlg.ShowDialog(); |
| | | 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 |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroThreelinkListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | 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 |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroFourlinkListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | 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 += delegate |
| | | this.barBtnSetMeterList.ItemClick += async delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroMeterListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | 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 += delegate |
| | | this.barBtnSetFlowmeterList.ItemClick += async delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroFlowmeterListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | 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 += delegate |
| | | this.barBtnSetPressmeterList.ItemClick += async delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroPressmeterListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | 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 += delegate |
| | | this.barBtnSetPipeList.ItemClick += async delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroPipeListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | 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 += delegate |
| | | this.barBtnSetPumpList.ItemClick += async delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroPumpListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | 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 += delegate |
| | | this.barBtnSetValveList.ItemClick += async delegate |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | var changeHelper = GetChangeHelper(); |
| | | var propStatusHelper = await GetPropStatusHelper(); |
| | | var dlg = new SetHydroValveListDlg(); |
| | | dlg.SetBindingData(_hydroInfo); |
| | | 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 barBtnAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_hydroInfo.Pumps == null || _hydroInfo.Pumps.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | var vmList = new List<XhsSinglePumpViewModel>(); |
| | | foreach (var pump in _hydroInfo.Pumps) |
| | | { |
| | | if (!pump.RatedN.HasValue) |
| | | { |
| | | continue; |
| | | } |
| | | var qh = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQH)?.CurveData; |
| | | var qe = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQE)?.CurveData; |
| | | var qp = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQP)?.CurveData; |
| | | if (qh == null) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | var qhPtList = qh.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); |
| | | var qePtList = qe?.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); |
| | | var qpPtList = qp?.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); |
| | | |
| | | var vm = new XhsSinglePumpViewModel(); |
| | | vmList.Add(vm); |
| | | vm.ID = pump.ID; |
| | | vm.Name = pump.Name; |
| | | vm.Code = pump.Code; |
| | | vm.IsBp = true; |
| | | vm.RunStatus = pump.LinkStatus == Yw.Hydro.LinkStatus.Open; |
| | | vm.RatedHz = pump.RatedHz; |
| | | vm.CurrentHz = Math.Round(pump.RatedHz * pump.SpeedRatio, 1); |
| | | vm.RatedSpeed = pump.RatedN.Value; |
| | | vm.CurrentSpeed = Math.Round(pump.RatedN.Value * pump.SpeedRatio); |
| | | vm.CurveQH = qhPtList; |
| | | vm.CurveQE = qePtList; |
| | | vm.CurveQP = qpPtList; |
| | | |
| | | if (allCalcuResultList != null && allCalcuResultList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList.Find(x => x.Code == pump.Code) as HydroCalcuLinkResult; |
| | | if (calcuResult != null) |
| | | { |
| | | if (calcuResult.CalcuFlow.HasValue) |
| | | { |
| | | vm.CalcuQ = Math.Abs(calcuResult.CalcuFlow.Value); |
| | | } |
| | | |
| | | var calcuResultStart = allCalcuResultList.Find(x => x.Code == pump.StartCode) as HydroCalcuNodeResult; |
| | | var calcuResultEnd = allCalcuResultList.Find(x => x.Code == pump.EndCode) as HydroCalcuNodeResult; |
| | | if (calcuResultStart != null && calcuResultEnd != null) |
| | | { |
| | | if (calcuResultStart.CalcuHead.HasValue && calcuResultEnd.CalcuHead.HasValue) |
| | | { |
| | | vm.CalcuH = Math.Round(Math.Abs(calcuResultStart.CalcuHead.Value - calcuResultEnd.CalcuHead.Value), 4); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | var dlg = new PumpParallelAnalyDlg(); |
| | | dlg.SetBindingData(vmList); |
| | | dlg.ReloadDataEvent += (list) => |
| | | { |
| | | list?.ForEach(x => |
| | | { |
| | | var pump = _hydroInfo.Pumps?.Find(t => t.Code == x.Code); |
| | | if (pump != null) |
| | | { |
| | | pump.LinkStatus = x.RunStatus ? Yw.Hydro.PumpStatus.Open : Yw.Hydro.PumpStatus.Closed; |
| | | pump.SpeedRatio = Math.Round(x.CurrentHz / pump.RatedHz, 1); |
| | | } |
| | | }); |
| | | ShowSelectedProperty(); |
| | | return true; |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region 构件查询 |
| | | |
| | |
| | | { |
| | | if (_searchCtrl == null) |
| | | { |
| | | var visualVmListHelper = GetVisualVmListHelper(); |
| | | var allVisualVmList = visualVmListHelper.GetVisualList(); |
| | | _searchCtrl = new HydroVisualSearchListCtrl(); |
| | | _searchCtrl.Dock = DockStyle.Fill; |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | _searchCtrl.InitialData(allVisualViewModelList); |
| | | _searchCtrl.HydroClickInfoEvent += async (visual) => |
| | | _searchCtrl.InitialData(allVisualVmList); |
| | | _searchCtrl.HydroClickInfoEvent += (visual) => |
| | | { |
| | | ShowSelectedProperty(visual); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | SelectVisual(visual, eSimulationVisualSource.Check); |
| | | }; |
| | | _searchCtrl.HydroSearchInfoEvent += async (list) => |
| | | _searchCtrl.HydroSearchInfoEvent += (list) => |
| | | { |
| | | var elementIds = new List<string>(); |
| | | if (list != null && list.Count > 0) |
| | | { |
| | | _selectedVisual = list.First(); |
| | | list.ForEach(x => elementIds.Add(x.Code)); |
| | | } |
| | | else |
| | | { |
| | | _selectedVisual = null; |
| | | } |
| | | ShowSelectedProperty(); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | var visual = list?.FirstOrDefault(); |
| | | SelectVisual(visual, eSimulationVisualSource.Search); |
| | | }; |
| | | } |
| | | return _searchCtrl; |
| | |
| | | ShowSearchDlg(); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 构件查询 |
| | | |
| | | #region 模型标注 |
| | | |
| | | #region 标注设置 |
| | | //标注辅助类 |
| | | private SimulationMarkHelper _markHelper = null; |
| | | |
| | | //所有标注设置列表 |
| | | private List<HydroMarkSetViewModel> _allMarkSetList = null; |
| | | |
| | | //获取标注设置列表 |
| | | private List<HydroMarkSetViewModel> GetMarkSetList() |
| | | //获取标注辅助类 |
| | | private async Task<SimulationMarkHelper> GetMarkHelper() |
| | | { |
| | | if (_hydroInfo == null) |
| | | if (_markHelper == null) |
| | | { |
| | | return default; |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var calcuResultHelper = GetCalcuResultHelper(); |
| | | var bimfaceCtrl = await GetBimfaceCtrl(); |
| | | _markHelper = new SimulationMarkHelper(visualListHelper, calcuResultHelper, bimfaceCtrl); |
| | | } |
| | | if (_allMarkSetList == null) |
| | | { |
| | | _allMarkSetList = HydroMarkHelper.GetSetList(_hydroInfo); |
| | | } |
| | | return _allMarkSetList; |
| | | return _markHelper; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 标注结果 |
| | | |
| | | //所有标注结果列表 |
| | | private List<HydroMarkResultViewModel> _allMarkResultList = null; |
| | | |
| | | //获取标注结果列表 |
| | | //UseCache 是否使用缓存 |
| | | private List<HydroMarkResultViewModel> GetMarkResultList(bool useCache = true) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (!useCache) |
| | | { |
| | | var allSetList = GetMarkSetList(); |
| | | _allMarkResultList = HydroMarkHelper.GetResultList(_hydroInfo, allSetList); |
| | | } |
| | | if (_allMarkResultList == null) |
| | | { |
| | | var allSetList = GetMarkSetList(); |
| | | _allMarkResultList = HydroMarkHelper.GetResultList(_hydroInfo, allSetList); |
| | | } |
| | | return _allMarkResultList; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 标注显示 |
| | | |
| | | //标注是否显示 |
| | | private bool _isMarkVisible = false; |
| | | |
| | | //更新标注 |
| | | private async void UpdateMark(Yw.Model.HydroVisualInfo visual) |
| | | { |
| | | var allSetList = GetMarkSetList(); |
| | | var result = HydroMarkHelper.GetResult(visual, allSetList); |
| | | if (result == null) |
| | | { |
| | | return; |
| | | } |
| | | var allResultList = GetMarkResultList(true); |
| | | allResultList.Remove(x => x.Code == visual.Code); |
| | | allResultList.Add(result); |
| | | if (_isMarkVisible) |
| | | { |
| | | var leadLabel = new LogicMarkLeadLabel() { Id = result.Code, Text = result.Text, Distance = null }; |
| | | await _bimfaceCtrl?.UpdateLogicMarkLeadLabel(leadLabel); |
| | | } |
| | | } |
| | | |
| | | //更新标注列表 |
| | | private void UpdateMarkList(List<Yw.Model.HydroVisualInfo> visuals) |
| | | { |
| | | if (visuals == null || visuals.Count < 1) |
| | | { |
| | | visuals.ForEach(x => UpdateMark(x)); |
| | | } |
| | | } |
| | | |
| | | //应用标注列表 |
| | | //UseCache 是否使用缓存 |
| | | private async void ApplyMarkList(bool useCache = true) |
| | | { |
| | | if (_isMarkVisible) |
| | | { |
| | | var allResultList = GetMarkResultList(useCache); |
| | | var leadLabels = allResultList?.Select(x => new LogicMarkLeadLabel(x.Code, x.Text, null)).ToList(); |
| | | await _bimfaceCtrl?.SetLogicMarkLeadLabels(leadLabels); |
| | | } |
| | | else |
| | | { |
| | | await _bimfaceCtrl?.ClearLogicMarkLeadLabels(); |
| | | } |
| | | } |
| | | |
| | | //显示标注设置窗体 |
| | | private void ShowSetMarkDlg() |
| | | //显示标注列表 |
| | | private async void ShowMarkList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allMarkSetList = GetMarkSetList(); |
| | | var markHelper = await GetMarkHelper(); |
| | | var dlg = new SetHydroMarkDlg(); |
| | | dlg.SetBindingData(allMarkSetList); |
| | | dlg.SetBindingData(markHelper.Sets); |
| | | dlg.ReloadDataEvent += (list) => |
| | | { |
| | | _allMarkSetList = list; |
| | | ApplyMarkList(false); |
| | | markHelper.Sets = list; |
| | | markHelper.Set(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | |
| | | //设置标注 |
| | | private void barBtnSetMark_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowSetMarkDlg(); |
| | | ShowMarkList(); |
| | | } |
| | | |
| | | //是否显示 |
| | | private void barCkMark_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | private async void barCkMark_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | _isMarkVisible = this.barCkMark.Checked; |
| | | ApplyMarkList(true); |
| | | var markHelper = await GetMarkHelper(); |
| | | markHelper.Visible = this.barCkMark.Checked; |
| | | markHelper.Set(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | #region 颜色分级 |
| | | |
| | | #region 颜色配置 |
| | | //颜色分级辅助类 |
| | | private SimulationGradingHelper _gradingHelper = null; |
| | | |
| | | //所有分级列表 |
| | | private List<HydroGradingVmo> _allGradingList = null; |
| | | |
| | | //获取分级列表 |
| | | private async Task<List<HydroGradingVmo>> GetGradingList() |
| | | //获取颜色分级辅助类 |
| | | private async Task<SimulationGradingHelper> GetGradingHelper() |
| | | { |
| | | if (_hydroInfo == null) |
| | | if (_gradingHelper == null) |
| | | { |
| | | return default; |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var calcuResultHelper = GetCalcuResultHelper(); |
| | | var bimfaceCtrl = await GetBimfaceCtrl(); |
| | | _gradingHelper = new SimulationGradingHelper(visualListHelper, calcuResultHelper, bimfaceCtrl); |
| | | } |
| | | if (_allGradingList == null) |
| | | { |
| | | _allGradingList = await BLLFactory<Yw.BLL.HydroGrading>.Instance.GetByModelID(_hydroInfo.ID); |
| | | if (_allGradingList == null || _allGradingList.Count < 1) |
| | | { |
| | | var config = Yw.Settings.HydroParasHelper.Hydro.Grading; |
| | | if (config != null && config.Items != null && config.Items.Count > 0) |
| | | { |
| | | _allGradingList = new List<HydroGradingVmo>(); |
| | | config.Items.ForEach(x => |
| | | { |
| | | var vmo = new HydroGradingVmo() |
| | | { |
| | | ModelID = _hydroInfo.ID, |
| | | Catalog = x.Catalog, |
| | | PropName = x.PropName, |
| | | SetValue = x.SetValue, |
| | | MinValue = x.MinValue, |
| | | MaxValue = x.MaxValue, |
| | | Color = x.Color, |
| | | SortCode = config.Items.IndexOf(x) |
| | | }; |
| | | _allGradingList.Add(vmo); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | return _allGradingList; |
| | | return _gradingHelper; |
| | | } |
| | | |
| | | //显示配置颜色分级窗体 |
| | | private async void ShowSetGradingDlg() |
| | | //设置颜色分级列表 |
| | | private async void SetGradingList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allGradingList = await GetGradingList(); |
| | | var gradingHelper = await GetGradingHelper(); |
| | | var allGradingList = await gradingHelper.GetGradingList(); |
| | | var dlg = new SetHydroGradingTreeDlg(); |
| | | dlg.SetBindingData(_hydroInfo, allGradingList); |
| | | dlg.ReloadDataEvent += (list) => |
| | | { |
| | | _allGradingList = list; |
| | | gradingHelper.SetGradingList(list); |
| | | gradingHelper.Set(); |
| | | }; |
| | | dlg.ApplyDataEvent += (catalog, propName) => |
| | | { |
| | | ApplyGrading(catalog, propName); |
| | | gradingHelper.UpdateApply(catalog, propName); |
| | | gradingHelper.Set(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //配置颜色分级 |
| | | private void barBtnGradingSet_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | private void barBtnSetGradingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowSetGradingDlg(); |
| | | SetGradingList(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 应用分级 |
| | | |
| | | //颜色分级应用列表 |
| | | private List<HydroGradingApplyViewModel> _allGradingApplyList = null; |
| | | |
| | | //获取颜色分级应用列表 |
| | | private List<HydroGradingApplyViewModel> GetGradingApplyList() |
| | | { |
| | | if (_allGradingApplyList == null) |
| | | { |
| | | _allGradingApplyList = new List<HydroGradingApplyViewModel>(); |
| | | |
| | | if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0) |
| | | { |
| | | _allGradingApplyList.Add(new HydroGradingApplyViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Pump, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Pump), |
| | | PropName = Yw.Hydro.ParterProp.LinkStatus |
| | | }); |
| | | } |
| | | if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0) |
| | | { |
| | | _allGradingApplyList.Add(new HydroGradingApplyViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Valve, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Valve), |
| | | PropName = Yw.Hydro.ParterProp.LinkStatus |
| | | }); |
| | | } |
| | | if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) |
| | | { |
| | | _allGradingApplyList.Add(new HydroGradingApplyViewModel() |
| | | { |
| | | Code = Yw.Hydro.ParterCatalog.Pipe, |
| | | Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetName(Yw.Hydro.ParterCatalog.Pipe), |
| | | PropName = HydroVisualCalcuProp.CalcuFlow |
| | | }); |
| | | } |
| | | } |
| | | return _allGradingApplyList; |
| | | } |
| | | |
| | | //获取颜色分级应用结果列表 |
| | | private async Task<List<HydroGradingApplyResultViewModel>> GetGradingApplyResultList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | //所有分级列表 |
| | | var allGradingList = await GetGradingList(); |
| | | if (allGradingList == null || allGradingList.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | //所有分级应用列表 |
| | | var allGradingApplyList = GetGradingApplyList(); |
| | | if (allGradingApplyList == null || allGradingApplyList.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | //所有计算结果列表 |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | |
| | | //所有应用结果列表 |
| | | var allGradingApplyResultList = new List<HydroGradingApplyResultViewModel>(); |
| | | allGradingApplyList.ForEach(x => |
| | | { |
| | | var allCatalogGradingList = allGradingList.Where(t => t.Catalog == x.Code).ToList(); |
| | | if (allCatalogGradingList != null || allCatalogGradingList.Count > 0) |
| | | { |
| | | switch (x.Code) |
| | | { |
| | | case Yw.Hydro.ParterCatalog.Pump: |
| | | { |
| | | if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0) |
| | | { |
| | | foreach (var pump in _hydroInfo.Pumps) |
| | | { |
| | | switch (x.PropName) |
| | | { |
| | | case Yw.Hydro.ParterProp.LinkStatus: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.LinkStatus).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var grading = gradingList.Meet(pump.LinkStatus); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuFlow: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuFlow).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuFlow.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuVelocity: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuVelocity.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuHeadLoss: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuHeadLoss.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Valve: |
| | | { |
| | | if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0) |
| | | { |
| | | foreach (var valve in _hydroInfo.Valves) |
| | | { |
| | | switch (x.PropName) |
| | | { |
| | | case Yw.Hydro.ParterProp.LinkStatus: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.LinkStatus).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var grading = gradingList.Meet(valve.LinkStatus); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuFlow: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuFlow).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuFlow.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuVelocity: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuVelocity.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuHeadLoss: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuHeadLoss.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Pipe: |
| | | { |
| | | if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) |
| | | { |
| | | foreach (var pipe in _hydroInfo.Pipes) |
| | | { |
| | | switch (x.PropName) |
| | | { |
| | | case HydroVisualCalcuProp.CalcuFlow: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuFlow).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuFlow.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pipe.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuVelocity: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuVelocity.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pipe.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuHeadLoss: |
| | | { |
| | | var gradingList = allCatalogGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuHeadLoss.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pipe.Code, |
| | | Color = grading.Color |
| | | }; |
| | | allGradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | }); |
| | | |
| | | return allGradingApplyResultList; |
| | | } |
| | | |
| | | //获取颜色分级应用结果列表 |
| | | private async Task<List<HydroGradingApplyResultViewModel>> GetGradingApplyResultList(string catalog, string propName) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | //所有分级列表 |
| | | var allGradingList = await GetGradingList(); |
| | | if (allGradingList == null || allGradingList.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | var currentGradingList = allGradingList.Where(x => x.Catalog == catalog).ToList(); |
| | | if (currentGradingList.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | //所有分级应用列表 |
| | | var allGradingApplyList = GetGradingApplyList(); |
| | | if (allGradingApplyList == null || allGradingApplyList.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | //当前分级应用 |
| | | var gradingApply = allGradingApplyList.Find(x => x.Code == catalog); |
| | | if (gradingApply == null) |
| | | { |
| | | return default; |
| | | } |
| | | gradingApply.PropName = propName; |
| | | |
| | | //所有计算结果 |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | |
| | | //应用结果列表 |
| | | var gradingApplyResultList = new List<HydroGradingApplyResultViewModel>(); |
| | | |
| | | switch (catalog) |
| | | { |
| | | case Yw.Hydro.ParterCatalog.Pump: |
| | | { |
| | | if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0) |
| | | { |
| | | foreach (var pump in _hydroInfo.Pumps) |
| | | { |
| | | switch (propName) |
| | | { |
| | | case Yw.Hydro.ParterProp.LinkStatus: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.LinkStatus).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var grading = gradingList.Meet(pump.LinkStatus); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuFlow: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuFlow).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuFlow.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuVelocity: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuVelocity.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuHeadLoss: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuHeadLoss.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pump.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Valve: |
| | | { |
| | | if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0) |
| | | { |
| | | foreach (var valve in _hydroInfo.Valves) |
| | | { |
| | | switch (propName) |
| | | { |
| | | case Yw.Hydro.ParterProp.LinkStatus: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.LinkStatus).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var grading = gradingList.Meet(valve.LinkStatus); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuFlow: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuFlow).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuFlow.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuVelocity: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuVelocity.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuHeadLoss: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuHeadLoss.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = valve.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Pipe: |
| | | { |
| | | if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) |
| | | { |
| | | foreach (var pipe in _hydroInfo.Pipes) |
| | | { |
| | | switch (propName) |
| | | { |
| | | case HydroVisualCalcuProp.CalcuFlow: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuFlow).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuFlow.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pipe.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuVelocity: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuVelocity.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pipe.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case HydroVisualCalcuProp.CalcuHeadLoss: |
| | | { |
| | | var gradingList = currentGradingList.Where(x => x.PropName == HydroVisualCalcuProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList(); |
| | | if (gradingList != null && gradingList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code); |
| | | if (calcuResult is HydroCalcuLinkResult calcuLinkResult) |
| | | { |
| | | if (calcuLinkResult.CalcuHeadLoss.HasValue) |
| | | { |
| | | var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value)); |
| | | if (grading != null) |
| | | { |
| | | var result = new HydroGradingApplyResultViewModel() |
| | | { |
| | | Code = pipe.Code, |
| | | Color = grading.Color |
| | | }; |
| | | gradingApplyResultList.Add(result); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | |
| | | return gradingApplyResultList; |
| | | } |
| | | |
| | | //颜色分级是否应用了 |
| | | private bool _isGradingApply = false; |
| | | //颜色分级应用编码列表 |
| | | private List<string> _allGradingApplyCodeList = null; |
| | | |
| | | //应用颜色分级 |
| | | private async void ApplyGrading() |
| | | //应用颜色分级列表 |
| | | private async void ApplyGradingList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | _isGradingApply = true; |
| | | var allGradingApplyResultList = await GetGradingApplyResultList(); |
| | | if (allGradingApplyResultList == null || allGradingApplyResultList.Count < 1) |
| | | { |
| | | CancelApplyGrading(); |
| | | return; |
| | | } |
| | | var objGroupList = allGradingApplyResultList.GroupBy(x => x.Color).ToList(); |
| | | objGroupList.ForEach(async x => |
| | | { |
| | | await _bimfaceCtrl?.OverrideComponentsColor(x.Select(t => t.Code).Distinct().ToList(), x.Key, 1); |
| | | }); |
| | | _allGradingApplyCodeList = allGradingApplyResultList.Select(x => x.Code).Distinct().ToList(); |
| | | } |
| | | |
| | | //应用颜色分级 |
| | | private async void ApplyGrading(string catalog, string propName) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | _isGradingApply = true; |
| | | var allGradingApplyResultList = await GetGradingApplyResultList(catalog, propName); |
| | | if (allGradingApplyResultList == null || allGradingApplyResultList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var objGroupList = allGradingApplyResultList.GroupBy(x => x.Color).ToList(); |
| | | objGroupList.ForEach(async x => |
| | | { |
| | | await _bimfaceCtrl?.OverrideComponentsColor(x.Select(t => t.Code).Distinct().ToList(), x.Key, 1); |
| | | }); |
| | | var codeList = allGradingApplyResultList.Select(x => x.Code); |
| | | if (_allGradingApplyCodeList == null) |
| | | { |
| | | _allGradingApplyCodeList = new List<string>(); |
| | | } |
| | | _allGradingApplyCodeList.AddRange(codeList); |
| | | _allGradingApplyCodeList = _allGradingApplyCodeList.Distinct().ToList(); |
| | | } |
| | | |
| | | //自动应用颜色分级 |
| | | private void AutoApplyGrading() |
| | | { |
| | | if (!_isGradingApply) |
| | | { |
| | | return; |
| | | } |
| | | ApplyGrading(); |
| | | } |
| | | |
| | | //取消应用颜色分级 |
| | | private async void CancelApplyGrading() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | _isGradingApply = false; |
| | | if (_allGradingApplyCodeList != null && _allGradingApplyCodeList.Count > 0) |
| | | { |
| | | await _bimfaceCtrl?.RestoreComponentsColor(_allGradingApplyCodeList); |
| | | } |
| | | } |
| | | |
| | | //显示应用颜色分级窗体 |
| | | private void ShowApplyGradingDlg() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allGradingApplyList = GetGradingApplyList(); |
| | | if (allGradingApplyList == null || allGradingApplyList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var gradingHelper = await GetGradingHelper(); |
| | | var dlg = new ApplyHydroGradingDlg(); |
| | | dlg.SetBindingData(allGradingApplyList); |
| | | dlg.ReloadDataEvent += (obj) => |
| | | dlg.SetBindingData(gradingHelper.Applies); |
| | | dlg.ReloadDataEvent += (list) => |
| | | { |
| | | _allGradingApplyList = obj; |
| | | ApplyGrading(); |
| | | gradingHelper.Applies = list; |
| | | gradingHelper.Set(); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //应用颜色分级 |
| | | private void barBtnGradingApply_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | private void barBtnApplyGradingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowApplyGradingDlg(); |
| | | ApplyGradingList(); |
| | | } |
| | | |
| | | //取消应用分级 |
| | | private void batBtnCancelGradingApply_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //颜色分级展示 |
| | | private async void barCkGrading_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | CancelApplyGrading(); |
| | | var gradingHelper = await GetGradingHelper(); |
| | | gradingHelper.Visible = this.barCkGrading.Checked; |
| | | gradingHelper.Set(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | |
| | | //刷新 |
| | | private async void barBtnRefresh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (this.RefreshModelEvent == null) |
| | | { |
| | | return; |
| | | } |
| | | if (XtraMessageBox.Show("刷新后将丢失当前水力信息更改,是否继续刷新?", "询问", MessageBoxButtons.YesNo) == DialogResult.Yes) |
| | | { |
| | | if (_project == null) |
| | | var hydroInfo = await this.RefreshModelEvent.Invoke(); |
| | | if (hydroInfo == null) |
| | | { |
| | | TipFormHelper.ShowError("刷新失败!"); |
| | | return; |
| | | } |
| | | if (_projectSite == null) |
| | | { |
| | | return; |
| | | } |
| | | var hydroRelation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance |
| | | .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation); |
| | | Stopwatch sw = new Stopwatch(); |
| | | sw.Start(); |
| | | _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(hydroRelation.ModelID); |
| | | sw.Stop(); |
| | | TimeSpan ts2 = sw.Elapsed; |
| | | Console.WriteLine("Stopwatch总共花费{0}ms.", ts2.TotalMilliseconds); |
| | | _selectedVisual = null; |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(null); |
| | | ShowSelectedProperty(); |
| | | TipFormHelper.ShowSucceed("数据已刷新"); |
| | | _hydroInfo = hydroInfo; |
| | | SelectVisual(visual: null, eSimulationVisualSource.None); |
| | | |
| | | ResetVisualList(); |
| | | TipFormHelper.ShowSucceed("刷新成功!"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 水流动画 |
| | | #region 监测点 |
| | | |
| | | //水流动画是否可见 |
| | | private bool _isFlowEffectVisible = false; |
| | | //监测点辅助类 |
| | | private SimulationMonitorHelper _monitorHelper = null; |
| | | |
| | | //所有水流动画列表 |
| | | private List<LogicFlowEffect> _allFlowEffectList = null; |
| | | |
| | | //获取流向列表 |
| | | private List<LogicFlowEffect> GetFlowEffectList() |
| | | //获取监测点辅助类 |
| | | private SimulationMonitorHelper GetMonitorHelper() |
| | | { |
| | | if (_hydroInfo == null) |
| | | if (_monitorHelper == null) |
| | | { |
| | | return default; |
| | | var visualListHelper = GetVisualListHelper(); |
| | | _monitorHelper = new SimulationMonitorHelper(visualListHelper); |
| | | } |
| | | if (_allFlowEffectList == null) |
| | | { |
| | | _allFlowEffectList = new List<LogicFlowEffect>(); |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0) |
| | | { |
| | | foreach (var parter in _hydroInfo.Pipes) |
| | | { |
| | | var flowEffect = new LogicFlowEffect(); |
| | | _allFlowEffectList.Add(flowEffect); |
| | | flowEffect.Id = parter.Code; |
| | | flowEffect.Rotation = 90; |
| | | flowEffect.SpeedX = 0.1; |
| | | if (parter.FlowDirectionX == Yw.Hydro.FlowDirection.None) |
| | | { |
| | | flowEffect.SpeedX = 0; |
| | | } |
| | | else if (parter.FlowDirectionX == Yw.Hydro.FlowDirection.Positive) |
| | | { |
| | | flowEffect.SpeedX = 0.1; |
| | | } |
| | | else |
| | | { |
| | | flowEffect.SpeedX = -0.1; |
| | | } |
| | | |
| | | if (parter.FlowDirectionY == Yw.Hydro.FlowDirection.None) |
| | | { |
| | | flowEffect.SpeedY = 0; |
| | | } |
| | | else if (parter.FlowDirectionY == Yw.Hydro.FlowDirection.Positive) |
| | | { |
| | | flowEffect.SpeedY = 0.1; |
| | | } |
| | | else |
| | | { |
| | | flowEffect.SpeedY = -0.1; |
| | | } |
| | | |
| | | var calcuResult = allCalcuResultList?.Find(x => x.Code == parter.Code) as HydroCalcuLinkResult; |
| | | if (calcuResult != null) |
| | | { |
| | | if (calcuResult.CalcuVelocity < 0) |
| | | { |
| | | flowEffect.SpeedX = -flowEffect.SpeedX; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return _allFlowEffectList; |
| | | return _monitorHelper; |
| | | } |
| | | |
| | | //加载水流动画 |
| | | private async void LoadFlowEffect() |
| | | //获取监测点列表 |
| | | private async Task<List<HydroMonitorVmo>> GetMonitorList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allFlowEffectList = GetFlowEffectList(); |
| | | await _bimfaceCtrl?.LoadFlowEffect(allFlowEffectList); |
| | | var helper = GetMonitorHelper(); |
| | | return await helper.GetAll(); |
| | | } |
| | | |
| | | //卸载水流动画 |
| | | private async void UnloadFlowEffect() |
| | | //获取监测对接列表 |
| | | private async Task<List<HydroMonitorVmo>> GetMonitorDockingList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | await _bimfaceCtrl?.UnloadFlowEffect(); |
| | | var helper = GetMonitorHelper(); |
| | | return await helper.GetDockingList(); |
| | | } |
| | | |
| | | //设置水力动画 |
| | | private void SetFlowEffect() |
| | | //获取监测分析列表 |
| | | private async Task<List<HydroMonitorVmo>> GetMonitorAnalyseList() |
| | | { |
| | | if (_isFlowEffectVisible) |
| | | { |
| | | LoadFlowEffect(); |
| | | } |
| | | else |
| | | { |
| | | UnloadFlowEffect(); |
| | | } |
| | | } |
| | | |
| | | //更新水流动画 |
| | | private async void UpdateFlowEffect(Yw.Model.HydroVisualInfo visual) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allFlowEffectList = GetFlowEffectList(); |
| | | var flowEffect = _allFlowEffectList?.Find(x => x.Id == visual.Code); |
| | | if (flowEffect == null) |
| | | { |
| | | return; |
| | | } |
| | | if (visual.FlowDirectionX == Yw.Hydro.FlowDirection.None) |
| | | { |
| | | flowEffect.SpeedX = 0; |
| | | } |
| | | else if (visual.FlowDirectionX == Yw.Hydro.FlowDirection.Positive) |
| | | { |
| | | flowEffect.SpeedX = 0.1; |
| | | } |
| | | else |
| | | { |
| | | flowEffect.SpeedX = -0.1; |
| | | } |
| | | |
| | | if (visual.FlowDirectionY == Yw.Hydro.FlowDirection.None) |
| | | { |
| | | flowEffect.SpeedY = 0; |
| | | } |
| | | else if (visual.FlowDirectionY == Yw.Hydro.FlowDirection.Positive) |
| | | { |
| | | flowEffect.SpeedY = 0.1; |
| | | } |
| | | else |
| | | { |
| | | flowEffect.SpeedY = -0.1; |
| | | } |
| | | |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | var calcuResult = allCalcuResultList?.Find(x => x.Code == visual.Code) as HydroCalcuLinkResult; |
| | | if (calcuResult != null) |
| | | { |
| | | if (calcuResult.CalcuVelocity < 0) |
| | | { |
| | | flowEffect.SpeedX = -flowEffect.SpeedX; |
| | | } |
| | | } |
| | | if (_isFlowEffectVisible) |
| | | { |
| | | await _bimfaceCtrl?.UpdateFlowEffect(flowEffect); |
| | | } |
| | | } |
| | | |
| | | //水流动画是否可见 |
| | | private void barCkFlowEffect_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | _isFlowEffectVisible = this.barCkFlowEffect.Checked; |
| | | SetFlowEffect(); |
| | | var helper = GetMonitorHelper(); |
| | | return await helper.GetAnalyseList(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 选择构件 |
| | | #region 监测值 |
| | | |
| | | //选择构件 |
| | | private Yw.Model.HydroVisualInfo _selectedVisual = null; |
| | | //监测值辅助类 |
| | | private SimulationMonitorValueHelper _monitorValueHelper = null; |
| | | |
| | | //选择构件 |
| | | private Yw.Model.HydroVisualInfo SelectedVisual |
| | | //获取监测值辅助类 |
| | | private SimulationMonitorValueHelper GetMonitorValueHelper() |
| | | { |
| | | get { return _selectedVisual; } |
| | | set |
| | | if (_monitorValueHelper == null) |
| | | { |
| | | _selectedVisual = value; |
| | | if (_selectedVisual == null) |
| | | { |
| | | this.barBtnSetMonitor.Enabled = false; |
| | | } |
| | | else |
| | | { |
| | | this.barBtnSetMonitor.Enabled = true; |
| | | } |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var monitorHelper = GetMonitorHelper(); |
| | | var calcuResultHelper = GetCalcuResultHelper(); |
| | | _monitorValueHelper = new SimulationMonitorValueHelper(visualListHelper, monitorHelper, calcuResultHelper); |
| | | } |
| | | return _monitorValueHelper; |
| | | } |
| | | |
| | | //获取监测值列表 |
| | | private async Task<List<HydroMonitorValueViewModel>> GetMonitorValueList() |
| | | { |
| | | var helper = GetMonitorValueHelper(); |
| | | return await helper.GetAll(); |
| | | } |
| | | |
| | | //获取监测对接值列表 |
| | | private async Task<List<HydroMonitorValueViewModel>> GetMonitorDockingValueList() |
| | | { |
| | | var helper = GetMonitorValueHelper(); |
| | | return await helper.GetDockingList(); |
| | | } |
| | | |
| | | //获取监测分析值列表 |
| | | private async Task<List<HydroMonitorValueViewModel>> GetMonitorAnalyseValueList() |
| | | { |
| | | var helper = GetMonitorValueHelper(); |
| | | return await helper.GetAnalyseList(); |
| | | } |
| | | |
| | | //重置 |
| | | 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 |
| | | #endregion 监测值 |
| | | |
| | | #region 构件明细 |
| | | #region 传感器测点 |
| | | |
| | | #region 构件列表 |
| | | |
| | | //所有构件视图列表 |
| | | private List<HydroVisualViewModel> _allVisualViewModelList = null; |
| | | |
| | | //获取构件视图列表 |
| | | private List<HydroVisualViewModel> GetVisualViewModelList() |
| | | //设置可见构件对接测点列表 |
| | | private async void SetMonitorDockingList(HydroVisualInfo visual) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_allVisualViewModelList == null) |
| | | { |
| | | _allVisualViewModelList = new List<HydroVisualViewModel>(); |
| | | var allVisualList = _hydroInfo.GetAllVisuals(); |
| | | if (allVisualList != null && allVisualList.Count > 0) |
| | | { |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | allVisualList.ForEach(x => |
| | | { |
| | | var vm = HydroVisualViewModelBuilder.CreateVisualViewModel(x, _hydroInfo); |
| | | var calcuResult = allCalcuResultList?.Find(x => x.Code == x.Code); |
| | | if (calcuResult != null) |
| | | { |
| | | vm.UpdateCalcuProperty(calcuResult); |
| | | } |
| | | _allVisualViewModelList.Add(vm); |
| | | }); |
| | | } |
| | | } |
| | | return _allVisualViewModelList; |
| | | } |
| | | |
| | | //更新可见视图属性 |
| | | private void UpdateVisualViewModelProperty() |
| | | { |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | if (allVisualViewModelList != null && allVisualViewModelList.Count > 0) |
| | | { |
| | | allVisualViewModelList.ForEach(x => |
| | | { |
| | | x.UpdateProperty(); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | //更新可见视图属性 |
| | | private void UpdateVisualViewModelProperty(List<string> codes) |
| | | { |
| | | if (codes == null || codes.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | if (allVisualViewModelList != null && allVisualViewModelList.Count > 0) |
| | | { |
| | | allVisualViewModelList.ForEach(x => |
| | | { |
| | | if (codes.Contains(x.Code)) |
| | | { |
| | | x.UpdateProperty(); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | //更新可见视图属性 |
| | | private void UpdateVisualViewModelProperty(List<Yw.Model.HydroVisualInfo> visualList) |
| | | { |
| | | if (visualList == null || visualList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | if (allVisualViewModelList != null && allVisualViewModelList.Count > 0) |
| | | { |
| | | allVisualViewModelList.ForEach(x => |
| | | { |
| | | if (visualList.Exists(t => t.Code == x.Code)) |
| | | { |
| | | x.UpdateProperty(); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | //更新可见视图计算属性 |
| | | private void UpdateVisualViewModelCalcuProperty() |
| | | { |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | if (allVisualViewModelList != null && allVisualViewModelList.Count > 0) |
| | | { |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | if (allCalcuResultList != null && allCalcuResultList.Count > 0) |
| | | { |
| | | allVisualViewModelList.ForEach(x => |
| | | { |
| | | var calcuResult = allCalcuResultList.Find(t => t.Code == x.Code); |
| | | if (calcuResult != null) |
| | | { |
| | | x.UpdateCalcuProperty(calcuResult); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //获取构件视图 |
| | | private HydroVisualViewModel GetVisualViewModel(string code) |
| | | { |
| | | if (string.IsNullOrEmpty(code)) |
| | | { |
| | | return default; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | return allVisualViewModelList?.Find(x => x.Code == code); |
| | | } |
| | | |
| | | //获取可见视图 |
| | | private HydroVisualViewModel GetVisualViewModel(Yw.Model.HydroVisualInfo visual) |
| | | { |
| | | if (visual == null) |
| | | { |
| | | return default; |
| | | return; |
| | | } |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | return allVisualViewModelList?.Find(x => x.Code == visual.Code); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 构件明细控件 |
| | | |
| | | //构件明细控件 |
| | | private Yw.WinFrmUI.HydroVisualListCtrl _visualListCtrl = null; |
| | | |
| | | //获取构件明细控件 |
| | | private Yw.WinFrmUI.HydroVisualListCtrl GetVisualListCtrl() |
| | | { |
| | | if (_visualListCtrl == null) |
| | | var monitorHelper = GetMonitorHelper(); |
| | | var allMonitorList = await monitorHelper.GetAll(); |
| | | var monitorValueHelper = GetMonitorValueHelper(); |
| | | var allMonitorValueList = await monitorValueHelper.GetAll(); |
| | | var calcuResult = GetCalcuResult(); |
| | | var dlg = new SetHydroMonitorDockingListDlg(); |
| | | dlg.ReloadDataEvent += async (list) => |
| | | { |
| | | _visualListCtrl = new HydroVisualListCtrl(); |
| | | _visualListCtrl.Dock = DockStyle.Fill; |
| | | _visualListCtrl.HydroClickInfoEvent += async (visual) => |
| | | { |
| | | ShowSelectedProperty(visual); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponent(_selectedVisual?.Code); |
| | | }; |
| | | _visualListCtrl.HydroChangedInfoEvent += (visualList) => |
| | | { |
| | | UpdateMarkList(visualList); |
| | | UpdateSelectedProperty(); |
| | | AutoApplyGrading(); |
| | | }; |
| | | } |
| | | return _visualListCtrl; |
| | | var monitorList = list?.Select(x => x.Vmo).ToList(); |
| | | await monitorHelper.Update(visual.Code, eSourceType.Docking, monitorList); |
| | | await monitorValueHelper.Update(visual.Code, eSourceType.Docking, list); |
| | | var monitorMarkerHelper = await GetMonitorMarkerHelper(); |
| | | monitorMarkerHelper.Set(); |
| | | }; |
| | | dlg.SetBindingData(_hydroInfo, visual, allMonitorList, allMonitorValueList, calcuResult); |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //构件明细控件是否可见 |
| | | private bool IsVisualListCtrlVisible |
| | | //设置传感器测点 |
| | | private void barBtnDockingMonitor_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_visual == null) |
| | | { |
| | | return; |
| | | } |
| | | SetMonitorDockingList(_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.controlContainerBottom.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerBottom.Controls[0] is HydroVisualListCtrl) |
| | | if (this.controlContainerBottom.Controls[0] is HydroMonitorValueListCtrl) |
| | | { |
| | | return true; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | //显示构件明细控件 |
| | | private void ShowVisualListCtrl() |
| | | //显示监测对接值列表控件 |
| | | private async void ShowMonitorDockingValueListCtrl() |
| | | { |
| | | var monitorValueListCtrl = GetMonitorValueListCtrl(); |
| | | if (!IsMonitorValueListCtrlVisible) |
| | | { |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(monitorValueListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "传感器测值"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | var allValueList = await GetMonitorDockingValueList(); |
| | | var calcuResult = GetCalcuResult(); |
| | | monitorValueListCtrl.SetBindingData(allValueList); |
| | | } |
| | | |
| | | //设置传感器测值 |
| | | private void barBtnDockingMonitorValue_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowMonitorDockingValueListCtrl(); |
| | | } |
| | | |
| | | #endregion 传感器测值 |
| | | |
| | | #region 分析测点 |
| | | |
| | | //设置可见构件分析测点列表 |
| | | private async void SetMonitorAnalyseList(HydroVisualInfo visual) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (IsVisualListCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | var visualListCtrl = GetVisualListCtrl(); |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | visualListCtrl.SetBindingData(allVisualViewModelList); |
| | | var allCalcuResultList = GetCalcuResultList(); |
| | | if (allCalcuResultList == null || allCalcuResultList.Count < 1) |
| | | { |
| | | visualListCtrl.SetNormalView(); |
| | | } |
| | | else |
| | | { |
| | | visualListCtrl.SetCalcuView(); |
| | | } |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(visualListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "构件明细"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | |
| | | //更新构件明细控件 |
| | | private void UpdateVisualListCtrl() |
| | | { |
| | | if (!IsVisualListCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | | _visualListCtrl?.UpdateBindingData(); |
| | | } |
| | | |
| | | //构件明细 |
| | | private void barBtnHydroVisualList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowVisualListCtrl(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | #region 监测列表 |
| | | |
| | | #region 测点列表 |
| | | |
| | | //所有监测点列表 |
| | | private List<HydroMonitorVmo> _allMonitorList = null; |
| | | |
| | | //获取监测点列表 |
| | | private async Task<List<HydroMonitorVmo>> GetMonitorList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_allMonitorList == null) |
| | | { |
| | | _allMonitorList = await BLLFactory<Yw.BLL.HydroMonitor>.Instance.GetByModelID(_hydroInfo.ID); |
| | | if (_allMonitorList == null) |
| | | { |
| | | _allMonitorList = new List<HydroMonitorVmo>(); |
| | | } |
| | | } |
| | | return _allMonitorList; |
| | | } |
| | | |
| | | //更新监测点列表 |
| | | private async void UpdateMonitorList(string code) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (string.IsNullOrEmpty(code)) |
| | | { |
| | | return; |
| | | } |
| | | var allMonitorList = await GetMonitorList(); |
| | | allMonitorList.RemoveAll(x => x.Relation == code); |
| | | var monitorList = await BLLFactory<Yw.BLL.HydroMonitor>.Instance.GetByRelation(_hydroInfo.ID, code); |
| | | if (monitorList != null && monitorList.Count > 0) |
| | | { |
| | | allMonitorList.AddRange(monitorList); |
| | | } |
| | | UpdateMonitorValueList(code, monitorList); |
| | | SetLogicMonitorList(); |
| | | } |
| | | |
| | | //设置选择构件监测点列表 |
| | | private async void SetSelectVisualMonitorList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_selectedVisual == null) |
| | | { |
| | | return; |
| | | } |
| | | var allMonitorList = await GetMonitorList(); |
| | | var dlg = new SetHydroVisualMonitorDlg(); |
| | | dlg.SetBindingData(_hydroInfo, _selectedVisual, allMonitorList); |
| | | dlg.ReloadDataEvent += async (hydroInfo, visual, list) => |
| | | { |
| | | if (hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (visual == null) |
| | | { |
| | | return; |
| | | } |
| | | var bol = await BLLFactory<Yw.BLL.HydroMonitor>.Instance.Save(hydroInfo.ID, visual.Code, list); |
| | | if (!bol) |
| | | { |
| | | TipFormHelper.ShowError("设置失败"); |
| | | return; |
| | | } |
| | | TipFormHelper.ShowSucceed("设置成功"); |
| | | UpdateMonitorList(visual.Code); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //设置监测点 |
| | | private void barBtnSetMonitor_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | SetSelectVisualMonitorList(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 监测值列表 |
| | | |
| | | //所有监测值列表 |
| | | private List<HydroVisualMonitorValueViewModel> _allMonitorValueList = null; |
| | | |
| | | //获取监测值列表 |
| | | private async Task<List<HydroVisualMonitorValueViewModel>> GetMonitorValueList() |
| | | { |
| | | if (_allMonitorValueList == null) |
| | | { |
| | | _allMonitorValueList = new List<HydroVisualMonitorValueViewModel>(); |
| | | var allMonitorList = await GetMonitorList(); |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | allMonitorList.ForEach(x => |
| | | { |
| | | var visual = allVisualViewModelList.Find(t => t.Code == x.Relation); |
| | | if (visual != null) |
| | | { |
| | | var vm = new HydroVisualMonitorValueViewModel(visual.Vmo, x); |
| | | _allMonitorValueList.Add(vm); |
| | | } |
| | | }); |
| | | } |
| | | return _allMonitorValueList; |
| | | } |
| | | |
| | | //更新监测值列表 |
| | | private async void UpdateMonitorValueList(string code, List<HydroMonitorVmo> monitorList) |
| | | { |
| | | if (string.IsNullOrEmpty(code)) |
| | | { |
| | | return; |
| | | } |
| | | var visual = GetVisualViewModel(code)?.Vmo; |
| | | if (visual == null) |
| | | { |
| | | return; |
| | | } |
| | | var allMonitorValueList = await GetMonitorValueList(); |
| | | var monitorValueList = allMonitorValueList.Where(x => x.Vmo.Relation == code).ToList(); |
| | | monitorValueList?.ForEach(x => |
| | | var monitorHelper = GetMonitorHelper(); |
| | | var allMonitorList = await monitorHelper.GetAnalyseList(); |
| | | var dlg = new SetHydroMonitorAnalyseListDlg(); |
| | | dlg.ReloadDataEvent += async (list) => |
| | | { |
| | | var result = monitorList?.Exists(t => t.Relation == x.Vmo.Relation && t.PropName == x.Vmo.PropName); |
| | | if (!(result.HasValue && result.Value)) |
| | | { |
| | | allMonitorValueList.Remove(x); |
| | | } |
| | | }); |
| | | monitorList?.ForEach(x => |
| | | { |
| | | var result = monitorValueList?.Exists(t => t.Vmo.Relation == x.Relation && t.Vmo.PropName == x.PropName); |
| | | if (!(result.HasValue && result.Value)) |
| | | { |
| | | var vm = new HydroVisualMonitorValueViewModel(visual, x); |
| | | allMonitorValueList.Add(vm); |
| | | } |
| | | }); |
| | | await monitorHelper.Update(visual.Code, eSourceType.Analyse, list); |
| | | //var monitorMarkerHelper = await GetMonitorMarkerHelper(); |
| | | //monitorMarkerHelper.Update(visual.Code, monitorList); |
| | | //monitorMarkerHelper.Set(); |
| | | }; |
| | | dlg.SetBindingData(_hydroInfo, visual, allMonitorList); |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 监测值列表控件 |
| | | |
| | | //监测值列表控件 |
| | | private HydroVisualMonitorValueListCtrl _monitorValueListCtrl = null; |
| | | |
| | | //获取监测值列表控件 |
| | | private HydroVisualMonitorValueListCtrl GetMonitorValueListCtrl() |
| | | //设置分析测点 |
| | | private void barBtnAnalyseMonitor_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_monitorValueListCtrl == null) |
| | | if (_visual == null) |
| | | { |
| | | _monitorValueListCtrl = new HydroVisualMonitorValueListCtrl(); |
| | | _monitorValueListCtrl.Dock = DockStyle.Fill; |
| | | _monitorValueListCtrl.HydroViewEvent += (code) => |
| | | { |
| | | _bimfaceCtrl?.ZoomToComponent(code); |
| | | }; |
| | | return; |
| | | } |
| | | return _monitorValueListCtrl; |
| | | SetMonitorAnalyseList(_visual); |
| | | } |
| | | |
| | | //显示监测值列表控件 |
| | | private async void ShowMonitorValueListCtrl() |
| | | #endregion 分析测点 |
| | | |
| | | #region 测点标记 |
| | | |
| | | //监测标记辅助类 |
| | | private SimulationMonitorMarkerHelper _monitorMarkerHelper = null; |
| | | |
| | | //获取监测标记辅助类 |
| | | private async Task<SimulationMonitorMarkerHelper> GetMonitorMarkerHelper() |
| | | { |
| | | var monitorValueListCtrl = GetMonitorValueListCtrl(); |
| | | var allMonitorValueList = await GetMonitorValueList(); |
| | | monitorValueListCtrl.SetBindingData(allMonitorValueList); |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(monitorValueListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "监测值"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | |
| | | //设置监测值 |
| | | private void barBtnSetMonitorValue_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowMonitorValueListCtrl(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 监测列表显示 |
| | | |
| | | //监测是否显示 |
| | | private bool _isMonitorVisible = false; |
| | | |
| | | //获取业务监测列表 |
| | | private async Task<List<LogicMonitor>> GetLogicMonitorList() |
| | | { |
| | | var allMonitorList = await GetMonitorList(); |
| | | var allLogicMonitorList = allMonitorList.Select(x => |
| | | if (_monitorMarkerHelper == null) |
| | | { |
| | | var logicMonitor = new LogicMonitor(); |
| | | logicMonitor.Id = x.Relation; |
| | | logicMonitor.PropName = x.PropName; |
| | | logicMonitor.Description = x.Description; |
| | | return logicMonitor; |
| | | }).ToList(); |
| | | return allLogicMonitorList; |
| | | } |
| | | |
| | | //设置业务监测列表 |
| | | private async void SetLogicMonitorList() |
| | | { |
| | | if (_isMonitorVisible) |
| | | { |
| | | var allLogicMonitorList = await GetLogicMonitorList(); |
| | | await _bimfaceCtrl?.SetLogicMonitors(allLogicMonitorList); |
| | | var monitorHelper = GetMonitorHelper(); |
| | | var bimfaceCtrl = await GetBimfaceCtrl(); |
| | | _monitorMarkerHelper = new SimulationMonitorMarkerHelper(monitorHelper, bimfaceCtrl); |
| | | } |
| | | else |
| | | { |
| | | await _bimfaceCtrl?.ClearLogicMonitors(); |
| | | } |
| | | return _monitorMarkerHelper; |
| | | } |
| | | |
| | | //显示状态改变 |
| | | private void barCkMonitor_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //测点显示状态改变 |
| | | private async void barCkMonitorVisible_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | _isMonitorVisible = this.barCkMonitor.Checked; |
| | | SetLogicMonitorList(); |
| | | var monitorMarkerHelper = await GetMonitorMarkerHelper(); |
| | | monitorMarkerHelper.Visible = this.barCkMonitorVisible.Checked; |
| | | monitorMarkerHelper.Set(); |
| | | } |
| | | |
| | | #endregion 测点标记 |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | #region 水力检查 |
| | | |
| | | #region 检查结果 |
| | | |
| | | //检查结果缓存 |
| | | private HydroCheckResult _checkResult = null; |
| | | |
| | | //获取检查结果 |
| | | //needCheckAgain 用于确定是否需要重新检查 |
| | | private HydroCheckResult GetCheckResult(bool needCheckAgain = false) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (needCheckAgain) |
| | | { |
| | | _checkResult = _hydroInfo.Check(); |
| | | } |
| | | if (_checkResult == null) |
| | | { |
| | | _checkResult = _hydroInfo.Check(); |
| | | } |
| | | return _checkResult; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 检查控件 |
| | | #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 += async (code) => |
| | | _checkCtrl.HydroClickEvent += (code) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var elementIds = new List<string>(); |
| | | if (string.IsNullOrEmpty(code)) |
| | | { |
| | | this.SelectedVisual = null; |
| | | } |
| | | else |
| | | { |
| | | var allVisualViewModelList = GetVisualViewModelList(); |
| | | this.SelectedVisual = allVisualViewModelList?.Find(x => x.Code == code)?.Vmo; |
| | | if (this.SelectedVisual != null) |
| | | { |
| | | elementIds.Add(this.SelectedVisual.Code); |
| | | } |
| | | } |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds); |
| | | ShowSelectedProperty(); |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var visual = visualListHelper.GetVisual(code); |
| | | SelectVisual(visual, eSimulationVisualSource.Check); |
| | | }; |
| | | } |
| | | return _checkCtrl; |
| | | } |
| | | |
| | | //显示检查控件 |
| | | //needCheckAgain 用于确定是否需要重新检查 |
| | | private void ShowCheckCtrl(bool needCheckAgain = false) |
| | | //检查控件是否可见 |
| | | private bool IsCheckCtrlVisible |
| | | { |
| | | var checkResult = GetCheckResult(needCheckAgain); |
| | | 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); |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(checkCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "检查结果"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | |
| | | #endregion |
| | | //显示检查控件 |
| | | private void ShowCheckCtrl() |
| | | { |
| | | var checkResult = GetCheckResult(); |
| | | ShowCheckCtrl(checkResult); |
| | | } |
| | | |
| | | //检查 |
| | | private void barBtnCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowCheckCtrl(true); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region EPA计算结果 |
| | | |
| | | //EPA计算结果 |
| | | private Yw.EPAnet.CalcuResult _epaCalcuResult = null; |
| | | |
| | | //获取EPA计算结果 |
| | | //CalcuMode 在 Yw.EPANet.Calcu.Core 中定义 |
| | | //NeedCalcuAgain 是否需要重新计算 |
| | | private Yw.EPAnet.CalcuResult GetEpaCalcuResult(string calcuMode, bool needCalcuAgain = false) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | return; |
| | | } |
| | | if (needCalcuAgain) |
| | | { |
| | | var network = _hydroInfo.ToNetwork(); |
| | | _epaCalcuResult = network.Calcu(calcuMode); |
| | | } |
| | | if (_epaCalcuResult == null) |
| | | { |
| | | var network = _hydroInfo.ToNetwork(); |
| | | _epaCalcuResult = network.Calcu(calcuMode); |
| | | } |
| | | return _epaCalcuResult; |
| | | var checkResult = _hydroInfo.Check(); |
| | | ShowCheckCtrl(checkResult); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 模型检查 |
| | | |
| | | #region 模型计算 |
| | | |
| | | #region 计算结果 |
| | | |
| | | //计算结果辅助类 |
| | | private SimulationCalcuResultHelper _calcuResultHelper = null; |
| | | |
| | | //获取计算结果辅助类 |
| | | private SimulationCalcuResultHelper GetCalcuResultHelper() |
| | | { |
| | | if (_calcuResultHelper == null) |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | _calcuResultHelper = new SimulationCalcuResultHelper(workingHelper); |
| | | } |
| | | return _calcuResultHelper; |
| | | } |
| | | |
| | | #endregion 计算结果 |
| | | |
| | | #region 计算失败 |
| | | |
| | |
| | | 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(Yw.EPAnet.CalcuResult calcuResult) |
| | | private void ShowCalcuFailedCtrl(HydroCalcuResult calcuResult) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | |
| | | 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); |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(calcuFailedCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "计算失败原因"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | |
| | | //显示计算失败控件 |
| | | private void ShowCalcuFailedCtrl() |
| | | #endregion 计算失败 |
| | | |
| | | #region 计算警告 |
| | | |
| | | //计算警告控件 |
| | | private HydroCalcuWarningCtrl _calcuWarningCtrl = null; |
| | | |
| | | //获取计算警告控件 |
| | | private HydroCalcuWarningCtrl GetCalcuWarningCtrl() |
| | | { |
| | | ShowCalcuFailedCtrl(_epaCalcuResult); |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 管网修复 |
| | | |
| | | //修复管网 |
| | | private void Repair() |
| | | //显示计算警告控件 |
| | | private void ShowCalcuWarningCtrl(HydroCalcuResult calcuResult) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var checkResult = GetCheckResult(true); |
| | | if (checkResult == null) |
| | | if (calcuResult == null) |
| | | { |
| | | return; |
| | | } |
| | | if (!checkResult.Succeed) |
| | | if (!calcuResult.Succeed) |
| | | { |
| | | ShowCheckCtrl(false); |
| | | TipFormHelper.ShowWarn("检查失败导致无法进行试算,停止修复!"); |
| | | return; |
| | | } |
| | | var calcuResult = GetEpaCalcuResult(Yw.EPAnet.CalcuMode.Simple, true); |
| | | if (calcuResult == null || !calcuResult.Succeed) |
| | | var calcuWaringCtrl = GetCalcuWarningCtrl(); |
| | | if (!IsCalcuWarningCtrlVisible) |
| | | { |
| | | ShowCalcuFailedCtrl(calcuResult); |
| | | TipFormHelper.ShowWarn("试算失败,停止修复!"); |
| | | return; |
| | | 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 allLinks = _hydroInfo.GetAllLinks(); |
| | | if (allLinks != null && allLinks.Count < 1) |
| | | { |
| | | TipFormHelper.ShowError("模型中未包含管段信息,停止修复!"); |
| | | return; |
| | | } |
| | | int count = 0; |
| | | foreach (var link in allLinks) |
| | | { |
| | | var calcuLink = calcuResult.LinkList?.Find(x => x.Id == link.Code); |
| | | if (calcuLink == null) |
| | | { |
| | | continue; |
| | | } |
| | | if (calcuLink.Flow < 0) |
| | | { |
| | | var tempCode = link.StartCode; |
| | | link.StartCode = link.EndCode; |
| | | link.EndCode = tempCode; |
| | | count++; |
| | | } |
| | | } |
| | | UpdateVisualViewModelProperty(); |
| | | UpdateVisualListCtrl(); |
| | | UpdateSelectedProperty(); |
| | | TipFormHelper.ShowSucceed($"修复完成,共修复管段({count})个!"); |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var allVisualDict = visualListHelper.GetVisualDict(); |
| | | calcuWaringCtrl.SetBindingData(calcuResult.WainingList, allVisualDict); |
| | | } |
| | | |
| | | //管网修复 |
| | | private void barBtnRepair_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | #endregion 计算警告 |
| | | |
| | | #region 计算标签 |
| | | |
| | | //计算标签辅助类 |
| | | private SimulationCalcuResultLabelHelper _calcuResultLabelHelper = null; |
| | | |
| | | //获取计算标签辅助类 |
| | | private async Task<SimulationCalcuResultLabelHelper> GetCalcuResultLabelHelper() |
| | | { |
| | | Repair(); |
| | | if (_calcuResultLabelHelper == null) |
| | | { |
| | | var calcuResultHelper = GetCalcuResultHelper(); |
| | | var bimfaceCtrl = await GetBimfaceCtrl(); |
| | | _calcuResultLabelHelper = new SimulationCalcuResultLabelHelper(calcuResultHelper, bimfaceCtrl); |
| | | } |
| | | return _calcuResultLabelHelper; |
| | | } |
| | | |
| | | #endregion |
| | | //设置计算标签是否显示 |
| | | private async void barCkCalcu_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var calcuResultLabelHelper = await GetCalcuResultLabelHelper(); |
| | | calcuResultLabelHelper.Visible = this.barCkCalcu.Checked; |
| | | calcuResultLabelHelper.Set(); |
| | | } |
| | | |
| | | #region 导出INP文件 |
| | | #endregion 计算标签 |
| | | |
| | | #endregion 模型计算 |
| | | |
| | | #region 导出INP |
| | | |
| | | //导出INP文件 |
| | | private void barBtnExportInp_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | |
| | | TipFormHelper.ShowSucceed("导出成功"); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 导出INP |
| | | |
| | | #region 并联分析 |
| | | #region 水泵列表 |
| | | |
| | | //并联分析 |
| | | private void ParallelAnalysis() |
| | | //性能曲线 |
| | | private void PumpFeat() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | |
| | | XtraMessageBox.Show("无水泵信息"); |
| | | return; |
| | | } |
| | | var vmList = new List<XhsSinglePumpViewModel>(); |
| | | foreach (var pump in pumps) |
| | | var dlg = new SimulationPumpFeatDlg(); |
| | | dlg.SaveEvent += async (list) => |
| | | { |
| | | if (!pump.RatedN.HasValue) |
| | | { |
| | | continue; |
| | | } |
| | | var qh = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQH)?.CurveData; |
| | | var qe = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQE)?.CurveData; |
| | | var qp = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQP)?.CurveData; |
| | | if (qh == null) |
| | | { |
| | | continue; |
| | | } |
| | | 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(); |
| | | } |
| | | |
| | | var qhPtList = qh.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); |
| | | var qePtList = qe?.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); |
| | | var qpPtList = qp?.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); |
| | | //性能曲线 |
| | | private void barBtnPumpCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | PumpFeat(); |
| | | } |
| | | |
| | | var vm = new XhsSinglePumpViewModel(); |
| | | vmList.Add(vm); |
| | | vm.ID = pump.ID; |
| | | vm.Name = pump.Name; |
| | | vm.Code = pump.Code; |
| | | vm.IsBp = true; |
| | | vm.RunStatus = pump.LinkStatus == Yw.Hydro.LinkStatus.Open; |
| | | vm.RatedHz = pump.RatedHz; |
| | | vm.CurrentHz = Math.Round(pump.RatedHz * pump.SpeedRatio, 1); |
| | | vm.RatedSpeed = pump.RatedN.Value; |
| | | vm.CurrentSpeed = Math.Round(pump.RatedN.Value * pump.SpeedRatio, 1); |
| | | vm.CurveQH = qhPtList; |
| | | vm.CurveQE = qePtList; |
| | | vm.CurveQP = qpPtList; |
| | | |
| | | //并联模拟 |
| | | private void PumpParallel() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | var dlg = new PumpParallelAnalyDlg(); |
| | | dlg.SetBindingData(vmList); |
| | | dlg.ReloadDataEvent += (list) => |
| | | 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.RunStatus ? Yw.Hydro.PumpStatus.Open : Yw.Hydro.PumpStatus.Closed; |
| | | pump.SpeedRatio = x.CurrentHz / pump.RatedHz; |
| | | pump.LinkStatus = x.LinkStatus; |
| | | pump.SpeedRatio = x.SpeedRatio; |
| | | } |
| | | }); |
| | | var codes = list?.Select(x => x.Code).ToList(); |
| | | UpdateVisualViewModelProperty(codes); |
| | | ShowSelectedProperty(); |
| | | UpdateVisualListCtrl(); |
| | | return true; |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //并联分析 |
| | | private void barBtnParallel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ParallelAnalysis(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 工况计算 |
| | | |
| | | //所有工况元组列表 |
| | | private Tuple<HydroWorkingVmo, HydroCheckResult, HydroCalcuResult> _allWorkingTupleList = null; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | #region 工况 |
| | | |
| | | |
| | | //显示工况计算窗体 |
| | | private void ShowWorkingCalcuDlg() |
| | | { |
| | | var dlg = new SetHydroWorkingDlg(); |
| | | dlg.HydroViewEvent += async (parter) => |
| | | { |
| | | _selectedVisual = parter as Yw.Model.HydroVisualInfo; |
| | | if (_selectedVisual != null) |
| | | { |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(new List<string>() { _selectedVisual.Code }); |
| | | } |
| | | ShowSelectedProperty(); |
| | | }; |
| | | dlg.HydroCalcuEvent += async (hydroInfo, workingInfo) => |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | _hydroInfo.UpdateWorkingInfo(workingInfo); |
| | | //校验 |
| | | _checkResult = _hydroInfo.Check(); |
| | | if (!_checkResult.Succeed) |
| | | { |
| | | ShowCheckCtrl(); |
| | | TipFormHelper.ShowWarn("校验失败,请检查后重试"); |
| | | return; |
| | | } |
| | | |
| | | WaitFormHelper.ShowWaitForm(this, "正在计算分析中,请稍候..."); |
| | | |
| | | |
| | | //await Task.Delay(5000); |
| | | |
| | | var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo); |
| | | _epaCalcuResult = netWork.CalcuMinorLoss(); |
| | | |
| | | WaitFormHelper.HideWaitForm(); |
| | | if (_epaCalcuResult.Succeed) |
| | | { |
| | | GetCalcuResultList(false); |
| | | UpdateVisualViewModelProperty(); |
| | | UpdateVisualViewModelCalcuProperty(); |
| | | UpdateVisualListCtrl(); |
| | | UpdateSelectedProperty(); |
| | | await _bimfaceCtrl?.SetLogicCalcuCustomLabels(_epaCalcuResult); |
| | | TipFormHelper.ShowSucceed("计算成功!"); |
| | | var codes = _hydroInfo.Pumps.Select(x => x.Code).ToList(); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(codes); |
| | | } |
| | | else |
| | | { |
| | | ShowCalcuFailedCtrl(); |
| | | TipFormHelper.ShowError("计算失败!"); |
| | | } |
| | | AutoApplyGrading(); |
| | | UpdateVisualListCtrl(); |
| | | ShowSelectedProperty(); |
| | | 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; |
| | | |
| | | #region 计算结果 |
| | | |
| | | //所有计算结果列表 |
| | | private List<HydroCalcuVisualResult> _allCalcuResultList = null; |
| | | |
| | | //获取计算结果 |
| | | //true 使用缓存,false 不使用缓存 |
| | | private List<HydroCalcuVisualResult> GetCalcuResultList(bool isCache = true) |
| | | //获取评价规则辅助类 |
| | | 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; |
| | | } |
| | | |
| | | WaitFormHelper.ShowWaitForm(this, "正在计算分析中,请稍候..."); |
| | | await Task.Delay(3000); |
| | | var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss, _calcuPressModeIsHead); |
| | | 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; |
| | | } |
| | | if (_epaCalcuResult == null) |
| | | |
| | | #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; |
| | | } |
| | | if (!_epaCalcuResult.Succeed) |
| | | |
| | | #endregion |
| | | |
| | | var vm = new SimulationPrintViewModel(); |
| | | |
| | | #region 项目 |
| | | |
| | | vm.Project = new SimulationPrintProjectViewModel(_project); |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (isCache) |
| | | { |
| | | return _allCalcuResultList; |
| | | return vm; |
| | | } |
| | | |
| | | _allCalcuResultList = new List<HydroCalcuVisualResult>(); |
| | | #endregion |
| | | |
| | | //节点 |
| | | var allNodeList = _hydroInfo.GetAllNodes(); |
| | | if (allNodeList != null && allNodeList.Count > 0) |
| | | { |
| | | foreach (var node in allNodeList) |
| | | #region 水泵列表 |
| | | |
| | | vm.PumpList = _hydroInfo.Pumps?.Select(x => |
| | | { |
| | | var calcuNode = _epaCalcuResult.NodeList?.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 |
| | | }; |
| | | _allCalcuResultList.Add(calcuResult); |
| | | } |
| | | 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 = SimulationPrintAccuracyHelper.Create(baseHydroInfoRhs, allMonitorList, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); |
| | | //水泵分析 |
| | | printWorking.PumpAnaly = SimulationPrintPumpAnalyHelper.Create(baseHydroInfoRhs, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); |
| | | //监测分析 |
| | | printWorking.MonitorAnaly = SimulationPrintMonitorAnalyHelper.Create(baseHydroInfoRhs, allMonitorList, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); |
| | | //能耗分析 |
| | | printWorking.EnergyAnaly = SimulationPrintEnergyAnalyHelper.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 = SimulationPrintAccuracyHelper.Create(hydroInfoRhs, allMonitorList, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); |
| | | //水泵分析 |
| | | printWorking.PumpAnaly = SimulationPrintPumpAnalyHelper.Create(hydroInfoRhs, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); |
| | | //监测分析 |
| | | printWorking.MonitorAnaly = SimulationPrintMonitorAnalyHelper.Create(hydroInfoRhs, allMonitorList, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); |
| | | //能耗分析 |
| | | printWorking.EnergyAnaly = SimulationPrintEnergyAnalyHelper.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); |
| | | } |
| | | } |
| | | |
| | | //管段 |
| | | var allLinkList = _hydroInfo.GetAllLinks(); |
| | | if (allLinkList != null && allLinkList.Count > 0) |
| | | { |
| | | foreach (var link in allLinkList) |
| | | { |
| | | var calcuLink = _epaCalcuResult.LinkList?.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 |
| | | }; |
| | | _allCalcuResultList.Add(calcuResult); |
| | | } |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | //流量计 |
| | | var allFlowmeterList = _hydroInfo.Flowmeters; |
| | | if (allFlowmeterList != null && allFlowmeterList.Count > 0) |
| | | { |
| | | foreach (var flowmeter in allFlowmeterList) |
| | | { |
| | | var calcuFlowmeterResult = _allCalcuResultList.Find(x => x.Code == flowmeter.Code) as HydroCalcuNodeResult; |
| | | if (calcuFlowmeterResult != null) |
| | | { |
| | | var calcuFlowmeterNewResult = new HydroCalcuFlowmeterResult(calcuFlowmeterResult); |
| | | var calcuFlowmeterLinkResultList = new List<HydroCalcuLinkResult>(); |
| | | var flowmeterLinkList = allLinkList?.Where(x => x.StartCode == flowmeter.Code || x.EndCode == flowmeter.Code).ToList(); |
| | | if (flowmeterLinkList != null && flowmeterLinkList.Count > 0) |
| | | { |
| | | foreach (var flowmeterLink in flowmeterLinkList) |
| | | { |
| | | var calcuFlowmeterLinkResult = _allCalcuResultList.Find(x => x.Code == flowmeterLink.Code) as HydroCalcuLinkResult; |
| | | if (calcuFlowmeterLinkResult != null) |
| | | { |
| | | calcuFlowmeterLinkResultList.Add(calcuFlowmeterLinkResult); |
| | | } |
| | | } |
| | | } |
| | | if (calcuFlowmeterLinkResultList.Exists(x => x.CalcuFlow.HasValue)) |
| | | { |
| | | calcuFlowmeterNewResult.CalcuQ = calcuFlowmeterLinkResultList.Where(x => x.CalcuFlow.HasValue).Average(x => x.CalcuFlow.Value); |
| | | } |
| | | _allCalcuResultList.Remove(calcuFlowmeterResult); |
| | | _allCalcuResultList.Add(calcuFlowmeterNewResult); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //压力表 |
| | | var allPressmeterList = _hydroInfo.Pressmeters; |
| | | if (allPressmeterList != null && allPressmeterList.Count > 0) |
| | | { |
| | | foreach (var pressmeter in allPressmeterList) |
| | | { |
| | | var calcuPressmeterResult = _allCalcuResultList.Find(x => x.Code == pressmeter.Code) as HydroCalcuNodeResult; |
| | | if (calcuPressmeterResult != null) |
| | | { |
| | | var calcuPressmeterNewResult = new HydroCalcuPressmeterResult(calcuPressmeterResult); |
| | | calcuPressmeterNewResult.CalcuPr = calcuPressmeterResult.CalcuPress; |
| | | _allCalcuResultList.Remove(calcuPressmeterResult); |
| | | _allCalcuResultList.Add(calcuPressmeterNewResult); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //水泵 |
| | | var allPumpList = _hydroInfo.Pumps; |
| | | if (allPumpList != null && allPumpList.Count > 0) |
| | | { |
| | | foreach (var pump in allPumpList) |
| | | { |
| | | var calcuPumpResult = _allCalcuResultList.Find(x => x.Code == pump.Code) as HydroCalcuLinkResult; |
| | | if (calcuPumpResult != null) |
| | | { |
| | | var calcuPumpNewResult = new HydroCalcuPumpResult(calcuPumpResult); |
| | | calcuPumpNewResult.CalcuQ = calcuPumpResult.CalcuFlow; |
| | | if (calcuPumpNewResult.CalcuQ.HasValue) |
| | | { |
| | | var calcuNodeStartResult = _allCalcuResultList.Find(x => x.Code == pump.StartCode) as HydroCalcuNodeResult; |
| | | var calcuNodeEndResult = _allCalcuResultList.Find(x => x.Code == pump.EndCode) as HydroCalcuNodeResult; |
| | | if (calcuNodeStartResult != null && calcuNodeEndResult != null) |
| | | { |
| | | if (calcuNodeStartResult.CalcuPress.HasValue && calcuNodeEndResult.CalcuPress.HasValue) |
| | | { |
| | | calcuPumpNewResult.CalcuH = Math.Abs(calcuNodeStartResult.CalcuPress.Value - calcuNodeEndResult.CalcuPress.Value); |
| | | } |
| | | if (pump.LinkStatus == Yw.Hydro.PumpStatus.Open && pump.RatedN.HasValue) |
| | | { |
| | | var curveqp = _hydroInfo.Curves?.Find(x => x.Code == pump.CurveQP); |
| | | if (curveqp != null) |
| | | { |
| | | if (curveqp.CurveData != null && curveqp.CurveData.Count > 3) |
| | | { |
| | | var point2dList = curveqp.CurveData.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); |
| | | var point2dSimularList = point2dList.GetQPPointListByN(pump.RatedN.Value, pump.RatedN.Value * pump.SpeedRatio); |
| | | var pumpCurveQp = new Yw.Pump.CurveQP(eFeatType.Cubic, point2dSimularList); |
| | | calcuPumpNewResult.CalcuP = pumpCurveQp.FeatCurve.GetPointY(calcuPumpNewResult.CalcuQ.Value); |
| | | } |
| | | } |
| | | } |
| | | if (calcuPumpNewResult.CalcuH.HasValue && calcuPumpNewResult.CalcuP.HasValue) |
| | | { |
| | | calcuPumpNewResult.CalcuE = Yw.Pump.CalculationHelper.CalcuE(calcuPumpNewResult.CalcuQ.Value, calcuPumpNewResult.CalcuH.Value, calcuPumpNewResult.CalcuP.Value); |
| | | } |
| | | } |
| | | } |
| | | _allCalcuResultList.Remove(calcuPumpResult); |
| | | _allCalcuResultList.Add(calcuPumpNewResult); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return _allCalcuResultList; |
| | | return vm; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | //水力计算 |
| | | private void barBtnHydroCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | //导出word |
| | | private async void barBtnExportWord_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowWorkingCalcuDlg(); |
| | | var printInfo = await CreatePrintInfo(); |
| | | var printDlg = new 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); |
| | | }; |
| | | dlg.DeleteDataEvent += (rhs) => |
| | | { |
| | | this.RemoveWorkingEvent?.Invoke(rhs); |
| | | }; |
| | | dlg.SetBindingData(dict); |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 监测分析 |
| | | |
| | | //监测分析列表控件 |
| | | private HydroWorkingMonitorAnalyListCtrl _monitorAnalyListCtrl = null; |
| | | |
| | | //获取监测分析列表控件 |
| | | private HydroWorkingMonitorAnalyListCtrl GetMonitorAnalyListCtrl() |
| | | { |
| | | if (_monitorAnalyListCtrl == null) |
| | | { |
| | | _monitorAnalyListCtrl = new HydroWorkingMonitorAnalyListCtrl(); |
| | | _monitorAnalyListCtrl.Dock = DockStyle.Fill; |
| | | _monitorAnalyListCtrl.HydroViewEvent += (code) => |
| | | { |
| | | var visual = GetVisual(code); |
| | | SelectVisual(visual, eSimulationVisualSource.Monitor); |
| | | }; |
| | | } |
| | | return _monitorAnalyListCtrl; |
| | | } |
| | | |
| | | //监测分析列表控件是否可见 |
| | | private bool IsMonitorAnalyListCtrlVisible |
| | | { |
| | | get |
| | | { |
| | | if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | if (this.controlContainerBottom.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerBottom.Controls[0] is HydroWorkingMonitorAnalyListCtrl) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //显示监测值列表控件 |
| | | private async void ShowMonitorAnalyListCtrl() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var allWorkingList = GetCheckedWorkingList(); |
| | | if (allWorkingList == null || allWorkingList.Count < 1) |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (!workingHelper.Initialized) |
| | | { |
| | | TipFormHelper.ShowWarn("请计算后重试!"); |
| | | return; |
| | | } |
| | | } |
| | | var monitorAnalyListCtrl = GetMonitorAnalyListCtrl(); |
| | | if (!IsMonitorAnalyListCtrlVisible) |
| | | { |
| | | this.controlContainerBottom.Controls.Clear(); |
| | | this.controlContainerBottom.Controls.Add(monitorAnalyListCtrl); |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlBottom.Text = "监测分析"; |
| | | this.docPnlBottom.Height = 350; |
| | | } |
| | | var allMontorList = await GetMonitorAnalyseList(); |
| | | if (allWorkingList == null || allWorkingList.Count < 1) |
| | | { |
| | | monitorAnalyListCtrl.SetBindingData(_hydroInfo, allMontorList, GetCalcuResult()); |
| | | } |
| | | else |
| | | { |
| | | monitorAnalyListCtrl.SetBindingData(_hydroInfo, allMontorList, allWorkingList); |
| | | } |
| | | } |
| | | |
| | | //监测分析 |
| | | private void barBtnWorkingMonitorAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowMonitorAnalyListCtrl(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 工况分析 |
| | | |
| | | //选择进口水源 |
| | | private void SelectInputSource() |
| | | { |
| | | var sources = GetSourceList(); |
| | | if (sources != null) |
| | | { |
| | | if (sources.Count == 1) |
| | | { |
| | | SelectVisual(sources[0], eSimulationVisualSource.None); |
| | | } |
| | | else |
| | | { |
| | | var source = sources.FirstOrDefault(x => x.Flags.Contains(HStation.Xhs.Flags.进口)); |
| | | if (source != null) |
| | | { |
| | | SelectVisual(source, eSimulationVisualSource.None); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //获取选择节点 |
| | | private 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 barBtnWorkingEvaluation_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var allMonitorList = await GetMonitorDockingList(); |
| | | |
| | | var workingCheckedListHelper = GetWorkingCheckedListHelper(); |
| | | var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList(); |
| | | if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1) |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (!workingHelper.Initialized) |
| | | { |
| | | TipFormHelper.ShowWarn("请计算后重试!"); |
| | | return; |
| | | } |
| | | var dlg = new HydroSingleWorkingEvaluationDlg(); |
| | | dlg.SetBindingData(workingHelper.HydroInfo, allMonitorList, workingHelper.Working, workingHelper.CalcuResult); |
| | | dlg.ShowDialog(); |
| | | } |
| | | else |
| | | { |
| | | var dlg = new HydroMultiWorkingEvaluationDlg(); |
| | | dlg.SetBindingData(_hydroInfo, allMonitorList, allCheckedWorkingList); |
| | | dlg.ShowDialog(); |
| | | } |
| | | } |
| | | |
| | | //水泵分析 |
| | | private void barBtnPumpAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var workingCheckedListHelper = GetWorkingCheckedListHelper(); |
| | | var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList(); |
| | | if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1) |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (!workingHelper.Initialized) |
| | | { |
| | | TipFormHelper.ShowWarn("请计算后重试!"); |
| | | return; |
| | | } |
| | | var dlg = new SimulationSingleWorkingPumpAnalyDlg(); |
| | | dlg.SetBindingData(workingHelper.HydroInfo, workingHelper.CalcuResult); |
| | | dlg.ShowDialog(); |
| | | } |
| | | else |
| | | { |
| | | var dlg = new SimulationMultiWorkingPumpAnalyDlg(); |
| | | dlg.SetBindingData(_hydroInfo, allCheckedWorkingList); |
| | | dlg.ShowDialog(); |
| | | } |
| | | } |
| | | |
| | | //能效分析 |
| | | private async void barBtnWorkingPower_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var allMonitorList = await GetMonitorList(); |
| | | var workingCheckedListHelper = GetWorkingCheckedListHelper(); |
| | | var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList(); |
| | | if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1) |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (!workingHelper.Initialized) |
| | | { |
| | | TipFormHelper.ShowWarn("请计算后重试!"); |
| | | return; |
| | | } |
| | | var dlg = new SimulationSingleWorkingEnergyDlg(); |
| | | dlg.SetBindingData(workingHelper.Working, workingHelper.HydroInfo, allMonitorList, workingHelper.CalcuResult); |
| | | dlg.ShowDialog(); |
| | | } |
| | | else |
| | | { |
| | | var dlg = new SimulationMultiWorkingEnergyDlg(); |
| | | dlg.SetBindingData(_hydroInfo, allMonitorList, allCheckedWorkingList); |
| | | dlg.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 (_visual == null) |
| | | { |
| | | 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 monitorHelper = GetMonitorHelper(); |
| | | var allMonitorList = await monitorHelper.GetAll(); |
| | | |
| | | var workingCheckedListHelper = GetWorkingCheckedListHelper(); |
| | | var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList(); |
| | | if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1) |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | if (!workingHelper.Initialized) |
| | | { |
| | | TipFormHelper.ShowWarn("请计算后重试!"); |
| | | return; |
| | | } |
| | | var dlg = new SimulationSingleWorkingAnalyDlg(); |
| | | dlg.SetBindingData(workingHelper.HydroInfo, allMonitorList, workingHelper.Working, workingHelper.CalcuResult, visual); |
| | | dlg.ShowDialog(); |
| | | } |
| | | else |
| | | { |
| | | var dlg = new SimulationMultiWorkingAnalyDlg(); |
| | | dlg.SetBindingData(_hydroInfo, allMonitorList, allCheckedWorkingList, visual); |
| | | dlg.ShowDialog(); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #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 方案管理 |
| | | |
| | | |
| | | |