From 1f7091dac2a5dddf4a0a40acb0940d3787cf35f5 Mon Sep 17 00:00:00 2001
From: lixiaojun <1287241240@qq.com>
Date: 星期二, 18 二月 2025 14:05:47 +0800
Subject: [PATCH] 损失统计整理

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/XhsProjectSimulationMgrPage.cs |  123 ++++++++++++++++++++---------------------
 1 files changed, 60 insertions(+), 63 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/XhsProjectSimulationMgrPage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/XhsProjectSimulationMgrPage.cs
index f437feb..d63e686 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/XhsProjectSimulationMgrPage.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/XhsProjectSimulationMgrPage.cs
@@ -1,5 +1,4 @@
-锘縰sing DevExpress.Drawing;
-using DevExpress.Utils.Svg;
+锘縰sing DevExpress.Utils.Svg;
 using DevExpress.XtraBars.Docking;
 using DevExpress.XtraBars.Docking2010.Views;
 using Yw.Vmo;
@@ -17,11 +16,11 @@
             this.PageTitle.SvgImageSize = new Size(24, 24);
             this.simulationFunctionMgrCtrl1.ShowProjectSiteInfoEvent += SimulationFunctionMgrCtrl1_ShowProjectSiteInfoEvent;
             this.simulationFunctionMgrCtrl1.ShowProjectSiteSimulationEvent += SimulationFunctionMgrCtrl1_ShowProjectSiteSimulationEvent;
-            this.simulationFunctionMgrCtrl1.ShowProjectSiteWorkingEvent += SimulationFunctionMgrCtrl1_ShowProjectSiteWorkingEvent;
             this.simulationFunctionMgrCtrl1.ProjectSiteWorkingAppendEvent += SimulationFunctionMgrCtrl1_ProjectSiteWorkingAppendEvent;
             this.simulationFunctionMgrCtrl1.ProjectSiteWorkingUpdateEvent += SimulationFunctionMgrCtrl1_ProjectSiteWorkingUpdateEvent;
             this.simulationFunctionMgrCtrl1.ProjectSiteWorkingRemoveEvent += SimulationFunctionMgrCtrl1_ProjectSiteWorkingRemoveEvent;
             this.simulationFunctionMgrCtrl1.ProjectSiteWorkingCheckedEvent += SimulationFunctionMgrCtrl1_ProjectSiteWorkingCheckedEvent;
+            this.simulationFunctionMgrCtrl1.ProjectSiteWorkingReloadEvent += SimulationFunctionMgrCtrl1_ProjectSiteWorkingReloadEvent;
             this.simulationFunctionMgrCtrl1.CreateProjectSiteSchemeEvent += SimulationFunctionMgrCtrl1_CreateProjectSiteSchemeEvent;
             this.simulationFunctionMgrCtrl1.ProjectSiteSchemeAppendEvent += SimulationFunctionMgrCtrl1_ProjectSiteSchemeAppendEvent;
             this.simulationFunctionMgrCtrl1.ProjectSiteSchemeUpdateEvent += SimulationFunctionMgrCtrl1_ProjectSiteSchemeUpdateEvent;
@@ -120,21 +119,37 @@
                 {
                     var page = new XhsProjectSimulationCorePage();
                     page.PageTitle.HeaderSvgImage = svgImage;
-                    page.AppendWorkingEvent += (working) =>
+                    page.GetModelEvent += (s) =>
                     {
-                        //澧炲姞宸ュ喌浜嬩欢
-                        this.simulationFunctionMgrCtrl1.AppendWorking(scheme, working);
-                    };
-                    page.SaveModelEvent += (rhs) =>
-                    {
-                        //淇濆瓨妯″瀷浜嬩欢
-                        return this.simulationFunctionMgrCtrl1.SaveModel(scheme, rhs);
+                        //鑾峰彇妯″瀷浜嬩欢
+                        return this.simulationFunctionMgrCtrl1.GetModel(scheme);
                     };
                     page.RefreshModelEvent += () =>
                     {
                         //鍒锋柊妯″瀷浜嬩欢
                         return this.simulationFunctionMgrCtrl1.RefreshModel(scheme);
                     };
+                    page.AppendWorkingEvent += (working) =>
+                    {
+                        //澧炲姞宸ュ喌浜嬩欢
+                        this.simulationFunctionMgrCtrl1.AppendWorking(scheme, working);
+                    };
+                    page.UpdateWorkingEvent += (working) =>
+                    {
+                        //鏇存柊宸ュ喌浜嬩欢
+                        this.simulationFunctionMgrCtrl1.UpdateWorking(scheme, working);
+                    };
+                    page.RemoveWorkingEvent += (working) =>
+                    {
+                        //绉婚櫎宸ュ喌浜嬩欢
+                        this.simulationFunctionMgrCtrl1.RemoveWorking(scheme, working);
+                    };
+                    page.ReloadWorkingEvent += (dict) =>
+                    {
+                        //閲嶈浇宸ュ喌浜嬩欢
+                        this.simulationFunctionMgrCtrl1.ReloadWorking(scheme, dict);
+                    };
+
                     page.UpdateSchemeEvent += (rhs) =>
                     {
                         //鏇存柊鏂规浜嬩欢
@@ -146,44 +161,6 @@
                         this.simulationFunctionMgrCtrl1.RemoveScheme(rhs);
                     };
                     page.SetBindingData(project, projectSite, scheme, hydroInfo, allWorkingCheckedListDict);
-                    CreatePage(page, guid);
-                }
-            }
-        }
-
-        //鏄剧ず椤圭洰绔欏伐鍐典簨浠�
-        private void SimulationFunctionMgrCtrl1_ShowProjectSiteWorkingEvent
-            (
-                XhsProjectVmo project,
-                XhsProjectSiteVmo projectSite,
-                XhsSchemeVmo scheme,
-                Yw.Model.HydroModelInfo hydroInfo,
-                HydroWorkingVmo working,
-                SvgImage svgImage
-            )
-        {
-            lock (_locker)
-            {
-                var guid = new PageGuid()
-                {
-                    Modular = this.PageGuid.Modular,
-                    MoudingType = eMoudingType.Tab,
-                    Function = SimulationFunctionHelper.Working,
-                    TagName = $"{project.ID}-{projectSite.ID}-{scheme?.ID}-{working.ID}"
-                };
-                if (!IsExistPage(guid, true))
-                {
-                    var page = new XhsProjectSimulationWorkingPage();
-                    page.UpdateWorkingEvent += (rhs) =>
-                    {
-                        this.simulationFunctionMgrCtrl1.UpdateWorking(scheme, rhs);
-                    };
-                    page.RemoveWorkingEvent += (rhs) =>
-                    {
-                        this.simulationFunctionMgrCtrl1.RemoveWorking(scheme, rhs);
-                    };
-                    page.PageTitle.HeaderSvgImage = svgImage;
-                    page.SetBindingData(project, projectSite, scheme, hydroInfo, working);
                     CreatePage(page, guid);
                 }
             }
@@ -246,7 +223,7 @@
                 Modular = this.PageGuid.Modular,
                 MoudingType = eMoudingType.Tab,
                 Function = SimulationFunctionHelper.Simulation,
-                TagName = projectSite.ID.ToString()
+                TagName = $"{project.ID}-{projectSite.ID}-{scheme?.ID}"
             };
             var page = FindPage(guid);
             if (page == null)
@@ -276,7 +253,7 @@
                 Modular = this.PageGuid.Modular,
                 MoudingType = eMoudingType.Tab,
                 Function = SimulationFunctionHelper.Simulation,
-                TagName = projectSite.ID.ToString()
+                TagName = $"{project.ID}-{projectSite.ID}-{scheme?.ID}"
             };
             var page = FindPage(guid);
             if (page == null)
@@ -291,29 +268,49 @@
             ctrl.UpdateWorkingCheckedList(working, hasChecked);
         }
 
+        //椤圭洰绔欏伐鍐甸�夋嫨閲嶈浇浜嬩欢
+        private void SimulationFunctionMgrCtrl1_ProjectSiteWorkingReloadEvent
+            (
+                XhsProjectVmo project,
+                XhsProjectSiteVmo projectSite,
+                XhsSchemeVmo scheme,
+                Dictionary<HydroWorkingVmo, bool> dict
+            )
+        {
+            var guid = new PageGuid()
+            {
+                Modular = this.PageGuid.Modular,
+                MoudingType = eMoudingType.Tab,
+                Function = SimulationFunctionHelper.Simulation,
+                TagName = $"{project.ID}-{projectSite.ID}-{scheme?.ID}"
+            };
+            var page = FindPage(guid);
+            if (page == null)
+            {
+                return;
+            }
+            var ctrl = page as XhsProjectSimulationCorePage;
+            if (ctrl == null)
+            {
+                return;
+            }
+            ctrl.ReloadWorkingCheckedList(dict);
+        }
+
         //椤圭洰绔欐柟妗堝垱寤轰簨浠�
         private void SimulationFunctionMgrCtrl1_CreateProjectSiteSchemeEvent
             (
                 XhsProjectVmo project,
                 XhsProjectSiteVmo projectSite,
                 Yw.Model.HydroModelInfo hydroInfo,
+                List<XhsSchemeVmo> allSchemeList,
                 SvgImage svgImage
             )
         {
-            //WaitFormHelper.ShowWaitForm(this.FindForm(), "姝e湪鍔犺浇妯″瀷锛岃绋嶄警...");
-            //var dlg = new AddXhsSchemeDlg();
-            //dlg.Shown += delegate { WaitFormHelper.HideWaitForm(this.FindForm()); };
-            //dlg.ReloadDataEvent += (rhs) =>
-            //{
-            //    this.simulationFunctionMgrCtrl1.AppendScheme(rhs);
-            //};
-            //dlg.SetBindingData(project, projectSite, hydroInfo);
-            //dlg.ShowDialog();
-
-            WaitFormHelper.ShowWaitForm(this.FindForm(), "姝e湪鍔犺浇妯″瀷锛岃绋嶄警...");
+            WaitFormHelper.ShowWaitForm(this.FindForm(), "姝e湪鍔犺浇锛岃绋嶄警...");
             var dlg = new CreateXhsSchemeDlg();
             dlg.Shown += delegate { WaitFormHelper.HideWaitForm(this.FindForm()); };
-            dlg.SetBindingData(project, projectSite, hydroInfo);
+            dlg.SetBindingData(project, projectSite, hydroInfo, allSchemeList);
             dlg.ReloadDataEvent += (rhs) =>
             {
                 this.simulationFunctionMgrCtrl1.AppendScheme(rhs);

--
Gitblit v1.9.3