| | |
| | | using Yw.Model; |
| | | using Yw.Vmo; |
| | | using Yw.WinFrmUI.Q3d; |
| | | |
| | | using Yw.EPAnet; |
| | | using Mapster; |
| | | namespace HStation.WinFrmUI |
| | | { |
| | | public partial class XhsProjectSimulationWorkingPage : DocumentPage |
| | |
| | | public XhsProjectSimulationWorkingPage() |
| | | { |
| | | InitializeComponent(); |
| | | this.PageTitle.Caption = "水力工况"; |
| | | this.PageTitle.Caption = "水力模拟工况"; |
| | | this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; |
| | | } |
| | | |
| | | private HStation.Vmo.XhsProjectVmo _project = null;//项目 |
| | | private HStation.Vmo.XhsProjectSiteVmo _projectSite = null;//项目站 |
| | | private XhsSchemeVmo _scheme = null;//方案 |
| | | private Yw.Model.HydroModelInfo _hydroInfo = null;//水力信息 |
| | | private HydroWorkingVmo _working = null;//工况 |
| | | |
| | |
| | | { |
| | | _project = project; |
| | | _projectSite = projectSite; |
| | | _hydroInfo = hydroInfo; |
| | | _hydroInfo = hydroInfo.Adapt<Yw.Model.HydroModelInfo>(); |
| | | _working = working; |
| | | _hydroInfo.UpdateWorkingInfo(_working.WorkingInfo); |
| | | this.PageTitle.Caption = $"水力模拟\r\n{_working.Name}"; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 绑定数据 |
| | | /// </summary> |
| | | public void SetBindingData |
| | | ( |
| | | XhsProjectVmo project, |
| | | XhsProjectSiteVmo projectSite, |
| | | XhsSchemeVmo scheme, |
| | | Yw.Model.HydroModelInfo hydroInfo, |
| | | HydroWorkingVmo working |
| | | ) |
| | | { |
| | | _project = project; |
| | | _projectSite = projectSite; |
| | | _scheme = scheme; |
| | | _hydroInfo = hydroInfo.Adapt<Yw.Model.HydroModelInfo>(); |
| | | _working = working; |
| | | _hydroInfo.UpdateWorkingInfo(_working.WorkingInfo); |
| | | this.PageTitle.Caption = $"{scheme.Name}\r\n{_working.Name}"; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | return; |
| | | } |
| | | this.barCkDecorator.Checked = false; |
| | | this.barCkMonitor.Checked = true; |
| | | this.barCkGrading.Checked = true; |
| | | this.barCkCalcu.Checked = true; |
| | | CalcuWorking(); |
| | | }; |
| | | _bimfaceCtrl.HydroMouseLeftClickEvent += (code) => |
| | | {//鼠标左键点击事件 |
| | |
| | | case eVisualSource.None: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Bimface: |
| | | { |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Q3d: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Property: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | } |
| | | break; |
| | | case eVisualSource.List: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Search: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Monitor: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Check: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Calcu: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | | case eVisualSource.Warning: |
| | | { |
| | | _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code); |
| | | this.barBtnSetMonitor.Enabled = visual != null; |
| | | SetPropertyCtrl(visual); |
| | | } |
| | | break; |
| | |
| | | ShowCheckCtrl(checkResult); |
| | | } |
| | | |
| | | //检查 |
| | | private void barBtnCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var checkResult = _hydroInfo.Check(); |
| | | ShowCheckCtrl(checkResult); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 模型计算 |
| | |
| | | { |
| | | var workingHelper = GetWorkingHelper(); |
| | | _calcuResultHelper = new SimulationCalcuResultHelper(workingHelper); |
| | | var calcuResult = GetCalcuResult(); |
| | | _calcuResultHelper.InitialData(); |
| | | } |
| | | return _calcuResultHelper; |
| | | } |
| | |
| | | { |
| | | if (_calcuResultLabelHelper == null) |
| | | { |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var calcuResultHelper = GetCalcuResultHelper(); |
| | | var bimfaceCtrl = await GetBimfaceCtrl(); |
| | | _calcuResultLabelHelper = new SimulationCalcuResultLabelHelper(visualListHelper, calcuResultHelper, bimfaceCtrl); |
| | | _calcuResultLabelHelper = new SimulationCalcuResultLabelHelper(calcuResultHelper, bimfaceCtrl); |
| | | } |
| | | return _calcuResultLabelHelper; |
| | | } |
| | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | #region 工况计算 |
| | | |
| | | //计算工况 |
| | | private async void CalcuWorking() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_working == null) |
| | | { |
| | | return; |
| | | } |
| | | _hydroInfo.UpdateWorkingInfo(_working.WorkingInfo); |
| | | |
| | | var workingHelper = GetWorkingHelper(); |
| | | //校验 |
| | | var checkResult = _hydroInfo.Check(); |
| | | if (!checkResult.Succeed) |
| | | { |
| | | workingHelper.InitialData(_hydroInfo, _working, checkResult, null); |
| | | ShowCheckCtrl(checkResult); |
| | | TipFormHelper.ShowError("校验失败,请检查后重试"); |
| | | return; |
| | | } |
| | | //计算 |
| | | var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss); |
| | | workingHelper.InitialData(_hydroInfo, _working, checkResult, calcuResult); |
| | | if (calcuResult.Succeed) |
| | | { |
| | | if (calcuResult.WainingList != null && calcuResult.WainingList.Count > 0) |
| | | { |
| | | ShowCalcuWarningCtrl(calcuResult); |
| | | } |
| | | TipFormHelper.ShowSucceed("计算成功!"); |
| | | } |
| | | else |
| | | { |
| | | ShowCalcuFailedCtrl(calcuResult); |
| | | TipFormHelper.ShowError("计算失败!"); |
| | | } |
| | | |
| | | #region 计算标签 |
| | | |
| | | var calcuResultLabelHelper = await GetCalcuResultLabelHelper(); |
| | | calcuResultLabelHelper.Set(); |
| | | |
| | | #endregion |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | |
| | | 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) => |
| | | { |
| | | workingHelper.ResetWorking(rhs); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | //增加工况 |
| | | private void barBtnAddWorking_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | AddWorking(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 工况分析 |
| | | |
| | | #region 工况评估 |
| | | |
| | | //评估 |
| | | private async void Evaluate() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | var working = GetWorking(); |
| | | if (working == null) |
| | | { |
| | | TipFormHelper.ShowWarn("尚未计算,请计算后重试!"); |
| | | return; |
| | | } |
| | | var checkResult = GetCheckResult(); |
| | | if (checkResult == null) |
| | | { |
| | | return; |
| | | } |
| | | if (!checkResult.Succeed) |
| | | { |
| | | ShowCheckCtrl(checkResult); |
| | | TipFormHelper.ShowWarn("检查失败,停止评估!"); |
| | | return; |
| | | } |
| | | var calcuResult = GetCalcuResult(); |
| | | if (!calcuResult.Succeed) |
| | | { |
| | | ShowCalcuFailedCtrl(calcuResult); |
| | | TipFormHelper.ShowWarn("计算失败,停止评估!"); |
| | | return; |
| | | } |
| | | if (calcuResult.WainingList != null && calcuResult.WainingList.Count > 0) |
| | | { |
| | | ShowCalcuWarningCtrl(calcuResult); |
| | | TipFormHelper.ShowWarn("请关注警告信息!"); |
| | | } |
| | | var visualListHelper = GetVisualListHelper(); |
| | | var allVisualDict = visualListHelper.GetVisualDict(); |
| | | var monitorHelper = GetMonitorHelper(); |
| | | var allMonitorList = await monitorHelper.Get(); |
| | | var allWorkingMonitorList = JsonHelper.Json2Object<List<HydroWorkingMonitorViewModel>>(working.MonitorInfo); |
| | | var allCalcuResultDict = calcuResult.GetVisualDict(); |
| | | var dlg = new HydroWorkingEvaluationDlg(); |
| | | dlg.SetBindingData(allVisualDict, allMonitorList, allWorkingMonitorList, allCalcuResultDict); |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | |
| | | //精度评估 |
| | | private void barBtnWorkingEvaluation_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | Evaluate(); |
| | | |
| | | } |
| | | |
| | | #endregion |