ningshuxia
2025-03-19 48527dff9c5adda9881cad10fa9dbeecf6f07bed
WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs
@@ -124,8 +124,7 @@
        private void InitialSvgImages()
        {
            //监测
            this.barBtnDockingMonitor.ImageOptions.SvgImage = HydroMonitorSvgImageHelper.Docking;
            this.barBtnAnalyseMonitor.ImageOptions.SvgImage = HydroMonitorSvgImageHelper.Analyse;
            this.barBtnSetMonitorList.ImageOptions.SvgImage = HydroMonitorSvgImageHelper.Docking;
            //水库
            this.barBtnSetReservoirList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Tank;
@@ -144,6 +143,12 @@
            this.barBtnSetWaterboxList.ImageOptions.SvgImageSize = new Size(32, 32);
            this.barBtnSetWaterboxList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204);
            this.barBtnSetWaterboxList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True;
            //连接节点
            this.barBtnSetJunctionList.ImageOptions.SvgImage = HydroMainSvgImageHelper.Junction;
            this.barBtnSetJunctionList.ImageOptions.SvgImageSize = new Size(32, 32);
            this.barBtnSetJunctionList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204);
            this.barBtnSetJunctionList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True;
            //闷头
            this.barBtnSetBluntheadList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Blunthead;
@@ -553,16 +558,14 @@
                case eSimulationVisualSource.None:
                    {
                        _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
                        this.barBtnDockingMonitor.Enabled = visual != null;
                        this.barBtnAnalyseMonitor.Enabled = visual != null;
                        this.barBtnSetMonitorList.Enabled = visual != null;
                        SetPropertyCtrl(visual);
                    }
                    break;
                case eSimulationVisualSource.Bimface:
                    {
                        this.barBtnDockingMonitor.Enabled = visual != null;
                        this.barBtnAnalyseMonitor.Enabled = visual != null;
                        this.barBtnSetMonitorList.Enabled = visual != null;
                        SetPropertyCtrl(visual);
                    }
                    break;
@@ -570,8 +573,7 @@
                case eSimulationVisualSource.Q3d:
                    {
                        _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
                        this.barBtnDockingMonitor.Enabled = visual != null;
                        this.barBtnAnalyseMonitor.Enabled = visual != null;
                        this.barBtnSetMonitorList.Enabled = visual != null;
                        SetPropertyCtrl(visual);
                    }
                    break;
@@ -579,16 +581,14 @@
                case eSimulationVisualSource.Property:
                    {
                        _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
                        this.barBtnDockingMonitor.Enabled = visual != null;
                        this.barBtnAnalyseMonitor.Enabled = visual != null;
                        this.barBtnSetMonitorList.Enabled = visual != null;
                    }
                    break;
                case eSimulationVisualSource.List:
                    {
                        _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
                        this.barBtnDockingMonitor.Enabled = visual != null;
                        this.barBtnAnalyseMonitor.Enabled = visual != null;
                        this.barBtnSetMonitorList.Enabled = visual != null;
                        SetPropertyCtrl(visual);
                    }
                    break;
@@ -596,8 +596,7 @@
                case eSimulationVisualSource.Set:
                    {
                        _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
                        this.barBtnDockingMonitor.Enabled = visual != null;
                        this.barBtnAnalyseMonitor.Enabled = visual != null;
                        this.barBtnSetMonitorList.Enabled = visual != null;
                        SetPropertyCtrl(visual);
                    }
                    break;
@@ -605,8 +604,7 @@
                case eSimulationVisualSource.Search:
                    {
                        _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
                        this.barBtnDockingMonitor.Enabled = visual != null;
                        this.barBtnAnalyseMonitor.Enabled = visual != null;
                        this.barBtnSetMonitorList.Enabled = visual != null;
                        SetPropertyCtrl(visual);
                    }
                    break;
@@ -614,8 +612,7 @@
                case eSimulationVisualSource.Monitor:
                    {
                        _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
                        this.barBtnDockingMonitor.Enabled = visual != null;
                        this.barBtnAnalyseMonitor.Enabled = visual != null;
                        this.barBtnSetMonitorList.Enabled = visual != null;
                        SetPropertyCtrl(visual);
                    }
                    break;
@@ -623,8 +620,7 @@
                case eSimulationVisualSource.Check:
                    {
                        _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
                        this.barBtnDockingMonitor.Enabled = visual != null;
                        this.barBtnAnalyseMonitor.Enabled = visual != null;
                        this.barBtnSetMonitorList.Enabled = visual != null;
                        SetPropertyCtrl(visual);
                    }
                    break;
@@ -632,8 +628,7 @@
                case eSimulationVisualSource.Calcu:
                    {
                        _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
                        this.barBtnDockingMonitor.Enabled = visual != null;
                        this.barBtnAnalyseMonitor.Enabled = visual != null;
                        this.barBtnSetMonitorList.Enabled = visual != null;
                        SetPropertyCtrl(visual);
                    }
                    break;
@@ -641,8 +636,7 @@
                case eSimulationVisualSource.Warning:
                    {
                        _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
                        this.barBtnDockingMonitor.Enabled = visual != null;
                        this.barBtnAnalyseMonitor.Enabled = visual != null;
                        this.barBtnSetMonitorList.Enabled = visual != null;
                        SetPropertyCtrl(visual);
                    }
                    break;
@@ -990,8 +984,18 @@
            WaitFormHelper.ShowWaitForm("正在保存,请稍后...");
            var bol = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance
            bool bol = false;
            try
            {
                bol = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance
                .Update(_hydroInfo, addParterList, updateParterList, removeParters);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
                _isSaving = false;
            }
            if (!bol)
            {
@@ -1839,7 +1843,7 @@
            gradingHelper.Set();
        }
        #endregion 颜色分级
        #endregion
        #region 人工刷新
@@ -1891,21 +1895,7 @@
            return await helper.GetAll();
        }
        //获取监测对接列表
        private async Task<List<HydroMonitorVmo>> GetMonitorDockingList()
        {
            var helper = GetMonitorHelper();
            return await helper.GetDockingList();
        }
        //获取监测分析列表
        private async Task<List<HydroMonitorVmo>> GetMonitorAnalyseList()
        {
            var helper = GetMonitorHelper();
            return await helper.GetAnalyseList();
        }
        #endregion 监测点
        #endregion
        #region 监测值
@@ -1919,8 +1909,7 @@
            {
                var visualListHelper = GetVisualListHelper();
                var monitorHelper = GetMonitorHelper();
                var calcuResultHelper = GetCalcuResultHelper();
                _monitorValueHelper = new SimulationMonitorValueHelper(visualListHelper, monitorHelper, calcuResultHelper);
                _monitorValueHelper = new SimulationMonitorValueHelper(visualListHelper, monitorHelper);
            }
            return _monitorValueHelper;
        }
@@ -1932,21 +1921,7 @@
            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();
@@ -1958,12 +1933,12 @@
            }
        }
        #endregion 监测值
        #endregion
        #region 传感器测点
        #region 设置测点
        //设置可见构件对接测点列表
        private async void SetMonitorDockingList(HydroVisualInfo visual)
        //设置测点列表
        private async void SetMonitorList(HydroVisualInfo visual)
        {
            if (_hydroInfo == null)
            {
@@ -1977,33 +1952,33 @@
            var allMonitorList = await monitorHelper.GetAll();
            var monitorValueHelper = GetMonitorValueHelper();
            var allMonitorValueList = await monitorValueHelper.GetAll();
            var calcuResult = GetCalcuResult();
            var dlg = new SetHydroMonitorDockingListDlg();
            var dlg = new SetHydroMonitorListDlg();
            dlg.ReloadDataEvent += async (list) =>
            {
                var monitorList = list?.Select(x => x.Vmo).ToList();
                await monitorHelper.Update(visual.Code, eSourceType.Docking, monitorList);
                await monitorValueHelper.Update(visual.Code, eSourceType.Docking, list);
                await monitorHelper.Update(visual.Code, monitorList);
                await monitorValueHelper.Update(visual.Code, list);
                var monitorMarkerHelper = await GetMonitorMarkerHelper();
                monitorMarkerHelper.Set();
            };
            dlg.SetBindingData(_hydroInfo, visual, allMonitorList, allMonitorValueList, calcuResult);
            dlg.SetBindingData(_hydroInfo, visual, allMonitorList, allMonitorValueList);
            dlg.ShowDialog();
        }
        //设置传感器测点
        private void barBtnDockingMonitor_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        //设置测点列表
        private void barBtnSetMonitorList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_visual == null)
            {
                TipFormHelper.ShowWarn("请选择构件后重试!");
                return;
            }
            SetMonitorDockingList(_visual);
            SetMonitorList(_visual);
        }
        #endregion 传感器测点
        #endregion
        #region 传感器测值
        #region 设置测值
        //监测值列表控件
        private HydroMonitorValueListCtrl _monitorValueListCtrl = null;
@@ -2043,8 +2018,8 @@
            }
        }
        //显示监测对接值列表控件
        private async void ShowMonitorDockingValueListCtrl()
        //显示监测值列表控件
        private async void ShowMonitorValueListCtrl()
        {
            var monitorValueListCtrl = GetMonitorValueListCtrl();
            if (!IsMonitorValueListCtrlVisible)
@@ -2052,60 +2027,20 @@
                this.controlContainerBottom.Controls.Clear();
                this.controlContainerBottom.Controls.Add(monitorValueListCtrl);
                this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
                this.docPnlBottom.Text = "传感器测值";
                this.docPnlBottom.Text = "设置测值";
                this.docPnlBottom.Height = 350;
            }
            var allValueList = await GetMonitorDockingValueList();
            var calcuResult = GetCalcuResult();
            var allValueList = await GetMonitorValueList();
            monitorValueListCtrl.SetBindingData(allValueList);
        }
        //设置传感器测值
        private void barBtnDockingMonitorValue_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        //设置测值
        private void barBtnSetMonitorValueList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ShowMonitorDockingValueListCtrl();
            ShowMonitorValueListCtrl();
        }
        #endregion 传感器测值
        #region 分析测点
        //设置可见构件分析测点列表
        private async void SetMonitorAnalyseList(HydroVisualInfo visual)
        {
            if (_hydroInfo == null)
            {
                return;
            }
            if (visual == null)
            {
                return;
            }
            var monitorHelper = GetMonitorHelper();
            var allMonitorList = await monitorHelper.GetAnalyseList();
            var dlg = new SetHydroMonitorAnalyseListDlg();
            dlg.ReloadDataEvent += async (list) =>
            {
                await monitorHelper.Update(visual.Code, eSourceType.Analyse, list);
                //var monitorMarkerHelper = await GetMonitorMarkerHelper();
                //monitorMarkerHelper.Update(visual.Code, monitorList);
                //monitorMarkerHelper.Set();
            };
            dlg.SetBindingData(_hydroInfo, visual, allMonitorList);
            dlg.ShowDialog();
        }
        //设置分析测点
        private void barBtnAnalyseMonitor_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_visual == null)
            {
                return;
            }
            SetMonitorAnalyseList(_visual);
        }
        #endregion 分析测点
        #endregion
        #region 测点标记
@@ -2132,7 +2067,7 @@
            monitorMarkerHelper.Set();
        }
        #endregion 测点标记
        #endregion
        #region 模型检查
@@ -2236,7 +2171,7 @@
            return _calcuResultHelper;
        }
        #endregion 计算结果
        #endregion
        #region 计算失败
@@ -2401,7 +2336,7 @@
        #endregion 计算标签
        #endregion 模型计算
        #endregion
        #region 导出INP
@@ -2572,7 +2507,7 @@
            ShowEvaluationDlg();
        }
        #endregion 评价规则
        #endregion
        #region 水力计算
@@ -2623,9 +2558,12 @@
                    return;
                }
                var isHead = _calcuPressModeIsHead;
                var allEvaluationList = await GetEvaluationList();
                WaitFormHelper.ShowWaitForm(this, "正在计算分析中,请稍候...");
                await Task.Delay(3000);
                var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss, _calcuPressModeIsHead);
                var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss, isHead, allEvaluationList);
                WaitFormHelper.HideWaitForm();
                workingHelper.InitialData(hydroInfo, working, checkResult, calcuResult);
                if (calcuResult.Succeed)
@@ -3026,6 +2964,8 @@
                var monitorValueHelper = GetMonitorValueHelper();
                var allMonitorValueList = await monitorValueHelper.GetAll();
                allMonitorValueList.UpdateMonitorValue(rhs.MonitorInfo);
                var gradingHelper = await GetGradingHelper();
                gradingHelper.Set();
            };
            dlg.DeleteDataEvent += (rhs) =>
            {
@@ -3105,7 +3045,7 @@
                this.docPnlBottom.Height = 350;
            }
            var allMonitorList = await GetMonitorAnalyseList();
            var allMonitorList = await GetMonitorList();
            var isHead = _calcuPressModeIsHead;
            var allEvaluationList = await GetEvaluationList();
@@ -3126,7 +3066,7 @@
            ShowMonitorAnalyListCtrl();
        }
        #endregion 监测分析
        #endregion
        #region 工况分析
@@ -3179,10 +3119,11 @@
            {
                return;
            }
            var allMonitorList = await GetMonitorDockingList();
            var allMonitorList = await GetMonitorList();
            if (allMonitorList == null || allMonitorList.Count < 1)
            {
                TipFormHelper.ShowWarn("请配置传感器测点后重试!");
                TipFormHelper.ShowWarn("请设置监测点后重试!");
                return;
            }
@@ -3192,6 +3133,14 @@
            var workingList = GetCheckedWorkingList();
            if (workingList == null || workingList.Count < 1)
            {
                var allMonitorValueList = await GetMonitorValueList();
                allMonitorValueList = allMonitorValueList?.Where(x => x.PropValue.HasValue).ToList();
                if (allMonitorValueList == null || allMonitorValueList.Count < 1)
                {
                    TipFormHelper.ShowWarn("请设置监测值后,重新计算!");
                    return;
                }
                var workingHelper = GetWorkingHelper();
                if (!workingHelper.Initialized)
                {
@@ -3303,31 +3252,23 @@
        //综合分析
        private async void barBtnWorkingAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_visual == null)
            if (_hydroInfo == 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);
                return;
            }
            var monitorHelper = GetMonitorHelper();
            var allMonitorList = await monitorHelper.GetAll();
            var selectNode = GetSelectNode();
            if (selectNode == null)
            {
                return;
            }
            var workingCheckedListHelper = GetWorkingCheckedListHelper();
            var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList();
            if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1)
            var allMonitorList = await GetMonitorList();
            var isHead = _calcuPressModeIsHead;
            var allEvaluationList = await GetEvaluationList();
            var workingList = GetCheckedWorkingList();
            if (workingList == null || workingList.Count < 1)
            {
                var workingHelper = GetWorkingHelper();
                if (!workingHelper.Initialized)
@@ -3335,19 +3276,18 @@
                    TipFormHelper.ShowWarn("请计算后重试!");
                    return;
                }
                var dlg = new SimulationSingleWorkingAnalyDlg();
                dlg.SetBindingData(workingHelper.HydroInfo, allMonitorList, workingHelper.Working, workingHelper.CalcuResult, visual);
                var dlg = new SimulationMultiAnalyDlg();
                dlg.SetBindingData(workingHelper.HydroInfo, allMonitorList, workingHelper.Working, selectNode, workingHelper.CalcuResult, isHead, allEvaluationList);
                dlg.ShowDialog();
                return;
            }
            else
            {
                var dlg = new SimulationMultiWorkingAnalyDlg();
                dlg.SetBindingData(_hydroInfo, allMonitorList, allCheckedWorkingList, visual);
                dlg.ShowDialog();
            }
            var workingDlg = new SimulationMultiAnalyWorkingDlg();
            workingDlg.SetBindingData(_hydroInfo, allMonitorList, workingList, selectNode, isHead, allEvaluationList);
            workingDlg.ShowDialog();
        }
        #endregion 工况分析
        #endregion
        #region 损失曲线