From caf081a70d327cfb455b2ddcd5edc2e0acb2d3bf Mon Sep 17 00:00:00 2001
From: lixiaojun <1287241240@qq.com>
Date: 星期二, 10 十二月 2024 00:18:12 +0800
Subject: [PATCH] 工况分析优化

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs |   67 ++++++++++++++++++++++++++++++++-
 1 files changed, 65 insertions(+), 2 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 e37c7bf..56ad3e6 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
@@ -53,6 +53,7 @@
             _scheme = scheme;
             _hydroInfo = hydroInfo;
             _allWorkingCheckedListDict = allWorkingCheckedListDict;
+            ResetMonitorValue();
         }
 
         /// <summary>
@@ -399,6 +400,13 @@
             }
         }
 
+        //閫夋嫨鏋勪欢
+        private void SelectVisual(string code, eVisualSource source)
+        {
+            var visual = GetVisual(code);
+            SelectVisual(visual, source);
+        }
+
         #endregion
 
         #region 鏋勪欢鏄庣粏
@@ -417,6 +425,14 @@
                 _visualListHelper.InitialData(_hydroInfo);
             }
             return _visualListHelper;
+        }
+
+        //鑾峰彇鍙鏋勪欢
+        private Yw.Model.HydroVisualInfo GetVisual(string code)
+        {
+            var helper = GetVisualListHelper();
+            var visual = helper.GetVisual(code);
+            return visual;
         }
 
         //鑾峰彇鍙鍒楄〃
@@ -1547,6 +1563,19 @@
             return _monitorValueHelper;
         }
 
+        //閲嶇疆
+        private void ResetMonitorValue()
+        {
+            var allWorkingList = GetWorkingList();
+            var working = allWorkingList?.Last(x => !string.IsNullOrEmpty(x.MonitorInfo));
+            if (working != null)
+            {
+                var helper = GetMonitorValueHelper();
+                helper.Reset(working.MonitorInfo);
+            }
+
+        }
+
         #endregion
 
         #region 鐩戞祴鍊兼帶浠�
@@ -2273,6 +2302,13 @@
             return _workingCheckedListHelper;
         }
 
+        //鑾峰彇宸ュ喌鍒楄〃
+        private List<HydroWorkingVmo> GetWorkingList()
+        {
+            var helper = GetWorkingCheckedListHelper();
+            return helper.GetWorkingList();
+        }
+
         //鏇存柊宸ュ喌閫夋嫨鍒楄〃
         public void UpdateWorkingCheckedList(HydroWorkingVmo working)
         {
@@ -2422,12 +2458,20 @@
                     return;
                 }
                 var dlg = new HydroSingleWorkingLossCurveDlg();
+                dlg.HydroClickEvent += (code) =>
+                {
+                    SelectVisual(code, eVisualSource.None);
+                };
                 dlg.SetBindingData(workingHelper.HydroInfo, workingHelper.CalcuResult, visual);
                 dlg.ShowDialog();
             }
             else
             {
                 var dlg = new HydroMultiWorkingLossCurveDlg();
+                dlg.HydroClickEvent += (code) =>
+                {
+                    SelectVisual(code, eVisualSource.None);
+                };
                 dlg.SetBindingData(_hydroInfo, allCheckedWorkingList, visual);
                 dlg.ShowDialog();
             }
@@ -2463,8 +2507,27 @@
         {
             if (_visual == null)
             {
-                TipFormHelper.ShowWarn("璇烽�夋嫨鏋勪欢鍚庨噸璇曪紒");
-                return;
+                var sources = GetSourceList();
+                if (sources != null)
+                {
+                    if (sources.Count == 1)
+                    {
+                        SelectVisual(sources[0], eVisualSource.None);
+                    }
+                    else
+                    {
+                        var source = sources.FirstOrDefault(x => x.Flags.Contains(HStation.Xhs.Flags.杩涘彛));
+                        if (source != null)
+                        {
+                            SelectVisual(source, eVisualSource.None);
+                        }
+                    }
+                }
+                if (_visual == null)
+                {
+                    TipFormHelper.ShowWarn("璇烽�夋嫨鏋勪欢鍚庨噸璇曪紒");
+                    return;
+                }
             }
             HydroVisualInfo visual = _visual;
             if (_visual is HydroLinkInfo linkInfo)

--
Gitblit v1.9.3