11
Shuxia Ning
2024-11-08 7ae4a1016ac49599caa7dacb2c3256e9744175c4
WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs
@@ -1,9 +1,13 @@
global using Yw.EPAnet;
using DevExpress.Mvvm.Native;
using DevExpress.Xpo.Helpers;
using DevExpress.XtraRichEdit.Layout;
using DevExpress.XtraSpreadsheet.Commands;
using HStation.WinFrmUI.PhartRelation;
using System.Diagnostics;
using System.Windows.Media.Media3D;
using Yw.Pump;
using Yw.Vmo;
using Yw.WinFrmUI.Bimface;
using Yw.WinFrmUI.Hydro;
@@ -24,9 +28,9 @@
        private HStation.Vmo.XhsProjectSiteVmo _projectSite = 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 Yw.WinFrmUI.HydroCheckResult _checkResult = null;//检查结果
        private Yw.EPAnet.CalcuResult _calcuResult = null;//计算结果
        /// <summary>
        /// 绑定数据
@@ -74,6 +78,7 @@
        }
        #region Bimface
        //bimface控件
@@ -100,7 +105,7 @@
                    {
                        return;
                    }
                    _parter = obj;
                    _selectedParter = obj;
                    ShowProperty();
                };
            }
@@ -113,6 +118,11 @@
            var bimfaceCtrl = await GetBimfaceCtrl();
            this.tabPageBimface.Controls.Clear();
            this.tabPageBimface.Controls.Add(bimfaceCtrl);
        }
        private void SelectBimfaceParter()
        {
        }
        #endregion
@@ -137,7 +147,7 @@
                        return;
                    }
                    var allParterList = _hydroInfo.GetAllParters();
                    _parter = allParterList?.Find(x => x.Code == obj?.FirstOrDefault());
                    _selectedParter = allParterList?.Find(x => x.Code == obj?.FirstOrDefault());
                    ShowProperty();
                };
            }
@@ -166,7 +176,7 @@
            {
                _propertyCtrl = new XhsProjectSimulationPropertyCtrl();
                _propertyCtrl.Dock = DockStyle.Fill;
                _propertyCtrl.InitialData(() => _hydroInfo, () => GetAllCalcuResultList());
                _propertyCtrl.InitialData(() => _hydroInfo, () => GetCalcuResultList());
                _propertyCtrl.BlinkLinkParterEvent += async (code, linkCode) =>
                { //强调连接组件
                    if (string.IsNullOrEmpty(code))
@@ -215,6 +225,23 @@
                    await Task.Delay(5000);
                    await _bimfaceCtrl?.ClearBlinkComponents();
                };
                _propertyCtrl.PropertyValueChangedEvent += (parter) =>
                {
                    if (parter == null)
                    {
                        return;
                    }
                    UpdateParterListProperty(parter);
                    AutoApplyGrading();
                };
                _propertyCtrl.ViewParterEvent += (parter) =>
                {
                    if (parter == null)
                    {
                        return;
                    }
                    _bimfaceCtrl?.ZoomToComponent(parter.Code);
                };
            }
            return _propertyCtrl;
        }
@@ -230,12 +257,6 @@
            this.docPnlRight.Width = 300;
        }
        //属性面板按钮
        private void barBtnProperty_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ShowPropertyCtrl();
        }
        //显示属性
        private void ShowProperty()
        {
@@ -247,22 +268,122 @@
            {
                ShowPropertyCtrl();
            }
            if (_parter == null)
            if (_selectedParter == null)
            {
                _propertyCtrl?.SelectParter(null);
                _propertyCtrl?.CancelSelectParter();
                return;
            }
            _propertyCtrl?.SelectParter(_parter.Code);
            _propertyCtrl?.SelectParter(_selectedParter.Code);
            var allCalcuResultList = GetAllCalcuResultList();
            var allCalcuResultList = GetCalcuResultList();
            if (allCalcuResultList != null && allCalcuResultList.Count > 0)
            {
                var calcuResult = allCalcuResultList.Find(x => x.Code == _parter.Code);
                var calcuResult = allCalcuResultList.Find(x => x.Code == _selectedParter.Code);
                if (calcuResult != null)
                {
                    _propertyCtrl?.UpdateCalcuProperty(calcuResult);
                }
            }
        }
        #endregion
        #region 选择构件
        //选择构件
        private Yw.Model.HydroParterInfo _selectedParter = null;
        //更新选择组件属性
        private void UpdateSelectedParterProperty()
        {
            if (_selectedParter == null)
            {
                return;
            }
            _propertyCtrl?.UpdateProperty();
        }
        //更新选择组件计算属性
        private void UpdateSelectedParterCalcuProperty()
        {
            if (_selectedParter == null)
            {
                return;
            }
            var allCalcuResultList = GetCalcuResultList();
            if (allCalcuResultList == null || allCalcuResultList.Count < 1)
            {
                return;
            }
            var calcuResult = allCalcuResultList.Find(x => x.Code == _selectedParter.Code);
            if (calcuResult == null)
            {
                return;
            }
            _propertyCtrl?.UpdateCalcuProperty(calcuResult);
        }
        //更新构件列表属性
        private void UpdateParterListProperty()
        {
            if (this.docPnlBottom.Visibility != DevExpress.XtraBars.Docking.DockVisibility.Visible)
            {
                return;
            }
            var parterListCtrl = this.controlContainerBottom.Controls[0] as Yw.WinFrmUI.HydroParterListCtrl;
            if (parterListCtrl == null)
            {
                return;
            }
            parterListCtrl.UpdateProperty();
        }
        //更新构件列表属性
        private void UpdateParterListProperty(Yw.Model.HydroParterInfo parter)
        {
            if (this.docPnlBottom.Visibility != DevExpress.XtraBars.Docking.DockVisibility.Visible)
            {
                return;
            }
            var parterListCtrl = this.controlContainerBottom.Controls[0] as Yw.WinFrmUI.HydroParterListCtrl;
            if (parterListCtrl == null)
            {
                return;
            }
            parterListCtrl.UpdateProperty(parter);
        }
        //更新构件列表属性
        private void UpdateParterListProperty(List<Yw.Model.HydroParterInfo> parterList)
        {
            if (this.docPnlBottom.Visibility != DevExpress.XtraBars.Docking.DockVisibility.Visible)
            {
                return;
            }
            var parterListCtrl = this.controlContainerBottom.Controls[0] as Yw.WinFrmUI.HydroParterListCtrl;
            if (parterListCtrl == null)
            {
                return;
            }
            parterListCtrl.UpdateProperty(parterList);
        }
        //更新构件列表计算属性
        private void UpdateParterListCalcuProperty()
        {
            if (this.docPnlBottom.Visibility != DevExpress.XtraBars.Docking.DockVisibility.Visible)
            {
                return;
            }
            var parterListCtrl = this.controlContainerBottom.Controls[0] as Yw.WinFrmUI.HydroParterListCtrl;
            if (parterListCtrl == null)
            {
                return;
            }
            var allCalcuResultList = GetCalcuResultList();
            parterListCtrl.UpdateCalcuProperty(allCalcuResultList);
        }
        #endregion
@@ -283,11 +404,11 @@
                        return;
                    }
                    var allParterList = _hydroInfo.GetAllParters();
                    _parter = allParterList?.Find(x => x.Code == code);
                    _selectedParter = allParterList?.Find(x => x.Code == code);
                    var elementIds = new List<string>();
                    if (_parter != null)
                    if (_selectedParter != null)
                    {
                        elementIds.Add(_parter.Code);
                        elementIds.Add(_selectedParter.Code);
                    }
                    await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds);
                    ShowProperty();
@@ -316,7 +437,7 @@
            }
            this.controlContainerBottom.Controls.Clear();
            var matchingListCtrl = GetMatchingListCtrl();
            var input = AssetsMatchingParasHelper.Create(_hydroInfo, GetAllCalcuResultList());
            var input = AssetsMatchingParasHelper.Create(_hydroInfo, GetCalcuResultList());
            matchingListCtrl.SetBindingData(input);
            this.controlContainerBottom.Controls.Add(matchingListCtrl);
            this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
@@ -346,7 +467,7 @@
                        return;
                    }
                    var allParterList = _hydroInfo.GetAllParters();
                    _parter = allParterList?.Find(x => x.Code == parter.Code);
                    _selectedParter = allParterList?.Find(x => x.Code == parter.Code);
                    var elementIds = new List<string>() { parter.Code };
                    await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds);
                    ShowProperty();
@@ -355,7 +476,7 @@
                {
                    var codes = parters?.Select(x => x.Code).Distinct().ToList();
                    await _bimfaceCtrl?.ZoomAndSelectComponents(codes);
                    _parter = null;
                    _selectedParter = null;
                    ShowProperty();
                };
            }
@@ -439,15 +560,15 @@
                    var elementIds = new List<string>();
                    if (string.IsNullOrEmpty(code))
                    {
                        _parter = null;
                        _selectedParter = null;
                    }
                    else
                    {
                        var allParterList = _hydroInfo.GetAllParters();
                        _parter = allParterList?.Find(x => x.Code == code);
                        if (_parter != null)
                        _selectedParter = allParterList?.Find(x => x.Code == code);
                        if (_selectedParter != null)
                        {
                            elementIds.Add(_parter.Code);
                            elementIds.Add(_selectedParter.Code);
                        }
                    }
                    await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds);
@@ -457,7 +578,7 @@
            return _checkCtrl;
        }
        //显示校验控件
        //显示检查控件
        private void ShowCheckCtrl()
        {
            if (_checkResult == null)
@@ -469,12 +590,12 @@
            this.controlContainerBottom.Controls.Clear();
            this.controlContainerBottom.Controls.Add(checkCtrl);
            this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
            this.docPnlBottom.Text = "校验结果";
            this.docPnlBottom.Text = "检查结果";
            this.docPnlBottom.Height = 350;
        }
        //水力验证
        //水力检查
        private void barBtnHydroCheck_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_hydroInfo == null)
@@ -496,7 +617,17 @@
            {
                return;
            }
            Stopwatch sw = new Stopwatch();
            sw.Start();
            var id = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.Save(_hydroInfo);
            //耗时巨大的代码
            sw.Stop();
            TimeSpan ts2 = sw.Elapsed;
            Console.WriteLine("Stopwatch总共花费{0}ms.", ts2.TotalMilliseconds);
            if (id < 1)
            {
                TipFormHelper.ShowError("保存失败!");
@@ -522,14 +653,14 @@
                _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 });
                    _selectedParter = parter;
                    await _bimfaceCtrl?.ZoomAndSelectComponent(_selectedParter.Code);
                    ShowProperty();
                };
                _parterListCtrl.HydroChangedEvent += (parterList) =>
                {
                    UpdateSelectedParterProperty();
                    AutoApplyGrading();
                };
            }
            return _parterListCtrl;
@@ -542,8 +673,17 @@
            {
                return;
            }
            var allCalcuResultList = GetCalcuResultList();
            var parterListCtrl = GetParterListCtrl();
            parterListCtrl.SetBindingData(_hydroInfo, GetAllCalcuResultList());
            parterListCtrl.SetBindingData(_hydroInfo, allCalcuResultList);
            if (allCalcuResultList == null || allCalcuResultList.Count < 1)
            {
                parterListCtrl.SetNormalView();
            }
            else
            {
                parterListCtrl.SetCalcuView();
            }
            this.controlContainerBottom.Controls.Clear();
            this.controlContainerBottom.Controls.Add(parterListCtrl);
            this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
@@ -589,14 +729,14 @@
            //水库
            this.barBtnSetReservoirList.ItemClick += delegate
            {
                var dlg = new HydroReservoirBulkSetListDlg();
                dlg.ShowDialog();
                //var dlg = new HydroReservoirBulkSetListDlg();
                //dlg.ShowDialog();
            };
            //水池
            this.barBtnSetTankList.ItemClick += delegate
            {
                var dlg = new HydroTankBulkSetListDlg();
                dlg.ShowDialog();
                //var dlg = new HydroTankBulkSetListDlg();
                //dlg.ShowDialog();
            };
            //水箱
            this.barBtnSetWaterboxList.ItemClick += delegate
@@ -605,15 +745,29 @@
                {
                    return;
                }
                var dlg = new HydroWaterboxBulkSetListDlg();
                var dlg = new SetHydroWaterboxListDlg();
                dlg.SetBindingData(_hydroInfo);
                dlg.HydroClickEvent += async (obj) =>
                {
                    if (obj == null)
                    {
                        return;
                    }
                    _selectedParter = obj;
                    await _bimfaceCtrl?.ZoomAndSelectComponent(obj.Code);
                    ShowProperty();
                };
                dlg.HydroChangedEvent += (obj) =>
                {
                };
                dlg.ShowDialog();
            };
            //连接节点
            this.barBtnSetJunctionList.ItemClick += delegate
            {
                var dlg = new HydroJunctionBulkSetListDlg();
                dlg.ShowDialog();
                //var dlg = new HydroJunctionBulkSetListDlg();
                //dlg.ShowDialog();
            };
            //闷头
            this.barBtnSetBluntheadList.ItemClick += delegate
@@ -622,7 +776,22 @@
                {
                    return;
                }
                var dlg = new HydroBluntheadBulkSetListDlg();
                var dlg = new SetHydroBluntheadListDlg();
                dlg.SetBindingData(_hydroInfo);
                dlg.HydroClickEvent += async (obj) =>
                {
                    if (obj == null)
                    {
                        return;
                    }
                    _selectedParter = obj;
                    await _bimfaceCtrl?.ZoomAndSelectComponent(obj.Code);
                    ShowProperty();
                };
                dlg.HydroChangedEvent += (obj) =>
                {
                };
                dlg.ShowDialog();
            };
            //弯头
@@ -632,8 +801,22 @@
                {
                    return;
                }
                var dlg = new HydroElbowBulkSetListDlg();
                var dlg = new SetHydroElbowListDlg();
                dlg.SetBindingData(_hydroInfo);
                dlg.HydroClickEvent += async (obj) =>
                {
                    if (obj == null)
                    {
                        return;
                    }
                    _selectedParter = obj;
                    await _bimfaceCtrl?.ZoomAndSelectComponent(obj.Code);
                    ShowProperty();
                };
                dlg.HydroChangedEvent += (obj) =>
                {
                };
                dlg.ShowDialog();
            };
            //三通
@@ -643,7 +826,7 @@
                {
                    return;
                }
                var dlg = new HydroThreelinkBulkSetListDlg();
                var dlg = new SetHydroThreelinkListDlg();
                dlg.SetBindingData(_hydroInfo);
                dlg.ShowDialog();
            };
@@ -654,7 +837,7 @@
                {
                    return;
                }
                var dlg = new HydroFourlinkBulkSetListDlg();
                var dlg = new SetHydroFourlinkListDlg();
                dlg.SetBindingData(_hydroInfo);
                dlg.ShowDialog();
            };
@@ -665,7 +848,7 @@
                {
                    return;
                }
                var dlg = new HydroMeterBulkSetListDlg();
                var dlg = new SetHydroMeterListDlg();
                dlg.SetBindingData(_hydroInfo);
                dlg.ShowDialog();
            };
@@ -676,7 +859,7 @@
                {
                    return;
                }
                var dlg = new HydroFlowmeterBulkSetListDlg();
                var dlg = new SetHydroFlowmeterListDlg();
                dlg.SetBindingData(_hydroInfo);
                dlg.ShowDialog();
            };
@@ -687,7 +870,7 @@
                {
                    return;
                }
                var dlg = new HydroPressmeterBulkSetListDlg();
                var dlg = new SetHydroPressmeterListDlg();
                dlg.SetBindingData(_hydroInfo);
                dlg.ShowDialog();
            };
@@ -698,7 +881,7 @@
                {
                    return;
                }
                var dlg = new HydroPipeBulkSetListDlg();
                var dlg = new SetHydroPipeListDlg();
                dlg.SetBindingData(_hydroInfo);
                dlg.ShowDialog();
            };
@@ -709,7 +892,7 @@
                {
                    return;
                }
                var dlg = new HydroPumpBulkSetListDlg();
                var dlg = new SetHydroPumpListDlg();
                dlg.SetBindingData(_hydroInfo);
                dlg.ShowDialog();
            };
@@ -720,7 +903,7 @@
                {
                    return;
                }
                var dlg = new HydroValveBulkSetListDlg();
                var dlg = new SetHydroValveListDlg();
                dlg.SetBindingData(_hydroInfo);
                dlg.ShowDialog();
            };
@@ -948,7 +1131,7 @@
            {
                return;
            }
            var allCalcuResultList = GetAllCalcuResultList();
            var allCalcuResultList = GetCalcuResultList();
            var vmList = new List<XhsSinglePumpViewModel>();
            foreach (var pump in _hydroInfo.Pumps)
            {
@@ -1007,7 +1190,7 @@
            }
            var dlg = new PumpParallelChartDlg();
            var dlg = new PumpParallelAnalyDlg();
            dlg.SetBindingData(vmList);
            dlg.ReloadDataEvent += (list) =>
            {
@@ -1034,20 +1217,20 @@
        #region 前提条件
        //显示计算前提条件窗体
        private async void ShowCalcuPrefixDlg()
        private void ShowCalcuPrefixDlg()
        {
            if (_hydroInfo == null)
            {
                return;
            }
            var dlg = new SetHydroCalcuPrefixDlg();
            var dlg = new HStation.WinFrmUI.SetHydroCalcuPrefixDlg1();
            dlg.SetBindingData(_hydroInfo);
            dlg.HydroViewEvent += async (parter) =>
            {
                _parter = parter;
                if (_parter != null)
                _selectedParter = parter;
                if (_selectedParter != null)
                {
                    await _bimfaceCtrl?.ZoomAndSelectComponents(new List<string>() { _parter.Code });
                    await _bimfaceCtrl?.ZoomAndSelectComponents(new List<string>() { _selectedParter.Code });
                }
                ShowProperty();
            };
@@ -1067,11 +1250,18 @@
                    return;
                }
                WaitFormHelper.ShowWaitForm(this, "正在计算分析中,请稍候...");
                //await Task.Delay(5000);
                var netWork = Yw.Hydro.ParseHelper.ToNetwork(_hydroInfo);
                _calcuResult = netWork.Calcu();
                WaitFormHelper.HideWaitForm();
                if (_calcuResult.Succeed)
                {
                    GetAllCalcuResultList(false);
                    GetCalcuResultList(false);
                    await _bimfaceCtrl?.SetLogicCalcuCustomLabels(_calcuResult);
                    TipFormHelper.ShowSucceed("计算成功!");
                }
@@ -1082,10 +1272,7 @@
                }
            };
            if (dlg.ShowDialog() == DialogResult.Cancel)
            {
                await _bimfaceCtrl?.ClearLogicCalcuCustomLabels();
            }
            dlg.ShowDialog();
        }
        #endregion
@@ -1135,11 +1322,11 @@
        #region 计算结果
        //所有计算结果列表
        private List<IHydroCalcuResult> _allCalcuResultList = null;
        private List<HydroCalcuResult> _allCalcuResultList = null;
        //获取计算结果
        //true 使用缓存,false 不使用缓存
        private List<IHydroCalcuResult> GetAllCalcuResultList(bool isCache = true)
        private List<HydroCalcuResult> GetCalcuResultList(bool isCache = true)
        {
            if (_hydroInfo == null)
            {
@@ -1158,97 +1345,143 @@
                return _allCalcuResultList;
            }
            _allCalcuResultList = new List<IHydroCalcuResult>();
            _allCalcuResultList = new List<HydroCalcuResult>();
            //节点
            var allNodeList = _hydroInfo.GetAllNodes();
            if (allNodeList != null && allNodeList.Count > 0)
            {
                var allCalcuNodeList = _calcuResult.NodeList;
                if (allCalcuNodeList != null && allCalcuNodeList.Count > 0)
                foreach (var node in allNodeList)
                {
                    foreach (var node in allNodeList)
                    var calcuNode = _calcuResult.NodeList?.Find(x => x.Id == node.Code);
                    if (calcuNode != null)
                    {
                        var calcuNode = allCalcuNodeList.Find(x => x.Id == node.Code);
                        if (calcuNode != null)
                        var calcuResult = new HydroCalcuNodeResult()
                        {
                            var calcuResult = new HydroCalcuNodeResult()
                            {
                                Code = node.Code,
                                CalcuPress = calcuNode.Press,
                                CalcuHead = calcuNode.Head,
                                CalcuDemand = calcuNode.Demand
                            };
                            _allCalcuResultList.Add(calcuResult);
                        }
                            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)
            {
                var allCalcuLinkList = _calcuResult.LinkList;
                if (allCalcuLinkList != null && allCalcuLinkList.Count > 0)
                foreach (var link in allLinkList)
                {
                    foreach (var link in allLinkList)
                    var calcuLink = _calcuResult.LinkList?.Find(x => x.Id == link.Code);
                    if (calcuLink != null)
                    {
                        var calcuLink = allCalcuLinkList.Find(x => x.Id == link.Code);
                        if (calcuLink != null)
                        var calcuResult = new HydroCalcuLinkResult()
                        {
                            if (link is Yw.Model.HydroPumpInfo pump)
                            {
                                var calcuResult = new HydroCalcuPumpResult()
                                {
                                    Code = link.Code,
                                    CalcuFlow = calcuLink.Flow,
                                    CalcuVelocity = calcuLink.Velocity,
                                    CalcuHeadLoss = calcuLink.Headloss,
                                    CalcuQ = calcuLink.Flow
                                };
                                if (calcuResult.CalcuQ > 0)
                                {
                                    var startCalcuNode = _calcuResult.NodeList?.Find(x => x.Id == link.StartCode);
                                    var endCalcuNode = _calcuResult.NodeList?.Find(x => x.Id == link.EndCode);
                                    if (startCalcuNode != null && endCalcuNode != null)
                                    {
                                        calcuResult.CalcuH = Math.Abs(startCalcuNode.Press - endCalcuNode.Press);
                                    }
                            Code = link.Code,
                            CalcuFlow = calcuLink.Flow,
                            CalcuVelocity = calcuLink.Velocity,
                            CalcuHeadLoss = calcuLink.Headloss
                        };
                        _allCalcuResultList.Add(calcuResult);
                    }
                }
            }
                                    if (pump.RatedN.HasValue)
            //流量计
            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)
                                    {
                                        var curveqp = _hydroInfo.Curves?.Find(x => x.Code == pump.CurveQP);
                                        if (curveqp != null)
                                        if (curveqp.CurveData != null && curveqp.CurveData.Count > 3)
                                        {
                                            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);
                                                calcuResult.CalcuP = pumpCurveQp.FeatCurve.GetPointY(calcuResult.CalcuQ.Value);
                                            }
                                            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 (calcuResult.CalcuH.HasValue && calcuResult.CalcuP.HasValue)
                                    {
                                        calcuResult.CalcuE = Yw.Pump.CalculationHelper.CalcuE(calcuResult.CalcuQ.Value, calcuResult.CalcuH.Value, calcuResult.CalcuP.Value);
                                    }
                                }
                                _allCalcuResultList.Add(calcuResult);
                            }
                            else
                            {
                                var calcuResult = new HydroCalcuLinkResult()
                                if (calcuPumpNewResult.CalcuH.HasValue && calcuPumpNewResult.CalcuP.HasValue)
                                {
                                    Code = link.Code,
                                    CalcuFlow = calcuLink.Flow,
                                    CalcuVelocity = calcuLink.Velocity,
                                    CalcuHeadLoss = calcuLink.Headloss
                                };
                                _allCalcuResultList.Add(calcuResult);
                                    calcuPumpNewResult.CalcuE = Yw.Pump.CalculationHelper.CalcuE(calcuPumpNewResult.CalcuQ.Value, calcuPumpNewResult.CalcuH.Value, calcuPumpNewResult.CalcuP.Value);
                                }
                            }
                        }
                        _allCalcuResultList.Remove(calcuPumpResult);
                        _allCalcuResultList.Add(calcuPumpNewResult);
                    }
                }
            }
@@ -1290,12 +1523,12 @@
                    {
                        var first = list.First();
                        var allParterList = _hydroInfo.GetAllParters();
                        _parter = allParterList?.Find(x => x.Code == first.Code);
                        _selectedParter = allParterList?.Find(x => x.Code == first.Code);
                        list.ForEach(x => elementIds.Add(x.Code));
                    }
                    else
                    {
                        _parter = null;
                        _selectedParter = null;
                    }
                    await _bimfaceCtrl?.ZoomAndSelectComponents(elementIds);
                    ShowProperty();
@@ -1329,22 +1562,18 @@
        #region 模型标注
        //所有标注列表
        private List<HydroMarkSetViewModel> _allMarkList = null;
        //所有标注设置列表
        private List<HydroMarkSetViewModel> _allMarkSetList = null;
        //显示标注窗体
        private async void ShowMarkDlg()
        //获取标注设置列表
        private List<HydroMarkSetViewModel> GetMarkSetList()
        {
            if (_hydroInfo == null)
            if (_allMarkSetList == null)
            {
                return;
            }
            if (_allMarkList == null)
            {
                _allMarkList = new List<HydroMarkSetViewModel>();
                _allMarkSetList = new List<HydroMarkSetViewModel>();
                if (_hydroInfo.Waterboxs != null && _hydroInfo.Waterboxs.Count > 0)
                {
                    _allMarkList.Add(new HydroMarkSetViewModel()
                    _allMarkSetList.Add(new HydroMarkSetViewModel()
                    {
                        Code = Yw.Hydro.ParterCatalog.Waterbox,
                        Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Waterbox),
@@ -1353,7 +1582,7 @@
                }
                if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0)
                {
                    _allMarkList.Add(new HydroMarkSetViewModel()
                    _allMarkSetList.Add(new HydroMarkSetViewModel()
                    {
                        Code = Yw.Hydro.ParterCatalog.Pump,
                        Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pump),
@@ -1362,7 +1591,7 @@
                }
                if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0)
                {
                    _allMarkList.Add(new HydroMarkSetViewModel()
                    _allMarkSetList.Add(new HydroMarkSetViewModel()
                    {
                        Code = Yw.Hydro.ParterCatalog.Valve,
                        Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Valve),
@@ -1371,7 +1600,7 @@
                }
                if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0)
                {
                    _allMarkList.Add(new HydroMarkSetViewModel()
                    _allMarkSetList.Add(new HydroMarkSetViewModel()
                    {
                        Code = Yw.Hydro.ParterCatalog.Pipe,
                        Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pipe),
@@ -1380,7 +1609,7 @@
                }
                if (_hydroInfo.Nozzles != null && _hydroInfo.Nozzles.Count > 0)
                {
                    _allMarkList.Add(new HydroMarkSetViewModel()
                    _allMarkSetList.Add(new HydroMarkSetViewModel()
                    {
                        Code = Yw.Hydro.ParterCatalog.Nozzle,
                        Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Nozzle),
@@ -1388,54 +1617,561 @@
                    });
                }
            }
            var dlg = new SetHydroMarkDlg();
            dlg.InitialData(() => _hydroInfo);
            dlg.SetBindingData(_allMarkList);
            dlg.ReloadDataEvent += async (allResultList) =>
            return _allMarkSetList;
        }
        //所有标注结果列表
        private List<HydroMarkResultViewModel> _allMarkResultList = null;
        //获取标注结果列表
        private List<HydroMarkResultViewModel> GetMarkResultList()
        {
            if (_hydroInfo == null)
            {
                var leadLabels = allResultList?.Select(x => new LogicMarkLeadLabel(x.Code, x.Text)).ToList();
                await _bimfaceCtrl?.SetLogicMarkLeadLabels(leadLabels);
            };
            if (dlg.ShowDialog() != DialogResult.OK)
            {
                await _bimfaceCtrl?.ClearLogicMarkLeadLabels();
                return default;
            }
            _allMarkResultList = new List<HydroMarkResultViewModel>();
            var allMarkSetList = GetMarkSetList();
            foreach (var markSet in allMarkSetList)
            {
                switch (markSet.Code)
                {
                    case Yw.Hydro.ParterCatalog.Waterbox:
                        {
                            if (_hydroInfo.Waterboxs != null && _hydroInfo.Waterboxs.Count > 0)
                            {
                                switch ((eWaterboxMarkType)markSet.MarkType)
                                {
                                    case eWaterboxMarkType.None:
                                        {
                                        }
                                        break;
                                    case eWaterboxMarkType.PoolElev:
                                        {
                                            _hydroInfo.Waterboxs.ForEach(t =>
                                            {
                                                _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                {
                                                    Code = t.Code,
                                                    Text = $"池底标高:{Math.Round(t.PoolElev, 4)}m"
                                                });
                                            });
                                        }
                                        break;
                                    case eWaterboxMarkType.InitLevel:
                                        {
                                            _hydroInfo.Waterboxs.ForEach(t =>
                                            {
                                                _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                {
                                                    Code = t.Code,
                                                    Text = $"初始水位:{Math.Round(t.InitLevel, 4)}m"
                                                });
                                            });
                                        }
                                        break;
                                    case eWaterboxMarkType.MinLevel:
                                        {
                                            _hydroInfo.Waterboxs.ForEach(t =>
                                            {
                                                _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                {
                                                    Code = t.Code,
                                                    Text = $"最小水位:{Math.Round(t.MinLevel, 4)}m"
                                                });
                                            });
                                        }
                                        break;
                                    case eWaterboxMarkType.MaxLevel:
                                        {
                                            _hydroInfo.Waterboxs.ForEach(t =>
                                            {
                                                _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                {
                                                    Code = t.Code,
                                                    Text = $"最高水位:{Math.Round(t.MaxLevel, 4)}m"
                                                });
                                            });
                                        }
                                        break;
                                    case eWaterboxMarkType.DN:
                                        {
                                            _hydroInfo.Waterboxs.ForEach(t =>
                                            {
                                                _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                {
                                                    Code = t.Code,
                                                    Text = $"直径:{Math.Round(t.DN, 4)}m"
                                                });
                                            });
                                        }
                                        break;
                                    case eWaterboxMarkType.MinVol:
                                        {
                                            _hydroInfo.Waterboxs.ForEach(t =>
                                            {
                                                _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                {
                                                    Code = t.Code,
                                                    Text = $"最小容积:{Math.Round(t.MinVol, 1)}m"
                                                });
                                            });
                                        }
                                        break;
                                    default: break;
                                }
                            }
                        }
                        break;
                    case Yw.Hydro.ParterCatalog.Pump:
                        {
                            if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0)
                            {
                                switch ((ePumpMarkType)markSet.MarkType)
                                {
                                    case ePumpMarkType.None:
                                        {
                                        }
                                        break;
                                    case ePumpMarkType.PumpStatus:
                                        {
                                            _hydroInfo.Pumps.ForEach(t =>
                                            {
                                                _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                {
                                                    Code = t.Code,
                                                    Text = $"开机状态:{Yw.WinFrmUI.HydroLinkStatusHelper.GetStatusName(t.LinkStatus)}"
                                                });
                                            });
                                        }
                                        break;
                                    case ePumpMarkType.RatedP:
                                        {
                                            _hydroInfo.Pumps.ForEach(t =>
                                            {
                                                _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                {
                                                    Code = t.Code,
                                                    Text = $"额定功率:{t.RatedP}kW"
                                                });
                                            });
                                        }
                                        break;
                                    case ePumpMarkType.RatedQ:
                                        {
                                            _hydroInfo.Pumps.ForEach(t =>
                                            {
                                                _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                {
                                                    Code = t.Code,
                                                    Text = $"额定流量:{t.RatedQ}m³/h"
                                                });
                                            });
                                        }
                                        break;
                                    case ePumpMarkType.RatedH:
                                        {
                                            _hydroInfo.Pumps.ForEach(t =>
                                            {
                                                _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                {
                                                    Code = t.Code,
                                                    Text = $"额定扬程:{t.RatedH}m"
                                                });
                                            });
                                        }
                                        break;
                                    case ePumpMarkType.RatedN:
                                        {
                                            _hydroInfo.Pumps.ForEach(t =>
                                            {
                                                _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                {
                                                    Code = t.Code,
                                                    Text = $"额定转速:{t.RatedN}r/min"
                                                });
                                            });
                                        }
                                        break;
                                    case ePumpMarkType.RatedHz:
                                        {
                                            _hydroInfo.Pumps.ForEach(t =>
                                            {
                                                _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                {
                                                    Code = t.Code,
                                                    Text = $"额定频率:{t.RatedHz}"
                                                });
                                            });
                                        }
                                        break;
                                    case ePumpMarkType.CurrentN:
                                        {
                                            _hydroInfo.Pumps.ForEach(t =>
                                            {
                                                if (t.RatedN.HasValue)
                                                {
                                                    _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                    {
                                                        Code = t.Code,
                                                        Text = $"设定转速:{Math.Round(t.RatedN.Value * t.SpeedRatio, 1)}r/min"
                                                    });
                                                }
                                            });
                                        }
                                        break;
                                    case ePumpMarkType.CurrentHz:
                                        {
                                            _hydroInfo.Pumps.ForEach(t =>
                                            {
                                                _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                {
                                                    Code = t.Code,
                                                    Text = $"设定频率:{Math.Round(t.RatedHz * t.SpeedRatio, 1)}hz"
                                                });
                                            });
                                        }
                                        break;
                                    default: break;
                                }
                            }
                        }
                        break;
                    case Yw.Hydro.ParterCatalog.Valve:
                        {
                            if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0)
                            {
                                switch ((eValveMarkType)markSet.MarkType)
                                {
                                    case eValveMarkType.None:
                                        {
                                        }
                                        break;
                                    case eValveMarkType.ValveStatus:
                                        {
                                            _hydroInfo.Valves.ForEach(t =>
                                            {
                                                _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                {
                                                    Code = t.Code,
                                                    Text = $"阀门状态:{HydroLinkStatusHelper.GetStatusName(t.LinkStatus)}"
                                                });
                                            });
                                        }
                                        break;
                                    case eValveMarkType.ValveType:
                                        {
                                            _hydroInfo.Valves.ForEach(t =>
                                            {
                                                _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                {
                                                    Code = t.Code,
                                                    Text = $"阀门类型:{HydroValveTypeHelper.GetTypeName(t.ValveType)}"
                                                });
                                            });
                                        }
                                        break;
                                    case eValveMarkType.Diameter:
                                        {
                                            _hydroInfo.Valves.ForEach(t =>
                                            {
                                                _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                {
                                                    Code = t.Code,
                                                    Text = $"直径:{t.Diameter}mm"
                                                });
                                            });
                                        }
                                        break;
                                    case eValveMarkType.MinorLoss:
                                        {
                                            _hydroInfo.Valves.ForEach(t =>
                                            {
                                                _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                {
                                                    Code = t.Code,
                                                    Text = $"局阻系数:{t.MinorLoss}"
                                                });
                                            });
                                        }
                                        break;
                                    default: break;
                                }
                            }
                        }
                        break;
                    case Yw.Hydro.ParterCatalog.Pipe:
                        {
                            if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0)
                            {
                                switch ((ePipeMarkType)markSet.MarkType)
                                {
                                    case ePipeMarkType.None:
                                        {
                                        }
                                        break;
                                    case ePipeMarkType.PipeStatus:
                                        {
                                            _hydroInfo.Pipes.ForEach(t =>
                                            {
                                                _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                {
                                                    Code = t.Code,
                                                    Text = $"状态:{Yw.WinFrmUI.HydroLinkStatusHelper.GetStatusName(t.LinkStatus)}"
                                                });
                                            });
                                        }
                                        break;
                                    case ePipeMarkType.Diameter:
                                        {
                                            _hydroInfo.Pipes.ForEach(t =>
                                            {
                                                _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                {
                                                    Code = t.Code,
                                                    Text = $"直径:{t.Diameter}mm"
                                                });
                                            });
                                        }
                                        break;
                                    case ePipeMarkType.Length:
                                        {
                                            _hydroInfo.Pipes.ForEach(t =>
                                            {
                                                _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                {
                                                    Code = t.Code,
                                                    Text = $"长度:{t.Length}m"
                                                });
                                            });
                                        }
                                        break;
                                    case ePipeMarkType.Roughness:
                                        {
                                            _hydroInfo.Pipes.ForEach(t =>
                                            {
                                                _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                {
                                                    Code = t.Code,
                                                    Text = $"粗糙系数:{t.Roughness}"
                                                });
                                            });
                                        }
                                        break;
                                    case ePipeMarkType.MinorLoss:
                                        {
                                            _hydroInfo.Pipes.ForEach(t =>
                                            {
                                                _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                {
                                                    Code = t.Code,
                                                    Text = $"局阻系数:{t.MinorLoss}"
                                                });
                                            });
                                        }
                                        break;
                                    default: break;
                                }
                            }
                        }
                        break;
                    case Yw.Hydro.ParterCatalog.Nozzle:
                        {
                            if (_hydroInfo.Nozzles != null && _hydroInfo.Nozzles.Count > 0)
                            {
                                switch ((eNozzleMarkType)markSet.MarkType)
                                {
                                    case eNozzleMarkType.None:
                                        {
                                        }
                                        break;
                                    case eNozzleMarkType.Elev:
                                        {
                                            _hydroInfo.Nozzles.ForEach(t =>
                                            {
                                                _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                {
                                                    Code = t.Code,
                                                    Text = $"标高:{Math.Round(t.Elev, 4)}m"
                                                });
                                            });
                                        }
                                        break;
                                    case eNozzleMarkType.Demand:
                                        {
                                            _hydroInfo.Nozzles.ForEach(t =>
                                            {
                                                _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                {
                                                    Code = t.Code,
                                                    Text = $"需水量:{t.Demand}m³/h"
                                                });
                                            });
                                        }
                                        break;
                                    case eNozzleMarkType.Coefficient:
                                        {
                                            _hydroInfo.Nozzles.ForEach(t =>
                                            {
                                                _allMarkResultList.Add(new HydroMarkResultViewModel()
                                                {
                                                    Code = t.Code,
                                                    Text = $"喷射系数:{t.Coefficient}"
                                                });
                                            });
                                        }
                                        break;
                                    default: break;
                                }
                            }
                        }
                        break;
                    default: break;
                }
            }
            return _allMarkResultList;
        }
        //应用标注结果列表
        private async Task ApplyMarkResultList()
        {
            var allMarkResultList = GetMarkResultList();
            var leadLabels = allMarkResultList?.Select(x => new LogicMarkLeadLabel(x.Code, x.Text, 100000)).ToList();
            await _bimfaceCtrl?.SetLogicMarkLeadLabels(leadLabels);
            TipFormHelper.ShowSucceed("标注信息已设置");
        }
        //清除标注结果列表
        private async Task ClearMarkResultList()
        {
            if (_allMarkResultList == null || _allMarkResultList.Count < 1)
            {
                TipFormHelper.ShowWarn("尚未设置标注信息");
                return;
            }
            _allMarkResultList = null;
            await _bimfaceCtrl?.ClearLogicMarkLeadLabels();
            TipFormHelper.ShowSucceed("标注信息已清除");
        }
        //显示标注设置窗体
        private void ShowMarkSetDlg()
        {
            if (_hydroInfo == null)
            {
                return;
            }
            var allMarkSetList = GetMarkSetList();
            var dlg = new SetHydroMarkDlg();
            dlg.SetBindingData(allMarkSetList);
            dlg.ReloadDataEvent += async (list) =>
            {
                _allMarkSetList = list;
                await ApplyMarkResultList();
            };
            dlg.ShowDialog();
        }
        //设置标注
        private void barBtnSetMark_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ShowMarkDlg();
            ShowMarkSetDlg();
        }
        //清除标注
        private async void barBtnClearMark_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            await ClearMarkResultList();
        }
        #endregion
        #region 颜色分级
        //颜色分级应用列表
        private List<HydroGradingApplyViewModel> _allGradingApplyList = null;
        //颜色分级编码列表
        private List<string> _allGradingCodeList = null;
        #region 颜色配置
        //设置颜色分级
        private void SetGrading()
        //所有分级列表
        private List<HydroGradingVmo> _allGradingList = null;
        //获取分级列表
        private async Task<List<HydroGradingVmo>> GetGradingList()
        {
            if (_hydroInfo == null)
            {
                return default;
            }
            if (_allGradingList == null)
            {
                _allGradingList = await BLLFactory<Yw.BLL.HydroGrading>.Instance.GetByModelID(_hydroInfo.ID);
                if (_allGradingList == null || _allGradingList.Count < 1)
                {
                    var config = Yw.Settings.HydroParasHelper.Hydro.Grading;
                    if (config != null && config.Items != null && config.Items.Count > 0)
                    {
                        _allGradingList = new List<HydroGradingVmo>();
                        config.Items.ForEach(x =>
                        {
                            var vmo = new HydroGradingVmo()
                            {
                                ModelID = _hydroInfo.ID,
                                Catalog = x.Catalog,
                                PropName = x.PropName,
                                SetValue = x.SetValue,
                                MinValue = x.MinValue,
                                MaxValue = x.MaxValue,
                                Color = x.Color,
                                SortCode = config.Items.IndexOf(x)
                            };
                            _allGradingList.Add(vmo);
                        });
                    }
                }
            }
            return _allGradingList;
        }
        //显示配置颜色分级窗体
        private async void ShowSetGradingDlg()
        {
            if (_hydroInfo == null)
            {
                return;
            }
            var dlg = new SetHydroGradingModelDlg();
            dlg.SetBindingData(_hydroInfo.ID);
            var allGradingList = await GetGradingList();
            var dlg = new SetHydroGradingTreeDlg();
            dlg.SetBindingData(_hydroInfo, allGradingList);
            dlg.ReloadDataEvent += (list) =>
            {
                _allGradingList = list;
            };
            dlg.ApplyDataEvent += (catalog, propName) =>
            {
                ApplyGrading(catalog, propName);
            };
            dlg.ShowDialog();
        }
        //应用颜色分级
        private async void ApplyGrading()
        //配置颜色分级
        private void barBtnGradingSet_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_hydroInfo == null)
            {
                return;
            }
            ShowSetGradingDlg();
        }
        #endregion
        #region 应用分级
        //颜色分级应用列表
        private List<HydroGradingApplyViewModel> _allGradingApplyList = null;
        //获取颜色分级应用列表
        private List<HydroGradingApplyViewModel> GetGradingApplyList()
        {
            if (_allGradingApplyList == null)
            {
                _allGradingApplyList = new List<HydroGradingApplyViewModel>();
@@ -1446,7 +2182,7 @@
                    {
                        Code = Yw.Hydro.ParterCatalog.Pump,
                        Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pump),
                        PropName = string.Empty
                        PropName = Yw.Hydro.ParterProp.LinkStatus
                    });
                }
                if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0)
@@ -1455,7 +2191,7 @@
                    {
                        Code = Yw.Hydro.ParterCatalog.Valve,
                        Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Valve),
                        PropName = string.Empty
                        PropName = Yw.Hydro.ParterProp.LinkStatus
                    });
                }
                if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0)
@@ -1464,38 +2200,823 @@
                    {
                        Code = Yw.Hydro.ParterCatalog.Pipe,
                        Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pipe),
                        PropName = string.Empty
                        PropName = Yw.Hydro.ParterProp.CalcuFlow
                    });
                }
            }
            var dlg = new ApplyHydroGradingDlg();
            dlg.SetBindingData(() => _hydroInfo, _allGradingApplyList, GetAllCalcuResultList());
            dlg.ReloadDataEvent += (obj) =>
            return _allGradingApplyList;
        }
        //获取颜色分级应用结果列表
        private async Task<List<HydroGradingApplyResultViewModel>> GetGradingApplyResultList()
        {
            if (_hydroInfo == null)
            {
                _allGradingCodeList = obj?.Select(x => x.Code).Distinct().ToList();
                var objGroupList = obj?.GroupBy(x => x.Color).ToList();
                objGroupList?.ForEach(async x =>
                return default;
            }
            //所有分级列表
            var allGradingList = await GetGradingList();
            if (allGradingList == null || allGradingList.Count < 1)
            {
                return default;
            }
            //所有分级应用列表
            var allGradingApplyList = GetGradingApplyList();
            if (allGradingApplyList == null || allGradingApplyList.Count < 1)
            {
                return default;
            }
            //所有计算结果列表
            var allCalcuResultList = GetCalcuResultList();
            //所有应用结果列表
            var allGradingApplyResultList = new List<HydroGradingApplyResultViewModel>();
            allGradingApplyList.ForEach(x =>
            {
                var allCatalogGradingList = allGradingList.Where(t => t.Catalog == x.Code).ToList();
                if (allCatalogGradingList != null || allCatalogGradingList.Count > 0)
                {
                    await _bimfaceCtrl?.OverrideComponentsColor(x.Select(t => t.Code).Distinct().ToList(), x.Key, 1);
                });
            };
            if (dlg.ShowDialog() == DialogResult.Cancel)
                    switch (x.Code)
                    {
                        case Yw.Hydro.ParterCatalog.Pump:
                            {
                                if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0)
                                {
                                    foreach (var pump in _hydroInfo.Pumps)
                                    {
                                        switch (x.PropName)
                                        {
                                            case Yw.Hydro.ParterProp.LinkStatus:
                                                {
                                                    var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.LinkStatus).OrderBy(t => t.SortCode).ToList();
                                                    if (gradingList != null && gradingList.Count > 0)
                                                    {
                                                        var grading = gradingList.Meet(pump.LinkStatus);
                                                        if (grading != null)
                                                        {
                                                            var result = new HydroGradingApplyResultViewModel()
                                                            {
                                                                Code = pump.Code,
                                                                Color = grading.Color
                                                            };
                                                            allGradingApplyResultList.Add(result);
                                                        }
                                                    }
                                                }
                                                break;
                                            case Yw.Hydro.ParterProp.CalcuFlow:
                                                {
                                                    var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuFlow).OrderBy(t => t.SortCode).ToList();
                                                    if (gradingList != null && gradingList.Count > 0)
                                                    {
                                                        var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code);
                                                        if (calcuResult is HydroCalcuLinkResult calcuLinkResult)
                                                        {
                                                            if (calcuLinkResult.CalcuFlow.HasValue)
                                                            {
                                                                var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value));
                                                                if (grading != null)
                                                                {
                                                                    var result = new HydroGradingApplyResultViewModel()
                                                                    {
                                                                        Code = pump.Code,
                                                                        Color = grading.Color
                                                                    };
                                                                    allGradingApplyResultList.Add(result);
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                break;
                                            case Yw.Hydro.ParterProp.CalcuVelocity:
                                                {
                                                    var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList();
                                                    if (gradingList != null && gradingList.Count > 0)
                                                    {
                                                        var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code);
                                                        if (calcuResult is HydroCalcuLinkResult calcuLinkResult)
                                                        {
                                                            if (calcuLinkResult.CalcuVelocity.HasValue)
                                                            {
                                                                var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value));
                                                                if (grading != null)
                                                                {
                                                                    var result = new HydroGradingApplyResultViewModel()
                                                                    {
                                                                        Code = pump.Code,
                                                                        Color = grading.Color
                                                                    };
                                                                    allGradingApplyResultList.Add(result);
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                break;
                                            case Yw.Hydro.ParterProp.CalcuHeadLoss:
                                                {
                                                    var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList();
                                                    if (gradingList != null && gradingList.Count > 0)
                                                    {
                                                        var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code);
                                                        if (calcuResult is HydroCalcuLinkResult calcuLinkResult)
                                                        {
                                                            if (calcuLinkResult.CalcuHeadLoss.HasValue)
                                                            {
                                                                var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value));
                                                                if (grading != null)
                                                                {
                                                                    var result = new HydroGradingApplyResultViewModel()
                                                                    {
                                                                        Code = pump.Code,
                                                                        Color = grading.Color
                                                                    };
                                                                    allGradingApplyResultList.Add(result);
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                break;
                                            default: break;
                                        }
                                    }
                                }
                            }
                            break;
                        case Yw.Hydro.ParterCatalog.Valve:
                            {
                                if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0)
                                {
                                    foreach (var valve in _hydroInfo.Valves)
                                    {
                                        switch (x.PropName)
                                        {
                                            case Yw.Hydro.ParterProp.LinkStatus:
                                                {
                                                    var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.LinkStatus).OrderBy(t => t.SortCode).ToList();
                                                    if (gradingList != null && gradingList.Count > 0)
                                                    {
                                                        var grading = gradingList.Meet(valve.LinkStatus);
                                                        if (grading != null)
                                                        {
                                                            var result = new HydroGradingApplyResultViewModel()
                                                            {
                                                                Code = valve.Code,
                                                                Color = grading.Color
                                                            };
                                                            allGradingApplyResultList.Add(result);
                                                        }
                                                    }
                                                }
                                                break;
                                            case Yw.Hydro.ParterProp.CalcuFlow:
                                                {
                                                    var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuFlow).OrderBy(t => t.SortCode).ToList();
                                                    if (gradingList != null && gradingList.Count > 0)
                                                    {
                                                        var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code);
                                                        if (calcuResult is HydroCalcuLinkResult calcuLinkResult)
                                                        {
                                                            if (calcuLinkResult.CalcuFlow.HasValue)
                                                            {
                                                                var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value));
                                                                if (grading != null)
                                                                {
                                                                    var result = new HydroGradingApplyResultViewModel()
                                                                    {
                                                                        Code = valve.Code,
                                                                        Color = grading.Color
                                                                    };
                                                                    allGradingApplyResultList.Add(result);
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                break;
                                            case Yw.Hydro.ParterProp.CalcuVelocity:
                                                {
                                                    var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList();
                                                    if (gradingList != null && gradingList.Count > 0)
                                                    {
                                                        var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code);
                                                        if (calcuResult is HydroCalcuLinkResult calcuLinkResult)
                                                        {
                                                            if (calcuLinkResult.CalcuVelocity.HasValue)
                                                            {
                                                                var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value));
                                                                if (grading != null)
                                                                {
                                                                    var result = new HydroGradingApplyResultViewModel()
                                                                    {
                                                                        Code = valve.Code,
                                                                        Color = grading.Color
                                                                    };
                                                                    allGradingApplyResultList.Add(result);
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                break;
                                            case Yw.Hydro.ParterProp.CalcuHeadLoss:
                                                {
                                                    var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList();
                                                    if (gradingList != null && gradingList.Count > 0)
                                                    {
                                                        var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code);
                                                        if (calcuResult is HydroCalcuLinkResult calcuLinkResult)
                                                        {
                                                            if (calcuLinkResult.CalcuHeadLoss.HasValue)
                                                            {
                                                                var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value));
                                                                if (grading != null)
                                                                {
                                                                    var result = new HydroGradingApplyResultViewModel()
                                                                    {
                                                                        Code = valve.Code,
                                                                        Color = grading.Color
                                                                    };
                                                                    allGradingApplyResultList.Add(result);
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                break;
                                            default: break;
                                        }
                                    }
                                }
                            }
                            break;
                        case Yw.Hydro.ParterCatalog.Pipe:
                            {
                                if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0)
                                {
                                    foreach (var pipe in _hydroInfo.Pipes)
                                    {
                                        switch (x.PropName)
                                        {
                                            case Yw.Hydro.ParterProp.CalcuFlow:
                                                {
                                                    var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuFlow).OrderBy(t => t.SortCode).ToList();
                                                    if (gradingList != null && gradingList.Count > 0)
                                                    {
                                                        var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code);
                                                        if (calcuResult is HydroCalcuLinkResult calcuLinkResult)
                                                        {
                                                            if (calcuLinkResult.CalcuFlow.HasValue)
                                                            {
                                                                var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value));
                                                                if (grading != null)
                                                                {
                                                                    var result = new HydroGradingApplyResultViewModel()
                                                                    {
                                                                        Code = pipe.Code,
                                                                        Color = grading.Color
                                                                    };
                                                                    allGradingApplyResultList.Add(result);
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                break;
                                            case Yw.Hydro.ParterProp.CalcuVelocity:
                                                {
                                                    var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList();
                                                    if (gradingList != null && gradingList.Count > 0)
                                                    {
                                                        var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code);
                                                        if (calcuResult is HydroCalcuLinkResult calcuLinkResult)
                                                        {
                                                            if (calcuLinkResult.CalcuVelocity.HasValue)
                                                            {
                                                                var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value));
                                                                if (grading != null)
                                                                {
                                                                    var result = new HydroGradingApplyResultViewModel()
                                                                    {
                                                                        Code = pipe.Code,
                                                                        Color = grading.Color
                                                                    };
                                                                    allGradingApplyResultList.Add(result);
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                break;
                                            case Yw.Hydro.ParterProp.CalcuHeadLoss:
                                                {
                                                    var gradingList = allCatalogGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList();
                                                    if (gradingList != null && gradingList.Count > 0)
                                                    {
                                                        var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code);
                                                        if (calcuResult is HydroCalcuLinkResult calcuLinkResult)
                                                        {
                                                            if (calcuLinkResult.CalcuHeadLoss.HasValue)
                                                            {
                                                                var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value));
                                                                if (grading != null)
                                                                {
                                                                    var result = new HydroGradingApplyResultViewModel()
                                                                    {
                                                                        Code = pipe.Code,
                                                                        Color = grading.Color
                                                                    };
                                                                    allGradingApplyResultList.Add(result);
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                break;
                                            default: break;
                                        }
                                    }
                                }
                            }
                            break;
                        default: break;
                    }
                }
            });
            return allGradingApplyResultList;
        }
        //获取颜色分级应用结果列表
        private async Task<List<HydroGradingApplyResultViewModel>> GetGradingApplyResultList(string catalog, string propName)
        {
            if (_hydroInfo == null)
            {
                await _bimfaceCtrl?.RestoreComponentsColor(_allGradingCodeList);
                return default;
            }
            //所有分级列表
            var allGradingList = await GetGradingList();
            if (allGradingList == null || allGradingList.Count < 1)
            {
                return default;
            }
            var currentGradingList = allGradingList.Where(x => x.Catalog == catalog).ToList();
            if (currentGradingList.Count < 1)
            {
                return default;
            }
            //所有分级应用列表
            var allGradingApplyList = GetGradingApplyList();
            if (allGradingApplyList == null || allGradingApplyList.Count < 1)
            {
                return default;
            }
            //当前分级应用
            var gradingApply = allGradingApplyList.Find(x => x.Code == catalog);
            if (gradingApply == null)
            {
                return default;
            }
            gradingApply.PropName = propName;
            //所有计算结果
            var allCalcuResultList = GetCalcuResultList();
            //应用结果列表
            var gradingApplyResultList = new List<HydroGradingApplyResultViewModel>();
            switch (catalog)
            {
                case Yw.Hydro.ParterCatalog.Pump:
                    {
                        if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0)
                        {
                            foreach (var pump in _hydroInfo.Pumps)
                            {
                                switch (propName)
                                {
                                    case Yw.Hydro.ParterProp.LinkStatus:
                                        {
                                            var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.LinkStatus).OrderBy(t => t.SortCode).ToList();
                                            if (gradingList != null && gradingList.Count > 0)
                                            {
                                                var grading = gradingList.Meet(pump.LinkStatus);
                                                if (grading != null)
                                                {
                                                    var result = new HydroGradingApplyResultViewModel()
                                                    {
                                                        Code = pump.Code,
                                                        Color = grading.Color
                                                    };
                                                    gradingApplyResultList.Add(result);
                                                }
                                            }
                                        }
                                        break;
                                    case Yw.Hydro.ParterProp.CalcuFlow:
                                        {
                                            var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuFlow).OrderBy(t => t.SortCode).ToList();
                                            if (gradingList != null && gradingList.Count > 0)
                                            {
                                                var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code);
                                                if (calcuResult is HydroCalcuLinkResult calcuLinkResult)
                                                {
                                                    if (calcuLinkResult.CalcuFlow.HasValue)
                                                    {
                                                        var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value));
                                                        if (grading != null)
                                                        {
                                                            var result = new HydroGradingApplyResultViewModel()
                                                            {
                                                                Code = pump.Code,
                                                                Color = grading.Color
                                                            };
                                                            gradingApplyResultList.Add(result);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        break;
                                    case Yw.Hydro.ParterProp.CalcuVelocity:
                                        {
                                            var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList();
                                            if (gradingList != null && gradingList.Count > 0)
                                            {
                                                var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code);
                                                if (calcuResult is HydroCalcuLinkResult calcuLinkResult)
                                                {
                                                    if (calcuLinkResult.CalcuVelocity.HasValue)
                                                    {
                                                        var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value));
                                                        if (grading != null)
                                                        {
                                                            var result = new HydroGradingApplyResultViewModel()
                                                            {
                                                                Code = pump.Code,
                                                                Color = grading.Color
                                                            };
                                                            gradingApplyResultList.Add(result);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        break;
                                    case Yw.Hydro.ParterProp.CalcuHeadLoss:
                                        {
                                            var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList();
                                            if (gradingList != null && gradingList.Count > 0)
                                            {
                                                var calcuResult = allCalcuResultList?.Find(t => t.Code == pump.Code);
                                                if (calcuResult is HydroCalcuLinkResult calcuLinkResult)
                                                {
                                                    if (calcuLinkResult.CalcuHeadLoss.HasValue)
                                                    {
                                                        var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value));
                                                        if (grading != null)
                                                        {
                                                            var result = new HydroGradingApplyResultViewModel()
                                                            {
                                                                Code = pump.Code,
                                                                Color = grading.Color
                                                            };
                                                            gradingApplyResultList.Add(result);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        break;
                                    default: break;
                                }
                            }
                        }
                    }
                    break;
                case Yw.Hydro.ParterCatalog.Valve:
                    {
                        if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0)
                        {
                            foreach (var valve in _hydroInfo.Valves)
                            {
                                switch (propName)
                                {
                                    case Yw.Hydro.ParterProp.LinkStatus:
                                        {
                                            var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.LinkStatus).OrderBy(t => t.SortCode).ToList();
                                            if (gradingList != null && gradingList.Count > 0)
                                            {
                                                var grading = gradingList.Meet(valve.LinkStatus);
                                                if (grading != null)
                                                {
                                                    var result = new HydroGradingApplyResultViewModel()
                                                    {
                                                        Code = valve.Code,
                                                        Color = grading.Color
                                                    };
                                                    gradingApplyResultList.Add(result);
                                                }
                                            }
                                        }
                                        break;
                                    case Yw.Hydro.ParterProp.CalcuFlow:
                                        {
                                            var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuFlow).OrderBy(t => t.SortCode).ToList();
                                            if (gradingList != null && gradingList.Count > 0)
                                            {
                                                var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code);
                                                if (calcuResult is HydroCalcuLinkResult calcuLinkResult)
                                                {
                                                    if (calcuLinkResult.CalcuFlow.HasValue)
                                                    {
                                                        var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value));
                                                        if (grading != null)
                                                        {
                                                            var result = new HydroGradingApplyResultViewModel()
                                                            {
                                                                Code = valve.Code,
                                                                Color = grading.Color
                                                            };
                                                            gradingApplyResultList.Add(result);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        break;
                                    case Yw.Hydro.ParterProp.CalcuVelocity:
                                        {
                                            var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList();
                                            if (gradingList != null && gradingList.Count > 0)
                                            {
                                                var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code);
                                                if (calcuResult is HydroCalcuLinkResult calcuLinkResult)
                                                {
                                                    if (calcuLinkResult.CalcuVelocity.HasValue)
                                                    {
                                                        var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value));
                                                        if (grading != null)
                                                        {
                                                            var result = new HydroGradingApplyResultViewModel()
                                                            {
                                                                Code = valve.Code,
                                                                Color = grading.Color
                                                            };
                                                            gradingApplyResultList.Add(result);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        break;
                                    case Yw.Hydro.ParterProp.CalcuHeadLoss:
                                        {
                                            var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList();
                                            if (gradingList != null && gradingList.Count > 0)
                                            {
                                                var calcuResult = allCalcuResultList?.Find(t => t.Code == valve.Code);
                                                if (calcuResult is HydroCalcuLinkResult calcuLinkResult)
                                                {
                                                    if (calcuLinkResult.CalcuHeadLoss.HasValue)
                                                    {
                                                        var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value));
                                                        if (grading != null)
                                                        {
                                                            var result = new HydroGradingApplyResultViewModel()
                                                            {
                                                                Code = valve.Code,
                                                                Color = grading.Color
                                                            };
                                                            gradingApplyResultList.Add(result);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        break;
                                    default: break;
                                }
                            }
                        }
                    }
                    break;
                case Yw.Hydro.ParterCatalog.Pipe:
                    {
                        if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0)
                        {
                            foreach (var pipe in _hydroInfo.Pipes)
                            {
                                switch (propName)
                                {
                                    case Yw.Hydro.ParterProp.CalcuFlow:
                                        {
                                            var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuFlow).OrderBy(t => t.SortCode).ToList();
                                            if (gradingList != null && gradingList.Count > 0)
                                            {
                                                var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code);
                                                if (calcuResult is HydroCalcuLinkResult calcuLinkResult)
                                                {
                                                    if (calcuLinkResult.CalcuFlow.HasValue)
                                                    {
                                                        var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuFlow.Value));
                                                        if (grading != null)
                                                        {
                                                            var result = new HydroGradingApplyResultViewModel()
                                                            {
                                                                Code = pipe.Code,
                                                                Color = grading.Color
                                                            };
                                                            gradingApplyResultList.Add(result);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        break;
                                    case Yw.Hydro.ParterProp.CalcuVelocity:
                                        {
                                            var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuVelocity).OrderBy(t => t.SortCode).ToList();
                                            if (gradingList != null && gradingList.Count > 0)
                                            {
                                                var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code);
                                                if (calcuResult is HydroCalcuLinkResult calcuLinkResult)
                                                {
                                                    if (calcuLinkResult.CalcuVelocity.HasValue)
                                                    {
                                                        var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuVelocity.Value));
                                                        if (grading != null)
                                                        {
                                                            var result = new HydroGradingApplyResultViewModel()
                                                            {
                                                                Code = pipe.Code,
                                                                Color = grading.Color
                                                            };
                                                            gradingApplyResultList.Add(result);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        break;
                                    case Yw.Hydro.ParterProp.CalcuHeadLoss:
                                        {
                                            var gradingList = currentGradingList.Where(x => x.PropName == Yw.Hydro.ParterProp.CalcuHeadLoss).OrderBy(t => t.SortCode).ToList();
                                            if (gradingList != null && gradingList.Count > 0)
                                            {
                                                var calcuResult = allCalcuResultList?.Find(t => t.Code == pipe.Code);
                                                if (calcuResult is HydroCalcuLinkResult calcuLinkResult)
                                                {
                                                    if (calcuLinkResult.CalcuHeadLoss.HasValue)
                                                    {
                                                        var grading = gradingList.Meet(Math.Abs(calcuLinkResult.CalcuHeadLoss.Value));
                                                        if (grading != null)
                                                        {
                                                            var result = new HydroGradingApplyResultViewModel()
                                                            {
                                                                Code = pipe.Code,
                                                                Color = grading.Color
                                                            };
                                                            gradingApplyResultList.Add(result);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        break;
                                    default: break;
                                }
                            }
                        }
                    }
                    break;
                default: break;
            }
            return gradingApplyResultList;
        }
        //颜色分级是否应用了
        private bool _isGradingApply = false;
        //颜色分级应用编码列表
        private List<string> _allGradingApplyCodeList = null;
        //应用颜色分级
        private async void ApplyGrading()
        {
            if (_hydroInfo == null)
            {
                return;
            }
            _isGradingApply = true;
            var allGradingApplyResultList = await GetGradingApplyResultList();
            if (allGradingApplyResultList == null || allGradingApplyResultList.Count < 1)
            {
                CancelApplyGrading();
                return;
            }
            var objGroupList = allGradingApplyResultList.GroupBy(x => x.Color).ToList();
            objGroupList.ForEach(async x =>
            {
                await _bimfaceCtrl?.OverrideComponentsColor(x.Select(t => t.Code).Distinct().ToList(), x.Key, 1);
            });
            _allGradingApplyCodeList = allGradingApplyResultList.Select(x => x.Code).Distinct().ToList();
        }
        //应用颜色分级
        private async void ApplyGrading(string catalog, string propName)
        {
            if (_hydroInfo == null)
            {
                return;
            }
            _isGradingApply = true;
            var allGradingApplyResultList = await GetGradingApplyResultList(catalog, propName);
            if (allGradingApplyResultList == null || allGradingApplyResultList.Count < 1)
            {
                return;
            }
            var objGroupList = allGradingApplyResultList.GroupBy(x => x.Color).ToList();
            objGroupList.ForEach(async x =>
            {
                await _bimfaceCtrl?.OverrideComponentsColor(x.Select(t => t.Code).Distinct().ToList(), x.Key, 1);
            });
            var codeList = allGradingApplyResultList.Select(x => x.Code);
            if (_allGradingApplyCodeList == null)
            {
                _allGradingApplyCodeList = new List<string>();
            }
            _allGradingApplyCodeList.AddRange(codeList);
            _allGradingApplyCodeList = _allGradingApplyCodeList.Distinct().ToList();
        }
        //自动应用颜色分级
        private void AutoApplyGrading()
        {
            if (!_isGradingApply)
            {
                return;
            }
            ApplyGrading();
        }
        //取消应用颜色分级
        private async void CancelApplyGrading()
        {
            if (_hydroInfo == null)
            {
                return;
            }
            _isGradingApply = false;
            if (_allGradingApplyCodeList != null && _allGradingApplyCodeList.Count > 0)
            {
                await _bimfaceCtrl?.RestoreComponentsColor(_allGradingApplyCodeList);
            }
        }
        //设置
        private void barBtnGradingSet_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        //显示应用颜色分级窗体
        private void ShowApplyGradingDlg()
        {
            SetGrading();
            if (_hydroInfo == null)
            {
                return;
            }
            var allGradingApplyList = GetGradingApplyList();
            if (allGradingApplyList == null || allGradingApplyList.Count < 1)
            {
                return;
            }
            var dlg = new ApplyHydroGradingDlg();
            dlg.SetBindingData(allGradingApplyList);
            dlg.ReloadDataEvent += (obj) =>
            {
                _allGradingApplyList = obj;
                ApplyGrading();
            };
            dlg.ShowDialog();
        }
        //应用
        //应用颜色分级
        private void barBtnGradingApply_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ApplyGrading();
            ShowApplyGradingDlg();
        }
        //取消应用分级
        private void batBtnCancelGradingApply_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            CancelApplyGrading();
        }
        #endregion
        #endregion
@@ -1516,8 +3037,13 @@
                }
                var hydroRelation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance
                    .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation);
                Stopwatch sw = new Stopwatch();
                sw.Start();
                _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(hydroRelation.ModelID);
                _parter = null;
                sw.Stop();
                TimeSpan ts2 = sw.Elapsed;
                Console.WriteLine("Stopwatch总共花费{0}ms.", ts2.TotalMilliseconds);
                _selectedParter = null;
                await _bimfaceCtrl?.ZoomAndSelectComponents(null);
                ShowProperty();
                TipFormHelper.ShowSucceed("数据已刷新");
@@ -1525,5 +3051,35 @@
        }
        #endregion
        #region 水流动画
        //加载流向
        private async void barBtnLoadFlowDirection_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var pipes = _hydroInfo.Pipes;
            var list = pipes.Select(x =>
            {
                return new Yw.WinFrmUI.Bimface.LogicFlowEffect()
                {
                    Id = x.Code,
                    Rotation = 90,
                    Speed = 0.1d
                };
            }).ToList();
            await _bimfaceCtrl?.LoadFlowEffect(list);
        }
        //卸载流向
        private async void barBtnUnloadFlowDirection_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            await _bimfaceCtrl?.UnloadFlowEffect();
        }
        #endregion
    }
}