From ff457d72c09f3f0d49e6b79d9461bf596e8945bf Mon Sep 17 00:00:00 2001
From: duheng <2784771470@qq.com>
Date: 星期二, 10 十二月 2024 17:34:31 +0800
Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/HStation/XHS.V1.0

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/08-working/XhsProjectSimulationWorkingPage.cs |  117 ++++++++++++++++++++++++++++++++++------------------------
 1 files changed, 68 insertions(+), 49 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/08-working/XhsProjectSimulationWorkingPage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/08-working/XhsProjectSimulationWorkingPage.cs
index a8b09e0..50c8947 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/08-working/XhsProjectSimulationWorkingPage.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/08-working/XhsProjectSimulationWorkingPage.cs
@@ -45,25 +45,6 @@
             (
                 XhsProjectVmo project,
                 XhsProjectSiteVmo projectSite,
-                Yw.Model.HydroModelInfo hydroInfo,
-                HydroWorkingVmo working
-            )
-        {
-            _project = project;
-            _projectSite = projectSite;
-            _hydroInfo = hydroInfo.Adapt<Yw.Model.HydroModelInfo>();
-            _working = working;
-            _hydroInfo.UpdateWorkingInfo(_working.WorkingInfo);
-            this.PageTitle.Caption = $"姘村姏妯℃嫙\r\n{_working.Name}";
-        }
-
-        /// <summary>
-        /// 缁戝畾鏁版嵁
-        /// </summary>
-        public void SetBindingData
-            (
-                XhsProjectVmo project,
-                XhsProjectSiteVmo projectSite,
                 XhsSchemeVmo scheme,
                 Yw.Model.HydroModelInfo hydroInfo,
                 HydroWorkingVmo working
@@ -75,7 +56,14 @@
             _hydroInfo = hydroInfo.Adapt<Yw.Model.HydroModelInfo>();
             _working = working;
             _hydroInfo.UpdateWorkingInfo(_working.WorkingInfo);
-            this.PageTitle.Caption = $"{scheme.Name}\r\n{_working.Name}";
+            if (_scheme == null)
+            {
+                this.PageTitle.Caption = $"姘村姏妯℃嫙\r\n{_working.Name}";
+            }
+            else
+            {
+                this.PageTitle.Caption = $"{scheme.Name}\r\n{_working.Name}";
+            }
         }
 
         /// <summary>
@@ -179,10 +167,10 @@
         #region 灞炴�ф帶浠�
 
         //灞炴�ф帶浠�
-        private HydroVisualPropertyViewCtrl _propertyCtrl = null;
+        private SimulationPropertyCtrl _propertyCtrl = null;
 
         //鑾峰彇灞炴�ф帶浠�
-        private HydroVisualPropertyViewCtrl GetPropertyCtrl()
+        private SimulationPropertyCtrl GetPropertyCtrl()
         {
             if (_hydroInfo == null)
             {
@@ -190,11 +178,12 @@
             }
             if (_propertyCtrl == null)
             {
-                _propertyCtrl = new HydroVisualPropertyViewCtrl();
+                _propertyCtrl = new SimulationPropertyCtrl();
                 _propertyCtrl.Dock = DockStyle.Fill;
-                _propertyCtrl.HydroViewEvent += (visualViewModel) =>
+                _propertyCtrl.AllowEdit = false;
+                _propertyCtrl.HydroViewEvent += (visual) =>
                 {
-                    SelectVisual(GetVisual(visualViewModel), eVisualSource.Property);
+                    SelectVisual(visual, eVisualSource.Property);
                 };
                 _propertyCtrl.BlinkLinkNodeEvent += async (link, linkNodeCode) =>
                 { //寮鸿皟杩炴帴鑺傜偣
@@ -286,14 +275,6 @@
             _propertyCtrl?.UpdateRows();
         }
 
-        //娓呯悊灞炴�ф帶浠�
-        private void ClearPropertyCtrl()
-        {
-            if (_propertyCtrl != null)
-            {
-                _propertyCtrl.SelectedObject = null;
-            }
-        }
 
         #endregion
 
@@ -405,21 +386,33 @@
             return _visualListHelper;
         }
 
-        //鑾峰彇鍙鏋勪欢
-        private Yw.Model.HydroVisualInfo GetVisual(string code)
+        //閲嶇疆鍙鍒楄〃
+        private void ResetVisualList()
         {
-            if (string.IsNullOrEmpty(code))
-            {
-                return default;
-            }
-            var visualListHelper = GetVisualListHelper();
-            return visualListHelper.GetVisual(code);
+            var helper = GetVisualListHelper();
+            helper.InitialData(_hydroInfo);
         }
 
         //鑾峰彇鍙鏋勪欢
-        private Yw.Model.HydroVisualInfo GetVisual(HydroVisualViewModel visualViewModel)
+        private Yw.Model.HydroVisualInfo GetVisual(string code)
         {
-            return GetVisual(visualViewModel?.Code);
+            var helper = GetVisualListHelper();
+            var visual = helper.GetVisual(code);
+            return visual;
+        }
+
+        //鑾峰彇鍙鍒楄〃
+        private List<Yw.Model.HydroVisualInfo> GetVisualList()
+        {
+            var helper = GetVisualListHelper();
+            return helper.GetVisualList();
+        }
+
+        //鑾峰彇姘存簮鍒楄〃
+        private List<Yw.Model.HydroSourceInfo> GetSourceList()
+        {
+            var helper = GetVisualListHelper();
+            return helper.GetSourceList();
         }
 
         #endregion
@@ -1531,6 +1524,27 @@
 
         #region 宸ュ喌鍒嗘瀽
 
+        //閫夋嫨杩涘彛姘存簮
+        private void SelectInputSource()
+        {
+            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);
+                    }
+                }
+            }
+        }
+
         //绮惧害璇勪及
         private async void barBtnWorkingEvaluation_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
@@ -1649,22 +1663,27 @@
                 return;
             }
             var dlg = new SimulationSingleWorkingEnergyDlg();
-            dlg.SetBindingData(workingHelper.HydroInfo, workingHelper.CalcuResult);
+            //dlg.SetBindingData(workingHelper.Working, workingHelper.HydroInfo, workingHelper.CalcuResult);
             dlg.ShowDialog();
         }
 
         //鎹熷け鏇茬嚎
         private void barBtnWorkingLossCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
+            if (_visual == null)
+            {
+                SelectInputSource();
+                if (_visual == null)
+                {
+                    TipFormHelper.ShowWarn("璇烽�夋嫨鏋勪欢鍚庨噸璇曪紒");
+                    return;
+                }
+            }
+
             var workingHelper = GetWorkingHelper();
             if (!workingHelper.Initialized)
             {
                 TipFormHelper.ShowError("宸ュ喌璁$畻澶辫触锛�");
-                return;
-            }
-            if (_visual == null)
-            {
-                TipFormHelper.ShowWarn("璇烽�夋嫨鏋勪欢锛�");
                 return;
             }
             HydroVisualInfo visual = _visual;

--
Gitblit v1.9.3