From 58f8453c47ea5fa264f889f351d748eef2d71ca2 Mon Sep 17 00:00:00 2001 From: Shuxia Ning <NingShuxia0927@outlook.com> Date: 星期三, 11 十二月 2024 17:23:40 +0800 Subject: [PATCH] 缺失 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/04-scheme/01-info/CreateXhsSchemeInfoPage.cs | 129 ++++++++++++++++++++++++++----------------- 1 files changed, 78 insertions(+), 51 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/04-scheme/01-info/CreateXhsSchemeInfoPage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/04-scheme/01-info/CreateXhsSchemeInfoPage.cs index 96e8214..d1e91f6 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/04-scheme/01-info/CreateXhsSchemeInfoPage.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/04-scheme/01-info/CreateXhsSchemeInfoPage.cs @@ -5,44 +5,83 @@ public CreateXhsSchemeInfoPage() { InitializeComponent(); - } + } /// <summary> /// 椤甸潰鐘舵�佹敼鍙樹簨浠� /// </summary> public event Action PageStateChangedEvent; + + /// <summary> + /// 鍙樻洿绫诲瀷鏀瑰彉浜嬩欢 + /// </summary> + public event Action<List<string>> ChangeTypeChangedEvent; private CreateXhsSchemeViewModel _vm = null;//鎿嶄綔瀵硅薄 private bool _isInitialize = false;//鏄惁鍒濆鍖� - private Lazy<HStation.BLL.XhsProject> _bllProject = new(() => new HStation.BLL.XhsProject());//椤圭洰bll - private Lazy<Yw.BLL.SysFlag> _bllFlag = new(() => new Yw.BLL.SysFlag());//鏍囩bll - public static Action AutoAddItem; - public static Action DeleteItem; - public static bool AllowImport = false; + private bool _allow_next = false;//鍏佽涓嬩竴姝� - - public async void InitialPage(ImportXhsProjectViewModel t) + /// <summary> + /// 鍒濆鍖� + /// </summary> + public async void InitialPage(CreateXhsSchemeViewModel t) { if (_isInitialize) { return; } - //_vm = t; - //_isInitialize = true; - //var allFlagList = await _bllFlag.Value.GetBySysType(HStation.Xhs.DataType.XhsProject); - //if (allFlagList == null) - //{ - // return; - //} - //this.setFlagsEditCtrl1.SetBindingData(allFlagList.Select(x => x.Name).ToList(), null); + _vm = t; + _isInitialize = true; + var allFlagList = await BLLFactory<Yw.BLL.SysFlag>.Instance.GetBySysType(HStation.Xhs.DataType.XhsScheme); + if (allFlagList != null&& allFlagList.Any()) + { + this.setFlagsEditCtrl1.SetBindingData(allFlagList.Select(x => x.Name).ToList(), null); + } + + this.xhsSchemeChangeTypeCheckedListHorizCtrl1.SetBindingData(t.HydroInfo); + this.xhsSchemeChangeTypeCheckedListHorizCtrl1.CheckedChangedEvent += (change_type_list) => + { + if (change_type_list == null || !change_type_list.Any()) + { + _allow_next = false; + } + else + { + _allow_next = true; + } + this.ChangeTypeChangedEvent?.Invoke(change_type_list); + this.PageStateChangedEvent?.Invoke(); + }; + if (t.Scheme == null) + { + t.Scheme = new XhsSchemeVmo(); + if (t.AllSchemeList != null && t.AllSchemeList.Count > 0) + { + t.Scheme.SortCode = t.AllSchemeList.Max(x => x.SortCode) + 1; + } + } } - /// <summary> - /// 鍒濆鍖� - /// </summary> - public void InitialPage(CreateXhsSchemeViewModel t) + //淇濆瓨 + private bool Save() { - throw new NotImplementedException(); + if (!_isInitialize) + { + return false; + } + this.dxErrorProvider1.ClearErrors(); + if (string.IsNullOrEmpty(this.txtName.Text.Trim())) + { + this.dxErrorProvider1.SetError(this.txtName, "蹇呭~椤�"); + return false; + } + _vm.Scheme.Name = this.txtName.Text.Trim(); + _vm.Scheme.NO = this.txtNO.Text.Trim(); + _vm.Scheme.Flags = this.setFlagsEditCtrl1.SelectedFlagList; + _vm.Scheme.AllowCustom = this.ckAllowCustom.Checked; + _vm.Scheme.ChangeTypes = this.xhsSchemeChangeTypeCheckedListHorizCtrl1.GetCheckedList(); + _vm.Scheme.Description = this.txtDescription.Text.Trim(); + return true; } /// <summary> @@ -63,7 +102,7 @@ { get { - return _isInitialize; + return _allow_next; } } @@ -72,7 +111,10 @@ /// </summary> public bool AllowCancel { - get { return true; } + get + { + return true; + } } /// <summary> @@ -80,7 +122,14 @@ /// </summary> public bool AllowComplete { - get { return false; } + get + { + if (!_isInitialize) + return false; + + return !_allow_next; + } + } /// <summary> @@ -95,32 +144,8 @@ /// 鑳藉惁涓嬩竴姝� /// </summary> public bool CanNext() - { - if (!_isInitialize) - { - return false; - } - this.dxErrorProvider1.ClearErrors(); - if (string.IsNullOrEmpty(this.txtName.Text.Trim())) - { - this.dxErrorProvider1.SetError(this.txtName, "蹇呭~椤�"); - return false; - } - var tagName = this.txtTagNme.Text.Trim(); - if (!string.IsNullOrEmpty(tagName)) - { - if (_bllProject.Value.IsExistTagName(tagName).Result) - { - this.dxErrorProvider1.SetError(this.txtTagNme, "鏍囪宸插瓨鍦�"); - return false; - } - } - //_vm.Name = this.txtName.Text.Trim(); - //_vm.Customer = this.txtCustomer.Text.Trim(); - //_vm.Flags = this.setFlagsEditCtrl1.SelectedFlagList; - //_vm.TagName = tagName; - //_vm.Description = this.txtDescription.Text.Trim(); - return true; + { + return Save(); } /// <summary> @@ -136,9 +161,11 @@ /// </summary> public bool CanComplete() { - return false; + return Save(); } + + } } \ No newline at end of file -- Gitblit v1.9.3