From f97b3ccbfd63b62ec875223fcc417633f6ce2989 Mon Sep 17 00:00:00 2001
From: Shuxia Ning <NingShuxia0927@outlook.com>
Date: 星期一, 09 十二月 2024 17:38:26 +0800
Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/HStation/XHS.V1.0

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs |  231 +++++++++++++++++++++++++++++++--------------------------
 1 files changed, 127 insertions(+), 104 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs
index b8cf325..e37c7bf 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs
@@ -32,6 +32,7 @@
 
         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;//鎵�鏈夊伐鍐甸�夋嫨鍒楄〃瀛楀吀
 
@@ -42,12 +43,14 @@
             (
                 XhsProjectVmo project,
                 XhsProjectSiteVmo projectSite,
+                XhsSchemeVmo scheme,
                 Yw.Model.HydroModelInfo hydroInfo,
                 Dictionary<HydroWorkingVmo, bool> allWorkingCheckedListDict
             )
         {
             _project = project;
             _projectSite = projectSite;
+            _scheme = scheme;
             _hydroInfo = hydroInfo;
             _allWorkingCheckedListDict = allWorkingCheckedListDict;
         }
@@ -66,10 +69,10 @@
         #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)
             {
@@ -78,7 +81,7 @@
             if (_bimfaceCtrl == null)
             {
                 var overlay = this.ShowOverlay();
-                _bimfaceCtrl = new XhsProjectSimulationBimfaceCtrl();
+                _bimfaceCtrl = new SimulationBimfaceCtrl();
                 _bimfaceCtrl.Dock = DockStyle.Fill;
                 await _bimfaceCtrl.InitialData(_project, _projectSite);
                 _bimfaceCtrl.LoadCompletedEvent += () =>
@@ -147,10 +150,10 @@
         #region 灞炴�ф帶浠�
 
         //灞炴�ф帶浠�
-        private XhsProjectSimulationPropertyCtrl _propertyCtrl = null;
+        private SimulationPropertyCtrl _propertyCtrl = null;
 
         //鑾峰彇灞炴�ф帶浠�
-        private XhsProjectSimulationPropertyCtrl GetPropertyCtrl()
+        private SimulationPropertyCtrl GetPropertyCtrl()
         {
             if (_hydroInfo == null)
             {
@@ -158,8 +161,9 @@
             }
             if (_propertyCtrl == null)
             {
-                _propertyCtrl = new XhsProjectSimulationPropertyCtrl();
+                _propertyCtrl = new SimulationPropertyCtrl();
                 _propertyCtrl.Dock = DockStyle.Fill;
+                _propertyCtrl.AllowEdit = true;
                 _propertyCtrl.HydroViewEvent += (visual) =>
                 {
                     SelectVisual(visual, eVisualSource.Property);
@@ -246,7 +250,7 @@
                 {
                     if (this.controlContainerRight.Controls.Count > 0)
                     {
-                        if (this.controlContainerRight.Controls[0] is XhsProjectSimulationPropertyCtrl)
+                        if (this.controlContainerRight.Controls[0] is SimulationPropertyCtrl)
                         {
                             return true;
                         }
@@ -278,21 +282,13 @@
             var visualVmListHelper = GetVisualVmListHelper();
             var vm = visualVmListHelper.GetVisual(visual);
             _propertyCtrl.SelectedObject = vm;
+            _propertyCtrl.UpdateRows();
         }
 
         //鏇存柊灞炴�ф帶浠�
         private void UpdatePropertyCtrl()
         {
             _propertyCtrl?.UpdateRows();
-        }
-
-        //娓呯悊灞炴�ф帶浠�
-        private void ClearPropertyCtrl()
-        {
-            if (_propertyCtrl != null)
-            {
-                _propertyCtrl.SelectedObject = null;
-            }
         }
 
         #endregion
@@ -423,6 +419,20 @@
             return _visualListHelper;
         }
 
+        //鑾峰彇鍙鍒楄〃
+        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 瑙嗗浘鍒楄〃
@@ -444,6 +454,13 @@
                 _visualVmListHelper = new SimulationVisualVmListHelper(visualListHelper, calcuResultHelper);
             }
             return _visualVmListHelper;
+        }
+
+        //鑾峰彇鍙瑙嗗浘鍒楄〃
+        private List<HydroVisualViewModel> GetVisualViewModelList()
+        {
+            var helper = GetVisualVmListHelper();
+            return helper.GetVisualList();
         }
 
         #endregion
@@ -662,12 +679,9 @@
             //姘村簱
             this.barBtnSetReservoirList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
-                {
-                    return;
-                }
+                var allVisualViewModelList = GetVisualViewModelList();
                 var dlg = new SetHydroReservoirListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
                     SelectVisual(visual, eVisualSource.Set);
@@ -675,18 +689,16 @@
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
                     SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
             };
             //姘存睜
             this.barBtnSetTankList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
-                {
-                    return;
-                }
+                var allVisualViewModelList = GetVisualViewModelList();
                 var dlg = new SetHydroTankListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
                     SelectVisual(visual, eVisualSource.Set);
@@ -694,18 +706,16 @@
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
                     SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
             };
             //姘寸
             this.barBtnSetWaterboxList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
-                {
-                    return;
-                }
+                var allVisualViewModelList = GetVisualViewModelList();
                 var dlg = new SetHydroWaterboxListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
                     SelectVisual(visual, eVisualSource.Set);
@@ -713,18 +723,16 @@
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
                     SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
             };
             //杩炴帴鑺傜偣
             this.barBtnSetJunctionList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
-                {
-                    return;
-                }
+                var allVisualViewModelList = GetVisualViewModelList();
                 var dlg = new SetHydroJunctionListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
                     SelectVisual(visual, eVisualSource.Set);
@@ -732,18 +740,16 @@
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
                     SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
             };
             //闂峰ご
             this.barBtnSetBluntheadList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
-                {
-                    return;
-                }
+                var allVisualViewModelList = GetVisualViewModelList();
                 var dlg = new SetHydroBluntheadListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
                     SelectVisual(visual, eVisualSource.Set);
@@ -751,18 +757,16 @@
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
                     SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
             };
             //寮ご
             this.barBtnSetElbowsList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
-                {
-                    return;
-                }
+                var allVisualVmList = GetVisualViewModelList();
                 var dlg = new SetHydroElbowListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                dlg.SetBindingData(allVisualVmList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
                     SelectVisual(visual, eVisualSource.Set);
@@ -770,18 +774,16 @@
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
                     SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
             };
             //涓夐��
             this.barBtnSetThreelinkList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
-                {
-                    return;
-                }
+                var allVisualViewModelList = GetVisualViewModelList();
                 var dlg = new SetHydroThreelinkListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
                     SelectVisual(visual, eVisualSource.Set);
@@ -789,18 +791,16 @@
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
                     SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
             };
             //鍥涢��
             this.barBtnSetFourlinkList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
-                {
-                    return;
-                }
+                var allVisualViewModelList = GetVisualViewModelList();
                 var dlg = new SetHydroFourlinkListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
                     SelectVisual(visual, eVisualSource.Set);
@@ -808,18 +808,16 @@
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
                     SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
             };
             //姘磋〃
             this.barBtnSetMeterList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
-                {
-                    return;
-                }
+                var allVisualViewModelList = GetVisualViewModelList();
                 var dlg = new SetHydroMeterListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
                     SelectVisual(visual, eVisualSource.Set);
@@ -827,18 +825,16 @@
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
                     SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
             };
             //娴侀噺璁�
             this.barBtnSetFlowmeterList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
-                {
-                    return;
-                }
+                var allVisualViewModelList = GetVisualViewModelList();
                 var dlg = new SetHydroFlowmeterListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
                     SelectVisual(visual, eVisualSource.Set);
@@ -846,18 +842,16 @@
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
                     SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
             };
             //鍘嬪姏琛�
             this.barBtnSetPressmeterList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
-                {
-                    return;
-                }
+                var allVisualViewModelList = GetVisualViewModelList();
                 var dlg = new SetHydroPressmeterListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
                     SelectVisual(visual, eVisualSource.Set);
@@ -865,18 +859,16 @@
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
                     SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
             };
             //绠¢亾
             this.barBtnSetPipeList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
-                {
-                    return;
-                }
+                var allVisualViewModelList = GetVisualViewModelList();
                 var dlg = new SetHydroPipeListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
                     SelectVisual(visual, eVisualSource.Set);
@@ -884,18 +876,16 @@
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
                     SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
             };
             //杩囨浮浠�
             this.barBtnSetTranslationList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
-                {
-                    return;
-                }
+                var allVisualViewModelList = GetVisualViewModelList();
                 var dlg = new SetHydroTranslationListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
                     SelectVisual(visual, eVisualSource.Set);
@@ -903,18 +893,16 @@
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
                     SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
             };
             //姘存车
             this.barBtnSetPumpList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
-                {
-                    return;
-                }
+                var allVisualViewModelList = GetVisualViewModelList();
                 var dlg = new SetHydroPumpListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
                     SelectVisual(visual, eVisualSource.Set);
@@ -922,18 +910,16 @@
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
                     SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
             };
             //闃�闂�
             this.barBtnSetValveList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
-                {
-                    return;
-                }
+                var allVisualViewModelList = GetVisualViewModelList();
                 var dlg = new SetHydroValveListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
                     SelectVisual(visual, eVisualSource.Set);
@@ -941,18 +927,16 @@
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
                     SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
             };
             //鎹㈢儹鍣�
             this.barBtnSetExchangerList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
-                {
-                    return;
-                }
+                var allVisualViewModelList = GetVisualViewModelList();
                 var dlg = new SetHydroExchangerListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
                     SelectVisual(visual, eVisualSource.Set);
@@ -960,18 +944,16 @@
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
                     SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
             };
             //鎹㈢儹鍣�
             this.barBtnSetCompressorList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
-                {
-                    return;
-                }
+                var allVisualViewModelList = GetVisualViewModelList();
                 var dlg = new SetHydroCompressorListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
                     SelectVisual(visual, eVisualSource.Set);
@@ -979,6 +961,7 @@
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
                     SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
             };
@@ -2142,7 +2125,7 @@
                 }
 
                 WaitFormHelper.ShowWaitForm(this, "姝e湪璁$畻鍒嗘瀽涓紝璇风◢鍊�...");
-                //await Task.Delay(3000);
+                await Task.Delay(3000);
                 var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss);
                 WaitFormHelper.HideWaitForm();
                 workingHelper.InitialData(hydroInfo, working, checkResult, calcuResult);
@@ -2177,6 +2160,13 @@
                 #region 鏋勪欢鏄庣粏
 
                 UpdateVisualListCtrl();
+
+                #endregion
+
+                #region 棰滆壊鍒嗙骇
+
+                var gradingHelper = await GetGradingHelper();
+                gradingHelper.Set();
 
                 #endregion
 
@@ -2284,10 +2274,24 @@
         }
 
         //鏇存柊宸ュ喌閫夋嫨鍒楄〃
+        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);
         }
 
 
@@ -2378,8 +2382,27 @@
         {
             if (_visual == null)
             {
-                TipFormHelper.ShowWarn("璇烽�夋嫨鏋勪欢鍚庨噸璇曪紒");
-                return;
+                var sources = GetSourceList();
+                if (sources != null)
+                {
+                    if (sources.Count == 1)
+                    {
+                        SelectVisual(sources[0], eVisualSource.None);
+                    }
+                    else
+                    {
+                        var source = sources.FirstOrDefault(x => x.Flags.Contains(HStation.Xhs.Flags.杩涘彛));
+                        if (source != null)
+                        {
+                            SelectVisual(source, eVisualSource.None);
+                        }
+                    }
+                }
+                if (_visual == null)
+                {
+                    TipFormHelper.ShowWarn("璇烽�夋嫨鏋勪欢鍚庨噸璇曪紒");
+                    return;
+                }
             }
             HydroVisualInfo visual = _visual;
             if (_visual is HydroLinkInfo linkInfo)

--
Gitblit v1.9.3