duheng
2024-09-27 0e54c48e8190937f5b483c79e3cc9d17ec7c9af0
WinFrmUI/HStation.WinFrmUI.Xhs.Core/01-home/HomeXhsProjectPage.cs
@@ -1,4 +1,8 @@
using DevExpress.Utils.Svg;
using HStation.Vmo;
using HStation.WinFrmUI.Assets;
using HStation.WinFrmUI.Xhs.PumpProduct;
using Yw.WinFrmUI.Page;
namespace HStation.WinFrmUI
{
@@ -11,7 +15,6 @@
            this.PageTitle.HeaderSvgImage = this.svgImg32[0];
            this.PageTitle.SvgImageSize = new Size(24, 24);
            this.PageTitle.AllowClose = false;
            this.repPicEdit.SizeMode = DevExpress.XtraEditors.Controls.PictureSizeMode.Zoom;
        }
@@ -23,47 +26,55 @@
            public SvgImage Image { get; set; }
        }
        private List<XhsProjectVmo> _allProjectList = null;
        private Lazy<BLL.XhsProjectStd> _bllProjectStd = new(() => new BLL.XhsProjectStd());
        private List<XhsProjectStdDto> _allProjectList = null;
        private Lazy<BLL.PumpMain> _bllPump = new(() => new BLL.PumpMain());
        /// <summary>
        /// 初始化数据源
        /// </summary>
        public override async void InitialDataSource()
        {
            _allProjectList = await _bllProjectStd.Value.GetAll();
            SetBindingData();
            this.mapViewProjectListContainer1.LoadCompletedEvent += MapViewProjectListContainer1_LoadCompletedEvent;
            await this.mapViewProjectListContainer1.InitialContainer();
        }
        private async void SetBindingData()
        {
            _allProjectList = await BLLFactory<HStation.BLL.XhsProject>.Instance.GetAll();
            var allPump = await _bllPump.Value.GetAll();
            var allValveList = await new BLL.ValveMain().GetAll();
            var vm = new CurrentViewModel()
            {
                Name = "项目数量",
                Count = _allProjectList?.Count ?? 0,
                Image =  ImageLib.Project
                Image = ImageLib.Project
            };
            var vm2 = new CurrentViewModel()
            {
                Name = "水泵型号数量",
                Count = 999,
                Count = allPump?.Count ?? 0,
                Image = ImageLib.PumpMain
            };
            var vm3 = new CurrentViewModel()
            {
                Name = "阀门型号数量",
                Count = 666,
                Count = allValveList?.Count ?? 0,
                Image = ImageLib.Valve
            };
            var vm4 = new CurrentViewModel()
            {
                Name = "冷却塔数量",
                Count = 0,
                Image = ImageLib.CoolingTower
            };
            var list = new List<CurrentViewModel>() { vm, vm2, vm3 };
            var list = new List<CurrentViewModel>() { vm, vm2, vm3, vm4 };
            this.gridControl1.DataSource = list;
            this.gridControl1.RefreshDataSource();
            this.mapViewProjectListContainer1.LoadCompletedEvent += MapViewProjectListContainer1_LoadCompletedEvent;
            await this.mapViewProjectListContainer1.InitialContainer();
        }
        /// <summary>
@@ -72,9 +83,10 @@
        public override async void RefreshData()
        {
            base.RefreshData();
            _allProjectList = await _bllProjectStd.Value.GetAll();
            _allProjectList = await BLLFactory<HStation.BLL.XhsProject>.Instance.GetAll();
            await this.mapViewProjectListContainer1.SetProjectList(_allProjectList);
            this.homeXhsProjectTreeListCtrl1.SetBindingData(_allProjectList);
            SetBindingData();
        }
        //地图加载完成
@@ -85,7 +97,7 @@
        }
        //选择项目事件
        private async void homeXhsProjectTreeListCtrl1_SelectProjectEvent(XhsProjectStdDto obj)
        private async void homeXhsProjectTreeListCtrl1_SelectProjectEvent(XhsProjectVmo obj)
        {
            await this.mapViewProjectListContainer1.SelectProject(obj.ID);
            var vm = new HomeXhsProjectPropertyViewModel(obj);
@@ -99,25 +111,48 @@
        }
        //跳转事件
        private async void homeXhsProjectPropertyCtrl1_JumpDirectEvent(XhsProjectStdDto obj)
        private async void homeXhsProjectPropertyCtrl1_JumpDirectEvent(long PrjID)
        {
            var guid = new PageGuid()
            var bimfacefile = await BimfaceFileStateHelper.IsHaveBimFace(PrjID);
            if (bimfacefile == null)
            {
                Modular = Yw.WinFrmUI.PageModular.Bimface,
                MoudingType = Yw.WinFrmUI.Page.eMoudingType.Tab,
                Function = Yw.WinFrmUI.PageFunction.ViewBimface3d,
                TagName = $"{obj.ID}"
            };
            if (!IsExistPage(guid, true))
            {
                var page = new XhsSchemeMultiMgrPage();
                await page.SetBindingData(obj.ID);
                //var page = new XhsProjectSimulationMgrPage();
                CreatePage(page, guid);
                if (!MessageBoxHelper.IsClickOk("当前项目未上传文件,是否前去上传模型文件?"))
                {
                    var Prjguid = new PageGuid()
                    {
                        Modular = "Xhs",
                        MoudingType = eMoudingType.Tab,
                        Function = "ProjectMgr",
                    };
                    if (!IsExistPage(Prjguid, true))
                    {
                        var page = new XhsProjectMgrPage();
                        CreatePage(page, Prjguid);
                    }
                }
                return;
            }
            else
            {
                var guid = new PageGuid()
                {
                    Modular = Yw.WinFrmUI.PageModular.Bimface,
                    MoudingType = Yw.WinFrmUI.Page.eMoudingType.Tab,
                    Function = Yw.WinFrmUI.PageFunction.ViewBimface3d,
                    TagName = $"{PrjID}"
                };
                if (!IsExistPage(guid, true))
                {
                    // var page = new XhsSchemeMultiMgrPage();
                    // await page.SetMatching(obj.ID);
                    var page = new XhsProjectSimulationMgrPage();
                    await page.SetBindingData(PrjID);
                    //var page = new XhsProjectSimulationMgrPage();
                    CreatePage(page, guid);
                }
            }
        }
        //刷新数据事件
@@ -125,6 +160,84 @@
        {
            RefreshData();
        }
        //单击数量总览跳转
        private void layoutView1_FieldValueClick(object sender, DevExpress.XtraGrid.Views.Layout.Events.FieldValueClickEventArgs e)
        {
            if (e.Column.Caption != "名称")
                return;
            switch (e.FieldValue)
            {
                case "项目数量":
                    var guid = new PageGuid()
                    {
                        Modular = "Xhs",
                        MoudingType = eMoudingType.Tab,
                        Function = "ProjectMgr",
                    };
                    if (!IsExistPage(guid, true))
                    {
                        var page = new XhsProjectMgrPage();
                        CreatePage(page, guid);
                    }
                    break;
                case "水泵型号数量":
                    var pumpGuid = new PageGuid()
                    {
                        Modular = "Xhs",
                        MoudingType = eMoudingType.Tab,
                        Function = "pumpMgr",
                    };
                    if (!IsExistPage(pumpGuid, true))
                    {
                        var page = new PumpProductMainPanel();
                        CreatePage(page, pumpGuid);
                    }
                    break;
                case "阀门型号数量":
                    var valveGuid = new PageGuid()
                    {
                        Modular = "Xhs",
                        MoudingType = eMoudingType.Tab,
                        Function = "ValveMgr",
                    };
                    if (!IsExistPage(valveGuid, true))
                    {
                        var page = new ValveManageMainPanel();
                        CreatePage(page, valveGuid);
                    }
                    break;
            }
        }
        private void layoutView1_MouseMove(object sender, MouseEventArgs e)
        {
            var info = layoutView1.CalcHitInfo(e.X, e.Y);
            if (info.Column == null)
                return;
            if (info.Column.Caption == "名称")
            {
                Cursor.Current = Cursors.Help;
            }
            else
            {
            }
        }
        private void layoutView1_MouseEnter(object sender, EventArgs e)
        {
            var info = layoutView1.CalcHitInfo(Cursor.Position.X, Cursor.Position.Y);
            if (info.Column != null && info.Column.Caption == "名称")
            {
                Cursor.Current = Cursors.Help;
            }
        }
        private void layoutView1_MouseLeave(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.Default;
        }
    }
}
}