| | |
| | | using DevExpress.Mvvm.Native; |
| | | using DevExpress.XtraEditors.Controls; |
| | | using HStation.Dto; |
| | | using System.Windows.Forms; |
| | | using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel; |
| | | using DevExpress.XtraEditors.Controls; |
| | | |
| | | namespace HStation.WinFrmUI.Xhs.PumpProduct |
| | | { |
| | |
| | | |
| | | private AddPumpMainDto _PumpMain = null; //泵型号 |
| | | |
| | | private AddPumpPartMainDto _PumpPart = null; //泵产品 |
| | | |
| | | private List<AddPumpPropContentDto> _PumpPropContent = null; //泵属性 |
| | | |
| | | private AddPumpMainAndPartMapDto _PumpMainAndPartMap = null; //泵型号和产品映射 |
| | | |
| | | public async void SetBindingData(long ID) |
| | | { |
| | | var pumpseries = await new BLL.PumpSeries().GetByID(ID); |
| | | if (pumpseries != null) |
| | | { |
| | | _PumpMain = new AddPumpMainDto(); |
| | | _PumpPart = new AddPumpPartMainDto(); |
| | | _PumpMainAndPartMap = new AddPumpMainAndPartMapDto(); |
| | | _PumpMainAndPartMap.SeriesID = pumpseries.ID; |
| | | _PumpMain.PumpSeriesID = pumpseries.ID; |
| | | _PumpPart.SeriesID = pumpseries.ID; |
| | | _bll = new Yw.BLL.SysCatalog(); |
| | | var alllist = await _bll.GetAll(); |
| | | foreach (var item in alllist) |
| | |
| | | } |
| | | _proplist = new List<PropGroupChoiceViewModel>(); |
| | | TextEditCatalog.EditValue = pumpseries.CatalogID; |
| | | this.propGroupChoiceViewModelBindingSource.DataSource = _proplist; |
| | | this.propGroupChoiceViewModelBindingSource.ResetBindings(false); |
| | | } |
| | | } |
| | | |
| | | public event Func<AddPumpMainDto, AddPumpPartMainDto, List<AddPumpPropContentDto>, AddPumpMainAndPartMapDto, Task<bool>> ReloadDataEvent = null; |
| | | public event Func<AddPumpMainDto, Task<bool>> ReloadDataEvent = null; |
| | | |
| | | //数据验证 |
| | | private bool Valid() |
| | |
| | | double ratedEfficiency; |
| | | double.TryParse(TextEditRatedeffciency.Text.Trim(), out ratedEfficiency); |
| | | _PumpMain.RatedEfficiency = ratedEfficiency; |
| | | _PumpPart.Name = TextEditProductName.Text; |
| | | _PumpPart.NO = TextEditProductNO.Text; |
| | | _PumpPart.Code = TextEditProductCode.Text; |
| | | _PumpPropContent = new List<AddPumpPropContentDto>(); |
| | | foreach (var item in _proplist) |
| | | { |
| | | _PumpPropContent.Add(new AddPumpPropContentDto { PropID = item.ID, PropValue = item.Value, SeriesID = _PumpPart.SeriesID }); |
| | | } |
| | | if (await this.ReloadDataEvent.Invoke(_PumpMain, _PumpPart, _PumpPropContent, _PumpMainAndPartMap)) |
| | | if (await this.ReloadDataEvent.Invoke(_PumpMain)) |
| | | { |
| | | MessageBoxHelper.ShowSuccess("添加成功!"); |
| | | } |
| | |
| | | } |
| | | this.DialogResult = DialogResult.OK; |
| | | this.Close(); |
| | | } |
| | | |
| | | //分类选择变换 |
| | | private async void TextEditCatalog_SelectedValueChanged(object sender, EventArgs e) |
| | | { |
| | | this.gridView1.Columns["PropGroupName"].Group(); |
| | | this.layoutControlGroup2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; |
| | | this.tabbedControlGroup1.SelectedTabPage = layoutControlGroup2; |
| | | _proplist.Clear(); |
| | | var bll = new Yw.BLL.SysPropStruct(); |
| | | var catlogID = this.TextEditCatalog.EditValue; |
| | | if (catlogID == null) |
| | | return; |
| | | var id = Convert.ToInt64(catlogID); |
| | | var catlog = await bll.GetByCatalogID(id); |
| | | if (catlog == null) |
| | | { |
| | | this.propGroupChoiceViewModelBindingSource.ResetBindings(false); |
| | | return; |
| | | } |
| | | foreach (var item in catlog) |
| | | { |
| | | foreach (var prop in item.PropList) |
| | | { |
| | | _proplist.Add(new PropGroupChoiceViewModel() { PropGroupName = item.Name, PropName = prop.Name, ID = prop.ID }); |
| | | } |
| | | } |
| | | this.propGroupChoiceViewModelBindingSource.ResetBindings(false); |
| | | } |
| | | } |
| | | } |