From 920315563b014498ed9ad11f29d69638bc2223ca Mon Sep 17 00:00:00 2001
From: lixiaojun <1287241240@qq.com>
Date: 星期六, 21 十二月 2024 11:15:55 +0800
Subject: [PATCH] 导入修改

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs | 3141 +++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 2,188 insertions(+), 953 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 42f11fc..e5f6f59 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,11 +1,17 @@
-锘縢lobal using Yw.EPAnet;
+锘縰sing DevExpress.Diagram.Core.Native;
 using DevExpress.Mvvm.Native;
-using DevExpress.XtraRichEdit.Layout;
-using DevExpress.XtraSpreadsheet.Commands;
+using DevExpress.Utils.MVVM;
+using DevExpress.XtraMap;
 using HStation.WinFrmUI.PhartRelation;
-using Yw.Pump;
-using Yw.WinFrmUI.Bimface;
-using Yw.WinFrmUI.Hydro;
+using Mapster;
+using NPOI.OpenXmlFormats.Dml;
+using NPOI.SS.Formula.Functions;
+using System.Diagnostics;
+using Yw.EPAnet;
+using Yw.Hydro;
+using Yw.Model;
+using Yw.Vmo;
+using Yw.WinFrmUI.Q3d;
 
 namespace HStation.WinFrmUI
 {
@@ -20,40 +26,64 @@
             RegistBulkSetEvents();
         }
 
+        /// <summary>
+        /// 鏂板宸ュ喌浜嬩欢
+        /// </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;//鏂规
         private Yw.Model.HydroModelInfo _hydroInfo = null;//姘村姏淇℃伅
-
-        private Yw.Model.HydroParterInfo _parter = null;
-        private Yw.WinFrmUI.HydroCheckResult _checkResult = null;
-        private Yw.EPAnet.CalcuResult _calcuResult = null;
+        private Dictionary<HydroWorkingVmo, bool> _allWorkingCheckedListDict = null;//鎵�鏈夊伐鍐甸�夋嫨鍒楄〃瀛楀吀
 
         /// <summary>
         /// 缁戝畾鏁版嵁
         /// </summary>
-        public async Task SetBindingData
+        public void SetBindingData
             (
-                HStation.Vmo.XhsProjectVmo project,
-                HStation.Vmo.XhsProjectSiteVmo projectSite,
-                Yw.Model.HydroModelInfo hydroInfo
+                XhsProjectVmo project,
+                XhsProjectSiteVmo projectSite,
+                XhsSchemeVmo scheme,
+                Yw.Model.HydroModelInfo hydroInfo,
+                Dictionary<HydroWorkingVmo, bool> allWorkingCheckedListDict
             )
         {
-            if (project == null)
-            {
-                return;
-            }
             _project = project;
             _projectSite = projectSite;
+            _scheme = scheme;
             _hydroInfo = hydroInfo;
-            if (_projectSite == null)
+            _allWorkingCheckedListDict = allWorkingCheckedListDict;
+            ResetMonitorValue();
+            if (_scheme == null)
             {
-                _projectSite = await BLLFactory<HStation.BLL.XhsProjectSite>.Instance.GetDefaultByProjectID(_project.ID);
+                this.ribPageGroupForScheme.Visible = false;
+                this.PageTitle.Caption = $"姘村姏妯℃嫙";
             }
-            if (_hydroInfo == null)
+            else
             {
-                var hydroRelation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance
-                    .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation);
-                _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(hydroRelation.ModelID);
+                this.ribPageGroupForScheme.Visible = true;
+                this.PageTitle.Caption = $"妯℃嫙鏂规\r\n{_scheme.Name}";
             }
         }
 
@@ -63,45 +93,40 @@
         public override void InitialDataSource()
         {
             base.InitialDataSource();
-            if (_project == null)
-            {
-                return;
-            }
-            this.PageTitle.Caption = $"{_project.Name}\r\n姘村姏妯℃嫙";
             ShowBimfaceCtrl();
             ShowQ3dCtrl();
             ShowPropertyCtrl();
-
         }
 
-        #region Bimface
+        #region BIM鎺т欢
 
         //bimface鎺т欢
-        private XhsProjectSimulationBimfaceCtrl _bimfaceCtrl = null;
+        private SimulationBimfaceCtrl _bimfaceCtrl = null;
 
         //鑾峰彇 bimface 鎺т欢
-        private async Task<XhsProjectSimulationBimfaceCtrl> GetBimfaceCtrl()
+        private async Task<SimulationBimfaceCtrl> GetBimfaceCtrl()
         {
+            if (_hydroInfo == null)
+            {
+                return default;
+            }
             if (_bimfaceCtrl == null)
             {
-                _bimfaceCtrl = new XhsProjectSimulationBimfaceCtrl();
+                var overlay = this.ShowOverlay();
+                _bimfaceCtrl = new SimulationBimfaceCtrl();
                 _bimfaceCtrl.Dock = DockStyle.Fill;
-                await _bimfaceCtrl.InitialData(_project, _projectSite, () => _hydroInfo);
+                await _bimfaceCtrl.InitialData(_project, _projectSite);
                 _bimfaceCtrl.LoadCompletedEvent += () =>
                 {//view鍔犺浇瀹屾垚浜嬩欢
-                    if (_hydroInfo == null)
-                    {
-                        return;
-                    }
+                    overlay.Close();
+                    this.barCkDecorator.Checked = false;
+                    this.barCkGrading.Checked = true;
                 };
-                _bimfaceCtrl.HydroMouseLeftClickEvent += (obj) =>
+                _bimfaceCtrl.HydroMouseLeftClickEvent += (code) =>
                 {//榧犳爣宸﹂敭鐐瑰嚮浜嬩欢
-                    if (_hydroInfo == null)
-                    {
-                        return;
-                    }
-                    _parter = obj;
-                    ShowProperty();
+                    var visualListHelper = GetVisualListHelper();
+                    var visual = visualListHelper.GetVisual(code);
+                    SelectVisual(visual, eSimulationVisualSource.Bimface);
                 };
             }
             return _bimfaceCtrl;
@@ -115,9 +140,9 @@
             this.tabPageBimface.Controls.Add(bimfaceCtrl);
         }
 
-        #endregion
+        #endregion BIM鎺т欢
 
-        #region Q3d
+        #region Q3d鎺т欢
 
         //Q3d 鎺т欢
         private XhsProjectSimulationQ3dCtrl _q3dCtrl = null;
@@ -125,20 +150,20 @@
         //鑾峰彇 Q3d 鎺т欢
         private XhsProjectSimulationQ3dCtrl GetQ3dCtrl()
         {
+            if (_hydroInfo == null)
+            {
+                return default;
+            }
             if (_q3dCtrl == null)
             {
                 _q3dCtrl = new XhsProjectSimulationQ3dCtrl();
                 _q3dCtrl.Dock = DockStyle.Fill;
                 _q3dCtrl.InitialData(() => _hydroInfo);
-                _q3dCtrl.SelectedPartersChangedEvent += (obj) =>
+                _q3dCtrl.SelectedPartersChangedEvent += (codes) =>
                 {
-                    if (_hydroInfo == null)
-                    {
-                        return;
-                    }
-                    var allParterList = _hydroInfo.GetAllParters();
-                    _parter = allParterList?.Find(x => x.Code == obj?.FirstOrDefault());
-                    ShowProperty();
+                    var visualListHelper = GetVisualListHelper();
+                    var visuals = visualListHelper.GetVisualList(codes);
+                    SelectVisual(visuals?.LastOrDefault(), eSimulationVisualSource.Q3d);
                 };
             }
             return _q3dCtrl;
@@ -152,54 +177,50 @@
             this.tabPageQ3d.Controls.Add(q3dCtrl);
         }
 
-        #endregion
+        #endregion Q3d鎺т欢
 
-        #region 鏋勪欢灞炴��
+        #region 灞炴�ф帶浠�
 
         //灞炴�ф帶浠�
-        private XhsProjectSimulationPropertyCtrl _propertyCtrl = null;
+        private SimulationPropertyCtrl _propertyCtrl = null;
 
         //鑾峰彇灞炴�ф帶浠�
-        private XhsProjectSimulationPropertyCtrl GetPropertyCtrl()
+        private SimulationPropertyCtrl GetPropertyCtrl()
         {
+            if (_hydroInfo == null)
+            {
+                return default;
+            }
             if (_propertyCtrl == null)
             {
-                _propertyCtrl = new XhsProjectSimulationPropertyCtrl();
+                _propertyCtrl = new SimulationPropertyCtrl();
                 _propertyCtrl.Dock = DockStyle.Fill;
-                _propertyCtrl.InitialData(() => _hydroInfo, () => GetAllCalcuResultList());
-                _propertyCtrl.BlinkLinkParterEvent += async (code, linkCode) =>
-                { //寮鸿皟杩炴帴缁勪欢
-                    if (string.IsNullOrEmpty(code))
+                _propertyCtrl.AllowEdit = true;
+                _propertyCtrl.HydroViewEvent += (visual) =>
+                {
+                    SelectVisual(visual, eSimulationVisualSource.Property);
+                };
+                _propertyCtrl.BlinkLinkNodeEvent += async (link, linkNodeCode) =>
+                { //寮鸿皟杩炴帴鑺傜偣
+                    if (link == null)
                     {
                         return;
                     }
-                    if (string.IsNullOrEmpty(linkCode))
-                    {
-                        return;
-                    }
-                    if (_hydroInfo == null)
-                    {
-                        return;
-                    }
-                    var allVisualList = _hydroInfo.GetAllVisuals();
-                    if (allVisualList == null || allVisualList.Count < 1)
-                    {
-                        return;
-                    }
-                    var linkParter = allVisualList.Find(x => x.Code == linkCode);
-                    if (linkParter == null)
+                    var visualListHelper = GetVisualListHelper();
+                    var linkNode = visualListHelper.GetVisual(linkNodeCode);
+                    if (linkNode == null)
                     {
                         return;
                     }
                     var blinkCodes = new List<string>();
-                    if (linkParter.GetType() == typeof(Yw.Model.HydroJunctionInfo))
+                    if (linkNode.GetType() == typeof(HydroJunctionInfo))
                     {
-                        var allLinkList = _hydroInfo.GetAllLinks();
+                        var allLinkList = visualListHelper.GetLinkList();
                         if (allLinkList == null || allLinkList.Count < 1)
                         {
                             return;
                         }
-                        var linkList = allLinkList.Where(x => (x.StartCode == linkParter.Code || x.EndCode == linkParter.Code) && x.Code != code).ToList();
+                        var linkList = allLinkList.Where(x => (x.StartCode == linkNodeCode || x.EndCode == linkNodeCode) && x.Code != link.Code).ToList();
                         if (linkList == null || linkList.Count < 1)
                         {
                             return;
@@ -208,20 +229,75 @@
                     }
                     else
                     {
-                        blinkCodes.Add(linkCode);
+                        blinkCodes.Add(linkNodeCode);
                     }
 
+                    await _bimfaceCtrl?.ClearBlinkComponents();
                     await _bimfaceCtrl?.SetBlinkComponents(blinkCodes);
                     await Task.Delay(5000);
                     await _bimfaceCtrl?.ClearBlinkComponents();
+                };
+                _propertyCtrl.PropertyValueChangedEvent += async (visual) =>
+                {
+                    if (visual == null)
+                    {
+                        return;
+                    }
+                    UpdateVisualListCtrl();
+                    var gradingHelper = await GetGradingHelper();
+                    gradingHelper.Set();
+                };
+                _propertyCtrl.MarkPropertyValueChangedEvent += async (visual) =>
+                {
+                    //鏍囨敞灞炴�у彂鐢熸敼鍙�
+                    //鍒ゆ柇褰撳墠鏄惁鏈夋爣娉ㄥ睍绀猴紝鑻ユ湁鍒欐洿鏂版爣娉紝鏈�濂芥槸鏇存柊鍗曚釜鏍囨敞
+                    var markHelper = await GetMarkHelper();
+                    markHelper.Set(visual);
+                };
+                _propertyCtrl.GradingPropertyValueChangedEvent += async (visual) =>
+                {
+                    //鍒嗙骇灞炴�у彂鐢熸敼鍙�
+                    //鍒ゆ柇褰撳墠鏄惁鏈夊垎绾у睍绀猴紝鑻ユ湁鍒欐洿鏂板垎绾э紝鏈�濂芥槸鏇存柊鍗曚釜鍒嗙骇
+                    var gradingHelper = await GetGradingHelper();
+                    gradingHelper.Set(visual);
+                };
+                _propertyCtrl.FlowEffectPropertyValueChangedEvent += async (visual) =>
+                {
+                    //娴佸悜灞炴�у彂鐢熸敼鍙�
+                    //鍒ゆ柇娴佸悜鏄惁鍔犺浇锛屽鏋滃姞杞藉垯鏇存柊娴佸悜锛屾渶濂芥槸鏇存柊鍗曚釜娴佸悜
+                    var flowEffectHelper = await GetFlowEffectHelper();
+                    flowEffectHelper.Set(visual);
                 };
             }
             return _propertyCtrl;
         }
 
-        //鏄剧ず灞炴�ч潰鏉�
+        //灞炴�ф帶浠舵槸鍚﹀彲瑙�
+        private bool IsPropertyCtrlVisible
+        {
+            get
+            {
+                if (this.docPnlRight.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible)
+                {
+                    if (this.controlContainerRight.Controls.Count > 0)
+                    {
+                        if (this.controlContainerRight.Controls[0] is SimulationPropertyCtrl)
+                        {
+                            return true;
+                        }
+                    }
+                }
+                return false;
+            }
+        }
+
+        //鏄剧ず灞炴�ф帶浠�
         private void ShowPropertyCtrl()
         {
+            if (IsPropertyCtrlVisible)
+            {
+                return;
+            }
             var propertyCtrl = GetPropertyCtrl();
             this.controlContainerRight.Controls.Clear();
             this.controlContainerRight.Controls.Add(propertyCtrl);
@@ -230,262 +306,394 @@
             this.docPnlRight.Width = 300;
         }
 
-        //灞炴�ч潰鏉挎寜閽�
-        private void barBtnProperty_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        //璁剧疆灞炴�ф帶浠�
+        private void SetPropertyCtrl(HydroVisualInfo visual)
         {
             ShowPropertyCtrl();
+            var visualVmListHelper = GetVisualVmListHelper();
+            var vm = visualVmListHelper.GetVisual(visual);
+            _propertyCtrl.SelectedObject = vm;
+            _propertyCtrl.UpdateRows();
         }
 
-        //鏄剧ず灞炴��
-        private void ShowProperty()
+        //鏇存柊灞炴�ф帶浠�
+        private void UpdatePropertyCtrl()
+        {
+            _propertyCtrl?.UpdateRows();
+        }
+
+        #endregion 灞炴�ф帶浠�
+
+        #region 閫夋嫨鏋勪欢
+
+        //閫夋嫨鏋勪欢
+        private Yw.Model.HydroVisualInfo _visual = null;
+
+        //閫夋嫨鏋勪欢
+        private void SelectVisual(HydroVisualInfo visual, eSimulationVisualSource source)
+        {
+            _visual = visual;
+            switch (source)
+            {
+                case eSimulationVisualSource.None:
+                    {
+                        _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
+                        this.barBtnSetMonitor.Enabled = visual != null;
+                        SetPropertyCtrl(visual);
+                    }
+                    break;
+
+                case eSimulationVisualSource.Bimface:
+                    {
+                        this.barBtnSetMonitor.Enabled = visual != null;
+                        SetPropertyCtrl(visual);
+                    }
+                    break;
+
+                case eSimulationVisualSource.Q3d:
+                    {
+                        _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
+                        this.barBtnSetMonitor.Enabled = visual != null;
+                        SetPropertyCtrl(visual);
+                    }
+                    break;
+
+                case eSimulationVisualSource.Property:
+                    {
+                        _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
+                        this.barBtnSetMonitor.Enabled = visual != null;
+                    }
+                    break;
+
+                case eSimulationVisualSource.List:
+                    {
+                        _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
+                        this.barBtnSetMonitor.Enabled = visual != null;
+                        SetPropertyCtrl(visual);
+                    }
+                    break;
+
+                case eSimulationVisualSource.Set:
+                    {
+                        _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
+                        this.barBtnSetMonitor.Enabled = visual != null;
+                        SetPropertyCtrl(visual);
+                    }
+                    break;
+
+                case eSimulationVisualSource.Search:
+                    {
+                        _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
+                        this.barBtnSetMonitor.Enabled = visual != null;
+                        SetPropertyCtrl(visual);
+                    }
+                    break;
+
+                case eSimulationVisualSource.Monitor:
+                    {
+                        _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
+                        this.barBtnSetMonitor.Enabled = visual != null;
+                        SetPropertyCtrl(visual);
+                    }
+                    break;
+
+                case eSimulationVisualSource.Check:
+                    {
+                        _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
+                        this.barBtnSetMonitor.Enabled = visual != null;
+                        SetPropertyCtrl(visual);
+                    }
+                    break;
+
+                case eSimulationVisualSource.Calcu:
+                    {
+                        _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
+                        this.barBtnSetMonitor.Enabled = visual != null;
+                        SetPropertyCtrl(visual);
+                    }
+                    break;
+
+                case eSimulationVisualSource.Warning:
+                    {
+                        _bimfaceCtrl?.ZoomAndSelectComponent(visual?.Code);
+                        this.barBtnSetMonitor.Enabled = visual != null;
+                        SetPropertyCtrl(visual);
+                    }
+                    break;
+
+                default: break;
+            }
+        }
+
+        //閫夋嫨鏋勪欢
+        private void SelectVisual(string code, eSimulationVisualSource source)
+        {
+            var visual = GetVisual(code);
+            SelectVisual(visual, source);
+        }
+
+        #endregion 閫夋嫨鏋勪欢
+
+        #region 鏋勪欢鏄庣粏
+
+        #region 鍙鍒楄〃
+
+        //鍙鍒楄〃杈呭姪绫�
+        private SimulationVisualListHelper _visualListHelper = null;
+
+        //鑾峰彇鍙鍒楄〃杈呭姪绫�
+        private SimulationVisualListHelper GetVisualListHelper()
+        {
+            if (_visualListHelper == null)
+            {
+                _visualListHelper = new SimulationVisualListHelper();
+                _visualListHelper.InitialData(_hydroInfo);
+            }
+            return _visualListHelper;
+        }
+
+        //閲嶇疆鍙鍒楄〃
+        private void ResetVisualList()
+        {
+            var helper = GetVisualListHelper();
+            helper.InitialData(_hydroInfo);
+        }
+
+        //鑾峰彇鍙鏋勪欢
+        private Yw.Model.HydroVisualInfo GetVisual(string code)
+        {
+            var helper = GetVisualListHelper();
+            var visual = helper.GetVisual(code);
+            return visual;
+        }
+
+        //鑾峰彇鍙鍒楄〃
+        private List<Yw.Model.HydroVisualInfo> GetVisualList()
+        {
+            var helper = GetVisualListHelper();
+            return helper.GetVisualList();
+        }
+
+        //鑾峰彇姘存簮鍒楄〃
+        private List<Yw.Model.HydroSourceInfo> GetSourceList()
+        {
+            var helper = GetVisualListHelper();
+            return helper.GetSourceList();
+        }
+
+        #endregion 鍙鍒楄〃
+
+        #region 瑙嗗浘鍒楄〃
+
+        //鍙瑙嗗浘鍒楄〃杈呭姪绫�
+        private SimulationVisualVmListHelper _visualVmListHelper = null;
+
+        //鑾峰彇鍙瑙嗗浘鍒楄〃杈呭姪绫�
+        private SimulationVisualVmListHelper GetVisualVmListHelper()
         {
             if (_hydroInfo == null)
             {
-                return;
+                return default;
             }
-            if (this.docPnlRight.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Hidden)
+            if (_visualVmListHelper == null)
             {
-                ShowPropertyCtrl();
+                var visualListHelper = GetVisualListHelper();
+                var calcuResultHelper = GetCalcuResultHelper();
+                _visualVmListHelper = new SimulationVisualVmListHelper(visualListHelper, calcuResultHelper);
             }
-            if (_parter == null)
-            {
-                _propertyCtrl?.SelectParter(null);
-                return;
-            }
-            _propertyCtrl?.SelectParter(_parter.Code);
+            return _visualVmListHelper;
+        }
 
-            var allCalcuResultList = GetAllCalcuResultList();
-            if (allCalcuResultList != null && allCalcuResultList.Count > 0)
+        //鑾峰彇鍙瑙嗗浘鍒楄〃
+        private List<HydroVisualViewModel> GetVisualViewModelList()
+        {
+            var helper = GetVisualVmListHelper();
+            return helper.GetVisualList();
+        }
+
+        //鑾峰彇鍙瑙嗗浘
+        private HydroVisualViewModel GetVisualViewModel(string code)
+        {
+            var helper = GetVisualVmListHelper();
+            return helper.GetVisual(code);
+        }
+
+        #endregion 瑙嗗浘鍒楄〃
+
+        #region 鏄庣粏鎺т欢
+
+        //鏋勪欢鏄庣粏鎺т欢
+        private Yw.WinFrmUI.HydroVisualListCtrl _visualListCtrl = null;
+
+        //鑾峰彇鏋勪欢鏄庣粏鎺т欢
+        private Yw.WinFrmUI.HydroVisualListCtrl GetVisualListCtrl()
+        {
+            if (_visualListCtrl == null)
             {
-                var calcuResult = allCalcuResultList.Find(x => x.Code == _parter.Code);
-                if (calcuResult != null)
+                _visualListCtrl = new HydroVisualListCtrl();
+                _visualListCtrl.Dock = DockStyle.Fill;
+                _visualListCtrl.HydroClickInfoEvent += (visual) =>
                 {
-                    _propertyCtrl?.UpdateCalcuProperty(calcuResult);
+                    SelectVisual(visual, eSimulationVisualSource.List);
+                };
+                _visualListCtrl.HydroChangedInfoEvent += (visualList) =>
+                {
+                    SelectVisual(_visual, eSimulationVisualSource.List);
+                };
+            }
+            return _visualListCtrl;
+        }
+
+        //鏋勪欢鏄庣粏鎺т欢鏄惁鍙
+        private bool IsVisualListCtrlVisible
+        {
+            get
+            {
+                if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible)
+                {
+                    if (this.controlContainerBottom.Controls.Count > 0)
+                    {
+                        if (this.controlContainerBottom.Controls[0] is HydroVisualListCtrl)
+                        {
+                            return true;
+                        }
+                    }
                 }
+                return false;
             }
         }
 
-        #endregion
-
-        #region 鑷姩鍖归厤
-
-        //鑾峰彇鍖归厤鍒楄〃鎺т欢
-        private XhsProjectSimulationMatchingListCtrl GetMatchingListCtrl()
-        {
-            if (_matchingListCtrl == null)
-            {
-                _matchingListCtrl = new XhsProjectSimulationMatchingListCtrl();
-                _matchingListCtrl.Dock = DockStyle.Fill;
-                _matchingListCtrl.HydroClickEvent += async (code) =>
-                {
-                    if (_hydroInfo == null)
-                    {
-                        return;
-                    }
-                    var allParterList = _hydroInfo.GetAllParters();
-                    _parter = allParterList?.Find(x => x.Code == code);
-                    var elementIds = new List<string>();
-                    if (_parter != null)
-                    {
-                        elementIds.Add(_parter.Code);
-                    }
-                    await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds);
-                    ShowProperty();
-                };
-                _matchingListCtrl.ApplyMatchingEvent += (output) =>
-                {
-                    if (_hydroInfo == null)
-                    {
-                        return false;
-                    }
-                    return AssetsMatchingParasHelper.Apply(_hydroInfo, output);
-                };
-            }
-            return _matchingListCtrl;
-        }
-
-        //鍖归厤鍒楄〃鎺т欢
-        private XhsProjectSimulationMatchingListCtrl _matchingListCtrl = null;
-
-        //鑷姩鍖归厤
-        private void barBtnMatchingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        //鏄剧ず鏋勪欢鏄庣粏鎺т欢
+        private void ShowVisualListCtrl()
         {
             if (_hydroInfo == null)
             {
                 return;
             }
-            this.controlContainerBottom.Controls.Clear();
-            var matchingListCtrl = GetMatchingListCtrl();
-            var input = AssetsMatchingParasHelper.Create(_hydroInfo, GetAllCalcuResultList());
-            matchingListCtrl.SetBindingData(input);
-            this.controlContainerBottom.Controls.Add(matchingListCtrl);
-            this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
-            this.docPnlBottom.Text = "鍖归厤鍒楄〃";
-            this.docPnlBottom.Height = 350;
-        }
-
-        #endregion
-
-        #region 鏈尮閰嶅垪琛�
-
-        //鑾峰彇鏈尮閰嶅垪琛ㄦ帶浠�
-        private XhsProjectSimulationUnMatchingListCtrl GetUnMatchingListCtrl()
-        {
-            if (_unMatchingListCtrl == null)
+            var visualListCtrl = GetVisualListCtrl();
+            if (!IsVisualListCtrlVisible)
             {
-                _unMatchingListCtrl = new XhsProjectSimulationUnMatchingListCtrl();
-                _unMatchingListCtrl.Dock = DockStyle.Fill;
-                _unMatchingListCtrl.HydroClickEvent += async (parter) =>//琛岀偣鍑�
-                {
-                    if (parter == null)
-                    {
-                        return;
-                    }
-                    if (_hydroInfo == null)
-                    {
-                        return;
-                    }
-                    var allParterList = _hydroInfo.GetAllParters();
-                    _parter = allParterList?.Find(x => x.Code == parter.Code);
-                    var elementIds = new List<string>() { parter.Code };
-                    await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds);
-                    ShowProperty();
-                };
-                _unMatchingListCtrl.ViewModelEvent += async (parters) =>//鏌ョ湅妯″瀷
-                {
-                    var codes = parters?.Select(x => x.Code).Distinct().ToList();
-                    await _bimfaceCtrl?.ZoomAndSelectComponents(codes);
-                    _parter = null;
-                    ShowProperty();
-                };
+                this.controlContainerBottom.Controls.Clear();
+                this.controlContainerBottom.Controls.Add(visualListCtrl);
+                this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
+                this.docPnlBottom.Text = "鏋勪欢鏄庣粏";
+                this.docPnlBottom.Height = 350;
             }
-            return _unMatchingListCtrl;
-        }
-
-        private XhsProjectSimulationUnMatchingListCtrl _unMatchingListCtrl = null;//鏈尮閰嶅垪琛�
-
-        //鏈尮閰嶅垪琛�
-        private void barBtnUnMatchingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
-        {
-            if (_hydroInfo == null)
+            var visualVmListHelper = GetVisualVmListHelper();
+            var allVisualVmList = visualVmListHelper.GetVisualList();
+            visualListCtrl.SetBindingData(allVisualVmList);
+            var calcuResult = GetCalcuResult();
+            if (calcuResult != null && calcuResult.Succeed)
             {
-                return;
-            }
-            this.controlContainerBottom.Controls.Clear();
-            var unMatchingListCtrl = GetUnMatchingListCtrl();
-            unMatchingListCtrl.SetBindingData(_hydroInfo);
-            this.controlContainerBottom.Controls.Add(unMatchingListCtrl);
-            this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
-            this.docPnlBottom.Text = "鏈尮閰嶅垪琛�";
-            this.docPnlBottom.Height = 350;
-        }
-
-        #endregion
-
-        #region 涓�閿樉闅�
-
-        //涓�閿樉闅�
-        private async Task FastShowHidden()
-        {
-            if (_hydroInfo == null)
-            {
-                return;
-            }
-            if (_hydroInfo.Decorators == null || _hydroInfo.Decorators.Count < 1)
-            {
-                return;
-            }
-            if (_fastShowHiddenCodeList == null)
-            {
-                _fastShowHiddenCodeList = _hydroInfo.Decorators.Select(x => x.Code).ToList();
-                await _bimfaceCtrl?.HideComponents(_fastShowHiddenCodeList);
+                visualListCtrl.SetCalcuView();
             }
             else
             {
-                await _bimfaceCtrl?.ShowComponents(_fastShowHiddenCodeList);
-                _fastShowHiddenCodeList = null;
+                visualListCtrl.SetNormalView();
             }
         }
 
-        //鏄鹃殣缂栫爜鍒楄〃
-        private List<string> _fastShowHiddenCodeList = null;
-
-        //瑙﹀彂涓�閿樉闅�
-        private async void barBtnFastShowHidden_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        //鏇存柊鏋勪欢鏄庣粏鎺т欢
+        private void UpdateVisualListCtrl()
         {
-            await FastShowHidden();
-        }
-
-        #endregion
-
-        #region 姘村姏鏍¢獙
-
-        //鏍¢獙鎺т欢
-        private XhsProjectSimulationHydroCheckResultCtrl _checkCtrl = null;
-
-        //鑾峰彇鏍¢獙鎺т欢
-        private XhsProjectSimulationHydroCheckResultCtrl GetCheckCtrl()
-        {
-            if (_checkCtrl == null)
-            {
-                _checkCtrl = new XhsProjectSimulationHydroCheckResultCtrl();
-                _checkCtrl.Dock = DockStyle.Fill;
-                _checkCtrl.HydroClickEvent += async (code) =>
-                {
-                    if (_hydroInfo == null)
-                    {
-                        return;
-                    }
-                    var elementIds = new List<string>();
-                    if (string.IsNullOrEmpty(code))
-                    {
-                        _parter = null;
-                    }
-                    else
-                    {
-                        var allParterList = _hydroInfo.GetAllParters();
-                        _parter = allParterList?.Find(x => x.Code == code);
-                        if (_parter != null)
-                        {
-                            elementIds.Add(_parter.Code);
-                        }
-                    }
-                    await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds);
-                    ShowProperty();
-                };
-            }
-            return _checkCtrl;
-        }
-
-        //鏄剧ず妫�鏌ユ帶浠�
-        private void ShowCheckCtrl()
-        {
-            if (_checkResult == null)
+            if (!IsVisualListCtrlVisible)
             {
                 return;
             }
-            var checkCtrl = GetCheckCtrl();
-            checkCtrl.SetBindingData(_checkResult);
-            this.controlContainerBottom.Controls.Clear();
-            this.controlContainerBottom.Controls.Add(checkCtrl);
-            this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
-            this.docPnlBottom.Text = "妫�鏌ョ粨鏋�";
-            this.docPnlBottom.Height = 350;
-
+            _visualListCtrl?.UpdateBindingData();
+            var calcuResult = GetCalcuResult();
+            if (calcuResult != null && calcuResult.Succeed)
+            {
+                _visualListCtrl.SetCalcuView();
+            }
+            else
+            {
+                _visualListCtrl.SetNormalView();
+            }
         }
 
-        //姘村姏妫�鏌�
-        private void barBtnHydroCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        //鏋勪欢鏄庣粏
+        private void barBtnVisualList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            ShowVisualListCtrl();
+        }
+
+        #endregion 鏄庣粏鎺т欢
+
+        #region 鏋勪欢鏄剧ず
+
+        //鏋勪欢鍙杈呭姪绫�
+        private SimulationVisualVisibleHelper _visualVisibleHelper = null;
+
+        //鑾峰彇鏋勪欢鍙杈呭姪绫�
+        private async Task<SimulationVisualVisibleHelper> GetVisualVisibleHelper()
+        {
+            if (_hydroInfo == null)
+            {
+                return default;
+            }
+            if (_visualVisibleHelper == null)
+            {
+                var visualListHelper = GetVisualListHelper();
+                var bimfaceCtrl = await GetBimfaceCtrl();
+                _visualVisibleHelper = new SimulationVisualVisibleHelper(visualListHelper, bimfaceCtrl);
+                _visualVisibleHelper.InitialData(_hydroInfo);
+            }
+            return _visualVisibleHelper;
+        }
+
+        //璁剧疆鏋勪欢鍙鎬�
+        private async void SetVisualVisible()
         {
             if (_hydroInfo == null)
             {
                 return;
             }
-            _checkResult = _hydroInfo.Check();
-            ShowCheckCtrl();
+            var visualVisibleHelper = await GetVisualVisibleHelper();
+            var allVisibleList = visualVisibleHelper.Items;
+            var dlg = new SetHydroVisualVisibleDlg();
+            dlg.SetBindingData(allVisibleList);
+            dlg.ReloadDataEvent += (list) =>
+            {
+                visualVisibleHelper.Items = list;
+                visualVisibleHelper.Set();
+            };
+            dlg.ShowDialog();
         }
 
-        #endregion
+        //璁剧疆鏋勪欢鏄剧ず
+        private void barBtnSetVisualVisible_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            SetVisualVisible();
+        }
+
+        #endregion 鏋勪欢鏄剧ず
+
+        #endregion 鏋勪欢鏄庣粏
+
+        #region 涓�閿樉闅�
+
+        //璁剧疆瑁呴グ浠跺彲瑙佹��
+        private async void SetDecoratorVisible(bool isDecoratorVisible)
+        {
+            var codes = _hydroInfo.Decorators?.Select(x => x.Code).Distinct().ToList();
+            if (isDecoratorVisible)
+            {
+                await _bimfaceCtrl?.ShowComponents(codes);
+            }
+            else
+            {
+                await _bimfaceCtrl?.HideComponents(codes);
+            }
+        }
+
+        //璁剧疆
+        private void barCkDecorator_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            SetDecoratorVisible(this.barCkDecorator.Checked);
+        }
+
+        #endregion 涓�閿樉闅�
 
         #region 淇濆瓨淇℃伅
 
@@ -496,90 +704,29 @@
             {
                 return;
             }
-            var id = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.Save(_hydroInfo);
-            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
-
-        #region 鏋勪欢鏄庣粏
-
-        //鏋勪欢鏄庣粏鎺т欢
-        private Yw.WinFrmUI.HydroParterListCtrl _parterListCtrl = null;
-
-        //鑾峰彇鏋勪欢鏄庣粏鎺т欢
-        private Yw.WinFrmUI.HydroParterListCtrl GetParterListCtrl()
-        {
-            if (_parterListCtrl == null)
-            {
-                _parterListCtrl = new HydroParterListCtrl();
-                _parterListCtrl.Dock = DockStyle.Fill;
-                _parterListCtrl.HydroClickEvent += async (parter) =>
-                {
-                    if (_hydroInfo == null)
-                    {
-                        return;
-                    }
-                    var allParterList = _hydroInfo.GetAllParters();
-                    _parter = allParterList?.Find(x => x.Code == parter.Code);
-                    await _bimfaceCtrl?.ZoomAndSelectComponents(new List<string>() { _parter.Code });
-                    ShowProperty();
-                };
-            }
-            return _parterListCtrl;
-        }
-
-        //鏄剧ず鏋勪欢鏄庣粏鎺т欢
-        private void ShowParterListCtrl()
-        {
-            if (_hydroInfo == null)
-            {
-                return;
-            }
-            var parterListCtrl = GetParterListCtrl();
-            parterListCtrl.SetBindingData(_hydroInfo, GetAllCalcuResultList());
-            this.controlContainerBottom.Controls.Clear();
-            this.controlContainerBottom.Controls.Add(parterListCtrl);
-            this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
-            this.docPnlBottom.Text = "鏋勪欢鏄庣粏";
-            this.docPnlBottom.Height = 350;
-        }
-
-        //鏋勪欢鏄庣粏
-        private void barBtnHydroParterList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
-        {
-            ShowParterListCtrl();
-        }
-
-        #endregion
-
-        #region INP瀵煎嚭
-
-        //瀵煎嚭姘村姏INP鏂囦欢
-        private void barBtnHydroExportInp_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
-        {
-            if (_hydroInfo == null)
-            {
-                return;
-            }
-            var fileName = Yw.WinFrmUI.FileDialogHelper.SaveInp("瀵煎嚭Inp鏂囦欢");
-            if (string.IsNullOrEmpty(fileName))
-            {
-                return;
-            }
-            var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo);
-            var result = netWork.ToInpString();
-            File.WriteAllText(fileName, result);
-            TipFormHelper.ShowSucceed("瀵煎嚭鎴愬姛");
-        }
-
-        #endregion INP瀵煎嚭
+        #endregion 淇濆瓨淇℃伅
 
         #region 鎵归噺閰嶇疆
 
@@ -589,143 +736,339 @@
             //姘村簱
             this.barBtnSetReservoirList.ItemClick += delegate
             {
-                var dlg = new HydroReservoirBulkSetListDlg();
+                var allVisualViewModelList = GetVisualViewModelList();
+                var dlg = new SetHydroReservoirListDlg();
+                dlg.SetBindingData(allVisualViewModelList);
+                dlg.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eSimulationVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
+                    UpdateVisualListCtrl();
+                };
                 dlg.ShowDialog();
             };
             //姘存睜
             this.barBtnSetTankList.ItemClick += delegate
             {
-                var dlg = new HydroTankBulkSetListDlg();
+                var allVisualViewModelList = GetVisualViewModelList();
+                var dlg = new SetHydroTankListDlg();
+                dlg.SetBindingData(allVisualViewModelList);
+                dlg.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eSimulationVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
+                    UpdateVisualListCtrl();
+                };
                 dlg.ShowDialog();
             };
             //姘寸
             this.barBtnSetWaterboxList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
+                var allVisualViewModelList = GetVisualViewModelList();
+                var dlg = new SetHydroWaterboxListDlg();
+                dlg.SetBindingData(allVisualViewModelList);
+                dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    return;
-                }
-                var dlg = new HydroWaterboxBulkSetListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
+                    UpdateVisualListCtrl();
+                };
                 dlg.ShowDialog();
             };
             //杩炴帴鑺傜偣
             this.barBtnSetJunctionList.ItemClick += delegate
             {
-                var dlg = new HydroJunctionBulkSetListDlg();
+                var allVisualViewModelList = GetVisualViewModelList();
+                var dlg = new SetHydroJunctionListDlg();
+                dlg.SetBindingData(allVisualViewModelList);
+                dlg.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eSimulationVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
+                    UpdateVisualListCtrl();
+                };
                 dlg.ShowDialog();
             };
             //闂峰ご
             this.barBtnSetBluntheadList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
+                var allVisualViewModelList = GetVisualViewModelList();
+                var dlg = new SetHydroBluntheadListDlg();
+                dlg.SetBindingData(allVisualViewModelList);
+                dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    return;
-                }
-                var dlg = new HydroBluntheadBulkSetListDlg();
+                    SelectVisual(visual, eSimulationVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
+                    UpdateVisualListCtrl();
+                };
                 dlg.ShowDialog();
             };
             //寮ご
             this.barBtnSetElbowsList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
+                var allVisualVmList = GetVisualViewModelList();
+                var dlg = new SetHydroElbowListDlg();
+                dlg.SetBindingData(allVisualVmList);
+                dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    return;
-                }
-                var dlg = new HydroElbowBulkSetListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
+                    UpdateVisualListCtrl();
+                };
                 dlg.ShowDialog();
             };
             //涓夐��
             this.barBtnSetThreelinkList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
+                var allVisualViewModelList = GetVisualViewModelList();
+                var dlg = new SetHydroThreelinkListDlg();
+                dlg.SetBindingData(allVisualViewModelList);
+                dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    return;
-                }
-                var dlg = new HydroThreelinkBulkSetListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
+                    UpdateVisualListCtrl();
+                };
                 dlg.ShowDialog();
             };
             //鍥涢��
             this.barBtnSetFourlinkList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
+                var allVisualViewModelList = GetVisualViewModelList();
+                var dlg = new SetHydroFourlinkListDlg();
+                dlg.SetBindingData(allVisualViewModelList);
+                dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    return;
-                }
-                var dlg = new HydroFourlinkBulkSetListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
+                    UpdateVisualListCtrl();
+                };
                 dlg.ShowDialog();
             };
             //姘磋〃
             this.barBtnSetMeterList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
+                var allVisualViewModelList = GetVisualViewModelList();
+                var dlg = new SetHydroMeterListDlg();
+                dlg.SetBindingData(allVisualViewModelList);
+                dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    return;
-                }
-                var dlg = new HydroMeterBulkSetListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
+                    UpdateVisualListCtrl();
+                };
                 dlg.ShowDialog();
             };
             //娴侀噺璁�
             this.barBtnSetFlowmeterList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
+                var allVisualViewModelList = GetVisualViewModelList();
+                var dlg = new SetHydroFlowmeterListDlg();
+                dlg.SetBindingData(allVisualViewModelList);
+                dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    return;
-                }
-                var dlg = new HydroFlowmeterBulkSetListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
+                    UpdateVisualListCtrl();
+                };
                 dlg.ShowDialog();
             };
             //鍘嬪姏琛�
+            this.barBtnSetPressmeterList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204);
+            this.barBtnSetPressmeterList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Pressmeter;
+            this.barBtnSetPressmeterList.ImageOptions.SvgImageSize = new Size(32, 32);
+            this.barBtnSetPressmeterList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True;
             this.barBtnSetPressmeterList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
+                var allVisualViewModelList = GetVisualViewModelList();
+                var dlg = new SetHydroPressmeterListDlg();
+                dlg.SetBindingData(allVisualViewModelList);
+                dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    return;
-                }
-                var dlg = new HydroPressmeterBulkSetListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
+                    UpdateVisualListCtrl();
+                };
+                dlg.ShowDialog();
+            };
+            //鍠峰槾
+            this.barBtnSetNozzleList.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204);
+            this.barBtnSetNozzleList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Nozzle;
+            this.barBtnSetNozzleList.ImageOptions.SvgImageSize = new Size(32, 32);
+            this.barBtnSetNozzleList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True;
+            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.ItemAppearance.Normal.ForeColor = Color.FromArgb(0, 122, 204);
+            this.barBtnSetCoolingList.ImageOptions.SvgImage = AssetsMainSvgImageHelper.Cooling;
+            this.barBtnSetCoolingList.ImageOptions.SvgImageSize = new Size(32, 32);
+            this.barBtnSetCoolingList.ImageOptions.AllowGlyphSkinning = DevExpress.Utils.DefaultBoolean.True;
+            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();
             };
             //绠¢亾
             this.barBtnSetPipeList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
+                var allVisualViewModelList = GetVisualViewModelList();
+                var dlg = new SetHydroPipeListDlg();
+                dlg.SetBindingData(allVisualViewModelList);
+                dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    return;
-                }
-                var dlg = new HydroPipeBulkSetListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
+                    UpdateVisualListCtrl();
+                };
+                dlg.ShowDialog();
+            };
+            //杩囨浮浠�
+            this.barBtnSetTranslationList.ItemClick += delegate
+            {
+                var allVisualViewModelList = GetVisualViewModelList();
+                var dlg = new SetHydroTranslationListDlg();
+                dlg.SetBindingData(allVisualViewModelList);
+                dlg.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eSimulationVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
+                    UpdateVisualListCtrl();
+                };
                 dlg.ShowDialog();
             };
             //姘存车
             this.barBtnSetPumpList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
+                var allVisualViewModelList = GetVisualViewModelList();
+                var dlg = new SetHydroPumpListDlg();
+                dlg.SetBindingData(allVisualViewModelList);
+                dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    return;
-                }
-                var dlg = new HydroPumpBulkSetListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
+                    UpdateVisualListCtrl();
+                };
                 dlg.ShowDialog();
             };
             //闃�闂�
             this.barBtnSetValveList.ItemClick += delegate
             {
-                if (_hydroInfo == null)
+                var allVisualViewModelList = GetVisualViewModelList();
+                var dlg = new SetHydroValveListDlg();
+                dlg.SetBindingData(allVisualViewModelList);
+                dlg.HydroClickInfoEvent += (visual) =>
                 {
-                    return;
-                }
-                var dlg = new HydroValveBulkSetListDlg();
-                dlg.SetBindingData(_hydroInfo);
+                    SelectVisual(visual, eSimulationVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
+                    UpdateVisualListCtrl();
+                };
+                dlg.ShowDialog();
+            };
+            //鎹㈢儹鍣�
+            this.barBtnSetExchangerList.ItemClick += delegate
+            {
+                var allVisualViewModelList = GetVisualViewModelList();
+                var dlg = new SetHydroExchangerListDlg();
+                dlg.SetBindingData(allVisualViewModelList);
+                dlg.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eSimulationVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
+                    UpdateVisualListCtrl();
+                };
+                dlg.ShowDialog();
+            };
+            //鍘嬬缉鏈�
+            this.barBtnSetCompressorList.ItemClick += delegate
+            {
+                var allVisualViewModelList = GetVisualViewModelList();
+                var dlg = new SetHydroCompressorListDlg();
+                dlg.SetBindingData(allVisualViewModelList);
+                dlg.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eSimulationVisualSource.Set);
+                };
+                dlg.HydroChangedInfoEvent += visuals =>
+                {
+                    SelectVisual(visuals?.FirstOrDefault(), eSimulationVisualSource.Set);
+                    UpdateVisualListCtrl();
+                };
                 dlg.ShowDialog();
             };
         }
-
 
         //鏄剧ずRadialMenu
         private void barBtnSetList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
@@ -799,6 +1142,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;
             }
 
             //闂峰ご
@@ -891,26 +1244,6 @@
                 this.barBtnSetTranslationList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
             }
 
-            //鎹㈢儹鍣�
-            if (_hydroInfo.Exchangers == null || _hydroInfo.Exchangers.Count < 1)
-            {
-                this.barBtnSetExchangerList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
-            }
-            else
-            {
-                this.barBtnSetExchangerList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
-            }
-
-            //绌哄帇鏈�
-            if (_hydroInfo.Compressors == null || _hydroInfo.Compressors.Count < 1)
-            {
-                this.barBtnSetCompressorList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
-            }
-            else
-            {
-                this.barBtnSetCompressorList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
-            }
-
             //姘存车
             if (_hydroInfo.Pumps == null || _hydroInfo.Pumps.Count < 1)
             {
@@ -931,161 +1264,615 @@
                 this.barBtnSetValveList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
             }
 
+            //鎹㈢儹鍣�
+            if (_hydroInfo.Exchangers == null || _hydroInfo.Exchangers.Count < 1)
+            {
+                this.barBtnSetExchangerList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
+            }
+            else
+            {
+                this.barBtnSetExchangerList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
+            }
+
+            //绌哄帇鏈�
+            if (_hydroInfo.Compressors == null || _hydroInfo.Compressors.Count < 1)
+            {
+                this.barBtnSetCompressorList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
+            }
+            else
+            {
+                this.barBtnSetCompressorList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
+            }
         }
 
-        #endregion
+        #endregion 鎵归噺閰嶇疆
 
-        #region 骞惰仈鍒嗘瀽
+        #region 鏋勪欢鏌ヨ
 
-        //骞惰仈鍒嗘瀽
-        private void barBtnAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        //鏌ヨ缁勪欢
+        private HydroVisualSearchListCtrl _searchCtrl = null;
+
+        //鑾峰彇鏌ヨ缁勪欢
+        private HydroVisualSearchListCtrl GetSearchCtrl()
+        {
+            if (_searchCtrl == null)
+            {
+                var visualVmListHelper = GetVisualVmListHelper();
+                var allVisualVmList = visualVmListHelper.GetVisualList();
+                _searchCtrl = new HydroVisualSearchListCtrl();
+                _searchCtrl.Dock = DockStyle.Fill;
+                _searchCtrl.InitialData(allVisualVmList);
+                _searchCtrl.HydroClickInfoEvent += (visual) =>
+                {
+                    SelectVisual(visual, eSimulationVisualSource.Check);
+                };
+                _searchCtrl.HydroSearchInfoEvent += (list) =>
+                {
+                    var visual = list?.FirstOrDefault();
+                    SelectVisual(visual, eSimulationVisualSource.Search);
+                };
+            }
+            return _searchCtrl;
+        }
+
+        //鏌ヨ鎺т欢鏄惁鍙
+        private bool IsSearchCtrlVisible
+        {
+            get
+            {
+                if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible)
+                {
+                    if (this.controlContainerBottom.Controls.Count > 0)
+                    {
+                        if (this.controlContainerBottom.Controls[0] is HydroVisualSearchListCtrl)
+                        {
+                            return true;
+                        }
+                    }
+                }
+                return false;
+            }
+        }
+
+        //鏄剧ず鏌ヨ鎺т欢
+        private void ShowSearchCtrl(string content)
+        {
+            if (IsSearchCtrlVisible)
+            {
+                return;
+            }
+            var searchCtrl = GetSearchCtrl();
+            searchCtrl.SetBindingData(content);
+            this.controlContainerBottom.Controls.Clear();
+            this.controlContainerBottom.Controls.Add(searchCtrl);
+            this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
+            this.docPnlBottom.Text = "鏋勪欢鏌ヨ";
+            this.docPnlBottom.Height = 350;
+        }
+
+        //鏄剧ず鏌ヨ绐椾綋
+        private void ShowSearchDlg()
+        {
+            if (IsSearchCtrlVisible)
+            {
+                return;
+            }
+            var dlg = new InputHydroVisualSearchListDlg();
+            dlg.SearchEvent += (content) =>
+            {
+                if (string.IsNullOrEmpty(content))
+                {
+                    return;
+                }
+                ShowSearchCtrl(content);
+            };
+            dlg.SetBindingData();
+            dlg.ShowDialog();
+        }
+
+        //鏌ヨ
+        private void barBtnSearch_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            ShowSearchDlg();
+        }
+
+        #endregion 鏋勪欢鏌ヨ
+
+        #region 妯″瀷鏍囨敞
+
+        //鏍囨敞杈呭姪绫�
+        private SimulationMarkHelper _markHelper = null;
+
+        //鑾峰彇鏍囨敞杈呭姪绫�
+        private async Task<SimulationMarkHelper> GetMarkHelper()
+        {
+            if (_markHelper == null)
+            {
+                var visualListHelper = GetVisualListHelper();
+                var calcuResultHelper = GetCalcuResultHelper();
+                var bimfaceCtrl = await GetBimfaceCtrl();
+                _markHelper = new SimulationMarkHelper(visualListHelper, calcuResultHelper, bimfaceCtrl);
+            }
+            return _markHelper;
+        }
+
+        //鏄剧ず鏍囨敞鍒楄〃
+        private async void ShowMarkList()
         {
             if (_hydroInfo == null)
             {
                 return;
             }
-            if (_hydroInfo.Pumps == null || _hydroInfo.Pumps.Count < 1)
-            {
-                return;
-            }
-            var allCalcuResultList = GetAllCalcuResultList();
-            var vmList = new List<XhsSinglePumpViewModel>();
-            foreach (var pump in _hydroInfo.Pumps)
-            {
-                if (!pump.RatedN.HasValue)
-                {
-                    continue;
-                }
-                var qh = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQH)?.CurveData;
-                var qe = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQE)?.CurveData;
-                var qp = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQP)?.CurveData;
-                if (qh == null)
-                {
-                    continue;
-                }
-
-                var qhPtList = qh.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList();
-                var qePtList = qe?.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList();
-                var qpPtList = qp?.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList();
-
-                var vm = new XhsSinglePumpViewModel();
-                vmList.Add(vm);
-                vm.ID = pump.ID;
-                vm.Name = pump.Name;
-                vm.Code = pump.Code;
-                vm.IsBp = true;
-                vm.RunStatus = pump.LinkStatus == Yw.Hydro.LinkStatus.Open;
-                vm.RatedHz = pump.RatedHz;
-                vm.CurrentHz = Math.Round(pump.RatedHz * pump.SpeedRatio, 1);
-                vm.RatedSpeed = pump.RatedN.Value;
-                vm.CurrentSpeed = Math.Round(pump.RatedN.Value * pump.SpeedRatio);
-                vm.CurveQH = qhPtList;
-                vm.CurveQE = qePtList;
-                vm.CurveQP = qpPtList;
-
-                if (allCalcuResultList != null && allCalcuResultList.Count > 0)
-                {
-                    var calcuResult = allCalcuResultList.Find(x => x.Code == pump.Code) as HydroCalcuLinkResult;
-                    if (calcuResult != null)
-                    {
-                        if (calcuResult.CalcuFlow.HasValue)
-                        {
-                            vm.CalcuQ = Math.Abs(calcuResult.CalcuFlow.Value);
-                        }
-
-                        var calcuResultStart = allCalcuResultList.Find(x => x.Code == pump.StartCode) as HydroCalcuNodeResult;
-                        var calcuResultEnd = allCalcuResultList.Find(x => x.Code == pump.EndCode) as HydroCalcuNodeResult;
-                        if (calcuResultStart != null && calcuResultEnd != null)
-                        {
-                            if (calcuResultStart.CalcuHead.HasValue && calcuResultEnd.CalcuHead.HasValue)
-                            {
-                                vm.CalcuH = Math.Round(Math.Abs(calcuResultStart.CalcuHead.Value - calcuResultEnd.CalcuHead.Value), 4);
-                            }
-                        }
-                    }
-                }
-
-            }
-
-            var dlg = new PumpParallelAnalyDlg();
-            dlg.SetBindingData(vmList);
+            var markHelper = await GetMarkHelper();
+            var dlg = new SetHydroMarkDlg();
+            dlg.SetBindingData(markHelper.Sets);
             dlg.ReloadDataEvent += (list) =>
             {
-                list?.ForEach(x =>
-                {
-                    var pump = _hydroInfo.Pumps?.Find(t => t.Code == x.Code);
-                    if (pump != null)
-                    {
-                        pump.LinkStatus = x.RunStatus ? Yw.Hydro.PumpStatus.Open : Yw.Hydro.PumpStatus.Closed;
-                        pump.SpeedRatio = Math.Round(x.CurrentHz / pump.RatedHz, 1);
-                    }
-                });
-                ShowProperty();
-                return true;
+                markHelper.Sets = list;
+                markHelper.Set();
             };
             dlg.ShowDialog();
         }
 
-        #endregion
+        //璁剧疆鏍囨敞
+        private void barBtnSetMark_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            ShowMarkList();
+        }
 
-        #region 姘村姏璁$畻
+        //鏄惁鏄剧ず
+        private async void barCkMark_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            var markHelper = await GetMarkHelper();
+            markHelper.Visible = this.barCkMark.Checked;
+            markHelper.Set();
+        }
 
+        #endregion 妯″瀷鏍囨敞
 
-        #region 鍓嶆彁鏉′欢
+        #region 棰滆壊鍒嗙骇
 
-        //鏄剧ず璁$畻鍓嶆彁鏉′欢绐椾綋
-        private async void ShowCalcuPrefixDlg()
+        //棰滆壊鍒嗙骇杈呭姪绫�
+        private SimulationGradingHelper _gradingHelper = null;
+
+        //鑾峰彇棰滆壊鍒嗙骇杈呭姪绫�
+        private async Task<SimulationGradingHelper> GetGradingHelper()
+        {
+            if (_gradingHelper == null)
+            {
+                var visualListHelper = GetVisualListHelper();
+                var calcuResultHelper = GetCalcuResultHelper();
+                var bimfaceCtrl = await GetBimfaceCtrl();
+                _gradingHelper = new SimulationGradingHelper(visualListHelper, calcuResultHelper, bimfaceCtrl);
+            }
+            return _gradingHelper;
+        }
+
+        //璁剧疆棰滆壊鍒嗙骇鍒楄〃
+        private async void SetGradingList()
         {
             if (_hydroInfo == null)
             {
                 return;
             }
-            var dlg = new SetHydroCalcuPrefixDlg();
-            dlg.SetBindingData(_hydroInfo);
-            dlg.HydroViewEvent += async (parter) =>
+            var gradingHelper = await GetGradingHelper();
+            var allGradingList = await gradingHelper.GetGradingList();
+            var dlg = new SetHydroGradingTreeDlg();
+            dlg.SetBindingData(_hydroInfo, allGradingList);
+            dlg.ReloadDataEvent += (list) =>
             {
-                _parter = parter;
-                if (_parter != null)
-                {
-                    await _bimfaceCtrl?.ZoomAndSelectComponents(new List<string>() { _parter.Code });
-                }
-                ShowProperty();
+                gradingHelper.SetGradingList(list);
+                gradingHelper.Set();
             };
-            dlg.HydroCalcuEvent += async () =>
+            dlg.ApplyDataEvent += (catalog, propName) =>
             {
-                if (_hydroInfo == null)
-                {
-                    return;
-                }
-
-                //鏍¢獙
-                _checkResult = _hydroInfo.Check();
-                if (!_checkResult.Succeed)
-                {
-                    ShowCheckCtrl();
-                    TipFormHelper.ShowWarn("鏍¢獙澶辫触锛岃妫�鏌ュ悗閲嶈瘯");
-                    return;
-                }
-
-                var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo);
-                _calcuResult = netWork.Calcu();
-                if (_calcuResult.Succeed)
-                {
-                    GetAllCalcuResultList(false);
-                    await _bimfaceCtrl?.SetLogicCalcuCustomLabels(_calcuResult);
-                    TipFormHelper.ShowSucceed("璁$畻鎴愬姛锛�");
-                }
-                else
-                {
-                    ShowCalcuFailedCtrl();
-                    TipFormHelper.ShowError("璁$畻澶辫触锛�");
-                }
-
+                gradingHelper.UpdateApply(catalog, propName);
+                gradingHelper.Set();
             };
             dlg.ShowDialog();
         }
 
+        //閰嶇疆棰滆壊鍒嗙骇
+        private void barBtnSetGradingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            SetGradingList();
+        }
+
+        //搴旂敤棰滆壊鍒嗙骇鍒楄〃
+        private async void ApplyGradingList()
+        {
+            if (_hydroInfo == null)
+            {
+                return;
+            }
+            var gradingHelper = await GetGradingHelper();
+            var dlg = new ApplyHydroGradingDlg();
+            dlg.SetBindingData(gradingHelper.Applies);
+            dlg.ReloadDataEvent += (list) =>
+            {
+                gradingHelper.Applies = list;
+                gradingHelper.Set();
+            };
+            dlg.ShowDialog();
+        }
+
+        //搴旂敤棰滆壊鍒嗙骇
+        private void barBtnApplyGradingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            ApplyGradingList();
+        }
+
+        //棰滆壊鍒嗙骇灞曠ず
+        private async void barCkGrading_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            var gradingHelper = await GetGradingHelper();
+            gradingHelper.Visible = this.barCkGrading.Checked;
+            gradingHelper.Set();
+        }
+
+        #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)
+            {
+                var hydroInfo = await this.RefreshModelEvent.Invoke();
+                if (hydroInfo == null)
+                {
+                    TipFormHelper.ShowError("鍒锋柊澶辫触锛�");
+                    return;
+                }
+                _hydroInfo = hydroInfo;
+                SelectVisual(visual: null, eSimulationVisualSource.None);
+
+                ResetVisualList();
+                TipFormHelper.ShowSucceed("鍒锋柊鎴愬姛锛�");
+            }
+        }
+
+        #endregion 浜哄伐鍒锋柊
+
+        #region 姘存祦鍔ㄧ敾
+
+        //姘存祦鍔ㄧ敾杈呭姪绫�
+        private SimulationFlowEffectHelper _flowEffectHelper = null;
+
+        //鑾峰彇姘存祦鍔ㄧ敾杈呭姪绫�
+        private async Task<SimulationFlowEffectHelper> GetFlowEffectHelper()
+        {
+            if (_hydroInfo == null)
+            {
+                return default;
+            }
+            if (_flowEffectHelper == null)
+            {
+                var visualListHelper = GetVisualListHelper();
+                var bimfaceCtrl = await GetBimfaceCtrl();
+                _flowEffectHelper = new SimulationFlowEffectHelper(visualListHelper, bimfaceCtrl);
+                var calcuResult = GetCalcuResult();
+                _flowEffectHelper.InitialData(calcuResult);
+            }
+            return _flowEffectHelper;
+        }
+
+        //姘存祦鍔ㄧ敾鏄惁鍙
+        private async void barCkFlowEffect_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            var flowEffectHelper = await GetFlowEffectHelper();
+            flowEffectHelper.Visible = this.barCkFlowEffect.Checked;
+            flowEffectHelper.Set();
+        }
+
+        #endregion 姘存祦鍔ㄧ敾
+
+        #region 鐩戞祴鍒楄〃
+
+        #region 鐩戞祴鐐�
+
+        //鐩戞祴鐐硅緟鍔╃被
+        private SimulationMonitorHelper _monitorHelper = null;
+
+        //鑾峰彇鐩戞祴鐐硅緟鍔╃被
+        private SimulationMonitorHelper GetMonitorHelper()
+        {
+            if (_hydroInfo == null)
+            {
+                return default;
+            }
+            if (_monitorHelper == null)
+            {
+                var visualListHelper = GetVisualListHelper();
+                _monitorHelper = new SimulationMonitorHelper(visualListHelper);
+            }
+            return _monitorHelper;
+        }
+
+        //鑾峰彇鐩戞祴鐐瑰垪琛�
+        private async Task<List<HydroMonitorVmo>> GetMonitorList()
+        {
+            var helper = GetMonitorHelper();
+            return await helper.Get();
+        }
+
+        //璁剧疆鐩戞祴鐐瑰垪琛�
+        private async void SetMonitorList(HydroVisualInfo visual)
+        {
+            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();
+        }
+
+        //璁剧疆鐩戞祴鐐�
+        private void barBtnSetMonitor_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            SetMonitorList(_visual);
+        }
+
+        #endregion 鐩戞祴鐐�
+
+        #region 鐩戞祴鍊�
+
+        //鐩戞祴鍊艰緟鍔╃被
+        private SimulationMonitorValueHelper _monitorValueHelper = null;
+
+        //鑾峰彇鐩戞祴鍊艰緟鍔╃被
+        private SimulationMonitorValueHelper GetMonitorValueHelper()
+        {
+            if (_monitorValueHelper == null)
+            {
+                var visualListHelper = GetVisualListHelper();
+                var monitorHelper = GetMonitorHelper();
+                _monitorValueHelper = new SimulationMonitorValueHelper(visualListHelper, monitorHelper);
+            }
+            return _monitorValueHelper;
+        }
+
+        //鑾峰彇鐩戞祴鍊煎垪琛�
+        private async Task<List<HydroMonitorValueViewModel>> GetMonitorValueList()
+        {
+            var helper = GetMonitorValueHelper();
+            return await helper.Get();
+        }
+
+        //閲嶇疆
+        private void ResetMonitorValue()
+        {
+            var allWorkingList = GetWorkingList();
+            var working = allWorkingList?.LastOrDefault(x => !string.IsNullOrEmpty(x.MonitorInfo));
+            if (working != null)
+            {
+                var helper = GetMonitorValueHelper();
+                helper.Reset(working.MonitorInfo);
+            }
+        }
+
         #endregion
+
+        #region 鐩戞祴鍊兼帶浠�
+
+        //鐩戞祴鍊煎垪琛ㄦ帶浠�
+        private HydroMonitorValueListCtrl _monitorValueListCtrl = null;
+
+        //鑾峰彇鐩戞祴鍊煎垪琛ㄦ帶浠�
+        private HydroMonitorValueListCtrl GetMonitorValueListCtrl()
+        {
+            if (_monitorValueListCtrl == null)
+            {
+                _monitorValueListCtrl = new HydroMonitorValueListCtrl();
+                _monitorValueListCtrl.Dock = DockStyle.Fill;
+                _monitorValueListCtrl.HydroViewEvent += (code) =>
+                {
+                    var visual = GetVisual(code);
+                    SelectVisual(visual, eSimulationVisualSource.Monitor);
+                };
+            }
+            return _monitorValueListCtrl;
+        }
+
+        //鐩戞祴鍊煎垪琛ㄦ帶浠舵槸鍚﹀彲瑙�
+        private bool IsMonitorValueListCtrlVisible
+        {
+            get
+            {
+                if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible)
+                {
+                    if (this.controlContainerBottom.Controls.Count > 0)
+                    {
+                        if (this.controlContainerBottom.Controls[0] is HydroMonitorValueListCtrl)
+                        {
+                            return true;
+                        }
+                    }
+                }
+                return false;
+            }
+        }
+
+        //鏄剧ず鐩戞祴鍊煎垪琛ㄦ帶浠�
+        private async void ShowMonitorValueListCtrl()
+        {
+            var monitorValueListCtrl = GetMonitorValueListCtrl();
+            if (!IsMonitorValueListCtrlVisible)
+            {
+                this.controlContainerBottom.Controls.Clear();
+                this.controlContainerBottom.Controls.Add(monitorValueListCtrl);
+                this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
+                this.docPnlBottom.Text = "鐩戞祴鍊�";
+                this.docPnlBottom.Height = 350;
+            }
+            var allMonitorValueList = await GetMonitorValueList();
+            monitorValueListCtrl.SetBindingData(allMonitorValueList, _visual);
+        }
+
+        //璁剧疆鐩戞祴鍊�
+        private void barBtnSetMonitorValue_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            ShowMonitorValueListCtrl();
+        }
+
+        #endregion
+
+        #region 鐩戞祴鐐规爣璁�
+
+        //鐩戞祴鏍囪杈呭姪绫�
+        private SimulationMonitorMarkerHelper _monitorMarkerHelper = null;
+
+        //鑾峰彇鐩戞祴鏍囪杈呭姪绫�
+        private async Task<SimulationMonitorMarkerHelper> GetMonitorMarkerHelper()
+        {
+            if (_monitorMarkerHelper == null)
+            {
+                var monitorHelper = GetMonitorHelper();
+                var bimfaceCtrl = await GetBimfaceCtrl();
+                _monitorMarkerHelper = new SimulationMonitorMarkerHelper(monitorHelper, bimfaceCtrl);
+            }
+            return _monitorMarkerHelper;
+        }
+
+        //鏄剧ず鐘舵�佹敼鍙�
+        private async void barCkMonitor_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            var monitorMarkerHelper = await GetMonitorMarkerHelper();
+            monitorMarkerHelper.Visible = this.barCkMonitor.Checked;
+            monitorMarkerHelper.Set();
+        }
+
+        #endregion
+
+        #endregion 鐩戞祴鍒楄〃
+
+        #region 妯″瀷妫�鏌�
+
+        //妫�鏌ユ帶浠�
+        private HydroCheckResultCtrl _checkCtrl = null;
+
+        //鑾峰彇妫�鏌ユ帶浠�
+        private HydroCheckResultCtrl GetCheckCtrl()
+        {
+            if (_hydroInfo == null)
+            {
+                return default;
+            }
+            if (_checkCtrl == null)
+            {
+                _checkCtrl = new HydroCheckResultCtrl();
+                _checkCtrl.Dock = DockStyle.Fill;
+                _checkCtrl.HydroClickEvent += (code) =>
+                {
+                    var visualListHelper = GetVisualListHelper();
+                    var visual = visualListHelper.GetVisual(code);
+                    SelectVisual(visual, eSimulationVisualSource.Check);
+                };
+            }
+            return _checkCtrl;
+        }
+
+        //妫�鏌ユ帶浠舵槸鍚﹀彲瑙�
+        private bool IsCheckCtrlVisible
+        {
+            get
+            {
+                if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible)
+                {
+                    if (this.controlContainerBottom.Controls.Count > 0)
+                    {
+                        if (this.controlContainerBottom.Controls[0] is HydroCheckResultCtrl)
+                        {
+                            return true;
+                        }
+                    }
+                }
+                return false;
+            }
+        }
+
+        //鏄剧ず妫�鏌ユ帶浠�
+        private void ShowCheckCtrl(HydroCheckResult checkResult)
+        {
+            if (checkResult == null)
+            {
+                return;
+            }
+            var checkCtrl = GetCheckCtrl();
+            if (!IsCheckCtrlVisible)
+            {
+                this.controlContainerBottom.Controls.Clear();
+                this.controlContainerBottom.Controls.Add(checkCtrl);
+                this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
+                this.docPnlBottom.Text = "妫�鏌ョ粨鏋�";
+                this.docPnlBottom.Height = 350;
+            }
+            checkCtrl.SetBindingData(checkResult);
+        }
+
+        //鏄剧ず妫�鏌ユ帶浠�
+        private void ShowCheckCtrl()
+        {
+            var checkResult = GetCheckResult();
+            ShowCheckCtrl(checkResult);
+        }
+
+        //妫�鏌�
+        private void barBtnCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            if (_hydroInfo == null)
+            {
+                return;
+            }
+            var checkResult = _hydroInfo.Check();
+            ShowCheckCtrl(checkResult);
+        }
+
+        #endregion 妯″瀷妫�鏌�
+
+        #region 妯″瀷璁$畻
+
+        #region 璁$畻缁撴灉
+
+        //璁$畻缁撴灉杈呭姪绫�
+        private SimulationCalcuResultHelper _calcuResultHelper = null;
+
+        //鑾峰彇璁$畻缁撴灉杈呭姪绫�
+        private SimulationCalcuResultHelper GetCalcuResultHelper()
+        {
+            if (_calcuResultHelper == null)
+            {
+                var workingHelper = GetWorkingHelper();
+                _calcuResultHelper = new SimulationCalcuResultHelper(workingHelper);
+            }
+            return _calcuResultHelper;
+        }
+
+        #endregion 璁$畻缁撴灉
 
         #region 璁$畻澶辫触
 
@@ -1103,469 +1890,917 @@
             return _calcuFailedCtrl;
         }
 
+        //璁$畻澶辫触鎺т欢鏄惁鍙
+        private bool IsCalcuFailedCtrlVisible
+        {
+            get
+            {
+                if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible)
+                {
+                    if (this.controlContainerBottom.Controls.Count > 0)
+                    {
+                        if (this.controlContainerBottom.Controls[0] is HydroCalcuFailedCtrl)
+                        {
+                            return true;
+                        }
+                    }
+                }
+                return false;
+            }
+        }
+
         //鏄剧ず璁$畻澶辫触鎺т欢
-        private void ShowCalcuFailedCtrl()
+        private void ShowCalcuFailedCtrl(HydroCalcuResult calcuResult)
         {
             if (_hydroInfo == null)
             {
                 return;
             }
-            if (_calcuResult == null)
+            if (calcuResult == null)
             {
                 return;
             }
-            if (_calcuResult.Succeed)
+            if (calcuResult.Succeed)
             {
                 return;
             }
             var calcuFailedCtrl = GetCalcuFailedCtrl();
-            calcuFailedCtrl.SetBindingData(_calcuResult.FailedList);
-            this.controlContainerBottom.Controls.Clear();
-            this.controlContainerBottom.Controls.Add(calcuFailedCtrl);
-            this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
-            this.docPnlBottom.Text = "璁$畻澶辫触鍘熷洜";
-            this.docPnlBottom.Height = 350;
+            if (!IsCalcuFailedCtrlVisible)
+            {
+                this.controlContainerBottom.Controls.Clear();
+                this.controlContainerBottom.Controls.Add(calcuFailedCtrl);
+                this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
+                this.docPnlBottom.Text = "璁$畻澶辫触鍘熷洜";
+                this.docPnlBottom.Height = 350;
+            }
+            calcuFailedCtrl.SetBindingData(calcuResult.FailedList);
         }
 
-        #endregion
+        #endregion 璁$畻澶辫触
 
-        #region 璁$畻缁撴灉
+        #region 璁$畻璀﹀憡
 
-        //鎵�鏈夎绠楃粨鏋滃垪琛�
-        private List<HydroCalcuResult> _allCalcuResultList = null;
+        //璁$畻璀﹀憡鎺т欢
+        private HydroCalcuWarningCtrl _calcuWarningCtrl = null;
 
-        //鑾峰彇璁$畻缁撴灉
-        //true 浣跨敤缂撳瓨锛宖alse 涓嶄娇鐢ㄧ紦瀛�
-        private List<HydroCalcuResult> GetAllCalcuResultList(bool isCache = true)
+        //鑾峰彇璁$畻璀﹀憡鎺т欢
+        private HydroCalcuWarningCtrl GetCalcuWarningCtrl()
         {
-            if (_hydroInfo == null)
+            if (_calcuWarningCtrl == null)
             {
-                return default;
-            }
-            if (_calcuResult == null)
-            {
-                return default;
-            }
-            if (!_calcuResult.Succeed)
-            {
-                return default;
-            }
-            if (isCache)
-            {
-                return _allCalcuResultList;
-            }
-
-            _allCalcuResultList = new List<HydroCalcuResult>();
-
-            //鑺傜偣
-            var allNodeList = _hydroInfo.GetAllNodes();
-            if (allNodeList != null && allNodeList.Count > 0)
-            {
-                foreach (var node in allNodeList)
+                _calcuWarningCtrl = new HydroCalcuWarningCtrl();
+                _calcuWarningCtrl.Dock = DockStyle.Fill;
+                _calcuWarningCtrl.HydroClickEvent += (code) =>
                 {
-                    var calcuNode = _calcuResult.NodeList?.Find(x => x.Id == node.Code);
-                    if (calcuNode != null)
-                    {
-                        var calcuResult = new HydroCalcuNodeResult()
-                        {
-                            Code = node.Code,
-                            CalcuPress = calcuNode.Press,
-                            CalcuHead = calcuNode.Head,
-                            CalcuDemand = calcuNode.Demand
-                        };
-                        _allCalcuResultList.Add(calcuResult);
-                    }
-                }
-            }
-
-            //绠℃
-            var allLinkList = _hydroInfo.GetAllLinks();
-            if (allLinkList != null && allLinkList.Count > 0)
-            {
-                foreach (var link in allLinkList)
-                {
-                    var calcuLink = _calcuResult.LinkList?.Find(x => x.Id == link.Code);
-                    if (calcuLink != null)
-                    {
-                        var calcuResult = new HydroCalcuLinkResult()
-                        {
-                            Code = link.Code,
-                            CalcuFlow = calcuLink.Flow,
-                            CalcuVelocity = calcuLink.Velocity,
-                            CalcuHeadLoss = calcuLink.Headloss
-                        };
-                        _allCalcuResultList.Add(calcuResult);
-                    }
-                }
-            }
-
-            //娴侀噺璁�
-            var allFlowmeterList = _hydroInfo.Flowmeters;
-            if (allFlowmeterList != null && allFlowmeterList.Count > 0)
-            {
-                foreach (var flowmeter in allFlowmeterList)
-                {
-                    var calcuFlowmeterResult = _allCalcuResultList.Find(x => x.Code == flowmeter.Code) as HydroCalcuNodeResult;
-                    if (calcuFlowmeterResult != null)
-                    {
-                        var calcuFlowmeterNewResult = new HydroCalcuFlowmeterResult(calcuFlowmeterResult);
-                        var calcuFlowmeterLinkResultList = new List<HydroCalcuLinkResult>();
-                        var flowmeterLinkList = allLinkList?.Where(x => x.StartCode == flowmeter.Code || x.EndCode == flowmeter.Code).ToList();
-                        if (flowmeterLinkList != null && flowmeterLinkList.Count > 0)
-                        {
-                            foreach (var flowmeterLink in flowmeterLinkList)
-                            {
-                                var calcuFlowmeterLinkResult = _allCalcuResultList.Find(x => x.Code == flowmeterLink.Code) as HydroCalcuLinkResult;
-                                if (calcuFlowmeterLinkResult != null)
-                                {
-                                    calcuFlowmeterLinkResultList.Add(calcuFlowmeterLinkResult);
-                                }
-                            }
-                        }
-                        if (calcuFlowmeterLinkResultList.Exists(x => x.CalcuFlow.HasValue))
-                        {
-                            calcuFlowmeterNewResult.CalcuQ = calcuFlowmeterLinkResultList.Where(x => x.CalcuFlow.HasValue).Average(x => x.CalcuFlow.Value);
-                        }
-                        _allCalcuResultList.Remove(calcuFlowmeterResult);
-                        _allCalcuResultList.Add(calcuFlowmeterNewResult);
-                    }
-                }
-            }
-
-            //鍘嬪姏琛�
-            var allPressmeterList = _hydroInfo.Pressmeters;
-            if (allPressmeterList != null && allPressmeterList.Count > 0)
-            {
-                foreach (var pressmeter in allPressmeterList)
-                {
-                    var calcuPressmeterResult = _allCalcuResultList.Find(x => x.Code == pressmeter.Code) as HydroCalcuNodeResult;
-                    if (calcuPressmeterResult != null)
-                    {
-                        var calcuPressmeterNewResult = new HydroCalcuPressmeterResult(calcuPressmeterResult);
-                        calcuPressmeterNewResult.CalcuPr = calcuPressmeterResult.CalcuPress;
-                        _allCalcuResultList.Remove(calcuPressmeterResult);
-                        _allCalcuResultList.Add(calcuPressmeterNewResult);
-                    }
-                }
-            }
-
-            //姘存车
-            var allPumpList = _hydroInfo.Pumps;
-            if (allPumpList != null && allPumpList.Count > 0)
-            {
-                foreach (var pump in allPumpList)
-                {
-                    var calcuPumpResult = _allCalcuResultList.Find(x => x.Code == pump.Code) as HydroCalcuLinkResult;
-                    if (calcuPumpResult != null)
-                    {
-                        var calcuPumpNewResult = new HydroCalcuPumpResult(calcuPumpResult);
-                        calcuPumpNewResult.CalcuQ = calcuPumpResult.CalcuFlow;
-                        if (calcuPumpNewResult.CalcuQ.HasValue)
-                        {
-                            var calcuNodeStartResult = _allCalcuResultList.Find(x => x.Code == pump.StartCode) as HydroCalcuNodeResult;
-                            var calcuNodeEndResult = _allCalcuResultList.Find(x => x.Code == pump.EndCode) as HydroCalcuNodeResult;
-                            if (calcuNodeStartResult != null && calcuNodeEndResult != null)
-                            {
-                                if (calcuNodeStartResult.CalcuPress.HasValue && calcuNodeEndResult.CalcuPress.HasValue)
-                                {
-                                    calcuPumpNewResult.CalcuH = Math.Abs(calcuNodeStartResult.CalcuPress.Value - calcuNodeEndResult.CalcuPress.Value);
-                                }
-                                if (pump.LinkStatus == Yw.Hydro.PumpStatus.Open && pump.RatedN.HasValue)
-                                {
-                                    var curveqp = _hydroInfo.Curves?.Find(x => x.Code == pump.CurveQP);
-                                    if (curveqp != null)
-                                    {
-                                        if (curveqp.CurveData != null && curveqp.CurveData.Count > 3)
-                                        {
-                                            var point2dList = curveqp.CurveData.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList();
-                                            var point2dSimularList = point2dList.GetQPPointListByN(pump.RatedN.Value, pump.RatedN.Value * pump.SpeedRatio);
-                                            var pumpCurveQp = new Yw.Pump.CurveQP(eFeatType.Cubic, point2dSimularList);
-                                            calcuPumpNewResult.CalcuP = pumpCurveQp.FeatCurve.GetPointY(calcuPumpNewResult.CalcuQ.Value);
-                                        }
-                                    }
-                                }
-                                if (calcuPumpNewResult.CalcuH.HasValue && calcuPumpNewResult.CalcuP.HasValue)
-                                {
-                                    calcuPumpNewResult.CalcuE = Yw.Pump.CalculationHelper.CalcuE(calcuPumpNewResult.CalcuQ.Value, calcuPumpNewResult.CalcuH.Value, calcuPumpNewResult.CalcuP.Value);
-                                }
-                            }
-                        }
-                        _allCalcuResultList.Remove(calcuPumpResult);
-                        _allCalcuResultList.Add(calcuPumpNewResult);
-                    }
-                }
-            }
-
-            return _allCalcuResultList;
-        }
-
-        #endregion
-
-        //姘村姏璁$畻
-        private void barBtnHydroCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
-        {
-            ShowCalcuPrefixDlg();
-        }
-
-        #endregion
-
-        #region 鏋勪欢鏌ヨ
-
-        //鏌ヨ缁勪欢
-        private XhsProjectSimulationSearchCtrl _searchCtrl = null;
-
-        //鑾峰彇鏌ヨ缁勪欢
-        private XhsProjectSimulationSearchCtrl GetSearchCtrl()
-        {
-            if (_searchCtrl == null)
-            {
-                _searchCtrl = new XhsProjectSimulationSearchCtrl();
-                _searchCtrl.Dock = DockStyle.Fill;
-                _searchCtrl.InitialData(() => _hydroInfo);
-                _searchCtrl.ApplySearchEvent += async (list) =>
-                {
-                    if (_hydroInfo == null)
-                    {
-                        return;
-                    }
-                    var elementIds = new List<string>();
-                    if (list != null && list.Count > 0)
-                    {
-                        var first = list.First();
-                        var allParterList = _hydroInfo.GetAllParters();
-                        _parter = allParterList?.Find(x => x.Code == first.Code);
-                        list.ForEach(x => elementIds.Add(x.Code));
-                    }
-                    else
-                    {
-                        _parter = null;
-                    }
-                    await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds);
-                    ShowProperty();
+                    var visualListHelper = GetVisualListHelper();
+                    var visual = visualListHelper.GetVisual(code);
+                    SelectVisual(visual, eSimulationVisualSource.Warning);
                 };
             }
-            return _searchCtrl;
+            return _calcuWarningCtrl;
         }
 
-        //鏄剧ず鏌ヨ鎺т欢
-        private void ShowSearchCtrl()
+        //璁$畻璀﹀憡鎺т欢鏄惁鍙
+        private bool IsCalcuWarningCtrlVisible
+        {
+            get
+            {
+                if (this.docPnlBottom.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible)
+                {
+                    if (this.controlContainerBottom.Controls.Count > 0)
+                    {
+                        if (this.controlContainerBottom.Controls[0] is HydroCalcuWarningCtrl)
+                        {
+                            return true;
+                        }
+                    }
+                }
+                return false;
+            }
+        }
+
+        //鏄剧ず璁$畻璀﹀憡鎺т欢
+        private void ShowCalcuWarningCtrl(HydroCalcuResult calcuResult)
         {
             if (_hydroInfo == null)
             {
                 return;
             }
-            var searchCtrl = GetSearchCtrl();
-            this.controlContainerBottom.Controls.Clear();
-            this.controlContainerBottom.Controls.Add(searchCtrl);
-            this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
-            this.docPnlBottom.Text = "鏋勪欢鏌ヨ";
-            this.docPnlBottom.Height = 350;
+            if (calcuResult == null)
+            {
+                return;
+            }
+            if (!calcuResult.Succeed)
+            {
+                return;
+            }
+            var calcuWaringCtrl = GetCalcuWarningCtrl();
+            if (!IsCalcuWarningCtrlVisible)
+            {
+                this.controlContainerBottom.Controls.Clear();
+                this.controlContainerBottom.Controls.Add(calcuWaringCtrl);
+                this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
+                this.docPnlBottom.Text = "璁$畻璀﹀憡";
+                this.docPnlBottom.Height = 350;
+            }
+            var visualListHelper = GetVisualListHelper();
+            var allVisualDict = visualListHelper.GetVisualDict();
+            calcuWaringCtrl.SetBindingData(calcuResult.WainingList, allVisualDict);
         }
 
-        //鏌ヨ
-        private void barBtnSearch_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        #endregion 璁$畻璀﹀憡
+
+        #region 璁$畻鏍囩
+
+        //璁$畻鏍囩杈呭姪绫�
+        private SimulationCalcuResultLabelHelper _calcuResultLabelHelper = null;
+
+        //鑾峰彇璁$畻鏍囩杈呭姪绫�
+        private async Task<SimulationCalcuResultLabelHelper> GetCalcuResultLabelHelper()
         {
-            ShowSearchCtrl();
+            if (_calcuResultLabelHelper == null)
+            {
+                var calcuResultHelper = GetCalcuResultHelper();
+                var bimfaceCtrl = await GetBimfaceCtrl();
+                _calcuResultLabelHelper = new SimulationCalcuResultLabelHelper(calcuResultHelper, bimfaceCtrl);
+            }
+            return _calcuResultLabelHelper;
         }
+
+        //璁剧疆璁$畻鏍囩鏄惁鏄剧ず
+        private async void barCkCalcu_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            var calcuResultLabelHelper = await GetCalcuResultLabelHelper();
+            calcuResultLabelHelper.Visible = this.barCkCalcu.Checked;
+            calcuResultLabelHelper.Set();
+        }
+
+        #endregion 璁$畻鏍囩
 
         #endregion
 
-        #region 妯″瀷鏍囨敞
+        #region 瀵煎嚭INP
 
-        //鎵�鏈夋爣娉ㄥ垪琛�
-        private List<HydroMarkSetViewModel> _allMarkList = null;
-
-        //鏄剧ず鏍囨敞绐椾綋
-        private async void ShowMarkDlg()
+        //瀵煎嚭INP鏂囦欢
+        private void barBtnExportInp_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
             if (_hydroInfo == null)
             {
                 return;
             }
-            if (_allMarkList == null)
+            var fileName = FileDialogHelper.SaveInp("瀵煎嚭Inp鏂囦欢");
+            if (string.IsNullOrEmpty(fileName))
             {
-                _allMarkList = new List<HydroMarkSetViewModel>();
-                if (_hydroInfo.Waterboxs != null && _hydroInfo.Waterboxs.Count > 0)
-                {
-                    _allMarkList.Add(new HydroMarkSetViewModel()
-                    {
-                        Code = Yw.Hydro.ParterCatalog.Waterbox,
-                        Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Waterbox),
-                        MarkType = (int)eWaterboxMarkType.None
-                    });
-                }
-                if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0)
-                {
-                    _allMarkList.Add(new HydroMarkSetViewModel()
-                    {
-                        Code = Yw.Hydro.ParterCatalog.Pump,
-                        Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pump),
-                        MarkType = (int)eWaterboxMarkType.None
-                    });
-                }
-                if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0)
-                {
-                    _allMarkList.Add(new HydroMarkSetViewModel()
-                    {
-                        Code = Yw.Hydro.ParterCatalog.Valve,
-                        Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Valve),
-                        MarkType = (int)eWaterboxMarkType.None
-                    });
-                }
-                if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0)
-                {
-                    _allMarkList.Add(new HydroMarkSetViewModel()
-                    {
-                        Code = Yw.Hydro.ParterCatalog.Pipe,
-                        Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pipe),
-                        MarkType = (int)eWaterboxMarkType.None
-                    });
-                }
-                if (_hydroInfo.Nozzles != null && _hydroInfo.Nozzles.Count > 0)
-                {
-                    _allMarkList.Add(new HydroMarkSetViewModel()
-                    {
-                        Code = Yw.Hydro.ParterCatalog.Nozzle,
-                        Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Nozzle),
-                        MarkType = (int)eWaterboxMarkType.None
-                    });
-                }
+                return;
             }
-            var dlg = new SetHydroMarkDlg();
-            dlg.SetBindingData(_hydroInfo, _allMarkList);
-            dlg.ReloadDataEvent += async (allResultList) =>
+            var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo);
+            var result = netWork.ToInpString();
+            File.WriteAllText(fileName, result);
+            TipFormHelper.ShowSucceed("瀵煎嚭鎴愬姛");
+        }
+
+        #endregion 瀵煎嚭INP
+
+        #region 姘存车鍒楄〃
+
+        //鎬ц兘鏇茬嚎
+        private void PumpFeat()
+        {
+            if (_hydroInfo == null)
             {
-                var leadLabels = allResultList?.Select(x => new LogicMarkLeadLabel(x.Code, x.Text, 100000)).ToList();
-                await _bimfaceCtrl?.SetLogicMarkLeadLabels(leadLabels);
+                return;
+            }
+            var pumps = _hydroInfo.Pumps;
+            if (pumps == null || pumps.Count < 1)
+            {
+                XtraMessageBox.Show("鏃犳按娉典俊鎭�");
+                return;
+            }
+            var dlg = new SimulationPumpFeatDlg();
+            dlg.SaveEvent += async (list) =>
+            {
+                pumps.ForEach(x => x.UpdateWorkingInfo(list));
+                var visualVmListHelper = GetVisualVmListHelper();
+                visualVmListHelper.UpdateProperty(pumps.Select(x => x as Yw.Model.HydroVisualInfo).ToList());
+                SelectVisual(_visual, eSimulationVisualSource.None);
+                var gradingHelper = await GetGradingHelper();
+                gradingHelper.Set();
             };
-            if (dlg.ShowDialog() != DialogResult.OK)
-            {
-                await _bimfaceCtrl?.ClearLogicMarkLeadLabels();
-            }
-        }
-
-        //璁剧疆鏍囨敞
-        private void barBtnSetMark_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
-        {
-            ShowMarkDlg();
-        }
-
-        #endregion
-
-        #region 棰滆壊鍒嗙骇
-
-        //棰滆壊鍒嗙骇搴旂敤鍒楄〃
-        private List<HydroGradingApplyViewModel> _allGradingApplyList = null;
-        //棰滆壊鍒嗙骇缂栫爜鍒楄〃
-        private List<string> _allGradingCodeList = null;
-
-        //璁剧疆棰滆壊鍒嗙骇
-        private void SetGrading()
-        {
-            if (_hydroInfo == null)
-            {
-                return;
-            }
-            var dlg = new SetHydroGradingModelDlg();
-            dlg.SetBindingData(_hydroInfo.ID);
+            dlg.SetBindingData(_hydroInfo);
             dlg.ShowDialog();
         }
 
-        //搴旂敤棰滆壊鍒嗙骇
-        private async void ApplyGrading()
+        //鎬ц兘鏇茬嚎
+        private void barBtnPumpCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            PumpFeat();
+        }
+
+        //骞惰仈妯℃嫙
+        private void PumpParallel()
         {
             if (_hydroInfo == null)
             {
                 return;
             }
-            if (_allGradingApplyList == null)
+            var pumps = _hydroInfo.Pumps;
+            if (pumps == null || pumps.Count < 1)
             {
-                _allGradingApplyList = new List<HydroGradingApplyViewModel>();
-
-                if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0)
-                {
-                    _allGradingApplyList.Add(new HydroGradingApplyViewModel()
-                    {
-                        Code = Yw.Hydro.ParterCatalog.Pump,
-                        Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pump),
-                        PropName = string.Empty
-                    });
-                }
-                if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0)
-                {
-                    _allGradingApplyList.Add(new HydroGradingApplyViewModel()
-                    {
-                        Code = Yw.Hydro.ParterCatalog.Valve,
-                        Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Valve),
-                        PropName = string.Empty
-                    });
-                }
-                if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0)
-                {
-                    _allGradingApplyList.Add(new HydroGradingApplyViewModel()
-                    {
-                        Code = Yw.Hydro.ParterCatalog.Pipe,
-                        Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pipe),
-                        PropName = string.Empty
-                    });
-                }
+                XtraMessageBox.Show("鏃犳按娉典俊鎭�");
+                return;
             }
-            var dlg = new ApplyHydroGradingDlg();
-            dlg.SetBindingData(() => _hydroInfo, _allGradingApplyList, GetAllCalcuResultList());
-            dlg.ReloadDataEvent += (obj) =>
+            var dlg = new SimulationPumpParallelDlg();
+            dlg.SaveEvent += async (list) =>
             {
-                _allGradingCodeList = obj?.Select(x => x.Code).Distinct().ToList();
-                var objGroupList = obj?.GroupBy(x => x.Color).ToList();
-                objGroupList?.ForEach(async x =>
+                list?.ForEach(x =>
                 {
-                    await _bimfaceCtrl?.OverrideComponentsColor(x.Select(t => t.Code).Distinct().ToList(), x.Key, 1);
+                    var pump = pumps.Find(t => t.Code == x.Code);
+                    if (pump != null)
+                    {
+                        pump.LinkStatus = x.LinkStatus;
+                        pump.SpeedRatio = x.SpeedRatio;
+                    }
                 });
+                var visualVmListHelper = GetVisualVmListHelper();
+                visualVmListHelper.UpdateProperty(pumps.Select(x => x as Yw.Model.HydroVisualInfo).ToList());
+                SelectVisual(_visual, eSimulationVisualSource.None);
+                var gradingHelper = await GetGradingHelper();
+                gradingHelper.Set();
             };
-            if (dlg.ShowDialog() == DialogResult.Cancel)
+            dlg.SetBindingData(_hydroInfo);
+            dlg.ShowDialog();
+        }
+
+        //骞惰仈妯℃嫙
+        private void barBtnPumpParallel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            PumpParallel();
+        }
+
+        #endregion 姘存车鍒楄〃
+
+        #region 姘村姏璁$畻
+
+        //璁$畻
+        private async void Calcu()
+        {
+            if (_hydroInfo == null)
             {
-                await _bimfaceCtrl?.RestoreComponentsColor(_allGradingCodeList);
+                return;
+            }
+            var workingCheckedListHelper = GetWorkingCheckedListHelper();
+            var allWorkingList = workingCheckedListHelper.GetWorkingList();
+            var monitorValueHelper = GetMonitorValueHelper();
+            var allMonitorValueList = await monitorValueHelper.Get();
+            var dlg = new SetHydroWorkingDlg();
+            dlg.SetBindingData(_hydroInfo, allWorkingList, allMonitorValueList);
+            dlg.HydroViewEvent += (visual) =>
+            {
+                SelectVisual(visual, eSimulationVisualSource.Calcu);
+            };
+            dlg.HydroCalcuEvent += async (vm) =>
+            {
+                _hydroInfo.UpdateWorkingInfo(vm.WorkingInfo);
+                allMonitorValueList.UpdateMonitorValue(vm.MonitorInfo);
+
+                var hydroInfo = _hydroInfo.Adapt<Yw.Model.HydroModelInfo>();
+
+                var working = new HydroWorkingVmo();
+                working.ModelID = vm.ModelID;
+                working.Name = vm.Name;
+                working.WorkingInfo = JsonHelper.Object2Json(vm.WorkingInfo);
+                var useWorkingMonitorInfo = vm.MonitorInfo?.Where(x => x.PropValue.HasValue).ToList();
+                if (useWorkingMonitorInfo != null && useWorkingMonitorInfo.Count > 0)
+                {
+                    working.MonitorInfo = JsonHelper.Object2Json(useWorkingMonitorInfo);
+                }
+                working.SortCode = vm.SortCode;
+                working.Description = vm.Description;
+
+                var workingHelper = GetWorkingHelper();
+                //鏍¢獙
+                var checkResult = _hydroInfo.Check();
+                if (!checkResult.Succeed)
+                {
+                    ShowCheckCtrl(checkResult);
+                    workingHelper.InitialData(hydroInfo, working, checkResult, null);
+                    TipFormHelper.ShowError("鏍¢獙澶辫触锛岃妫�鏌ュ悗閲嶈瘯");
+                    return;
+                }
+
+                WaitFormHelper.ShowWaitForm(this, "姝e湪璁$畻鍒嗘瀽涓紝璇风◢鍊�...");
+                await Task.Delay(3000);
+                var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss);
+                WaitFormHelper.HideWaitForm();
+                workingHelper.InitialData(hydroInfo, working, checkResult, calcuResult);
+                if (calcuResult.Succeed)
+                {
+                    if (calcuResult.WainingList != null && calcuResult.WainingList.Count > 0)
+                    {
+                        ShowCalcuWarningCtrl(calcuResult);
+                    }
+                    this.barBtnAddWorking.Enabled = true;
+                    this.barBtnExportWord.Enabled = true;
+                    TipFormHelper.ShowSucceed("璁$畻鎴愬姛锛�");
+                }
+                else
+                {
+                    ShowCalcuFailedCtrl(calcuResult);
+                    TipFormHelper.ShowError("璁$畻澶辫触锛�");
+                }
+
+                #region 瑙嗗浘鍒楄〃
+
+                var visualVmListHelper = GetVisualVmListHelper();
+                visualVmListHelper.UpdateCalcuProperty(calcuResult);
+
+                #endregion 瑙嗗浘鍒楄〃
+
+                #region 褰撳墠鏋勪欢
+
+                SelectVisual(_visual, eSimulationVisualSource.Calcu);
+
+                #endregion 褰撳墠鏋勪欢
+
+                #region 鏋勪欢鏄庣粏
+
+                UpdateVisualListCtrl();
+
+                #endregion 鏋勪欢鏄庣粏
+
+                #region 棰滆壊鍒嗙骇
+
+                var gradingHelper = await GetGradingHelper();
+                gradingHelper.Set();
+
+                #endregion 棰滆壊鍒嗙骇
+
+                #region 璁$畻鏍囩
+
+                var calcuResultLabelHelper = await GetCalcuResultLabelHelper();
+                calcuResultLabelHelper.Set();
+
+                #endregion 璁$畻鏍囩
+            };
+            dlg.ShowDialog();
+        }
+
+        //姘村姏璁$畻
+        private void barBtnCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            Calcu();
+        }
+
+        #endregion 姘村姏璁$畻
+
+        #region 瀵煎嚭鎶ュ憡
+
+        private async 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 SimulationWorkingReportHelper();
+                reportHelper.Create(fileName, vm);
+                TipFormHelper.ShowInfo("瀵煎嚭鎴愬姛锛�");
+            };
+            dlg.SetBindingData(_project, _hydroInfo, allMonitorList, working, calcuResult, visual);
+            dlg.ShowDialog();
+        }
+
+        #endregion 瀵煎嚭鎶ュ憡
+
+        #region 褰撳墠宸ュ喌
+
+        //宸ュ喌杈呭姪绫�
+        private SimulationWorkingHelper _workingHelper = null;
+
+        //鑾峰彇宸ュ喌杈呭姪绫�
+        private SimulationWorkingHelper GetWorkingHelper()
+        {
+            if (_workingHelper == null)
+            {
+                _workingHelper = new SimulationWorkingHelper();
+            }
+            return _workingHelper;
+        }
+
+        //鑾峰彇宸ュ喌
+        private HydroWorkingVmo GetWorking()
+        {
+            var workingHelper = GetWorkingHelper();
+            return workingHelper.Working;
+        }
+
+        //鑾峰彇妫�鏌ョ粨鏋�
+        private HydroCheckResult GetCheckResult()
+        {
+            var workingHelper = GetWorkingHelper();
+            return workingHelper.CheckResult;
+        }
+
+        //鑾峰彇璁$畻缁撴灉
+        private HydroCalcuResult GetCalcuResult()
+        {
+            var workingHelper = GetWorkingHelper();
+            return workingHelper.CalcuResult;
+        }
+
+        //鏂板宸ュ喌
+        private void AddWorking()
+        {
+            var workingHelper = GetWorkingHelper();
+            if (workingHelper.Working == null)
+            {
+                TipFormHelper.ShowWarn("灏氭湭璁$畻锛岃璁$畻鍚庨噸璇曪紒");
+                return;
+            }
+            var dlg = new AddHydroWorkingDlg();
+            dlg.SetBindingData(workingHelper.Working);
+            dlg.ReloadDataEvent += (rhs) =>
+            {
+                this.barBtnAddWorking.Enabled = false;
+                workingHelper.ResetWorking(rhs);
+                UpdateWorkingCheckedList(rhs, false);
+                this.AppendWorkingEvent?.Invoke(rhs);
+            };
+            dlg.ShowDialog();
+        }
+
+        //澧炲姞宸ュ喌
+        private void barBtnAddWorking_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            AddWorking();
+        }
+
+        #endregion 褰撳墠宸ュ喌
+
+        #region 閫夋嫨宸ュ喌
+
+        //宸ュ喌閫夋嫨鍒楄〃杈呭姪绫�
+        private SimulationWorkingCheckedListHelper _workingCheckedListHelper = null;
+
+        //鑾峰彇宸ュ喌鍏冪粍杈呭姪绫�
+        private SimulationWorkingCheckedListHelper GetWorkingCheckedListHelper()
+        {
+            if (_workingCheckedListHelper == null)
+            {
+                var visualListHelper = GetVisualListHelper();
+                _workingCheckedListHelper = new SimulationWorkingCheckedListHelper(visualListHelper);
+                _workingCheckedListHelper.InitialData(_allWorkingCheckedListDict);
+            }
+            return _workingCheckedListHelper;
+        }
+
+        //鑾峰彇宸ュ喌鍒楄〃
+        private List<HydroWorkingVmo> GetWorkingList()
+        {
+            var helper = GetWorkingCheckedListHelper();
+            return helper.GetWorkingList();
+        }
+
+        //鑾峰彇閫夋嫨宸ュ喌鍒楄〃
+        private List<HydroWorkingVmo> GetCheckedWorkingList()
+        {
+            var helper = GetWorkingCheckedListHelper();
+            return helper.GetCheckedWorkingList();
+        }
+
+        //鏇存柊宸ュ喌閫夋嫨鍒楄〃
+        public void UpdateWorkingCheckedList(HydroWorkingVmo working)
+        {
+            var helper = GetWorkingCheckedListHelper();
+            helper.Update(working);
+        }
+
+        //鏇存柊宸ュ喌閫夋嫨鍒楄〃
+        public void UpdateWorkingCheckedList(HydroWorkingVmo working, bool hasChecked)
+        {
+            var helper = GetWorkingCheckedListHelper();
+            helper.Update(working, hasChecked);
+        }
+
+        //绉婚櫎宸ュ喌閫夋嫨鍒楄〃
+        public void RemoveWorkingCheckedList(HydroWorkingVmo working)
+        {
+            var helper = GetWorkingCheckedListHelper();
+            helper.Remove(working);
+        }
+
+        #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 void barBtnGradingSet_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        //鏄剧ず鐩戞祴鍊煎垪琛ㄦ帶浠�
+        private async void ShowMonitorAnalyListCtrl()
         {
-            SetGrading();
+            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 GetMonitorList();
+            var allMonitorValueList = await GetMonitorValueList();
+
+            if (allWorkingList == null || allWorkingList.Count < 1)
+            {
+                monitorAnalyListCtrl.SetBindingData(_hydroInfo, allMontorList, allMonitorValueList, GetWorking(), GetCalcuResult(), _visual);
+            }
+            else
+            {
+                monitorAnalyListCtrl.SetBindingData(_hydroInfo, allMontorList, allMonitorValueList, allWorkingList, _visual);
+            }
         }
 
-        //搴旂敤
-        private void barBtnGradingApply_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        //鐩戞祴鍒嗘瀽
+        private void barBtnWorkingMonitorAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
-            ApplyGrading();
+            ShowMonitorAnalyListCtrl();
         }
 
         #endregion
 
-        #region 浜哄伐鍒锋柊
+        #region 宸ュ喌鍒嗘瀽
 
-        //鍒锋柊
-        private async void barBtnRefresh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        //閫夋嫨杩涘彛姘存簮
+        private void SelectInputSource()
         {
-            if (XtraMessageBox.Show("鍒锋柊鍚庡皢涓㈠け褰撳墠姘村姏淇℃伅鏇存敼锛屾槸鍚︾户缁埛鏂帮紵", "璇㈤棶", MessageBoxButtons.YesNo) == DialogResult.Yes)
+            var sources = GetSourceList();
+            if (sources != null)
             {
-                if (_project == 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 workingCheckedListHelper = GetWorkingCheckedListHelper();
+            var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList();
+            if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1)
+            {
+                var workingHelper = GetWorkingHelper();
+                if (!workingHelper.Initialized)
+                {
+                    TipFormHelper.ShowWarn("璇疯绠楀悗閲嶈瘯锛�");
                     return;
                 }
-                if (_projectSite == null)
+                var dlg = new HydroSingleWorkingEvaluationDlg();
+                dlg.SetBindingData(workingHelper.HydroInfo, allMonitorList, workingHelper.Working, workingHelper.CalcuResult);
+                dlg.ShowDialog();
+            }
+            else
+            {
+                var dlg = new HydroMultiWorkingEvaluationDlg();
+                dlg.SetBindingData(_hydroInfo, allMonitorList, allCheckedWorkingList);
+                dlg.ShowDialog();
+            }
+        }
+
+        //姘存车鍒嗘瀽
+        private void barBtnPumpAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            var workingCheckedListHelper = GetWorkingCheckedListHelper();
+            var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList();
+            if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1)
+            {
+                var workingHelper = GetWorkingHelper();
+                if (!workingHelper.Initialized)
                 {
+                    TipFormHelper.ShowWarn("璇疯绠楀悗閲嶈瘯锛�");
                     return;
                 }
-                var hydroRelation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance
-                    .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation);
-                _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(hydroRelation.ModelID);
-                _parter = null;
-                await _bimfaceCtrl?.ZoomAndSelectComponents(null);
-                ShowProperty();
-                TipFormHelper.ShowSucceed("鏁版嵁宸插埛鏂�");
+                var dlg = new SimulationSingleWorkingPumpAnalyDlg();
+                dlg.SetBindingData(workingHelper.HydroInfo, workingHelper.CalcuResult);
+                dlg.ShowDialog();
+            }
+            else
+            {
+                var dlg = new SimulationMultiWorkingPumpAnalyDlg();
+                dlg.SetBindingData(_hydroInfo, allCheckedWorkingList);
+                dlg.ShowDialog();
+            }
+        }
+
+        //鑳芥晥鍒嗘瀽
+        private async void barBtnWorkingPower_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            var allMonitorList = await GetMonitorList();
+            var workingCheckedListHelper = GetWorkingCheckedListHelper();
+            var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList();
+            if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1)
+            {
+                var workingHelper = GetWorkingHelper();
+                if (!workingHelper.Initialized)
+                {
+                    TipFormHelper.ShowWarn("璇疯绠楀悗閲嶈瘯锛�");
+                    return;
+                }
+                var dlg = new SimulationSingleWorkingEnergyDlg();
+                dlg.SetBindingData(workingHelper.Working, workingHelper.HydroInfo, allMonitorList, workingHelper.CalcuResult);
+                dlg.ShowDialog();
+            }
+            else
+            {
+                var dlg = new SimulationMultiWorkingEnergyDlg();
+                dlg.SetBindingData(_hydroInfo, allMonitorList, allCheckedWorkingList);
+                dlg.ShowDialog();
+            }
+        }
+
+        //鎹熷け鏇茬嚎
+        private 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;
+                }
+                var dlg = new HydroSingleWorkingLossCurveDlg();
+                dlg.HydroClickEvent += (code) =>
+                {
+                    SelectVisual(code, eSimulationVisualSource.None);
+                };
+                dlg.SetBindingData(workingHelper.HydroInfo, workingHelper.CalcuResult, visual);
+                dlg.ShowDialog();
+            }
+            else
+            {
+                var dlg = new HydroMultiWorkingLossCurveDlg();
+                dlg.HydroClickEvent += (code) =>
+                {
+                    SelectVisual(code, eSimulationVisualSource.None);
+                };
+                dlg.SetBindingData(_hydroInfo, allCheckedWorkingList, visual);
+                dlg.ShowDialog();
+            }
+        }
+
+        //鎹熷け缁熻
+        private void barBtnWorkingLossStatistics_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            var workingCheckedListHelper = GetWorkingCheckedListHelper();
+            var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList();
+            if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1)
+            {
+                var workingHelper = GetWorkingHelper();
+                if (!workingHelper.Initialized)
+                {
+                    TipFormHelper.ShowWarn("璇疯绠楀悗閲嶈瘯锛�");
+                    return;
+                }
+                var dlg = new HydroSingleWorkingLossStatisticsDlg();
+                dlg.SetBindingData(workingHelper.HydroInfo);
+                dlg.ShowDialog();
+            }
+            else
+            {
+                var dlg = new HydroMultiWorkingLossStatisticsDlg();
+                dlg.SetBindingData(_hydroInfo, allCheckedWorkingList);
+                dlg.ShowDialog();
+            }
+        }
+
+        //缁煎悎鍒嗘瀽
+        private async void barBtnWorkingAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            if (_visual == null)
+            {
+                if (_visual == null)
+                {
+                    SelectInputSource();
+                    if (_visual == null)
+                    {
+                        TipFormHelper.ShowWarn("璇烽�夋嫨鏋勪欢鍚庨噸璇曪紒");
+                        return;
+                    }
+                }
+            }
+            HydroVisualInfo visual = _visual;
+            if (_visual is HydroLinkInfo linkInfo)
+            {
+                var visualListHelper = GetVisualListHelper();
+                visual = visualListHelper.GetVisual(linkInfo.StartCode);
+            }
+
+            var monitorHelper = GetMonitorHelper();
+            var allMonitorList = await monitorHelper.Get();
+
+            var workingCheckedListHelper = GetWorkingCheckedListHelper();
+            var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList();
+            if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1)
+            {
+                var workingHelper = GetWorkingHelper();
+                if (!workingHelper.Initialized)
+                {
+                    TipFormHelper.ShowWarn("璇疯绠楀悗閲嶈瘯锛�");
+                    return;
+                }
+                var dlg = new SimulationSingleWorkingAnalyDlg();
+                dlg.SetBindingData(workingHelper.HydroInfo, allMonitorList, workingHelper.Working, workingHelper.CalcuResult, visual);
+                dlg.ShowDialog();
+            }
+            else
+            {
+                var dlg = new SimulationMultiWorkingAnalyDlg();
+                dlg.SetBindingData(_hydroInfo, allMonitorList, allCheckedWorkingList, visual);
+                dlg.ShowDialog();
             }
         }
 
         #endregion
+
+        #region 鏂规绠$悊
+
+        //鏇存柊鏂规
+        private 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