| | |
| | | // 按Type区分操作类型(0=新增,1=删除) |
| | | switch (barcodeDto.Type) |
| | | { |
| | | case "0": |
| | | return InsertBarcode(barcodeEntity); |
| | | case "1": |
| | | return InsertBarcode(barcodeEntity); |
| | | case "2": |
| | | return DeleteBarcode(barcodeEntity.Id); |
| | | default: |
| | | throw new ArgumentOutOfRangeException( nameof(barcodeDto.Type), barcodeDto.Type, "条码操作类型错误:仅支持 0(新增)、1(删除)"); |
| | |
| | | { |
| | | switch (type) |
| | | { |
| | | case "0": |
| | | case "1": |
| | | groupResultList.Add(InsertBarcodeBatch(entityGroup)); |
| | | break; |
| | | case "1": |
| | | case "2": |
| | | groupResultList.Add(DeleteBarcodeBatch(entityGroup.Select(e => e.Id).ToArray())); |
| | | break; |
| | | default: |
| | | throw new ArgumentOutOfRangeException(nameof(type),type,"批量操作中存在非法Type:仅支持 0(新增)、1(删除)"); |
| | | throw new ArgumentOutOfRangeException(nameof(type),type,"批量操作中存在非法Type:仅支持 1(新增)、2(删除)"); |
| | | } |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | private BarcodeInformation ConvertDtoToEntity(DeliveryBarcodeInfo dto) |
| | | { |
| | | var entityId = dto.Type == "0" ? Guid.NewGuid() : (string.IsNullOrEmpty(dto.SmallBarcode) ? Guid.Empty : Guid.Parse(dto.SmallBarcode)); |
| | | var entityId = dto.Type == "1" ? Guid.NewGuid() : (string.IsNullOrEmpty(dto.SmallBarcode) ? Guid.Empty : Guid.NewGuid()); |
| | | |
| | | return new BarcodeInformation |
| | | { |
| | |
| | | DeliveryNo = dto.DeliveryNo, |
| | | DnLines = dto.LineNo, |
| | | PackLevel = dto.BarcodeType, |
| | | CreateTime = dto.Type == "0" ? DateTime.Now : (DateTime?)null, |
| | | CreateTime = dto.Type == "1" ? DateTime.Now : (DateTime?)null, |
| | | UpdateTime = DateTime.Now, |
| | | // 扩展字段赋默认值 |
| | | BigBarcode = null, |