Browse Source

修改拆箱记录

Agv分支2024-11-19
郑勃旭 4 months ago
parent
commit
61678e58a6
  1. 91
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/OperationPacking/SeparationPackingNotes/SeparationPackingNoteAppService.cs

91
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/OperationPacking/SeparationPackingNotes/SeparationPackingNoteAppService.cs

@ -86,48 +86,47 @@ public class SeparationPackingNoteAppService :
entity.SetIdAndNumberWithDetails(GuidGenerator, entity.Number); entity.SetIdAndNumberWithDetails(GuidGenerator, entity.Number);
entity = await _repository.InsertAsync(entity).ConfigureAwait(false); entity = await _repository.InsertAsync(entity).ConfigureAwait(false);
var dto = entity.ToObject<SeparationPackingNoteDTO>();
foreach (var detailInput in input.Details) foreach (var detail in entity.Details)
{ {
//创建标签 //创建标签
var splitPackingRecDtos = await _splitPackingRecAppService.GetListByToPackingCode(new List<string> { input.PackingCode }).ConfigureAwait(false); var splitPackingRecDtos = await _splitPackingRecAppService.GetListByToPackingCode(new List<string> { input.PackingCode }).ConfigureAwait(false);
var splitPackingRecDto = splitPackingRecDtos.First(); var splitPackingRecDto = splitPackingRecDtos.First();
var inventoryLabelWithoutCodeCreateInput = new InventoryLabelWithoutCodeCreateInput var inventoryLabelWithoutCodeCreateInput = new InventoryLabelWithoutCodeCreateInput
{ {
Qty = detailInput.Qty, Qty = detail.Qty,
ItemCode = detailInput.ItemCode, ItemCode = detail.ItemCode,
SupplierCode = detailInput.SupplierCode, SupplierCode = detail.SupplierCode,
Lot = detailInput.Lot, Lot = detail.Lot,
Uom = detailInput.Uom, Uom = detail.Uom,
LocationErpCode = detailInput.LocationErpCode, LocationErpCode = detail.LocationErpCode,
ItemDesc1 = detailInput.ItemDesc1, ItemDesc1 = detail.ItemDesc1,
ArriveDate = detailInput.ArriveDate, ArriveDate = detail.ArriveDate,
StdPackQty = detailInput.StdPackQty, StdPackQty = detail.StdPackQty,
ProdLine = string.Empty, ProdLine = string.Empty,
AsnNumber = detailInput.PurchaseInfo_AsnNumber, AsnNumber = detail.PurchaseInfo_AsnNumber,
ContainerCode = detailInput.ContainerCode, ContainerCode = detail.ContainerCode,
ExpireDate = detailInput.ExpireDate, ExpireDate = detail.ExpireDate,
FullBarcodeString = string.Empty, FullBarcodeString = string.Empty,
ItemDesc2 = detailInput.ItemDesc2, ItemDesc2 = detail.ItemDesc2,
ItemName = detailInput.ItemName, ItemName = detail.ItemName,
SupplierName = detailInput.SupplierName, SupplierName = detail.SupplierName,
Remark = detailInput.Remark, Remark = detail.Remark,
LabelStatus = LabelStatus.Enable, LabelStatus = LabelStatus.Enable,
LabelType = detailInput.LabelType, LabelType = detail.LabelType,
PlanArriveDate = detailInput.PlanArriveDate, PlanArriveDate = detail.PlanArriveDate,
PoNumber = detailInput.PurchaseInfo_PoNumber, PoNumber = detail.PurchaseInfo_PoNumber,
ProduceDate = detailInput.ProduceDate, ProduceDate = detail.ProduceDate,
QLevel = string.Empty, QLevel = string.Empty,
QualityFile = string.Empty, QualityFile = string.Empty,
RecommendLocationCode = detailInput.RecommendLocationCode, RecommendLocationCode = detail.RecommendLocationCode,
RpNumber = detailInput.RpNumber, RpNumber = detail.RpNumber,
Shift = string.Empty, Shift = string.Empty,
Specifications = string.Empty, Specifications = string.Empty,
SupplierBatch = detailInput.SupplierBatch, SupplierBatch = detail.SupplierBatch,
SupplierItemCode = detailInput.ItemCode, SupplierItemCode = detail.ItemCode,
SupplierItemName = detailInput.SupplierItemName, SupplierItemName = detail.SupplierItemName,
SupplierSimpleName = detailInput.SupplierSimpleName, SupplierSimpleName = detail.SupplierSimpleName,
Team = string.Empty, Team = string.Empty,
}; };
var inventoryLabelDto = await _inventoryLabelAppService.GenerateAndCreateAsync(inventoryLabelWithoutCodeCreateInput).ConfigureAwait(false); var inventoryLabelDto = await _inventoryLabelAppService.GenerateAndCreateAsync(inventoryLabelWithoutCodeCreateInput).ConfigureAwait(false);
@ -170,18 +169,22 @@ public class SeparationPackingNoteAppService :
ReceiptRecNumber = inventoryLabelDto.RpNumber, ReceiptRecNumber = inventoryLabelDto.RpNumber,
ToStdPackQty = inventoryLabelDto.StdPackQty, ToStdPackQty = inventoryLabelDto.StdPackQty,
ToUom = inventoryLabelDto.Uom, ToUom = inventoryLabelDto.Uom,
TaskOrderNumber = detailInput.TaskOrderNumber, TaskOrderNumber = detail.TaskOrderNumber,
ArrivalNoticNumber = detailInput.ArrivalNoticNumber, ArrivalNoticNumber = detail.ArrivalNoticNumber,
PutOnShelfNumber = detailInput.PutOnShelfNumber, PutOnShelfNumber = detail.PutOnShelfNumber,
} }
}; };
await _splitPackingRecAppService.BatchInsertAsync(splitPackingRecEditInputs).ConfigureAwait(false); await _splitPackingRecAppService.BatchInsertAsync(splitPackingRecEditInputs).ConfigureAwait(false);
detail.PackingCode = inventoryLabelDto.Code;
//库存移动 //库存移动
var transferLogEditInput = await BuildTransferLogsAsync(dto, detailInput, splitPackingRecEditInputs.First()).ConfigureAwait(false); var transferLogEditInput = await BuildTransferLogsAsync(entity, detail, splitPackingRecEditInputs.First()).ConfigureAwait(false);
transferLogEditInputs.Add(transferLogEditInput); transferLogEditInputs.Add(transferLogEditInput);
} }
await _repository.UpdateAsync(entity).ConfigureAwait(false);
var dto = entity.ToObject<SeparationPackingNoteDTO>();
await _transferLogAppService.AddManyAsync(transferLogEditInputs).ConfigureAwait(false); await _transferLogAppService.AddManyAsync(transferLogEditInputs).ConfigureAwait(false);
return dto; return dto;
} }
@ -189,23 +192,23 @@ public class SeparationPackingNoteAppService :
/// <summary> /// <summary>
/// 构造 库存转移日志实体 /// 构造 库存转移日志实体
/// </summary> /// </summary>
/// <param name="dto"></param> /// <param name="entity"></param>
/// <param name="detailInput"></param> /// <param name="detail"></param>
/// <param name="splitPackingRecEditInput"></param> /// <param name="splitPackingRecEditInput"></param>
/// <returns></returns> /// <returns></returns>
private async Task<TransferLogEditInput> BuildTransferLogsAsync( private async Task<TransferLogEditInput> BuildTransferLogsAsync(
SeparationPackingNoteDTO dto, SeparationPackingNote entity,
SeparationPackingNoteDetailInput detailInput, SeparationPackingNoteDetail detail,
SplitPackingRecEditInput splitPackingRecEditInput) SplitPackingRecEditInput splitPackingRecEditInput)
{ {
var fromLocationDto = await _locationAppService.GetByCodeAsync(dto.LocationCode).ConfigureAwait(false); var fromLocationDto = await _locationAppService.GetByCodeAsync(entity.LocationCode).ConfigureAwait(false);
var toLocationDto = await _locationAppService.GetByCodeAsync(detailInput.LocationCode).ConfigureAwait(false); var toLocationDto = await _locationAppService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false);
var transferLogEditInput = new TransferLogEditInput var transferLogEditInput = new TransferLogEditInput
{ {
Worker = dto.Worker, Worker = entity.Worker,
Qty = detailInput.Qty, Qty = detail.Qty,
ItemCode = detailInput.ItemCode, ItemCode = detail.ItemCode,
FromLocationCode = fromLocationDto.Code, FromLocationCode = fromLocationDto.Code,
FromLocationErpCode = fromLocationDto.ErpLocationCode, FromLocationErpCode = fromLocationDto.ErpLocationCode,
FromLocationArea = fromLocationDto.AreaCode, FromLocationArea = fromLocationDto.AreaCode,
@ -221,9 +224,9 @@ public class SeparationPackingNoteAppService :
ArriveDate = splitPackingRecEditInput.ArriveDate, ArriveDate = splitPackingRecEditInput.ArriveDate,
DocNumber = string.Empty, DocNumber = string.Empty,
ExpireDate = splitPackingRecEditInput.ExpireDate, ExpireDate = splitPackingRecEditInput.ExpireDate,
FromContainerCode = detailInput.ContainerCode, FromContainerCode = detail.ContainerCode,
FromLot = splitPackingRecEditInput.FromLot, FromLot = splitPackingRecEditInput.FromLot,
FromPackingCode = dto.PackingCode, FromPackingCode = entity.PackingCode,
Uom = splitPackingRecEditInput.FromUom, Uom = splitPackingRecEditInput.FromUom,
FromStatus = EnumInventoryStatus.OK, FromStatus = EnumInventoryStatus.OK,
JobNumber = string.Empty, JobNumber = string.Empty,
@ -235,7 +238,7 @@ public class SeparationPackingNoteAppService :
ItemName = splitPackingRecEditInput.ItemName, ItemName = splitPackingRecEditInput.ItemName,
ProduceDate = splitPackingRecEditInput.ProduceDate, ProduceDate = splitPackingRecEditInput.ProduceDate,
SupplierBatch = splitPackingRecEditInput.SupplierBatch, SupplierBatch = splitPackingRecEditInput.SupplierBatch,
ToContainerCode = detailInput.ContainerCode, ToContainerCode = detail.ContainerCode,
ToStatus = EnumInventoryStatus.OK, ToStatus = EnumInventoryStatus.OK,
TransSubType = EnumTransSubType.Transfer_SplitPacking TransSubType = EnumTransSubType.Transfer_SplitPacking
}; };

Loading…
Cancel
Save