From d672ca82c49f01dae2c5c955202b5857ef680a71 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期五, 03 一月 2025 22:16:48 +0800 Subject: [PATCH] 创建方案 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/04-scheme/02-change/01-pump/CreateXhsSchemePumpChangePage.cs | 158 +++++++++++++++++++++++++++++++--------------------- 1 files changed, 93 insertions(+), 65 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/04-scheme/02-change/01-pump/CreateXhsSchemePumpChangePage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/04-scheme/02-change/01-pump/CreateXhsSchemePumpChangePage.cs index 913f530..2f25d57 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/04-scheme/02-change/01-pump/CreateXhsSchemePumpChangePage.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/04-scheme/02-change/01-pump/CreateXhsSchemePumpChangePage.cs @@ -1,12 +1,22 @@ -锘縩amespace HStation.WinFrmUI +锘縰sing DevExpress.Utils.Svg; +using Mapster; +using Yw; + +namespace HStation.WinFrmUI { - public partial class CreateXhsSchemePumpChangePage : DevExpress.XtraEditors.XtraUserControl, Yw.WinFrmUI.IWizardPage<CreateXhsSchemeViewModel> + /// <summary> + /// + /// </summary> + public partial class CreateXhsSchemePumpChangePage : DevExpress.XtraEditors.XtraUserControl, Yw.WinFrmUI.IWizardPageAsync<CreateXhsSchemeViewModel> { + /// <summary> + /// + /// </summary> public CreateXhsSchemePumpChangePage() { InitializeComponent(); - InitialStatus(); - this.layoutView1.OptionsFilter.AllowFilterEditor = false; + this.xhsSchemePumpChangeListCtrl1.HydroViewEvent += XhsSchemePumpChangeListCtrl1_HydroViewEvent; + this.xhsSchemePumpChangeListCtrl1.HydroChangeEvent += XhsSchemePumpChangeListCtrl1_HydroChangeEvent; } /// <summary> @@ -15,71 +25,73 @@ public event Action PageStateChangedEvent; private CreateXhsSchemeViewModel _vm = null;//鎿嶄綔瀵硅薄 - private bool _isInitialize = false;//鏄惁鍒濆鍖� - - private HStation.Vmo.XhsProjectVmo _project = null;//椤圭洰 - private HStation.Vmo.XhsProjectSiteVmo _project_site = null;//椤圭洰绔� - private Yw.Model.HydroModelInfo _hydro_info = null;//姘村姏淇℃伅 + private List<HydroPumpViewModel> _allViewModelList = null;//鎵�鏈夎鍥惧垪琛� /// <summary> /// 鍒濆鍖� /// </summary> - public void InitialPage(CreateXhsSchemeViewModel t) + public void InitialPage(CreateXhsSchemeViewModel vm) { - if (_isInitialize) + if (vm == null) { return; } - _vm = t; - _isInitialize = true; - _project = t.Project; - _project_site = t.ProjectSite; - _hydro_info = t.HydroInfo; - - this.createXhsSchemePumpChangeViewMdoelBindingSource.DataSource = _hydro_info.Pumps; - this.createXhsSchemePumpChangeViewMdoelBindingSource.ResetBindings(false); + _vm = vm; + _allViewModelList = new List<HydroPumpViewModel>(); + if (vm.HydroInfo.Pumps != null && vm.HydroInfo.Pumps.Count > 0) + { + foreach (var visualViewModel in vm.AllVisualViewModelList) + { + if (visualViewModel.Vmo.Catalog == Yw.Hydro.ParterCatalog.Pump) + { + var vmPump = visualViewModel as HydroPumpViewModel; + if (vmPump != null) + { + _allViewModelList.Add(vmPump); + } + } + } + } ShowBimfaceCtrl(); - } - - private void InitialStatus() - { - this.repImgCmbStatus.BeginUpdate(); - this.repImgCmbStatus.Items.Clear(); - this.repImgCmbStatus.Items.Add("寮�鍚�", Yw.Hydro.PumpStatus.Open, -1); - this.repImgCmbStatus.Items.Add("鍏抽棴", Yw.Hydro.PumpStatus.Closed, -1); - this.repImgCmbStatus.EndUpdate(); + this.xhsSchemePumpChangeListCtrl1.SetBindingData(_allViewModelList); + this.PageStateChangedEvent?.Invoke(); } #region Bimface //bimface鎺т欢 - private SimulationBimfaceCtrl _bimfaceCtrl = null; + private CreateXhsSchemeBimfaceCtrl _bimfaceCtrl = null; //鑾峰彇 bimface 鎺т欢 - private async Task<SimulationBimfaceCtrl> GetBimfaceCtrl() + private async Task<CreateXhsSchemeBimfaceCtrl> GetBimfaceCtrl() { if (_vm == null) - return null; + { + return default; + } if (_bimfaceCtrl == null) { - _bimfaceCtrl = new SimulationBimfaceCtrl(); + _bimfaceCtrl = new CreateXhsSchemeBimfaceCtrl(); _bimfaceCtrl.Dock = DockStyle.Fill; - await _bimfaceCtrl.InitialData(_project, _project_site); - _bimfaceCtrl.LoadCompletedEvent += () => + await _bimfaceCtrl.InitialData(_vm.Project, _vm.ProjectSite, _vm.HydroInfo, _vm.AllVisualViewModelList); + _bimfaceCtrl.HydroMouseLeftClickEvent += (code) => { - //view鍔犺浇瀹屾垚浜嬩欢 - if (_hydro_info == null) + if (_allViewModelList == null || _allViewModelList.Count < 1) { return; } + var index = _allViewModelList.FindIndex(x => x.Vmo.Code == code); + this.xhsSchemePumpChangeListCtrl1.SetFocusedRow(index); }; - _bimfaceCtrl.HydroMouseLeftClickEvent += (obj) => - {//榧犳爣宸﹂敭鐐瑰嚮浜嬩欢 - if (_hydro_info == null) + _bimfaceCtrl.SelectVisualEvent += (code) => + { + if (_allViewModelList == null || _allViewModelList.Count < 1) { return; } + var index = _allViewModelList.FindIndex(x => x.Vmo.Code == code); + this.xhsSchemePumpChangeListCtrl1.SetFocusedRow(index); }; } return _bimfaceCtrl; @@ -89,9 +101,10 @@ private async void ShowBimfaceCtrl() { var bimfaceCtrl = await GetBimfaceCtrl(); - this.sidePanel3dModel.Controls.Clear(); - this.sidePanel3dModel.Controls.Add(bimfaceCtrl); + this.panelControl1.Controls.Clear(); + this.panelControl1.Controls.Add(bimfaceCtrl); } + #endregion @@ -102,10 +115,7 @@ /// </summary> public bool AllowPrev { - get - { - return true; - } + get { return true; } } /// <summary> @@ -113,10 +123,7 @@ /// </summary> public bool AllowNext { - get - { - return _isInitialize; - } + get { return true; } } /// <summary> @@ -124,7 +131,7 @@ /// </summary> public bool AllowCancel { - get { return false; } + get { return true; } } /// <summary> @@ -138,42 +145,63 @@ /// <summary> /// 鑳藉惁涓婁竴姝� /// </summary> - public bool CanPrev() + public Task<bool> CanPrev() { - return false; + return Task.Run(() => true); } /// <summary> /// 鑳藉惁涓嬩竴姝� /// </summary> - public bool CanNext() + public Task<bool> CanNext() { - if (!_isInitialize) - { - return false; - } - - return true; + return Task.Run(() => true); } /// <summary> /// 鑳藉惁鍏抽棴 /// </summary> - public bool CanCancel() + public Task<bool> CanCancel() { - return true; + return Task.Run(() => true); } /// <summary> /// 鑳藉惁瀹屾垚 /// </summary> - public bool CanComplete() + public Task<bool> CanComplete() { - return false; + return Task.Run(() => false); } - private void layoutView1_CardClick(object sender, DevExpress.XtraGrid.Views.Layout.Events.CardClickEventArgs e) - { + //鏀瑰彉 + private void XhsSchemePumpChangeListCtrl1_HydroChangeEvent(HydroPumpViewModel obj) + { + if (_vm == null) + { + return; + } + if (_vm.allChangeRecordList == null) + { + _vm.allChangeRecordList = new List<XhsSchemeChangeRecordViewModel>(); + } + _vm.allChangeRecordList.Update(obj); } + + //瀹氫綅 + private void XhsSchemePumpChangeListCtrl1_HydroViewEvent(string obj) + { + if (string.IsNullOrEmpty(obj)) + { + return; + } + if (_vm == null) + { + return; + } + _bimfaceCtrl?.ZoomAndSelectComponent(obj); + } + + } } \ No newline at end of file -- Gitblit v1.9.3