| | |
| | | using DevExpress.XtraEditors.Controls; |
| | | using DevExpress.XtraEditors.Repository; |
| | | |
| | | namespace HStation.WinFrmUI.Assets |
| | | { |
| | |
| | | _allBindingList = new List<PumpAccountViewModel>(); |
| | | if (pumpList != null) |
| | | { |
| | | var nameCountGroups = pumpList |
| | | .GroupBy(item => item.PumpMainID) |
| | | .Select(group => new { Name = group.Key, Count = group.Count() }); |
| | | foreach (var group in nameCountGroups) |
| | | /* var nameCountGroups = pumpList |
| | | .GroupBy(item => item.PumpMainID) |
| | | .Select(group => new { Name = group.Key, Count = group.Count() }); |
| | | */ |
| | | foreach (var group in pumpList) |
| | | { |
| | | _allBindingList.Add(new PumpAccountViewModel(group.Name, group.Count)); |
| | | _allBindingList.Add(new PumpAccountViewModel(group.PumpMainID)); |
| | | } |
| | | } |
| | | this.pumpAccountViewModelBindingSource.DataSource = _allBindingList; |
| | |
| | | this.textEditCatalog.EditValue = _EquipmentVmo.CatalogID; |
| | | this.textEditName.Text = _EquipmentVmo.Name; |
| | | this.textEditNo.Text = _EquipmentVmo.NO; |
| | | this.textEditEquipmentCount.Text = _EquipmentVmo.EquipmentCount.ToString(); |
| | | this.textEditUseCount.Text = _EquipmentVmo.PumpTotal.ToString(); |
| | | this.textEditDescription.Text = _EquipmentVmo.Description; |
| | | } |
| | | |
| | |
| | | this.dxErrorProvider1.SetError(this.textEditName, "必填项"); |
| | | return false; |
| | | } |
| | | if (string.IsNullOrEmpty(textEditEquipmentCount.Text.Trim())) |
| | | if (string.IsNullOrEmpty(textEditUseCount.Text.Trim())) |
| | | { |
| | | this.dxErrorProvider1.SetError(this.textEditEquipmentCount, "必填项"); |
| | | this.dxErrorProvider1.SetError(this.textEditUseCount, "必填项"); |
| | | return false; |
| | | } |
| | | if (_allBindingList != null) |
| | | { |
| | | int.TryParse(textEditUseCount.Text, out int UseCount); |
| | | if (UseCount < _allBindingList.Count) |
| | | { |
| | | TipFormHelper.ShowError("使用数量大于泵数量"); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | return true; |
| | |
| | | _EquipmentVmo.Description = textEditDescription.Text.Trim(); |
| | | _EquipmentVmo.Name = textEditName.Text.Trim(); |
| | | _EquipmentVmo.NO = textEditNo.Text.Trim(); |
| | | if (int.TryParse(this.textEditEquipmentCount.Text, out int equipmentCount)) |
| | | if (int.TryParse(this.textEditUseCount.Text, out int equipmentCount)) |
| | | { |
| | | _EquipmentVmo.UseCount = equipmentCount; |
| | | _EquipmentVmo.PumpUseCount = equipmentCount; |
| | | } |
| | | if (long.TryParse(textEditCatalog.EditValue?.ToString() ?? "", out long catalogID)) |
| | | { |