|
@ -3,6 +3,7 @@ using System.Linq; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
using Volo.Abp.EventBus; |
|
|
using Volo.Abp.EventBus; |
|
|
using Volo.Abp.Uow; |
|
|
using Volo.Abp.Uow; |
|
|
|
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
|
using Win_in.Sfs.Label.Application.Contracts; |
|
|
using Win_in.Sfs.Label.Application.Contracts; |
|
|
using Win_in.Sfs.Shared.Domain.Shared; |
|
|
using Win_in.Sfs.Shared.Domain.Shared; |
|
|
using Win_in.Sfs.Shared.Event; |
|
|
using Win_in.Sfs.Shared.Event; |
|
@ -27,15 +28,18 @@ public class PurchaseReturnNoteEventHandler |
|
|
private readonly IPurchaseReturnRequestAppService _purchaseReturnRequestApp; |
|
|
private readonly IPurchaseReturnRequestAppService _purchaseReturnRequestApp; |
|
|
private readonly IPurchaseOrderAppService _purchaseOrderAppService; |
|
|
private readonly IPurchaseOrderAppService _purchaseOrderAppService; |
|
|
private readonly IInventoryLabelAppService _inventoryLabelAppService; |
|
|
private readonly IInventoryLabelAppService _inventoryLabelAppService; |
|
|
|
|
|
private readonly IItemBasicAppService _itemBasicAppService; |
|
|
|
|
|
|
|
|
public PurchaseReturnNoteEventHandler( |
|
|
public PurchaseReturnNoteEventHandler( |
|
|
IPurchaseReturnRequestAppService purchaseReturnRequestApp |
|
|
IPurchaseReturnRequestAppService purchaseReturnRequestApp |
|
|
, IPurchaseOrderAppService purchaseOrderAppService, |
|
|
, IPurchaseOrderAppService purchaseOrderAppService, |
|
|
IInventoryLabelAppService inventoryLabelAppService) |
|
|
IInventoryLabelAppService inventoryLabelAppService, |
|
|
|
|
|
IItemBasicAppService itemBasicAppService) |
|
|
{ |
|
|
{ |
|
|
_purchaseReturnRequestApp = purchaseReturnRequestApp; |
|
|
_purchaseReturnRequestApp = purchaseReturnRequestApp; |
|
|
_purchaseOrderAppService = purchaseOrderAppService; |
|
|
_purchaseOrderAppService = purchaseOrderAppService; |
|
|
_inventoryLabelAppService = inventoryLabelAppService; |
|
|
_inventoryLabelAppService = inventoryLabelAppService; |
|
|
|
|
|
_itemBasicAppService = itemBasicAppService; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[UnitOfWork] |
|
|
[UnitOfWork] |
|
@ -81,7 +85,7 @@ public class PurchaseReturnNoteEventHandler |
|
|
{ |
|
|
{ |
|
|
var inboundTransactions = new List<TransactionEditInput>(); |
|
|
var inboundTransactions = new List<TransactionEditInput>(); |
|
|
|
|
|
|
|
|
inboundTransactions.AddRange(BuildTransactions(purchaseReturnNote)); |
|
|
inboundTransactions.AddRange(await BuildTransactions(purchaseReturnNote).ConfigureAwait(false)); |
|
|
|
|
|
|
|
|
await TransactionAppService.AddManyAsync(inboundTransactions).ConfigureAwait(false); |
|
|
await TransactionAppService.AddManyAsync(inboundTransactions).ConfigureAwait(false); |
|
|
|
|
|
|
|
@ -118,12 +122,13 @@ public class PurchaseReturnNoteEventHandler |
|
|
} |
|
|
} |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
private List<TransactionEditInput> BuildTransactions(PurchaseReturnNote purchaseReturnNote) |
|
|
private async Task<List<TransactionEditInput>> BuildTransactions(PurchaseReturnNote purchaseReturnNote) |
|
|
{ |
|
|
{ |
|
|
var transactions = new List<TransactionEditInput>(); |
|
|
var transactions = new List<TransactionEditInput>(); |
|
|
//构造库存转移记录创建Input
|
|
|
//构造库存转移记录创建Input
|
|
|
foreach (var detail in purchaseReturnNote.Details.Where(detail => detail.Qty != 0)) |
|
|
foreach (var detail in purchaseReturnNote.Details.Where(detail => detail.Qty != 0)) |
|
|
{ |
|
|
{ |
|
|
|
|
|
var itemBasicDto= await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); |
|
|
var transaction = ObjectMapper.Map<PurchaseReturnNoteDetail, TransactionEditInput>(detail); |
|
|
var transaction = ObjectMapper.Map<PurchaseReturnNoteDetail, TransactionEditInput>(detail); |
|
|
|
|
|
|
|
|
transaction.TransType = |
|
|
transaction.TransType = |
|
@ -134,6 +139,7 @@ public class PurchaseReturnNoteEventHandler |
|
|
transaction.Worker = purchaseReturnNote.Worker; |
|
|
transaction.Worker = purchaseReturnNote.Worker; |
|
|
transaction.DocNumber = purchaseReturnNote.Number; |
|
|
transaction.DocNumber = purchaseReturnNote.Number; |
|
|
transaction.JobNumber = purchaseReturnNote.JobNumber; |
|
|
transaction.JobNumber = purchaseReturnNote.JobNumber; |
|
|
|
|
|
transaction.ManageType = itemBasicDto.ManageType; |
|
|
//transaction.Status =
|
|
|
//transaction.Status =
|
|
|
// detail.Status == EnumInventoryStatus.None
|
|
|
// detail.Status == EnumInventoryStatus.None
|
|
|
// ? InventoryStatus
|
|
|
// ? InventoryStatus
|
|
|