From 9ffb31c233f3b4891550293294c2ee716f77b42a Mon Sep 17 00:00:00 2001
From: duheng <2784771470@qq.com>
Date: 星期日, 22 九月 2024 19:08:49 +0800
Subject: [PATCH] 完善自动匹配

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/XhsProjectSimulationMgrPage.cs |  114 +++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 106 insertions(+), 8 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/XhsProjectSimulationMgrPage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/XhsProjectSimulationMgrPage.cs
index 982592f..c27376c 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/XhsProjectSimulationMgrPage.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/XhsProjectSimulationMgrPage.cs
@@ -1,5 +1,6 @@
 锘縰sing DevExpress.XtraBars.Docking;
 using DevExpress.XtraBars.Docking2010.Views;
+using HStation.Vmo;
 using Yw.WinFrmUI.Page;
 
 namespace HStation.WinFrmUI
@@ -13,28 +14,43 @@
             this.PageTitle.HeaderSvgImage = this.svgImg32[0];
             this.PageTitle.SvgImageSize = new Size(24, 24);
 
+            this.xhsProjectSimulationSchemeMgrCtrl1.ProjectSiteSelectedChangedEvent += XhsProjectSimulationSchemeMgrCtrl1_ProjectSiteSelectedChangedEvent;
+            this.xhsProjectSimulationFunctionMgrCtrl1.ShowXhsProjectInfoEvent += XhsProjectSimulationFunctionMgrCtrl1_ShowXhsProjectInfoEvent;
+            this.xhsProjectSimulationFunctionMgrCtrl1.ShowXhsProjectSimulationEvent += XhsProjectSimulationFunctionMgrCtrl1_ShowXhsProjectSimulationEvent;
+            this.xhsProjectSimulationFunctionMgrCtrl1.CreateXhsProjectSchemeEvent += XhsProjectSimulationFunctionMgrCtrl1_CreateXhsProjectSchemeEvent;
+            this.xhsProjectSimulationFunctionMgrCtrl1.CompareXhsProjectSchemeEvent += XhsProjectSimulationFunctionMgrCtrl1_CompareXhsProjectSchemeEvent;
         }
 
-        private XhsProjectStdDto _project = null;
-        private Yw.Model.HydroModelInfo _hydroInfo = null;
+        private long _projectId;//椤圭洰id
+        private XhsProjectVmo _project = null;//椤圭洰
+        private XhsProjectSiteVmo _projectSite = null;//椤圭洰绔�
+        private Yw.Model.HydroModelInfo _hydroInfo = null;//姘村姏淇℃伅
 
         /// <summary>
-        /// 鍒濆鍖栨暟鎹簮
+        /// 璁剧疆鏁版嵁
         /// </summary>
-        public override void InitialDataSource()
+        public async Task SetBindingData(XhsProjectVmo project)
         {
-            base.InitialDataSource();
+            if (project == null)
+            {
+                return;
+            }
+            _project = project;
+            _projectId = project.ID;
+            this.PageTitle.Caption = $"{_project.Name}\r\n姘村姏妯℃嫙";
+            await this.xhsProjectSimulationSchemeMgrCtrl1.SetBindingData(_project);
         }
 
         /// <summary>
         /// 缁戝畾鏁版嵁
         /// </summary>
-        /// <param name="projectId">椤圭洰id</param>
         public async Task SetBindingData(long projectId)
         {
-            //this.xhsSchemeMgrListCtrl1.SetBindingData(projectId);
+            _project = await BLLFactory<HStation.BLL.XhsProject>.Instance.GetByID(projectId);
+            await SetBindingData(_project);
+            //this.xhsSchemeMgrListCtrl1.SetMatching(projectId);
             //_project = await new BLL.XhsProjectStd().GetByID(projectId);
-            //this.PageTitle.Caption = $"{_project?.Name}\r\n鏂规绠$悊";
+            //this.PageTitle.Caption = 
             //var projectSite = await new BLL.XhsProjectSiteStd().GetDefaultByProjectID(_project.ID);
             //if (projectSite == null)
             //{
@@ -51,6 +67,88 @@
             //_hydroInfo = await new Yw.BLL.HydroModelInfo().GetByID(relation.ModelID);
         }
 
+        /// <summary>
+        /// 鍒濆鍖栨暟鎹簮
+        /// </summary>
+        public override void InitialDataSource()
+        {
+            base.InitialDataSource();
+        }
+
+        //椤圭洰绔欓�夋嫨鏀瑰彉浜嬩欢
+        private async void XhsProjectSimulationSchemeMgrCtrl1_ProjectSiteSelectedChangedEvent(XhsProjectSiteVmo obj)
+        {
+            _projectSite = obj;
+            if (_projectSite != null)
+            {
+                var hydroRelation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance
+                   .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation);
+                _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(hydroRelation.ModelID);
+            }
+        }
+
+        //鏄剧ず椤圭洰淇℃伅浜嬩欢
+        private async void XhsProjectSimulationFunctionMgrCtrl1_ShowXhsProjectInfoEvent(DevExpress.Utils.Svg.SvgImage obj)
+        {
+            var guid = new PageGuid()
+            {
+                Modular = this.PageGuid.Modular,
+                MoudingType = eMoudingType.Tab,
+                Function = "xhs-project-simulation-info",
+            };
+            if (!IsExistPage(guid, true))
+            {
+                var page = new XhsProjectSimulationInfoPage();
+                await page.SetBindingData(_project, _projectSite, _hydroInfo);
+                CreatePage(page, guid);
+            }
+
+        }
+
+        //鏄剧ず姘村姏妯℃嫙浜嬩欢
+        private async void XhsProjectSimulationFunctionMgrCtrl1_ShowXhsProjectSimulationEvent(DevExpress.Utils.Svg.SvgImage obj)
+        {
+            var guid = new PageGuid()
+            {
+                Modular = this.PageGuid.Modular,
+                MoudingType = eMoudingType.Tab,
+                Function = "xhs-project-simulation-core",
+            };
+            if (!IsExistPage(guid, true))
+            {
+                var page = new XhsProjectSimulationCorePage();
+                await page.SetBindingData(_project, _projectSite, _hydroInfo);
+                CreatePage(page, guid);
+            }
+        }
+
+        //鍒涘缓椤圭洰鏂规浜嬩欢
+        private async void XhsProjectSimulationFunctionMgrCtrl1_CreateXhsProjectSchemeEvent(DevExpress.Utils.Svg.SvgImage obj)
+        {
+            if (_projectSite == null)
+            {
+                return;
+            }
+            var dlg = new AddXhsProjectSimulationSchemeDlg();
+            await dlg.SetBindingData(_projectSite.ID);
+            dlg.ReloadDataEvent += (scheme) =>
+            {
+                this.xhsProjectSimulationSchemeMgrCtrl1.AppendScheme(scheme);
+            };
+            dlg.ShowDialog();
+        }
+
+        //姣旇緝椤圭洰鏂规浜嬩欢
+        private void XhsProjectSimulationFunctionMgrCtrl1_CompareXhsProjectSchemeEvent(DevExpress.Utils.Svg.SvgImage obj)
+        {
+
+        }
+
+
+
+
+
+
 
         //鍔熻兘鐐瑰嚮
         private async void accordionControl1_ElementClick(object sender, DevExpress.XtraBars.Navigation.ElementClickEventArgs e)

--
Gitblit v1.9.3