|
@ -1,15 +1,19 @@ |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
|
|
|
using IdentityModel; |
|
|
using IdentityServer4.Models; |
|
|
using IdentityServer4.Models; |
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
using Volo.Abp; |
|
|
using Volo.Abp; |
|
|
|
|
|
using Volo.Abp.Domain.Entities; |
|
|
|
|
|
using Volo.Abp.Guids; |
|
|
using Volo.Abp.ObjectMapping; |
|
|
using Volo.Abp.ObjectMapping; |
|
|
using Win_in.Sfs.Basedata; |
|
|
using Win_in.Sfs.Basedata; |
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
|
using Win_in.Sfs.Basedata.Domain.Shared; |
|
|
using Win_in.Sfs.Basedata.Domain.Shared; |
|
|
using Win_in.Sfs.Label.Application.Contracts; |
|
|
using Win_in.Sfs.Label.Application.Contracts; |
|
|
|
|
|
using Win_in.Sfs.Shared.Application; |
|
|
using Win_in.Sfs.Shared.Domain.Shared; |
|
|
using Win_in.Sfs.Shared.Domain.Shared; |
|
|
using Win_in.Sfs.Wms.Inventory.Application.Contracts; |
|
|
using Win_in.Sfs.Wms.Inventory.Application.Contracts; |
|
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|
@ -67,109 +71,38 @@ public class IntegrationPackingNoteAppService : |
|
|
public override async Task<IntegrationPackingNoteDTO> CreateAsync(IntegrationPackingNoteEditInput input) |
|
|
public override async Task<IntegrationPackingNoteDTO> CreateAsync(IntegrationPackingNoteEditInput input) |
|
|
{ |
|
|
{ |
|
|
var transferLogEditInputs = new List<TransferLogEditInput>(); |
|
|
var transferLogEditInputs = new List<TransferLogEditInput>(); |
|
|
var outDtos=await _expectOutAppService.GetListByPackingCodeAsync(input.PackingCode).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
var outDtos = await _expectOutAppService.GetListByPackingCodeAsync(input.PackingCode).ConfigureAwait(false); |
|
|
if (outDtos.Any()) |
|
|
if (outDtos.Any()) |
|
|
{ |
|
|
{ |
|
|
throw new UserFriendlyException($"此物料已经被【任务编号:{outDtos.First().JobNumber}】占用"); |
|
|
throw new UserFriendlyException($"此物料已经被【任务编号:{outDtos.First().JobNumber}】占用"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
foreach (var detailInput in input.Details) |
|
|
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 inventoryLabelWithoutCodeCreateInput = new InventoryLabelWithoutCodeCreateInput |
|
|
var entity = input.ToObject<IntegrationPackingNote>(); |
|
|
{ |
|
|
var number = await GenerateNumberAsync(nameof(IntegrationPackingNote), Clock.Now).ConfigureAwait(false); |
|
|
Qty = detailInput.Qty, ItemCode = detailInput.ItemCode, |
|
|
entity.Number = number; |
|
|
SupplierCode = detailInput.SupplierCode, |
|
|
entity.SetId(GuidGenerator.Create()); |
|
|
Lot = detailInput.Lot, |
|
|
entity.SetIdAndNumberWithDetails(GuidGenerator, entity.Number); |
|
|
Uom = detailInput.Uom, |
|
|
|
|
|
LocationErpCode = detailInput.LocationErpCode, |
|
|
entity = await _repository.InsertAsync(entity).ConfigureAwait(false); |
|
|
ItemDesc1 = detailInput.ItemDesc1, |
|
|
var dto = entity.ToObject<IntegrationPackingNoteDTO>(); |
|
|
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) |
|
|
|
|
|
{ |
|
|
//库存移动
|
|
|
//库存移动
|
|
|
var transferLogEditInput=await BuildTransferLogsAsync(dto, detailInput, splitPackingRecEditInputs.First()).ConfigureAwait(false); |
|
|
var transferLogEditInput = await BuildTransferLogsAsync(dto, detailInput).ConfigureAwait(false); |
|
|
transferLogEditInputs.Add(transferLogEditInput); |
|
|
transferLogEditInputs.Add(transferLogEditInput); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
await _transferLogAppService.AddManyAsync(transferLogEditInputs).ConfigureAwait(false); |
|
|
await _transferLogAppService.AddManyAsync(transferLogEditInputs).ConfigureAwait(false); |
|
|
|
|
|
return dto; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
@ -177,15 +110,13 @@ public class IntegrationPackingNoteAppService : |
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
/// <param name="dto"></param>
|
|
|
/// <param name="dto"></param>
|
|
|
/// <param name="detailInput"></param>
|
|
|
/// <param name="detailInput"></param>
|
|
|
/// <param name="splitPackingRecEditInput"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
/// <returns></returns>
|
|
|
private async Task<TransferLogEditInput> BuildTransferLogsAsync( |
|
|
private async Task<TransferLogEditInput> BuildTransferLogsAsync( |
|
|
IntegrationPackingNoteDTO dto, |
|
|
IntegrationPackingNoteDTO dto, |
|
|
IntegrationPackingNoteDetailInput detailInput, |
|
|
IntegrationPackingNoteDetailInput detailInput) |
|
|
SplitPackingRecEditInput splitPackingRecEditInput) |
|
|
|
|
|
{ |
|
|
{ |
|
|
var fromLocationDto = await _locationAppService.GetByCodeAsync(dto.LocationCode).ConfigureAwait(false); |
|
|
var fromLocationDto = await _locationAppService.GetByCodeAsync(detailInput.LocationCode).ConfigureAwait(false); |
|
|
var toLocationDto = await _locationAppService.GetByCodeAsync(detailInput.LocationCode).ConfigureAwait(false); |
|
|
var toLocationDto = await _locationAppService.GetByCodeAsync(dto.LocationCode).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
var transferLogEditInput = new TransferLogEditInput |
|
|
var transferLogEditInput = new TransferLogEditInput |
|
|
{ |
|
|
{ |
|
@ -202,35 +133,30 @@ public class IntegrationPackingNoteAppService : |
|
|
ToLocationArea = toLocationDto.AreaCode, |
|
|
ToLocationArea = toLocationDto.AreaCode, |
|
|
ToLocationGroup = toLocationDto.LocationGroupCode, |
|
|
ToLocationGroup = toLocationDto.LocationGroupCode, |
|
|
ToWarehouseCode = toLocationDto.WarehouseCode, |
|
|
ToWarehouseCode = toLocationDto.WarehouseCode, |
|
|
ToPackingCode = splitPackingRecEditInput.ToPackingCode, |
|
|
ToPackingCode = dto.PackingCode, |
|
|
Remark = splitPackingRecEditInput.Remark, |
|
|
Remark = dto.Remark, |
|
|
ArriveDate = splitPackingRecEditInput.ArriveDate, |
|
|
ArriveDate = dto.ArriveDate, |
|
|
DocNumber = string.Empty, |
|
|
DocNumber = string.Empty, |
|
|
ExpireDate = splitPackingRecEditInput.ExpireDate, |
|
|
ExpireDate = dto.ExpireDate, |
|
|
FromContainerCode = detailInput.ContainerCode, |
|
|
FromContainerCode = detailInput.ContainerCode, |
|
|
FromLot = splitPackingRecEditInput.FromLot, |
|
|
FromLot = detailInput.Lot, |
|
|
FromPackingCode = dto.PackingCode, |
|
|
FromPackingCode = detailInput.PackingCode, |
|
|
Uom = splitPackingRecEditInput.FromUom, |
|
|
Uom = detailInput.Uom, |
|
|
FromStatus = EnumInventoryStatus.OK, |
|
|
FromStatus = EnumInventoryStatus.OK, |
|
|
JobNumber = string.Empty, |
|
|
JobNumber = string.Empty, |
|
|
ItemDesc1 = splitPackingRecEditInput.ItemDesc1, |
|
|
ItemDesc1 = dto.ItemDesc1, |
|
|
StdPackQty = splitPackingRecEditInput.FromStdPackQty, |
|
|
StdPackQty = dto.StdPackQty, |
|
|
TransType = EnumTransType.Transfer, |
|
|
TransType = EnumTransType.Transfer, |
|
|
ToLot = splitPackingRecEditInput.ToLot, |
|
|
ToLot = dto.Lot, |
|
|
ItemDesc2 = splitPackingRecEditInput.ItemDesc2, |
|
|
ItemDesc2 = dto.ItemDesc2, |
|
|
ItemName = splitPackingRecEditInput.ItemName, |
|
|
ItemName = dto.ItemName, |
|
|
ProduceDate = splitPackingRecEditInput.ProduceDate, |
|
|
ProduceDate = dto.ProduceDate, |
|
|
SupplierBatch = splitPackingRecEditInput.SupplierBatch, |
|
|
SupplierBatch = dto.SupplierBatch, |
|
|
ToContainerCode = detailInput.ContainerCode, |
|
|
ToContainerCode = detailInput.ContainerCode, |
|
|
ToStatus = EnumInventoryStatus.OK, |
|
|
ToStatus = EnumInventoryStatus.OK, |
|
|
TransSubType = EnumTransSubType.Transfer_SplitPacking |
|
|
TransSubType = EnumTransSubType.Transfer_Integration, |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
return transferLogEditInput; |
|
|
return transferLogEditInput; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private async Task CreateLabelAsync() |
|
|
|
|
|
{ |
|
|
|
|
|
var batchInsert=await _splitPackingRecAppService.BatchInsertAsync().ConfigureAwait(false); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|