duheng
2024-09-20 7d17fabc46e87ea0f0896f760034f4d16a4dfed0
WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/XhsProjectSimulationMgrPage.cs
@@ -1,5 +1,6 @@
using 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)
        {
            _project = await BLLFactory<HStation.BLL.XhsProject>.Instance.GetByID(projectId);
            await SetBindingData(_project);
            //this.xhsSchemeMgrListCtrl1.SetBindingData(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)