From 5dd7ab9852c9a5659cc916e9ed986b5099efeaf8 Mon Sep 17 00:00:00 2001 From: Shuxia Ning <NingShuxia0927@outlook.com> Date: 星期三, 23 十月 2024 13:04:33 +0800 Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/HStation/XHS.V1.0 --- WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/EditPumpPartPropDlg.cs | 76 +++++++++++++++++++++++++++++++------- 1 files changed, 62 insertions(+), 14 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/EditPumpPartPropDlg.cs b/WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/EditPumpPartPropDlg.cs index f596f2f..a613855 100644 --- a/WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/EditPumpPartPropDlg.cs +++ b/WinFrmUI/HStation.WinFrmUI.Assets.Core/01-pump/01-EditPumpPartProp/EditPumpPartPropDlg.cs @@ -12,22 +12,28 @@ this.pumpProductListBox1.MouseUp += PumpProductListBox1_MouseUp; } - private BLL.AssetsPumpPartMain _bll = null; - private List<PropGroupChoiceViewModel> _propList = null; + #region Private + + private BLL.AssetsPumpPartMain _bll; + private List<PropGroupChoiceViewModel> _propList; private List<CurrentPartMainViewModel> _allBindingList = new List<CurrentPartMainViewModel>(); - private Vmo.AssetsPumpMainAndPartMapVmo _partMapping = null; + private Vmo.AssetsPumpMainAndPartMapVmo _partMapping; private Vmo.AssetsPumpMainVmo _pumpMain; - private Vmo.AssetsPumpPartMainVmo _pumpPart = null; + private Vmo.AssetsPumpPartMainVmo _pumpPart; private long _catalogID; //鍒嗙被ID private Vmo.AssetsPumpSeriesVmo _series; //绯诲垪ID - private List<Vmo.AssetsPumpPropContentVmo> _allPropList = null; + private List<Vmo.AssetsPumpPropContentVmo> _allPropList; + + private Yw.BLL.SysPropMapping _sysPropMapping; + + #endregion Private //鍥炶皟浜嬩欢 public event Func<Vmo.AssetsPumpPartMainVmo, List<Vmo.AssetsPumpPropContentVmo>, Vmo.AssetsPumpMainAndPartMapVmo, Task<bool>> ReloadEvent; @@ -56,8 +62,6 @@ _partMapping = new Vmo.AssetsPumpMainAndPartMapVmo(); _partMapping.PumpID = AssetsPumpMain.ID; _partMapping.SeriesID = _series.ID; - // this.ListBoxPart.DataSource = _allBindingList; - // this.ListBoxPart.Refresh(); this.propGroupChoiceViewModelBindingSource.DataSource = _propList; this.propGroupChoiceViewModelBindingSource.ResetBindings(false); } @@ -80,10 +84,10 @@ return; } _propList.Clear(); - _propList.Add(new PropGroupChoiceViewModel() { PropGroupName = "閾墝鍙傛暟", PropName = "娴侀噺", Value = _pumpMain.RatedFlow.ToString(), KeyWorldType = "Basic" }); - _propList.Add(new PropGroupChoiceViewModel() { PropGroupName = "閾墝鍙傛暟", PropName = "鎵▼", Value = _pumpMain.RatedHead.ToString(), KeyWorldType = "Basic" }); - _propList.Add(new PropGroupChoiceViewModel() { PropGroupName = "閾墝鍙傛暟", PropName = "鍔熺巼", Value = _pumpMain.RatedPower.ToString(), KeyWorldType = "Basic" }); - _propList.Add(new PropGroupChoiceViewModel() { PropGroupName = "閾墝鍙傛暟", PropName = "杞��", Value = _pumpMain.RatedSpeed.ToString(), KeyWorldType = "Basic" }); + _propList.Add(new PropGroupChoiceViewModel() { PropGroupName = "閾墝鍙傛暟", PropName = "娴侀噺", Value = _pumpMain.RatedFlow.ToString(), KeyWorldType = "Basic_Flow" }); + _propList.Add(new PropGroupChoiceViewModel() { PropGroupName = "閾墝鍙傛暟", PropName = "鎵▼", Value = _pumpMain.RatedHead.ToString(), KeyWorldType = "Basic_Head" }); + _propList.Add(new PropGroupChoiceViewModel() { PropGroupName = "閾墝鍙傛暟", PropName = "鍔熺巼", Value = _pumpMain.RatedPower.ToString(), KeyWorldType = "Basic_Power" }); + _propList.Add(new PropGroupChoiceViewModel() { PropGroupName = "閾墝鍙傛暟", PropName = "杞��", Value = _pumpMain.RatedSpeed.ToString(), KeyWorldType = "Basic_Speed" }); foreach (var item in catlog) { foreach (var prop in item.PropList) @@ -127,8 +131,8 @@ updatepart.NO = TextEditNo.Text; updatepart.Code = TextEditProductCode.Text; updatepart.SeriesID = _series.ID; - var updateproplist = new List<UpdateAssetsPumpPropContentInput>(); - foreach (var item in _propList) + var propList = _propList.Where(x => x.KeyWorldType == "Prop").ToList(); //鎵惧埌鎵�鏈夌殑棰濆灞炴�� + foreach (var item in propList) { if (_allPropList != null) { @@ -145,6 +149,28 @@ } } } + var basicFlow = _propList.Find(x => x.KeyWorldType == "Basic_Flow"); + var basicHead = _propList.Find(x => x.KeyWorldType == "Basic_Head"); + var basicSpeed = _propList.Find(x => x.KeyWorldType == "Basic_Speed"); + var basicPower = _propList.Find(x => x.KeyWorldType == "Basic_Power"); + if (double.TryParse(basicFlow.Value, out double flow)) + { + _pumpMain.RatedFlow = flow; + } + if (double.TryParse(basicHead.Value, out double head)) + { + _pumpMain.RatedHead = head; + } + if (double.TryParse(basicSpeed.Value, out double speed)) + { + _pumpMain.RatedSpeed = speed; + } + if (double.TryParse(basicPower.Value, out double power)) + { + _pumpMain.RatedPower = power; + } + var pumpMainBll = new BLL.AssetsPumpMain(); + await pumpMainBll.Update(_pumpMain); if (await _bll.UpdateEx(updatepart, _allPropList)) { vm.Reset(updatepart); @@ -283,8 +309,30 @@ var id = await bll.Insert(rhs); if (id > 0) { + _sysPropMapping = new Yw.BLL.SysPropMapping(); + var allList = await _sysPropMapping.GetHaveListByCatalogID(_series.CatalogID); + var list = new List<Yw.Vmo.SysPropMappingSetterVmo>(); + foreach (var item in allList) + { + foreach (var prop in item.PropList) + { + if (prop.Have) + { + list.Add(new Yw.Vmo.SysPropMappingSetterVmo + { + PropID = prop.ID, + UnitName = prop.UnitName, + IsNull = prop.IsNull, + DefaultValue = prop.DefaultValue, + ChoiceIds = prop.ChoiceList.Select(x => x.ID).ToList(), + }); + } + } + } + list.Add(new Yw.Vmo.SysPropMappingSetterVmo { PropID = id, UnitName = rhs.UnitName, IsNull = rhs.IsNull }); + await _sysPropMapping.SetByCatalogID(_series.CatalogID, list); var model = await bll.GetByID(id); - var partMain = new PropGroupChoiceViewModel() { PropGroupName = groupName, PropName = model.Name, ID = model.ID, Value = propValue }; + var partMain = new PropGroupChoiceViewModel() { PropGroupName = groupName, PropName = model.Name, ID = model.ID, Value = propValue, KeyWorldType = "Prop" }; _propList.Add(partMain); this.propGroupChoiceViewModelBindingSource.ResetBindings(false); return true; -- Gitblit v1.9.3