| | |
| | | using HStation.Vmo; |
| | | using HStation.WinFrmUI.Xhs.PumpProduct; |
| | | using NetTaste; |
| | | using HStation.WinFrmUI.Xhs.PumpProduct; |
| | | |
| | | namespace HStation.WinFrmUI |
| | | { |
| | |
| | | } |
| | | |
| | | private BLL.AssetsPumpPartMain _bll = null; |
| | | private List<PropGroupChoiceViewModel> _proplist = null; |
| | | private List<PropGroupChoiceViewModel> _propList = null; |
| | | |
| | | private List<CurrentPartMainViewModel> _allBindingList = new List<CurrentPartMainViewModel>(); |
| | | |
| | | private Vmo.AssetsPumpMainAndPartMapVmo _partmap = null; |
| | | private Vmo.AssetsPumpMainAndPartMapVmo _partMapping = null; |
| | | |
| | | private Vmo.AssetsPumpMainVmo _pumpMain; |
| | | |
| | | private Vmo.AssetsPumpPartMainVmo _pumpPart = null; |
| | | |
| | | private long _catalogID; //分类ID |
| | | |
| | | private long _seriesID; //系列ID |
| | | private Vmo.AssetsPumpSeriesVmo _series; //系列ID |
| | | |
| | | private List<Vmo.AssetsPumpPropContentVmo> _allPropList = null; |
| | | |
| | |
| | | public async void SetBindingData(Vmo.AssetsPumpMainVmo AssetsPumpMain) |
| | | { |
| | | this.pumpProductListBox1.SetBindingData(AssetsPumpMain); |
| | | _pumpMain = AssetsPumpMain; |
| | | this.pumpProductListBox1.SelectReloadEvent += () => |
| | | { |
| | | ListBoxPart_SelectedIndexChanged(); |
| | |
| | | var allpartlist = await _bll.GetByPumpMainID(AssetsPumpMain.ID); //获取所有产品 |
| | | var series = await new BLL.AssetsPumpSeries().GetByID(AssetsPumpMain.PumpSeriesID); //获取系列 |
| | | _pumpPart = new Vmo.AssetsPumpPartMainVmo(); |
| | | _seriesID = series.ID; |
| | | _pumpPart.SeriesID = _seriesID; |
| | | _series = series; |
| | | _pumpPart.SeriesID = _series.ID; |
| | | _catalogID = series.CatalogID; |
| | | _proplist = new List<PropGroupChoiceViewModel>(); |
| | | _partmap = new Vmo.AssetsPumpMainAndPartMapVmo(); |
| | | _partmap.PumpID = AssetsPumpMain.ID; |
| | | _partmap.SeriesID = _seriesID; |
| | | _propList = new List<PropGroupChoiceViewModel>(); |
| | | _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.DataSource = _propList; |
| | | this.propGroupChoiceViewModelBindingSource.ResetBindings(false); |
| | | } |
| | | |
| | |
| | | this.TextEditNo.Text = partmain.NO.Trim(); |
| | | this.TextEditProductCode.Text = partmain.Code.Trim(); |
| | | this.TextEditProductName.Text = partmain.Name.Trim(); |
| | | _proplist.Clear(); |
| | | _propList.Clear(); |
| | | var bll = new Yw.BLL.SysPropStruct(); |
| | | var catlog = await bll.GetByCatalogID(_catalogID); |
| | | if (catlog == null) |
| | |
| | | this.propGroupChoiceViewModelBindingSource.ResetBindings(false); |
| | | return; |
| | | } |
| | | _proplist.Clear(); |
| | | _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" }); |
| | | foreach (var item in catlog) |
| | | { |
| | | foreach (var prop in item.PropList) |
| | | { |
| | | _proplist.Add(new PropGroupChoiceViewModel() { PropGroupName = item.Name, PropName = prop.Name, ID = prop.ID }); |
| | | _propList.Add(new PropGroupChoiceViewModel() { PropGroupName = item.Name, PropName = prop.Name, ID = prop.ID, KeyWorldType = "Prop" }); |
| | | } |
| | | } |
| | | var propbll = new BLL.PumpPartPropContent(); |
| | |
| | | _allPropList = alllist; |
| | | foreach (var item in alllist) |
| | | { |
| | | var selectProp = _proplist.Find(x => x.ID == item.PropID); |
| | | var selectProp = _propList.Find(x => x.ID == item.PropID); |
| | | if (selectProp != null) |
| | | { |
| | | selectProp.Value = item.PropValue; |
| | |
| | | updatepart.Name = TextEditProductName.Text; |
| | | updatepart.NO = TextEditNo.Text; |
| | | updatepart.Code = TextEditProductCode.Text; |
| | | updatepart.SeriesID = _seriesID; |
| | | updatepart.SeriesID = _series.ID; |
| | | var updateproplist = new List<UpdateAssetsPumpPropContentInput>(); |
| | | foreach (var item in _proplist) |
| | | foreach (var item in _propList) |
| | | { |
| | | if (_allPropList != null) |
| | | { |
| | |
| | | _pumpPart.NO = TextEditNo.Text; |
| | | _pumpPart.Code = TextEditProductCode.Text; |
| | | var AssetsPumpPropContent = new List<Vmo.AssetsPumpPropContentVmo>(); |
| | | foreach (var item in _proplist) |
| | | foreach (var item in _propList) |
| | | { |
| | | AssetsPumpPropContent.Add(new Vmo.AssetsPumpPropContentVmo { PropID = item.ID, PropValue = item.Value, SeriesID = _pumpPart.SeriesID }); |
| | | } |
| | | var id = await _bll.InsertEx(_pumpPart, AssetsPumpPropContent, _partmap); |
| | | var id = await _bll.InsertEx(_pumpPart, AssetsPumpPropContent, _partMapping); |
| | | if (id > 0) |
| | | { |
| | | var pumppart = await _bll.GetByID(id); |
| | |
| | | this.propGroupChoiceViewModelBindingSource.ResetBindings(false); |
| | | return; |
| | | } |
| | | _proplist.Clear(); |
| | | _propList.Clear(); |
| | | foreach (var item in catlog) |
| | | { |
| | | foreach (var prop in item.PropList) |
| | | { |
| | | _proplist.Add(new PropGroupChoiceViewModel() { PropGroupName = item.Name, PropName = prop.Name, ID = prop.ID, Value = prop.DefaultValue }); |
| | | _propList.Add(new PropGroupChoiceViewModel() { PropGroupName = item.Name, PropName = prop.Name, ID = prop.ID, Value = prop.DefaultValue }); |
| | | } |
| | | } |
| | | this.propGroupChoiceViewModelBindingSource.ResetBindings(false); |
| | |
| | | } |
| | | |
| | | #endregion 菜单功能 |
| | | |
| | | //增加属性 |
| | | private void simpleLabelItemAddProp_Click(object sender, EventArgs e) |
| | | { |
| | | var dlg = new AddPumpPropDlg(); |
| | | dlg.SetBindingData(_series.CatalogID); |
| | | dlg.ReloadDataEvent += async (rhs) => |
| | | { |
| | | var bll = new Yw.BLL.SysProp(); |
| | | var id = await bll.Insert(rhs); |
| | | if (id > 0) |
| | | { |
| | | var model = await bll.GetByID(id); |
| | | // var partMain = new PropGroupChoiceViewModel() {PropGroupName= model.GroupID, }; |
| | | //_propList.Add(partMain); |
| | | // this.propViewModelBindingSource.ResetBindings(false); |
| | | return true; |
| | | } |
| | | return false; |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | } |
| | | } |