|
@ -80,29 +80,103 @@ public class IntegrationPackingNoteAppService : |
|
|
|
|
|
|
|
|
if (input.Details.Any(p=>p.Qty<=0)) |
|
|
if (input.Details.Any(p=>p.Qty<=0)) |
|
|
{ |
|
|
{ |
|
|
throw new UserFriendlyException($"数量必须大于0"); |
|
|
//标签记录
|
|
|
} |
|
|
var splitPackingRecDtos = await _splitPackingRecAppService.GetListByToPackingCode(new List<string> { input.PackingCode }).ConfigureAwait(false); |
|
|
|
|
|
var splitPackingRecDto = splitPackingRecDtos.First(); |
|
|
var entity = input.ToObject<IntegrationPackingNote>(); |
|
|
var inventoryLabelWithoutCodeCreateInput = new InventoryLabelWithoutCodeCreateInput |
|
|
var number = await GenerateNumberAsync(nameof(IntegrationPackingNote), Clock.Now).ConfigureAwait(false); |
|
|
{ |
|
|
entity.Number = number; |
|
|
Qty = detailInput.Qty, ItemCode = detailInput.ItemCode, |
|
|
entity.SetId(GuidGenerator.Create()); |
|
|
SupplierCode = detailInput.SupplierCode, |
|
|
entity.SetIdAndNumberWithDetails(GuidGenerator, entity.Number); |
|
|
Lot = detailInput.Lot, |
|
|
|
|
|
Uom = detailInput.Uom, |
|
|
entity = await _repository.InsertAsync(entity).ConfigureAwait(false); |
|
|
LocationErpCode = detailInput.LocationErpCode, |
|
|
var dto = entity.ToObject<IntegrationPackingNoteDTO>(); |
|
|
ItemDesc1 = detailInput.ItemDesc1, |
|
|
|
|
|
ArriveDate = detailInput.ArriveDate, |
|
|
|
|
|
StdPackQty = detailInput.StdPackQty, |
|
|
|
|
|
ProdLine = string.Empty, |
|
|
|
|
|
AsnNumber = detailInput.PurchaseInfo_AsnNumber, |
|
|
|
|
|
ContainerCode = detailInput.ContainerCode, |
|
|
|
|
|
ExpireDate = detailInput.ExpireDate, |
|
|
|
|
|
FullBarcodeString = string.Empty, |
|
|
|
|
|
ItemDesc2 = detailInput.ItemDesc2, |
|
|
|
|
|
ItemName = detailInput.ItemName, |
|
|
|
|
|
SupplierName = detailInput.SupplierName, |
|
|
|
|
|
Remark = detailInput.Remark, |
|
|
|
|
|
LabelStatus = LabelStatus.Enable, |
|
|
|
|
|
LabelType = detailInput.LabelType, |
|
|
|
|
|
PlanArriveDate = detailInput.PlanArriveDate, |
|
|
|
|
|
PoNumber = detailInput.PurchaseInfo_PoNumber, |
|
|
|
|
|
ProduceDate = detailInput.ProduceDate, |
|
|
|
|
|
QLevel = string.Empty, |
|
|
|
|
|
QualityFile = string.Empty, |
|
|
|
|
|
RecommendLocationCode = detailInput.RecommendLocationCode, |
|
|
|
|
|
RpNumber = detailInput.RpNumber, |
|
|
|
|
|
Shift = string.Empty, |
|
|
|
|
|
Specifications = string.Empty, |
|
|
|
|
|
SupplierBatch = detailInput.SupplierBatch, |
|
|
|
|
|
SupplierItemCode = detailInput.ItemCode, |
|
|
|
|
|
SupplierItemName = detailInput.SupplierItemName, |
|
|
|
|
|
SupplierSimpleName = detailInput.SupplierSimpleName, |
|
|
|
|
|
Team = string.Empty, |
|
|
|
|
|
}; |
|
|
|
|
|
var inventoryLabelDto=await _inventoryLabelAppService.GenerateAndCreateAsync(inventoryLabelWithoutCodeCreateInput).ConfigureAwait(false); |
|
|
|
|
|
var splitPackingRecEditInputs = new List<SplitPackingRecEditInput>() |
|
|
|
|
|
{ |
|
|
|
|
|
new SplitPackingRecEditInput() |
|
|
|
|
|
{ |
|
|
|
|
|
ItemCode = inventoryLabelDto.ItemCode, |
|
|
|
|
|
SupplierCode = inventoryLabelDto.SupplierCode, |
|
|
|
|
|
ToPackingCode = inventoryLabelDto.Code, |
|
|
|
|
|
FromPackingCode = input.PackingCode, |
|
|
|
|
|
LocationErpCode = inventoryLabelDto.LocationErpCode, |
|
|
|
|
|
ItemDesc1 = inventoryLabelDto.ItemDesc1, |
|
|
|
|
|
FromLot = input.Lot, |
|
|
|
|
|
ToLot = inventoryLabelDto.Lot, |
|
|
|
|
|
ArriveDate = inventoryLabelDto.ArriveDate, |
|
|
|
|
|
ItemName = inventoryLabelDto.ItemName, |
|
|
|
|
|
ItemDesc2 = inventoryLabelDto.ItemDesc2, |
|
|
|
|
|
PurchaseInfo_PoNumber = inventoryLabelDto.PoNumber, |
|
|
|
|
|
LabelType = (EnumLabelType)inventoryLabelDto.LabelType, |
|
|
|
|
|
RecommendLocationCode = inventoryLabelDto.RecommendLocationCode, |
|
|
|
|
|
RpNumber = inventoryLabelDto.RpNumber, |
|
|
|
|
|
SupplierName = inventoryLabelDto.SupplierName, |
|
|
|
|
|
Remark = inventoryLabelDto.Remark, |
|
|
|
|
|
FromQty = input.Qty, |
|
|
|
|
|
ToQty = inventoryLabelDto.Qty, |
|
|
|
|
|
PurchaseInfo_AsnNumber = inventoryLabelDto.AsnNumber, |
|
|
|
|
|
ExpireDate = inventoryLabelDto.ExpireDate, |
|
|
|
|
|
FullBarcodeString = inventoryLabelDto.FullBarcodeString, |
|
|
|
|
|
SupplierBatch = inventoryLabelDto.SupplierBatch, |
|
|
|
|
|
ProduceDate = inventoryLabelDto.ProduceDate, |
|
|
|
|
|
LabelStatus = Basedata.LabelStatus.Enable, |
|
|
|
|
|
SupplierSimpleName = inventoryLabelDto.SupplierSimpleName, |
|
|
|
|
|
SupplierItemCode = inventoryLabelDto.SupplierItemCode, |
|
|
|
|
|
SupplierItemName = inventoryLabelDto.SupplierItemName, |
|
|
|
|
|
PlanArriveDate = inventoryLabelDto.PlanArriveDate, |
|
|
|
|
|
FromStdPackQty = input.StdPackQty, |
|
|
|
|
|
FromUom = input.Uom, |
|
|
|
|
|
OprType = OprTypeEnum.SplitBox, |
|
|
|
|
|
ReceiptRecNumber = inventoryLabelDto.RpNumber, |
|
|
|
|
|
ToStdPackQty = inventoryLabelDto.StdPackQty, |
|
|
|
|
|
ToUom = inventoryLabelDto.Uom, |
|
|
|
|
|
TaskOrderNumber = detailInput.TaskOrderNumber, |
|
|
|
|
|
ArrivalNoticNumber = detailInput.ArrivalNoticNumber, |
|
|
|
|
|
PutOnShelfNumber = detailInput.PutOnShelfNumber, |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
await _splitPackingRecAppService.BatchInsertAsync(splitPackingRecEditInputs).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
//var dto = await base.CreateAsync(input).ConfigureAwait(false);
|
|
|
//创建标签
|
|
|
|
|
|
var dto= await base.CreateAsync(input).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
foreach (var detailInput in input.Details) |
|
|
foreach (var detailInput in input.Details) |
|
|
{ |
|
|
{ |
|
|
//库存移动
|
|
|
//库存移动
|
|
|
var transferLogEditInput = await BuildTransferLogsAsync(dto, detailInput).ConfigureAwait(false); |
|
|
var transferLogEditInput=await BuildTransferLogsAsync(dto, detailInput, splitPackingRecEditInputs.First()).ConfigureAwait(false); |
|
|
transferLogEditInputs.Add(transferLogEditInput); |
|
|
transferLogEditInputs.Add(transferLogEditInput); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
await _transferLogAppService.AddManyAsync(transferLogEditInputs).ConfigureAwait(false); |
|
|
await _transferLogAppService.AddManyAsync(transferLogEditInputs).ConfigureAwait(false); |
|
|
return dto; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
@ -159,4 +233,9 @@ public class IntegrationPackingNoteAppService : |
|
|
|
|
|
|
|
|
return transferLogEditInput; |
|
|
return transferLogEditInput; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private async Task CreateLabelAsync() |
|
|
|
|
|
{ |
|
|
|
|
|
var batchInsert=await _splitPackingRecAppService.BatchInsertAsync().ConfigureAwait(false); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|