From f7253b1a5b2a945d88e6ab230910a78c2cbbc7ad Mon Sep 17 00:00:00 2001
From: lixiaojun <1287241240@qq.com>
Date: 星期二, 24 十二月 2024 20:31:31 +0800
Subject: [PATCH] 批量问题修改

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs | 1263 +++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 877 insertions(+), 386 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 3daca48..b6a8882 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
@@ -1,9 +1,12 @@
-锘縰sing DevExpress.Diagram.Core.Native;
+锘縰sing Castle.Core.Logging;
+using DevExpress.CodeParser;
+using DevExpress.Diagram.Core.Native;
 using DevExpress.Mvvm.Native;
 using DevExpress.Utils.MVVM;
 using DevExpress.XtraMap;
 using HStation.WinFrmUI.PhartRelation;
 using Mapster;
+using NPOI.OpenXmlFormats.Dml;
 using NPOI.SS.Formula.Functions;
 using System.Diagnostics;
 using Yw.EPAnet;
@@ -30,6 +33,26 @@
         /// </summary>
         public event Action<HydroWorkingVmo> AppendWorkingEvent;
 
+        /// <summary>
+        /// 淇濆瓨妯″瀷浜嬩欢
+        /// </summary>
+        public event Func<Yw.Model.HydroModelInfo, Task<Yw.Model.HydroModelInfo>> SaveModelEvent;
+
+        /// <summary>
+        /// 鍒锋柊妯″瀷浜嬩欢
+        /// </summary>
+        public event Func<Task<Yw.Model.HydroModelInfo>> RefreshModelEvent;
+
+        /// <summary>
+        /// 鏇存柊鏂规浜嬩欢
+        /// </summary>
+        public event Action<XhsSchemeVmo> UpdateSchemeEvent;
+
+        /// <summary>
+        /// 绉婚櫎鏂规浜嬩欢
+        /// </summary>
+        public event Action<XhsSchemeVmo> RemoveSchemeEvent;
+
         private HStation.Vmo.XhsProjectVmo _project = null;//椤圭洰
         private HStation.Vmo.XhsProjectSiteVmo _projectSite = null;//椤圭洰绔�
         private HStation.Vmo.XhsSchemeVmo _scheme = null;//鏂规
@@ -54,6 +77,16 @@
             _hydroInfo = hydroInfo;
             _allWorkingCheckedListDict = allWorkingCheckedListDict;
             ResetMonitorValue();
+            if (_scheme == null)
+            {
+                this.ribPageGroupForScheme.Visible = false;
+                this.PageTitle.Caption = $"姘村姏妯℃嫙";
+            }
+            else
+            {
+                this.ribPageGroupForScheme.Visible = true;
+                this.PageTitle.Caption = $"妯℃嫙鏂规\r\n{_scheme.Name}";
+            }
         }
 
         /// <summary>
@@ -65,6 +98,129 @@
             ShowBimfaceCtrl();
             ShowQ3dCtrl();
             ShowPropertyCtrl();
+            InitialSvgImages();
+        }
+
+        //鍒濆鍖朣vg鍥剧墖
+        private void InitialSvgImages()
+        {
+            //鐩戞祴
+            this.barBtnDockingMonitor.ImageOptions.SvgImage = HydroMonitorSvgImageHelper.Docking;
+            this.barBtnAnalyseMonitor.ImageOptions.SvgImage = HydroMonitorSvgImageHelper.Analyse;
+
+            //姘村簱
+            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 BIM鎺т欢
@@ -81,13 +237,13 @@
             }
             if (_bimfaceCtrl == null)
             {
-                var overlay = this.ShowOverlay();
                 _bimfaceCtrl = new SimulationBimfaceCtrl();
                 _bimfaceCtrl.Dock = DockStyle.Fill;
+                WaitFormHelper.ShowWaitForm(this.FindForm(), "姝e湪鍔犺浇妯″瀷锛岃绋嶅悗...");
                 await _bimfaceCtrl.InitialData(_project, _projectSite);
                 _bimfaceCtrl.LoadCompletedEvent += () =>
                 {//view鍔犺浇瀹屾垚浜嬩欢
-                    overlay.Close();
+                    WaitFormHelper.HideWaitForm();
                     this.barCkDecorator.Checked = false;
                     this.barCkGrading.Checked = true;
                 };
@@ -95,7 +251,7 @@
                 {//榧犳爣宸﹂敭鐐瑰嚮浜嬩欢
                     var visualListHelper = GetVisualListHelper();
                     var visual = visualListHelper.GetVisual(code);
-                    SelectVisual(visual, eVisualSource.Bimface);
+                    SelectVisual(visual, eSimulationVisualSource.Bimface);
                 };
             }
             return _bimfaceCtrl;
@@ -109,7 +265,7 @@
             this.tabPageBimface.Controls.Add(bimfaceCtrl);
         }
 
-        #endregion
+        #endregion BIM鎺т欢
 
         #region Q3d鎺т欢
 
@@ -132,7 +288,7 @@
                 {
                     var visualListHelper = GetVisualListHelper();
                     var visuals = visualListHelper.GetVisualList(codes);
-                    SelectVisual(visuals?.LastOrDefault(), eVisualSource.Q3d);
+                    SelectVisual(visuals?.LastOrDefault(), eSimulationVisualSource.Q3d);
                 };
             }
             return _q3dCtrl;
@@ -146,7 +302,7 @@
             this.tabPageQ3d.Controls.Add(q3dCtrl);
         }
 
-        #endregion
+        #endregion Q3d鎺т欢
 
         #region 灞炴�ф帶浠�
 
@@ -165,9 +321,10 @@
                 _propertyCtrl = new SimulationPropertyCtrl();
                 _propertyCtrl.Dock = DockStyle.Fill;
                 _propertyCtrl.AllowEdit = true;
+                _propertyCtrl.CalcuResult = () => GetCalcuResult();
                 _propertyCtrl.HydroViewEvent += (visual) =>
                 {
-                    SelectVisual(visual, eVisualSource.Property);
+                    SelectVisual(visual, eSimulationVisualSource.Property);
                 };
                 _propertyCtrl.BlinkLinkNodeEvent += async (link, linkNodeCode) =>
                 { //寮鸿皟杩炴帴鑺傜偣
@@ -189,7 +346,7 @@
                         {
                             return;
                         }
-                        var linkList = allLinkList.Where(x => (x.StartCode == linkNodeCode || x.EndCode == linkNodeCode) && x.Code != linkNodeCode).ToList();
+                        var linkList = allLinkList.Where(x => (x.StartCode == linkNodeCode || x.EndCode == linkNodeCode) && x.Code != link.Code).ToList();
                         if (linkList == null || linkList.Count < 1)
                         {
                             return;
@@ -237,7 +394,6 @@
                     var flowEffectHelper = await GetFlowEffectHelper();
                     flowEffectHelper.Set(visual);
                 };
-
             }
             return _propertyCtrl;
         }
@@ -292,122 +448,128 @@
             _propertyCtrl?.UpdateRows();
         }
 
-        #endregion
+        #endregion 灞炴�ф帶浠�
 
         #region 閫夋嫨鏋勪欢
-
-        //鍙鏉ユ簮
-        protected enum eVisualSource
-        {
-            None,
-            Bimface,
-            Q3d,
-            Property,
-            List,
-            Set,
-            Search,
-            Monitor,
-            Check,
-            Calcu,
-            Warning,
-        }
 
         //閫夋嫨鏋勪欢
         private Yw.Model.HydroVisualInfo _visual = null;
 
         //閫夋嫨鏋勪欢
-        private void SelectVisual(HydroVisualInfo visual, eVisualSource source)
+        private void SelectVisual(HydroVisualInfo visual, eSimulationVisualSource source)
         {
             _visual = visual;
             switch (source)
             {
-                case eVisualSource.None:
+                case eSimulationVisualSource.None:
                     {
                         _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
-                        this.barBtnSetMonitor.Enabled = visual != null;
+                        this.barBtnDockingMonitor.Enabled = visual != null;
+                        this.barBtnAnalyseMonitor.Enabled = visual != null;
                         SetPropertyCtrl(visual);
                     }
                     break;
-                case eVisualSource.Bimface:
+
+                case eSimulationVisualSource.Bimface:
                     {
-                        this.barBtnSetMonitor.Enabled = visual != null;
+                        this.barBtnDockingMonitor.Enabled = visual != null;
+                        this.barBtnAnalyseMonitor.Enabled = visual != null;
                         SetPropertyCtrl(visual);
                     }
                     break;
-                case eVisualSource.Q3d:
+
+                case eSimulationVisualSource.Q3d:
                     {
                         _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
-                        this.barBtnSetMonitor.Enabled = visual != null;
+                        this.barBtnDockingMonitor.Enabled = visual != null;
+                        this.barBtnAnalyseMonitor.Enabled = visual != null;
                         SetPropertyCtrl(visual);
                     }
                     break;
-                case eVisualSource.Property:
+
+                case eSimulationVisualSource.Property:
                     {
                         _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
-                        this.barBtnSetMonitor.Enabled = visual != null;
+                        this.barBtnDockingMonitor.Enabled = visual != null;
+                        this.barBtnAnalyseMonitor.Enabled = visual != null;
                     }
                     break;
-                case eVisualSource.List:
+
+                case eSimulationVisualSource.List:
                     {
                         _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
-                        this.barBtnSetMonitor.Enabled = visual != null;
+                        this.barBtnDockingMonitor.Enabled = visual != null;
+                        this.barBtnAnalyseMonitor.Enabled = visual != null;
                         SetPropertyCtrl(visual);
                     }
                     break;
-                case eVisualSource.Set:
+
+                case eSimulationVisualSource.Set:
                     {
                         _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
-                        this.barBtnSetMonitor.Enabled = visual != null;
+                        this.barBtnDockingMonitor.Enabled = visual != null;
+                        this.barBtnAnalyseMonitor.Enabled = visual != null;
                         SetPropertyCtrl(visual);
                     }
                     break;
-                case eVisualSource.Search:
+
+                case eSimulationVisualSource.Search:
                     {
                         _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
-                        this.barBtnSetMonitor.Enabled = visual != null;
+                        this.barBtnDockingMonitor.Enabled = visual != null;
+                        this.barBtnAnalyseMonitor.Enabled = visual != null;
                         SetPropertyCtrl(visual);
                     }
                     break;
-                case eVisualSource.Monitor:
+
+                case eSimulationVisualSource.Monitor:
                     {
                         _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
-                        this.barBtnSetMonitor.Enabled = visual != null;
+                        this.barBtnDockingMonitor.Enabled = visual != null;
+                        this.barBtnAnalyseMonitor.Enabled = visual != null;
                         SetPropertyCtrl(visual);
                     }
                     break;
-                case eVisualSource.Check:
+
+                case eSimulationVisualSource.Check:
                     {
                         _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
-                        this.barBtnSetMonitor.Enabled = visual != null;
+                        this.barBtnDockingMonitor.Enabled = visual != null;
+                        this.barBtnAnalyseMonitor.Enabled = visual != null;
                         SetPropertyCtrl(visual);
                     }
                     break;
-                case eVisualSource.Calcu:
+
+                case eSimulationVisualSource.Calcu:
                     {
                         _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
-                        this.barBtnSetMonitor.Enabled = visual != null;
+                        this.barBtnDockingMonitor.Enabled = visual != null;
+                        this.barBtnAnalyseMonitor.Enabled = visual != null;
                         SetPropertyCtrl(visual);
                     }
                     break;
-                case eVisualSource.Warning:
+
+                case eSimulationVisualSource.Warning:
                     {
                         _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
-                        this.barBtnSetMonitor.Enabled = visual != null;
+                        this.barBtnDockingMonitor.Enabled = visual != null;
+                        this.barBtnAnalyseMonitor.Enabled = visual != null;
                         SetPropertyCtrl(visual);
                     }
                     break;
+
                 default: break;
             }
         }
 
         //閫夋嫨鏋勪欢
-        private void SelectVisual(string code, eVisualSource source)
+        private void SelectVisual(string code, eSimulationVisualSource source)
         {
             var visual = GetVisual(code);
             SelectVisual(visual, source);
         }
 
-        #endregion
+        #endregion 閫夋嫨鏋勪欢
 
         #region 鏋勪欢鏄庣粏
 
@@ -425,6 +587,13 @@
                 _visualListHelper.InitialData(_hydroInfo);
             }
             return _visualListHelper;
+        }
+
+        //閲嶇疆鍙鍒楄〃
+        private void ResetVisualList()
+        {
+            var helper = GetVisualListHelper();
+            helper.InitialData(_hydroInfo);
         }
 
         //鑾峰彇鍙鏋勪欢
@@ -449,7 +618,7 @@
             return helper.GetSourceList();
         }
 
-        #endregion
+        #endregion 鍙鍒楄〃
 
         #region 瑙嗗浘鍒楄〃
 
@@ -479,7 +648,14 @@
             return helper.GetVisualList();
         }
 
-        #endregion
+        //鑾峰彇鍙瑙嗗浘
+        private HydroVisualViewModel GetVisualViewModel(string code)
+        {
+            var helper = GetVisualVmListHelper();
+            return helper.GetVisual(code);
+        }
+
+        #endregion 瑙嗗浘鍒楄〃
 
         #region 鏄庣粏鎺т欢
 
@@ -495,11 +671,11 @@
                 _visualListCtrl.Dock = DockStyle.Fill;
                 _visualListCtrl.HydroClickInfoEvent += (visual) =>
                 {
-                    SelectVisual(visual, eVisualSource.List);
+                    SelectVisual(visual, eSimulationVisualSource.List);
                 };
                 _visualListCtrl.HydroChangedInfoEvent += (visualList) =>
                 {
-                    SelectVisual(_visual, eVisualSource.List);
+                    SelectVisual(_visual, eSimulationVisualSource.List);
                 };
             }
             return _visualListCtrl;
@@ -579,7 +755,7 @@
             ShowVisualListCtrl();
         }
 
-        #endregion
+        #endregion 鏄庣粏鎺т欢
 
         #region 鏋勪欢鏄剧ず
 
@@ -628,16 +804,36 @@
             SetVisualVisible();
         }
 
-        #endregion
+        #endregion 鏋勪欢鏄剧ず
 
-        #endregion
+        #endregion 鏋勪欢鏄庣粏
 
         #region 涓�閿樉闅�
+
+        private List<string> _allDecoratorCodes = null;
+
+        //鑾峰彇瑁呴グ浠禼ode鍒楄〃
+        private async Task<List<string>> GetDecoratorCodes()
+        {
+            if (_hydroInfo == null)
+            {
+                return default;
+            }
+            if (_allDecoratorCodes == null)
+            {
+                _allDecoratorCodes = await BLLFactory<Yw.BLL.HydroDecoratorInfo>.Instance.GetCodeListByModelID(_hydroInfo.ID, null);
+            }
+            if (_allDecoratorCodes == null)
+            {
+                _allDecoratorCodes = new List<string>();
+            }
+            return _allDecoratorCodes;
+        }
 
         //璁剧疆瑁呴グ浠跺彲瑙佹��
         private async void SetDecoratorVisible(bool isDecoratorVisible)
         {
-            var codes = _hydroInfo.Decorators?.Select(x => x.Code).Distinct().ToList();
+            var codes = await GetDecoratorCodes();
             if (isDecoratorVisible)
             {
                 await _bimfaceCtrl?.ShowComponents(codes);
@@ -654,7 +850,7 @@
             SetDecoratorVisible(this.barCkDecorator.Checked);
         }
 
-        #endregion   
+        #endregion 涓�閿樉闅�
 
         #region 淇濆瓨淇℃伅
 
@@ -665,27 +861,29 @@
             {
                 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)
+            if (this.SaveModelEvent == null)
+            {
+                return;
+            }
+            var hydroInfo = await this.SaveModelEvent.Invoke(_hydroInfo);
+            if (hydroInfo == null)
             {
                 TipFormHelper.ShowError("淇濆瓨澶辫触锛�");
                 return;
             }
-            _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(id);
+            _hydroInfo = hydroInfo;
+
             TipFormHelper.ShowSucceed("淇濆瓨鎴愬姛锛�");
+
+            //Stopwatch sw = new Stopwatch();
+            //sw.Start();
+            //鑰楁椂宸ㄥぇ鐨勪唬鐮�
+            //sw.Stop();
+            //TimeSpan ts2 = sw.Elapsed;
+            //Console.WriteLine("Stopwatch鎬诲叡鑺辫垂{0}ms.", ts2.TotalMilliseconds);
         }
 
-        #endregion
+        #endregion 淇濆瓨淇℃伅
 
         #region 鎵归噺閰嶇疆
 
@@ -700,11 +898,11 @@
                 dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    SelectVisual(visual, eVisualSource.Set);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
                 };
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
-                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
                     UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
@@ -717,11 +915,11 @@
                 dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    SelectVisual(visual, eVisualSource.Set);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
                 };
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
-                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
                     UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
@@ -734,11 +932,11 @@
                 dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    SelectVisual(visual, eVisualSource.Set);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
                 };
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
-                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
                     UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
@@ -751,11 +949,11 @@
                 dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    SelectVisual(visual, eVisualSource.Set);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
                 };
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
-                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
                     UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
@@ -768,11 +966,11 @@
                 dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    SelectVisual(visual, eVisualSource.Set);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
                 };
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
-                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
                     UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
@@ -785,11 +983,11 @@
                 dlg.SetBindingData(allVisualVmList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    SelectVisual(visual, eVisualSource.Set);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
                 };
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
-                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
                     UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
@@ -802,11 +1000,11 @@
                 dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    SelectVisual(visual, eVisualSource.Set);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
                 };
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
-                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
                     UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
@@ -819,11 +1017,11 @@
                 dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    SelectVisual(visual, eVisualSource.Set);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
                 };
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
-                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
                     UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
@@ -836,11 +1034,11 @@
                 dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    SelectVisual(visual, eVisualSource.Set);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
                 };
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
-                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
                     UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
@@ -853,11 +1051,11 @@
                 dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    SelectVisual(visual, eVisualSource.Set);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
                 };
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
-                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
                     UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
@@ -870,11 +1068,45 @@
                 dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    SelectVisual(visual, eVisualSource.Set);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
                 };
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
-                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
+                    UpdateVisualListCtrl();
+                };
+                dlg.ShowDialog();
+            };
+            //鍠峰槾
+            this.barBtnSetNozzleList.ItemClick += delegate
+            {
+                var allVisualViewModelList = GetVisualViewModelList();
+                var dlg = new SetHydroNozzleListDlg();
+                dlg.SetBindingData(allVisualViewModelList);
+                dlg.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eSimulationVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
+                    UpdateVisualListCtrl();
+                };
+                dlg.ShowDialog();
+            };
+            //鍐峰嵈濉�
+            this.barBtnSetCoolingList.ItemClick += delegate
+            {
+                var allVisualViewModelList = GetVisualViewModelList();
+                var dlg = new SetHydroCoolingListDlg();
+                dlg.SetBindingData(allVisualViewModelList);
+                dlg.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eSimulationVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
                     UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
@@ -887,11 +1119,11 @@
                 dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    SelectVisual(visual, eVisualSource.Set);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
                 };
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
-                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
                     UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
@@ -904,11 +1136,11 @@
                 dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    SelectVisual(visual, eVisualSource.Set);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
                 };
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
-                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
                     UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
@@ -921,11 +1153,11 @@
                 dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    SelectVisual(visual, eVisualSource.Set);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
                 };
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
-                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
                     UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
@@ -938,11 +1170,11 @@
                 dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    SelectVisual(visual, eVisualSource.Set);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
                 };
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
-                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
                     UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
@@ -955,16 +1187,16 @@
                 dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    SelectVisual(visual, eVisualSource.Set);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
                 };
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
-                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
                     UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
             };
-            //鎹㈢儹鍣�
+            //鍘嬬缉鏈�
             this.barBtnSetCompressorList.ItemClick += delegate
             {
                 var allVisualViewModelList = GetVisualViewModelList();
@@ -972,17 +1204,16 @@
                 dlg.SetBindingData(allVisualViewModelList);
                 dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    SelectVisual(visual, eVisualSource.Set);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
                 };
                 dlg.HydroChangedInfoEvent += visuals =>
                 {
-                    SelectVisual(visuals?.FirstOrDefault(), eVisualSource.Set);
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
                     UpdateVisualListCtrl();
                 };
                 dlg.ShowDialog();
             };
         }
-
 
         //鏄剧ずRadialMenu
         private void barBtnSetList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
@@ -1056,6 +1287,16 @@
             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;
             }
 
             //闂峰ご
@@ -1187,11 +1428,9 @@
             {
                 this.barBtnSetCompressorList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
             }
-
-
         }
 
-        #endregion
+        #endregion 鎵归噺閰嶇疆
 
         #region 鏋勪欢鏌ヨ
 
@@ -1210,12 +1449,12 @@
                 _searchCtrl.InitialData(allVisualVmList);
                 _searchCtrl.HydroClickInfoEvent += (visual) =>
                 {
-                    SelectVisual(visual, eVisualSource.Check);
+                    SelectVisual(visual, eSimulationVisualSource.Check);
                 };
                 _searchCtrl.HydroSearchInfoEvent += (list) =>
                 {
                     var visual = list?.FirstOrDefault();
-                    SelectVisual(visual, eVisualSource.Search);
+                    SelectVisual(visual, eSimulationVisualSource.Search);
                 };
             }
             return _searchCtrl;
@@ -1282,7 +1521,7 @@
             ShowSearchDlg();
         }
 
-        #endregion
+        #endregion 鏋勪欢鏌ヨ
 
         #region 妯″瀷鏍囨敞
 
@@ -1334,7 +1573,7 @@
             markHelper.Set();
         }
 
-        #endregion
+        #endregion 妯″瀷鏍囨敞
 
         #region 棰滆壊鍒嗙骇
 
@@ -1416,42 +1655,34 @@
             gradingHelper.Set();
         }
 
-        #endregion
+        #endregion 棰滆壊鍒嗙骇
 
         #region 浜哄伐鍒锋柊
 
         //鍒锋柊
         private async void barBtnRefresh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
+            if (this.RefreshModelEvent == null)
+            {
+                return;
+            }
             if (XtraMessageBox.Show("鍒锋柊鍚庡皢涓㈠け褰撳墠姘村姏淇℃伅鏇存敼锛屾槸鍚︾户缁埛鏂帮紵", "璇㈤棶", MessageBoxButtons.YesNo) == DialogResult.Yes)
             {
-                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);
-                _visual = null;
-                await _bimfaceCtrl?.ZoomAndSelectComponents(null);
-                //ShowSelectedProperty();
-                TipFormHelper.ShowSucceed("鏁版嵁宸插埛鏂�");
+                _hydroInfo = hydroInfo;
+                SelectVisual(visual: null, eSimulationVisualSource.None);
 
-                var visualListHelper = GetVisualListHelper();
-                visualListHelper.InitialData(_hydroInfo);
+                ResetVisualList();
+                TipFormHelper.ShowSucceed("鍒锋柊鎴愬姛锛�");
             }
         }
 
-        #endregion
+        #endregion 浜哄伐鍒锋柊
 
         #region 姘存祦鍔ㄧ敾
 
@@ -1480,13 +1711,11 @@
         private async void barCkFlowEffect_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
             var flowEffectHelper = await GetFlowEffectHelper();
-            flowEffectHelper.Visible = this.barCkFlowEffect.Checked;
-            flowEffectHelper.Set();
+            //flowEffectHelper.Visible = this.barCkFlowEffect.Checked;
+            //flowEffectHelper.Set();
         }
 
         #endregion
-
-        #region 鐩戞祴鍒楄〃
 
         #region 鐩戞祴鐐�
 
@@ -1496,10 +1725,6 @@
         //鑾峰彇鐩戞祴鐐硅緟鍔╃被
         private SimulationMonitorHelper GetMonitorHelper()
         {
-            if (_hydroInfo == null)
-            {
-                return default;
-            }
             if (_monitorHelper == null)
             {
                 var visualListHelper = GetVisualListHelper();
@@ -1508,43 +1733,28 @@
             return _monitorHelper;
         }
 
-        //璁剧疆鐩戞祴鐐瑰垪琛�
-        private async void SetMonitorList(HydroVisualInfo visual)
+        //鑾峰彇鐩戞祴鐐瑰垪琛�
+        private async Task<List<HydroMonitorVmo>> GetMonitorList()
         {
-            if (_hydroInfo == null)
-            {
-                return;
-            }
-            var monitorHelper = GetMonitorHelper();
-            var allMonitorList = await monitorHelper.Get();
-            var dlg = new SetHydroMonitorListDlg();
-            dlg.SetBindingData(_hydroInfo, visual, allMonitorList);
-            dlg.ReloadDataEvent += async (list) =>
-            {
-                var bol = await BLLFactory<Yw.BLL.HydroMonitor>.Instance.Save(_hydroInfo.ID, visual.Code, list);
-                if (!bol)
-                {
-                    TipFormHelper.ShowError("璁剧疆澶辫触锛�");
-                    return;
-                }
-                TipFormHelper.ShowSucceed("璁剧疆鎴愬姛锛�");
-                var monitorList = await monitorHelper.Update(visual.Code);
-                var monitorValueHelper = GetMonitorValueHelper();
-                monitorValueHelper.Update(visual.Code, monitorList);
-                var monitorMarkerHelper = await GetMonitorMarkerHelper();
-                monitorMarkerHelper.Update(visual.Code, monitorList);
-                monitorMarkerHelper.Set();
-            };
-            dlg.ShowDialog();
+            var helper = GetMonitorHelper();
+            return await helper.GetAll();
         }
 
-        //璁剧疆鐩戞祴鐐�
-        private void barBtnSetMonitor_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        //鑾峰彇鐩戞祴瀵规帴鍒楄〃
+        private async Task<List<HydroMonitorVmo>> GetMonitorDockingList()
         {
-            SetMonitorList(_visual);
+            var helper = GetMonitorHelper();
+            return await helper.GetDockingList();
         }
 
-        #endregion
+        //鑾峰彇鐩戞祴鍒嗘瀽鍒楄〃
+        private async Task<List<HydroMonitorVmo>> GetMonitorAnalyseList()
+        {
+            var helper = GetMonitorHelper();
+            return await helper.GetAnalyseList();
+        }
+
+        #endregion 鐩戞祴鐐�
 
         #region 鐩戞祴鍊�
 
@@ -1558,27 +1768,91 @@
             {
                 var visualListHelper = GetVisualListHelper();
                 var monitorHelper = GetMonitorHelper();
-                _monitorValueHelper = new SimulationMonitorValueHelper(visualListHelper, monitorHelper);
+                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?.Last(x => !string.IsNullOrEmpty(x.MonitorInfo));
+            var working = allWorkingList?.LastOrDefault(x => !string.IsNullOrEmpty(x.MonitorInfo));
             if (working != null)
             {
                 var helper = GetMonitorValueHelper();
                 helper.Reset(working.MonitorInfo);
             }
-
         }
 
-        #endregion
+        #endregion 鐩戞祴鍊�
 
-        #region 鐩戞祴鍊兼帶浠�
+        #region 浼犳劅鍣ㄦ祴鐐�
+
+        //璁剧疆鍙鏋勪欢瀵规帴娴嬬偣鍒楄〃
+        private async void SetMonitorDockingList(HydroVisualInfo visual)
+        {
+            if (_hydroInfo == null)
+            {
+                return;
+            }
+            if (visual == null)
+            {
+                return;
+            }
+            var monitorHelper = GetMonitorHelper();
+            var allMonitorList = await monitorHelper.GetAll();
+            var monitorValueHelper = GetMonitorValueHelper();
+            var allMonitorValueList = await monitorValueHelper.GetAll();
+            var calcuResult = GetCalcuResult();
+            var dlg = new SetHydroMonitorDockingListDlg();
+            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);
+                var monitorMarkerHelper = await GetMonitorMarkerHelper();
+                monitorMarkerHelper.Set();
+            };
+            dlg.SetBindingData(_hydroInfo, visual, allMonitorList, allMonitorValueList, calcuResult);
+            dlg.ShowDialog();
+        }
+
+        //璁剧疆浼犳劅鍣ㄦ祴鐐�
+        private void barBtnDockingMonitor_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            if (_visual == null)
+            {
+                return;
+            }
+            SetMonitorDockingList(_visual);
+        }
+
+        #endregion 浼犳劅鍣ㄦ祴鐐�
+
+        #region 浼犳劅鍣ㄦ祴鍊�
 
         //鐩戞祴鍊煎垪琛ㄦ帶浠�
         private HydroMonitorValueListCtrl _monitorValueListCtrl = null;
@@ -1592,9 +1866,8 @@
                 _monitorValueListCtrl.Dock = DockStyle.Fill;
                 _monitorValueListCtrl.HydroViewEvent += (code) =>
                 {
-                    var visualListHelper = GetVisualListHelper();
-                    var visual = visualListHelper.GetVisual(code);
-                    SelectVisual(visual, eVisualSource.Monitor);
+                    var visual = GetVisual(code);
+                    SelectVisual(visual, eSimulationVisualSource.Monitor);
                 };
             }
             return _monitorValueListCtrl;
@@ -1619,8 +1892,8 @@
             }
         }
 
-        //鏄剧ず鐩戞祴鍊煎垪琛ㄦ帶浠�
-        private async void ShowMonitorValueListCtrl()
+        //鏄剧ず鐩戞祴瀵规帴鍊煎垪琛ㄦ帶浠�
+        private async void ShowMonitorDockingValueListCtrl()
         {
             var monitorValueListCtrl = GetMonitorValueListCtrl();
             if (!IsMonitorValueListCtrlVisible)
@@ -1628,23 +1901,62 @@
                 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 monitorValueHelper = GetMonitorValueHelper();
-            var allMonitorValueList = await monitorValueHelper.Get();
-            monitorValueListCtrl.SetBindingData(allMonitorValueList);
+            var allValueList = await GetMonitorDockingValueList();
+            var calcuResult = GetCalcuResult();
+            monitorValueListCtrl.SetBindingData(allValueList);
         }
 
-        //璁剧疆鐩戞祴鍊�
-        private void barBtnSetMonitorValue_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        //璁剧疆浼犳劅鍣ㄦ祴鍊�
+        private void barBtnDockingMonitorValue_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
-            ShowMonitorValueListCtrl();
+            ShowMonitorDockingValueListCtrl();
         }
 
-        #endregion
+        #endregion 浼犳劅鍣ㄦ祴鍊�
 
-        #region 鐩戞祴鐐规爣璁�
+        #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 鍒嗘瀽娴嬬偣
+
+        #region 娴嬬偣鏍囪
 
         //鐩戞祴鏍囪杈呭姪绫�
         private SimulationMonitorMarkerHelper _monitorMarkerHelper = null;
@@ -1661,17 +1973,15 @@
             return _monitorMarkerHelper;
         }
 
-        //鏄剧ず鐘舵�佹敼鍙�
-        private async void barCkMonitor_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        //娴嬬偣鏄剧ず鐘舵�佹敼鍙�
+        private async void barCkMonitorVisible_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
             var monitorMarkerHelper = await GetMonitorMarkerHelper();
-            monitorMarkerHelper.Visible = this.barCkMonitor.Checked;
+            monitorMarkerHelper.Visible = this.barCkMonitorVisible.Checked;
             monitorMarkerHelper.Set();
         }
 
-        #endregion
-
-        #endregion
+        #endregion 娴嬬偣鏍囪
 
         #region 妯″瀷妫�鏌�
 
@@ -1693,7 +2003,7 @@
                 {
                     var visualListHelper = GetVisualListHelper();
                     var visual = visualListHelper.GetVisual(code);
-                    SelectVisual(visual, eVisualSource.Check);
+                    SelectVisual(visual, eSimulationVisualSource.Check);
                 };
             }
             return _checkCtrl;
@@ -1755,7 +2065,7 @@
             ShowCheckCtrl(checkResult);
         }
 
-        #endregion
+        #endregion 妯″瀷妫�鏌�
 
         #region 妯″瀷璁$畻
 
@@ -1775,7 +2085,7 @@
             return _calcuResultHelper;
         }
 
-        #endregion
+        #endregion 璁$畻缁撴灉
 
         #region 璁$畻澶辫触
 
@@ -1839,7 +2149,7 @@
             calcuFailedCtrl.SetBindingData(calcuResult.FailedList);
         }
 
-        #endregion
+        #endregion 璁$畻澶辫触
 
         #region 璁$畻璀﹀憡
 
@@ -1857,7 +2167,7 @@
                 {
                     var visualListHelper = GetVisualListHelper();
                     var visual = visualListHelper.GetVisual(code);
-                    SelectVisual(visual, eVisualSource.Warning);
+                    SelectVisual(visual, eSimulationVisualSource.Warning);
                 };
             }
             return _calcuWarningCtrl;
@@ -1911,7 +2221,7 @@
             calcuWaringCtrl.SetBindingData(calcuResult.WainingList, allVisualDict);
         }
 
-        #endregion
+        #endregion 璁$畻璀﹀憡
 
         #region 璁$畻鏍囩
 
@@ -1938,74 +2248,9 @@
             calcuResultLabelHelper.Set();
         }
 
-        #endregion
+        #endregion 璁$畻鏍囩
 
-        #endregion
-
-        #region 绠$綉淇
-
-        //淇绠$綉
-        private void Repair()
-        {
-            if (_hydroInfo == null)
-            {
-                return;
-            }
-            var checkResult = _hydroInfo.Check();
-            if (!checkResult.Succeed)
-            {
-                ShowCheckCtrl(checkResult);
-                TipFormHelper.ShowWarn("妫�鏌ュけ璐ュ鑷存棤娉曡繘琛岃瘯绠楋紝鍋滄绠$綉淇锛�");
-                return;
-            }
-            var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.Simple);
-            if (!calcuResult.Succeed)
-            {
-                ShowCalcuFailedCtrl(calcuResult);
-                TipFormHelper.ShowWarn("璇曠畻澶辫触锛屽仠姝㈢缃戜慨澶嶏紒");
-                return;
-            }
-            var visualListHelper = GetVisualListHelper();
-            var allLinkList = visualListHelper.GetLinkList();
-            if (allLinkList != null && allLinkList.Count < 1)
-            {
-                TipFormHelper.ShowError("妯″瀷涓湭鍖呭惈绠℃淇℃伅锛屽仠姝㈢缃戜慨澶嶏紒");
-                return;
-            }
-            int count = 0;
-            foreach (var link in allLinkList)
-            {
-                var calcuLink = calcuResult.LinkList?.Find(x => x.Code == link.Code);
-                if (calcuLink == null)
-                {
-                    continue;
-                }
-                if (!calcuLink.CalcuFlow.HasValue)
-                {
-                    continue;
-                }
-                if (calcuLink.CalcuFlow.Value < 0)
-                {
-                    var tempCode = link.StartCode;
-                    link.StartCode = link.EndCode;
-                    link.EndCode = tempCode;
-                    count++;
-                }
-            }
-            var visualVmListHelper = GetVisualVmListHelper();
-            visualVmListHelper.UpdateProperty();
-            UpdateVisualListCtrl();
-            UpdatePropertyCtrl();
-            TipFormHelper.ShowSucceed($"淇瀹屾垚锛屽叡淇绠℃({count})涓紒");
-        }
-
-        //绠$綉淇
-        private void barBtnRepair_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
-        {
-            Repair();
-        }
-
-        #endregion
+        #endregion 妯″瀷璁$畻
 
         #region 瀵煎嚭INP
 
@@ -2027,7 +2272,7 @@
             TipFormHelper.ShowSucceed("瀵煎嚭鎴愬姛");
         }
 
-        #endregion
+        #endregion 瀵煎嚭INP
 
         #region 姘存车鍒楄〃
 
@@ -2050,7 +2295,7 @@
                 pumps.ForEach(x => x.UpdateWorkingInfo(list));
                 var visualVmListHelper = GetVisualVmListHelper();
                 visualVmListHelper.UpdateProperty(pumps.Select(x => x as Yw.Model.HydroVisualInfo).ToList());
-                SelectVisual(_visual, eVisualSource.None);
+                SelectVisual(_visual, eSimulationVisualSource.None);
                 var gradingHelper = await GetGradingHelper();
                 gradingHelper.Set();
             };
@@ -2091,7 +2336,7 @@
                 });
                 var visualVmListHelper = GetVisualVmListHelper();
                 visualVmListHelper.UpdateProperty(pumps.Select(x => x as Yw.Model.HydroVisualInfo).ToList());
-                SelectVisual(_visual, eVisualSource.None);
+                SelectVisual(_visual, eSimulationVisualSource.None);
                 var gradingHelper = await GetGradingHelper();
                 gradingHelper.Set();
             };
@@ -2102,11 +2347,10 @@
         //骞惰仈妯℃嫙
         private void barBtnPumpParallel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
-
             PumpParallel();
         }
 
-        #endregion
+        #endregion 姘存车鍒楄〃
 
         #region 姘村姏璁$畻
 
@@ -2120,12 +2364,12 @@
             var workingCheckedListHelper = GetWorkingCheckedListHelper();
             var allWorkingList = workingCheckedListHelper.GetWorkingList();
             var monitorValueHelper = GetMonitorValueHelper();
-            var allMonitorValueList = await monitorValueHelper.Get();
+            var allMonitorValueList = await monitorValueHelper.GetAll();
             var dlg = new SetHydroWorkingDlg();
             dlg.SetBindingData(_hydroInfo, allWorkingList, allMonitorValueList);
             dlg.HydroViewEvent += (visual) =>
             {
-                SelectVisual(visual, eVisualSource.Calcu);
+                SelectVisual(visual, eSimulationVisualSource.Calcu);
             };
             dlg.HydroCalcuEvent += async (vm) =>
             {
@@ -2138,7 +2382,11 @@
                 working.ModelID = vm.ModelID;
                 working.Name = vm.Name;
                 working.WorkingInfo = JsonHelper.Object2Json(vm.WorkingInfo);
-                working.MonitorInfo = JsonHelper.Object2Json(vm.MonitorInfo);
+                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;
 
@@ -2165,6 +2413,7 @@
                         ShowCalcuWarningCtrl(calcuResult);
                     }
                     this.barBtnAddWorking.Enabled = true;
+                    this.barBtnExportWord.Enabled = true;
                     TipFormHelper.ShowSucceed("璁$畻鎴愬姛锛�");
                 }
                 else
@@ -2178,38 +2427,35 @@
                 var visualVmListHelper = GetVisualVmListHelper();
                 visualVmListHelper.UpdateCalcuProperty(calcuResult);
 
-                #endregion
+                #endregion 瑙嗗浘鍒楄〃
 
                 #region 褰撳墠鏋勪欢
 
-                SelectVisual(_visual, eVisualSource.Calcu);
+                SelectVisual(_visual, eSimulationVisualSource.Calcu);
 
-                #endregion
+                #endregion 褰撳墠鏋勪欢
 
                 #region 鏋勪欢鏄庣粏
 
                 UpdateVisualListCtrl();
 
-                #endregion
+                #endregion 鏋勪欢鏄庣粏
 
                 #region 棰滆壊鍒嗙骇
 
                 var gradingHelper = await GetGradingHelper();
                 gradingHelper.Set();
 
-                #endregion
+                #endregion 棰滆壊鍒嗙骇
 
                 #region 璁$畻鏍囩
 
                 var calcuResultLabelHelper = await GetCalcuResultLabelHelper();
                 calcuResultLabelHelper.Set();
 
-                #endregion
-
+                #endregion 璁$畻鏍囩
             };
-
             dlg.ShowDialog();
-
         }
 
         //姘村姏璁$畻
@@ -2218,7 +2464,49 @@
             Calcu();
         }
 
-        #endregion
+        #endregion 姘村姏璁$畻
+
+        #region 瀵煎嚭鎶ュ憡
+
+        private async void barBtnExportWord_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            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 褰撳墠宸ュ喌
 
@@ -2283,7 +2571,7 @@
             AddWorking();
         }
 
-        #endregion
+        #endregion 褰撳墠宸ュ喌
 
         #region 閫夋嫨宸ュ喌
 
@@ -2309,6 +2597,13 @@
             return helper.GetWorkingList();
         }
 
+        //鑾峰彇閫夋嫨宸ュ喌鍒楄〃
+        private List<HydroWorkingVmo> GetCheckedWorkingList()
+        {
+            var helper = GetWorkingCheckedListHelper();
+            return helper.GetCheckedWorkingList();
+        }
+
         //鏇存柊宸ュ喌閫夋嫨鍒楄〃
         public void UpdateWorkingCheckedList(HydroWorkingVmo working)
         {
@@ -2330,16 +2625,120 @@
             helper.Remove(working);
         }
 
+        #endregion 閫夋嫨宸ュ喌
 
-        #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 async void barBtnWorkingEvaluation_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
-            var monitorHelper = GetMonitorHelper();
-            var allMonitorList = await monitorHelper.Get();
+            var allMonitorList = await GetMonitorDockingList();
 
             var workingCheckedListHelper = GetWorkingCheckedListHelper();
             var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList();
@@ -2389,8 +2788,9 @@
         }
 
         //鑳芥晥鍒嗘瀽
-        private void barBtnWorkingPower_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        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)
@@ -2402,78 +2802,13 @@
                     return;
                 }
                 var dlg = new SimulationSingleWorkingEnergyDlg();
-                dlg.SetBindingData(workingHelper.Working, workingHelper.HydroInfo, workingHelper.CalcuResult);
+                dlg.SetBindingData(workingHelper.Working, workingHelper.HydroInfo, allMonitorList, workingHelper.CalcuResult);
                 dlg.ShowDialog();
             }
             else
             {
-
                 var dlg = new SimulationMultiWorkingEnergyDlg();
-                dlg.SetBindingData(_hydroInfo, allCheckedWorkingList);
-                dlg.ShowDialog();
-            }
-        }
-
-        //鎹熷け鏇茬嚎
-        private void barBtnWorkingLossCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
-        {
-            if (_visual == null)
-            {
-                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)
-            {
-                var visualListHelper = GetVisualListHelper();
-                visual = visualListHelper.GetVisual(linkInfo.StartCode);
-            }
-
-            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 HydroSingleWorkingLossCurveDlg();
-                dlg.HydroClickEvent += (code) =>
-                {
-                    SelectVisual(code, eVisualSource.None);
-                };
-                dlg.SetBindingData(workingHelper.HydroInfo, workingHelper.CalcuResult, visual);
-                dlg.ShowDialog();
-            }
-            else
-            {
-                var dlg = new HydroMultiWorkingLossCurveDlg();
-                dlg.HydroClickEvent += (code) =>
-                {
-                    SelectVisual(code, eVisualSource.None);
-                };
-                dlg.SetBindingData(_hydroInfo, allCheckedWorkingList, visual);
+                dlg.SetBindingData(_hydroInfo, allMonitorList, allCheckedWorkingList);
                 dlg.ShowDialog();
             }
         }
@@ -2508,26 +2843,14 @@
         {
             if (_visual == null)
             {
-                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;
+                    SelectInputSource();
+                    if (_visual == null)
+                    {
+                        TipFormHelper.ShowWarn("璇烽�夋嫨鏋勪欢鍚庨噸璇曪紒");
+                        return;
+                    }
                 }
             }
             HydroVisualInfo visual = _visual;
@@ -2538,7 +2861,7 @@
             }
 
             var monitorHelper = GetMonitorHelper();
-            var allMonitorList = await monitorHelper.Get();
+            var allMonitorList = await monitorHelper.GetAll();
 
             var workingCheckedListHelper = GetWorkingCheckedListHelper();
             var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList();
@@ -2562,13 +2885,181 @@
             }
         }
 
-        #endregion
+        #endregion 宸ュ喌鍒嗘瀽
 
+        #region 鎹熷け鏇茬嚎
 
+        //鍗曞伐鍐垫崯澶辨洸绾挎帶浠�
+        private HydroSingleWorkingLossCurveCtrl _singleWorkingLossCurveCtrl = null;
 
+        //鑾峰彇鍗曞伐鍐垫崯澶辨洸绾挎帶浠�
+        private HydroSingleWorkingLossCurveCtrl GetSingleWorkingLossCurveCtrl()
+        {
+            if (_singleWorkingLossCurveCtrl == null)
+            {
+                _singleWorkingLossCurveCtrl = new HydroSingleWorkingLossCurveCtrl();
+                _singleWorkingLossCurveCtrl.Dock = DockStyle.Fill;
+                _singleWorkingLossCurveCtrl.HydroClickEvent += (code) =>
+                {
+                    var visual = GetVisual(code);
+                    SelectVisual(visual, eSimulationVisualSource.None);
+                };
+            }
+            return _singleWorkingLossCurveCtrl;
+        }
 
+        //鍗曞伐鍐垫崯澶辨洸绾挎帶浠舵槸鍚﹀彲瑙�
+        private bool IsSingleWorkingLossCurveCtrlVisible
+        {
+            get
+            {
+                if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible)
+                {
+                    if (this.controlContainerBottom.Controls.Count > 0)
+                    {
+                        if (this.controlContainerBottom.Controls[0] is HydroSingleWorkingLossCurveCtrl)
+                        {
+                            return true;
+                        }
+                    }
+                }
+                return false;
+            }
+        }
 
+        //鏄剧ず鍗曞伐鍐垫崯澶辨洸绾挎帶浠�
+        private void ShowSingleWorkingLossCurveCtrl(Yw.Model.HydroModelInfo hydroInfo, HydroCalcuResult calcuResult, HydroVisualInfo visual)
+        {
+            var singleWorkingLossCurveCtrl = GetSingleWorkingLossCurveCtrl();
+            if (!IsSingleWorkingLossCurveCtrlVisible)
+            {
+                this.controlContainerBottom.Controls.Clear();
+                this.controlContainerBottom.Controls.Add(singleWorkingLossCurveCtrl);
+                this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
+                this.docPnlBottom.Text = "鎹熷け鏇茬嚎";
+                this.docPnlBottom.Height = 350;
+            }
+            singleWorkingLossCurveCtrl.SetBindingData(hydroInfo, calcuResult, visual);
+        }
 
+        //鎹熷け鏇茬嚎
+        private void barBtnWorkingLossCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            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 workingCheckedListHelper = GetWorkingCheckedListHelper();
+            var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList();
+            if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1)
+            {
+                var workingHelper = GetWorkingHelper();
+                if (!workingHelper.Initialized)
+                {
+                    TipFormHelper.ShowWarn("璇疯绠楀悗閲嶈瘯锛�");
+                    return;
+                }
+                ShowSingleWorkingLossCurveCtrl(workingHelper.HydroInfo, workingHelper.CalcuResult, visual);
+            }
+            else
+            {
+                var dlg = new HydroMultiWorkingLossCurveDlg();
+                dlg.HydroClickEvent += (code) =>
+                {
+                    SelectVisual(code, eSimulationVisualSource.None);
+                };
+                dlg.SetBindingData(_hydroInfo, allCheckedWorkingList, visual);
+                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.HydroModelRelation>.Instance.DeleteAllByID(relation.ID))
+            {
+                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 鏂规绠$悊
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3