|
|
@ -13,6 +13,7 @@ using Win_in.Sfs.Wms.Store.Domain.Shared; |
|
|
|
|
|
|
|
namespace Win_in.Sfs.Wms.Store.Application; |
|
|
|
|
|
|
|
using Win_in.Sfs.Basedata.Application; |
|
|
|
using Win_in.Sfs.Shared.Application.Contracts; |
|
|
|
using Win_in.Sfs.Shared.Domain; |
|
|
|
|
|
|
@ -36,13 +37,15 @@ public class CountPlanAppService : |
|
|
|
|
|
|
|
private readonly ICountPlanManager _countPlanManager; |
|
|
|
private readonly ITransactionTypeAppService _transactionTypeAppService; |
|
|
|
private readonly IItemBasicAppService _itemBasicAppService; |
|
|
|
|
|
|
|
public CountPlanAppService(ICountPlanRepository repository, |
|
|
|
ICountPlanManager countPlanManager, |
|
|
|
ITransactionTypeAppService transactionTypeAppService) : base(repository, countPlanManager) |
|
|
|
ITransactionTypeAppService transactionTypeAppService, IItemBasicAppService itemBasicAppService) : base(repository, countPlanManager) |
|
|
|
{ |
|
|
|
_countPlanManager = countPlanManager; |
|
|
|
_transactionTypeAppService = transactionTypeAppService; |
|
|
|
_itemBasicAppService = itemBasicAppService; |
|
|
|
|
|
|
|
base.CreatePolicyName = CountPlanPermissions.Create; |
|
|
|
base.UpdatePolicyName = CountPlanPermissions.Update; |
|
|
@ -63,13 +66,13 @@ public class CountPlanAppService : |
|
|
|
|
|
|
|
entity.Worker = CurrentUser.GetUserName(); |
|
|
|
|
|
|
|
TransactionTypeDTO tranTypeDTO = null; |
|
|
|
TransactionTypeDTO tranTypeDto = null; |
|
|
|
switch (input.RequestType) |
|
|
|
{ |
|
|
|
case CountPlanRequestType.Manual: |
|
|
|
tranTypeDTO = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.CountPlan, |
|
|
|
tranTypeDto = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.CountPlan, |
|
|
|
EnumTransSubType.ArtificialCountPlan).ConfigureAwait(false); |
|
|
|
if (tranTypeDTO == null) |
|
|
|
if (tranTypeDto == null) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException( |
|
|
|
$"盘点方式 {input.RequestType} 没有设置库存事务类型。主事务类型{EnumTransType.CountPlan}," + |
|
|
@ -78,9 +81,9 @@ public class CountPlanAppService : |
|
|
|
|
|
|
|
break; |
|
|
|
case CountPlanRequestType.Import: |
|
|
|
tranTypeDTO = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.CountPlan, |
|
|
|
tranTypeDto = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.CountPlan, |
|
|
|
EnumTransSubType.ExcelInCountPlan).ConfigureAwait(false); |
|
|
|
if (tranTypeDTO == null) |
|
|
|
if (tranTypeDto == null) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException( |
|
|
|
$"盘点方式 {input.RequestType} 没有设置库存事务类型。主事务类型{EnumTransType.CountPlan}," + |
|
|
@ -93,11 +96,11 @@ public class CountPlanAppService : |
|
|
|
throw new UserFriendlyException($"{input.RequestType}盘点方式设置错误"); |
|
|
|
} |
|
|
|
|
|
|
|
entity.AutoCompleteJob = tranTypeDTO.AutoCompleteJob; |
|
|
|
entity.AutoSubmit = tranTypeDTO.AutoSubmitRequest; |
|
|
|
entity.AutoAgree = tranTypeDTO.AutoAgreeRequest; |
|
|
|
entity.AutoHandle = tranTypeDTO.AutoHandleRequest; |
|
|
|
entity.DirectCreateNote = tranTypeDTO.DirectCreateNote; |
|
|
|
entity.AutoCompleteJob = tranTypeDto.AutoCompleteJob; |
|
|
|
entity.AutoSubmit = tranTypeDto.AutoSubmitRequest; |
|
|
|
entity.AutoAgree = tranTypeDto.AutoAgreeRequest; |
|
|
|
entity.AutoHandle = tranTypeDto.AutoHandleRequest; |
|
|
|
entity.DirectCreateNote = tranTypeDto.DirectCreateNote; |
|
|
|
|
|
|
|
await _countPlanManager.CreateWithConditionAsync(entity, input.PartCondition, input.LocCondition, input.LocCondition, input.StatusList).ConfigureAwait(false); |
|
|
|
|
|
|
@ -185,6 +188,7 @@ public class CountPlanAppService : |
|
|
|
foreach (var detail in request.Details) |
|
|
|
{ |
|
|
|
var note = new CountPlanForNoteExportDTO(); |
|
|
|
var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); |
|
|
|
|
|
|
|
note.CountPlanNumber = request.Number; |
|
|
|
note.LocationCode = detail.LocationCode; |
|
|
@ -192,6 +196,9 @@ public class CountPlanAppService : |
|
|
|
note.ItemName = detail.ItemName; |
|
|
|
note.PackingCode = detail.PackingCode; |
|
|
|
note.ContainerCode = detail.ContainerCode; |
|
|
|
note.ItemDesc1=detail.ItemDesc1; |
|
|
|
note.ItemDesc2 = detail.ItemDesc1; |
|
|
|
note.Configuration = itemBasicDto.Configuration; |
|
|
|
note.Lot = detail.Lot; |
|
|
|
note.InventoryQty = detail.InventoryQty; |
|
|
|
note.FirstCountQty = detail.FirstCountQty; |
|
|
|