| | |
| | | this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon; |
| | | } |
| | | |
| | | private BLL.PumpPartMain _bll = null; |
| | | private BLL.AssetsPumpPartMain _bll = null; |
| | | private List<PropGroupChoiceViewModel> _proplist = null; |
| | | |
| | | private List<CurrentPartMainViewModel> _allBindingList = new List<CurrentPartMainViewModel>(); |
| | | |
| | | private Vmo.PumpMainAndPartMapVmo _partmap = null; |
| | | private Vmo.AssetsPumpMainAndPartMapVmo _partmap = null; |
| | | |
| | | private Vmo.PumpPartMainVmo _pumpPart = null; |
| | | private Vmo.AssetsPumpPartMainVmo _pumpPart = null; |
| | | |
| | | private long _catalogID; //分类ID |
| | | |
| | | private long _seriesID; //系列ID |
| | | |
| | | private List<Vmo.PumpPropContentVmo> _allPropList = null; |
| | | private List<Vmo.AssetsPumpPropContentVmo> _allPropList = null; |
| | | |
| | | //回调事件 |
| | | public event Func<Vmo.PumpPartMainVmo, List<Vmo.PumpPropContentVmo>, Vmo.PumpMainAndPartMapVmo, Task<bool>> ReloadEvent; |
| | | public event Func<Vmo.AssetsPumpPartMainVmo, List<Vmo.AssetsPumpPropContentVmo>, Vmo.AssetsPumpMainAndPartMapVmo, Task<bool>> ReloadEvent; |
| | | |
| | | //数据绑定 |
| | | public async void SetBindingData(Vmo.PumpMainVmo pumpMain) |
| | | public async void SetBindingData(Vmo.AssetsPumpMainVmo AssetsPumpMain) |
| | | { |
| | | this.pumpProductListBox1.SetBindingData(pumpMain); |
| | | this.pumpProductListBox1.SetBindingData(AssetsPumpMain); |
| | | this.pumpProductListBox1.SelectReloadEvent += () => |
| | | { |
| | | ListBoxPart_SelectedIndexChanged(); |
| | |
| | | { |
| | | BarBtnAddPumpPart_ItemClick(); |
| | | }; |
| | | _bll = new BLL.PumpPartMain(); |
| | | var allpartlist = await _bll.GetByPumpMainID(pumpMain.ID); //获取所有产品 |
| | | var series = await new BLL.PumpSeries().GetByID(pumpMain.PumpSeriesID); //获取系列 |
| | | _pumpPart = new Vmo.PumpPartMainVmo(); |
| | | _bll = new BLL.AssetsPumpPartMain(); |
| | | 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; |
| | | _catalogID = series.CatalogID; |
| | | _proplist = new List<PropGroupChoiceViewModel>(); |
| | | _partmap = new Vmo.PumpMainAndPartMapVmo(); |
| | | _partmap.PumpID = pumpMain.ID; |
| | | _partmap = new Vmo.AssetsPumpMainAndPartMapVmo(); |
| | | _partmap.PumpID = AssetsPumpMain.ID; |
| | | _partmap.SeriesID = _seriesID; |
| | | |
| | | // this.ListBoxPart.DataSource = _allBindingList; |
| | |
| | | var vm = this.pumpProductListBox1.GetCurrentVm(); |
| | | if (vm == null) |
| | | return; |
| | | var updatepart = new Vmo.PumpPartMainVmo(); |
| | | var updatepart = new Vmo.AssetsPumpPartMainVmo(); |
| | | updatepart.ID = vm.ID; |
| | | updatepart.Name = TextEditProductName.Text; |
| | | updatepart.NO = TextEditNo.Text; |
| | | updatepart.Code = TextEditProductCode.Text; |
| | | updatepart.SeriesID = _seriesID; |
| | | var updateproplist = new List<UpdatePumpPropContentInput>(); |
| | | // var update = _allPropList.Select(x => x.Adapt<PumpPropContentDto, UpdatePumpPropContentInput>()).ToList(); |
| | | var updateproplist = new List<UpdateAssetsPumpPropContentInput>(); |
| | | // var update = _allPropList.Select(x => x.Adapt<AssetsPumpPropContentDto, UpdateAssetsPumpPropContentInput>()).ToList(); |
| | | foreach (var item in _proplist) |
| | | { |
| | | _allPropList.Find(x => x.PropID == item.ID).PropValue = item.Value; |
| | | if (_allPropList != null) |
| | | { |
| | | _allPropList.Find(x => x.PropID == item.ID).PropValue = item.Value; |
| | | } |
| | | } |
| | | if (await _bll.UpdateEx(updatepart, _allPropList)) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | private bool Vaild() |
| | | { |
| | | this.dxErrorProvider1.ClearErrors(); |
| | | if (TextEditProductName.Text == null) |
| | | { |
| | | this.dxErrorProvider1.SetError(TextEditProductName, "必填项"); |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | //添加产品 |
| | | private async void BtnAddPumpPart_Click(object sender, EventArgs e) |
| | | { |
| | | if (!Vaild()) |
| | | return; |
| | | _pumpPart.Name = TextEditProductName.Text; |
| | | _pumpPart.NO = TextEditNo.Text; |
| | | _pumpPart.Code = TextEditProductCode.Text; |
| | | var PumpPropContent = new List<Vmo.PumpPropContentVmo>(); |
| | | var AssetsPumpPropContent = new List<Vmo.AssetsPumpPropContentVmo>(); |
| | | foreach (var item in _proplist) |
| | | { |
| | | PumpPropContent.Add(new Vmo.PumpPropContentVmo { PropID = item.ID, PropValue = item.Value, SeriesID = _pumpPart.SeriesID, MainID = _partmap.PumpID }); |
| | | AssetsPumpPropContent.Add(new Vmo.AssetsPumpPropContentVmo { PropID = item.ID, PropValue = item.Value, SeriesID = _pumpPart.SeriesID }); |
| | | } |
| | | var id = await _bll.InsertEx(_pumpPart, PumpPropContent, _partmap); |
| | | var id = await _bll.InsertEx(_pumpPart, AssetsPumpPropContent, _partmap); |
| | | if (id > 0) |
| | | { |
| | | var pumppart = await _bll.GetByID(id); |