From cb3ec7cb8001317857087da706e51e6caa58f591 Mon Sep 17 00:00:00 2001
From: lixiaojun <1287241240@qq.com>
Date: 星期一, 21 十月 2024 12:01:20 +0800
Subject: [PATCH] 错误检查

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs |  281 +++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 257 insertions(+), 24 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs
index 64fb679..367f20f 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs
@@ -1,5 +1,6 @@
 锘縢lobal using Yw.EPAnet;
 using DevExpress.Mvvm.Native;
+using DevExpress.Pdf.Native;
 using DevExpress.Utils.DirectXPaint;
 using Yw.WinFrmUI.Bimface;
 using Yw.WinFrmUI.Hydro;
@@ -218,6 +219,54 @@
                 _propertyCtrl = new XhsProjectSimulationPropertyCtrl();
                 _propertyCtrl.Dock = DockStyle.Fill;
                 _propertyCtrl.InitialData(() => _hydroInfo);
+                _propertyCtrl.BlinkLinkParterEvent += async (code, linkCode) =>
+                { //寮鸿皟杩炴帴缁勪欢
+                    if (string.IsNullOrEmpty(code))
+                    {
+                        return;
+                    }
+                    if (string.IsNullOrEmpty(linkCode))
+                    {
+                        return;
+                    }
+                    if (_hydroInfo == null)
+                    {
+                        return;
+                    }
+                    var allVisualList = _hydroInfo.GetAllVisuals();
+                    if (allVisualList == null || allVisualList.Count < 1)
+                    {
+                        return;
+                    }
+                    var linkParter = allVisualList.Find(x => x.Code == linkCode);
+                    if (linkParter == null)
+                    {
+                        return;
+                    }
+                    var blinkCodes = new List<string>();
+                    if (linkParter.GetType() == typeof(Yw.Model.HydroJunctionInfo))
+                    {
+                        var allLinkList = _hydroInfo.GetAllLinks();
+                        if (allLinkList == null || allLinkList.Count < 1)
+                        {
+                            return;
+                        }
+                        var linkList = allLinkList.Where(x => (x.StartCode == linkParter.Code || x.EndCode == linkParter.Code) && x.Code != code).ToList();
+                        if (linkList == null || linkList.Count < 1)
+                        {
+                            return;
+                        }
+                        blinkCodes.AddRange(linkList.Select(x => x.Code));
+                    }
+                    else
+                    {
+                        blinkCodes.Add(linkCode);
+                    }
+
+                    await _bimfaceCtrl?.SetBlinkComponents(blinkCodes);
+                    await Task.Delay(5000);
+                    await _bimfaceCtrl?.ClearBlinkComponents();
+                };
             }
             return _propertyCtrl;
         }
@@ -228,9 +277,9 @@
             var propertyCtrl = GetPropertyCtrl();
             this.controlContainerRight.Controls.Clear();
             this.controlContainerRight.Controls.Add(propertyCtrl);
-            this.docPnlRight.Text = "灞炴��";
             this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
-            this.docPnlRight.Width = 270;
+            this.docPnlRight.Text = "灞炴��";
+            this.docPnlRight.Width = 300;
         }
 
         //灞炴�ч潰鏉挎寜閽�
@@ -246,6 +295,11 @@
             {
                 return;
             }
+            if (this.docPnlRight.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Hidden)
+            {
+                ShowPropertyCtrl();
+            }
+
             if (_parter == null)
             {
                 _propertyCtrl?.SelectParter(null);
@@ -288,6 +342,7 @@
                     }
                 }
             }
+
         }
 
         #endregion
@@ -411,11 +466,8 @@
 
         #region 涓�閿樉闅�
 
-        //鏄鹃殣缂栫爜鍒楄〃
-        private List<string> _fastShowHideCodeList = null;
-
-        //瑙﹀彂涓�閿樉闅�
-        private async void barBtnShowHide_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        //涓�閿樉闅�
+        private async Task FastShowHidden()
         {
             if (_hydroInfo == null)
             {
@@ -425,19 +477,28 @@
             {
                 return;
             }
-            if (_fastShowHideCodeList == null)
+            if (_fastShowHiddenCodeList == null)
             {
-                _fastShowHideCodeList = _hydroInfo.Decorators.Select(x => x.Code).ToList();
-                await _bimfaceCtrl?.HideComponents(_fastShowHideCodeList);
+                _fastShowHiddenCodeList = _hydroInfo.Decorators.Select(x => x.Code).ToList();
+                await _bimfaceCtrl?.HideComponents(_fastShowHiddenCodeList);
             }
             else
             {
-                await _bimfaceCtrl?.ShowComponents(_fastShowHideCodeList);
-                _fastShowHideCodeList = null;
+                await _bimfaceCtrl?.ShowComponents(_fastShowHiddenCodeList);
+                _fastShowHiddenCodeList = null;
             }
         }
 
-        #endregion 涓�閿樉闅�
+        //鏄鹃殣缂栫爜鍒楄〃
+        private List<string> _fastShowHiddenCodeList = null;
+
+        //瑙﹀彂涓�閿樉闅�
+        private async void barBtnFastShowHidden_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            await FastShowHidden();
+        }
+
+        #endregion
 
         #region 姘村姏鏍¢獙
 
@@ -490,9 +551,10 @@
             checkCtrl.SetBindingData(_checkResult);
             this.controlContainerBottom.Controls.Clear();
             this.controlContainerBottom.Controls.Add(checkCtrl);
+            this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
             this.docPnlBottom.Text = "鏍¢獙缁撴灉";
             this.docPnlBottom.Height = 350;
-            this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
+
         }
 
         //姘村姏楠岃瘉
@@ -531,6 +593,9 @@
 
         #region 鏋勪欢鏄庣粏
 
+        //鏋勪欢鏄庣粏鎺т欢
+        private Yw.WinFrmUI.HydroParterListCtrl _parterListCtrl = null;
+
         //鑾峰彇鏋勪欢鏄庣粏鎺т欢
         private Yw.WinFrmUI.HydroParterListCtrl GetParterListCtrl()
         {
@@ -554,8 +619,7 @@
             return _parterListCtrl;
         }
 
-        //鏋勪欢鏄庣粏鎺т欢
-        private Yw.WinFrmUI.HydroParterListCtrl _parterListCtrl = null;
+
 
         //姘村姏鏋勪欢鍒楄〃
         private void barBtnHydroParterList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
@@ -731,6 +795,74 @@
             return _calcuCtrl;
         }
 
+        //鑾峰彇璁$畻缁撴灉
+        private List<IHydroCalcuResult> GetAllCalcuResult()
+        {
+            if (_hydroInfo == null)
+            {
+                return default;
+            }
+            if (_calcuResult == null)
+            {
+                return default;
+            }
+            if (!_calcuResult.Succeed)
+            {
+                return default;
+            }
+            var list = new List<IHydroCalcuResult>();
+
+            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)
+                    {
+                        var calcuNode = allCalcuNodeList.Find(x => x.Id == node.Code);
+                        if (calcuNode != null)
+                        {
+                            var calcuResult = new HydroCalcuNodeResult()
+                            {
+                                Code = node.Code,
+                                CalcuPress = calcuNode.Press,
+                                CalcuHead = calcuNode.Head,
+                                CalcuDemand = calcuNode.Demand
+                            };
+                            list.Add(calcuResult);
+                        }
+                    }
+                }
+            }
+
+            var allListList = _hydroInfo.GetAllLinks();
+            if (allListList != null && allListList.Count > 0)
+            {
+                var allCalcuLinkList = _calcuResult.LinkList;
+                if (allCalcuLinkList != null && allCalcuLinkList.Count > 0)
+                {
+                    foreach (var link in allListList)
+                    {
+                        var calcuLink = allCalcuLinkList.Find(x => x.Id == link.Code);
+                        if (calcuLink != null)
+                        {
+                            var calcuResult = new HydroCalcuLinkResult()
+                            {
+                                Code = link.Code,
+                                CalcuFlow = calcuLink.Flow,
+                                CalcuVelocity = calcuLink.Velocity,
+                                CalcuHeadLoss = calcuLink.Headloss
+                            };
+                            list.Add(calcuResult);
+                        }
+                    }
+                }
+            }
+
+            return list;
+        }
+
         //姘村姏璁$畻
         private void barBtnHydroCalcu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
@@ -750,6 +882,9 @@
         #endregion
 
         #region 鏋勪欢鏌ヨ
+
+        //鏌ヨ缁勪欢
+        private XhsProjectSimulationSearchCtrl _searchCtrl = null;
 
         //鑾峰彇鏌ヨ缁勪欢
         private XhsProjectSimulationSearchCtrl GetSearchCtrl()
@@ -785,25 +920,28 @@
             return _searchCtrl;
         }
 
-        private XhsProjectSimulationSearchCtrl _searchCtrl = null;//鏌ヨ缁勪欢
-
-        //鏌ヨ
-        private void barBtnSearch_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        //鏄剧ず鏌ヨ鎺т欢
+        private void ShowSearchCtrl()
         {
             if (_hydroInfo == null)
             {
                 return;
             }
-
-            this.controlContainerBottom.Controls.Clear();
             var searchCtrl = GetSearchCtrl();
+            this.controlContainerBottom.Controls.Clear();
             this.controlContainerBottom.Controls.Add(searchCtrl);
             this.docPnlBottom.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
-            this.docPnlBottom.Text = "妯″瀷鏋勪欢鏌ヨ";
+            this.docPnlBottom.Text = "鏋勪欢鏌ヨ";
             this.docPnlBottom.Height = 350;
         }
 
-        #endregion 鏋勪欢鏌ヨ
+        //鏌ヨ
+        private void barBtnSearch_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            ShowSearchCtrl();
+        }
+
+        #endregion
 
         #region 鏍囨敞
 
@@ -887,6 +1025,101 @@
 
         #endregion
 
+        #region 棰滆壊鍒嗙骇
+
+        private List<HydroGradingApplyViewModel> _allGradingApplyList = null;
+        private List<string> _allGradingCodeList = null;
+
+        //璁剧疆
+        private void barBtnGradingSet_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            if (_hydroInfo == null)
+            {
+                return;
+            }
+            var dlg = new SetHydroGradingModelDlg();
+            dlg.SetBindingData(_hydroInfo.ID);
+            dlg.ShowDialog();
+        }
+
+        //搴旂敤
+        private void barBtnGradingApply_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            if (_hydroInfo == null)
+            {
+                return;
+            }
+            if (_allGradingApplyList == null)
+            {
+                _allGradingApplyList = new List<HydroGradingApplyViewModel>();
+                if (_hydroInfo.Waterboxs != null && _hydroInfo.Waterboxs.Count > 0)
+                {
+                    _allGradingApplyList.Add(new HydroGradingApplyViewModel()
+                    {
+                        Code = Yw.Hydro.ParterCatalog.Waterbox,
+                        Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Waterbox),
+                        PropName = string.Empty
+                    });
+                }
+                if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0)
+                {
+                    _allGradingApplyList.Add(new HydroGradingApplyViewModel()
+                    {
+                        Code = Yw.Hydro.ParterCatalog.Pump,
+                        Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pump),
+                        PropName = string.Empty
+                    });
+                }
+                if (_hydroInfo.Valves != null && _hydroInfo.Valves.Count > 0)
+                {
+                    _allGradingApplyList.Add(new HydroGradingApplyViewModel()
+                    {
+                        Code = Yw.Hydro.ParterCatalog.Valve,
+                        Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Valve),
+                        PropName = string.Empty
+                    });
+                }
+                if (_hydroInfo.Pipes != null && _hydroInfo.Pipes.Count > 0)
+                {
+                    _allGradingApplyList.Add(new HydroGradingApplyViewModel()
+                    {
+                        Code = Yw.Hydro.ParterCatalog.Pipe,
+                        Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Pipe),
+                        PropName = string.Empty
+                    });
+                }
+                if (_hydroInfo.Nozzles != null && _hydroInfo.Nozzles.Count > 0)
+                {
+                    _allGradingApplyList.Add(new HydroGradingApplyViewModel()
+                    {
+                        Code = Yw.Hydro.ParterCatalog.Nozzle,
+                        Name = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogName(Yw.Hydro.ParterCatalog.Nozzle),
+                        PropName = string.Empty
+                    });
+                }
+            }
+            var dlg = new ApplyHydroGradingDlg();
+            dlg.SetBindingData(() => _hydroInfo, _allGradingApplyList, GetAllCalcuResult());
+            dlg.ReloadDataEvent += (obj) =>
+            {
+                _allGradingCodeList = obj?.Select(x => x.Code).Distinct().ToList();
+                var objGroupList = obj?.GroupBy(x => x.Color).ToList();
+                objGroupList.ForEach(async x =>
+                {
+                    await _bimfaceCtrl?.OverrideComponentsColor(x.Select(t => t.Code).Distinct().ToList(), x.Key, 1);
+                });
+            };
+            dlg.ShowDialog();
+        }
+
+        //鍙栨秷
+        private async void barBtnGradingCancel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            await _bimfaceCtrl?.RestoreComponentsColor(_allGradingCodeList);
+        }
+
+        #endregion
+
 
 
     }

--
Gitblit v1.9.3