|
|
@ -1,7 +1,9 @@ |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Castle.Components.DictionaryAdapter; |
|
|
|
using Volo.Abp.EventBus; |
|
|
|
using Volo.Abp.ObjectMapping; |
|
|
|
using Volo.Abp.Uow; |
|
|
|
using Win_in.Sfs.Shared.Event; |
|
|
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|
|
@ -32,12 +34,25 @@ public class ProductReceiptNoteEventHandler |
|
|
|
|
|
|
|
protected override async Task AddExchangeDataAsync(List<ProductReceiptNote> entities) |
|
|
|
{ |
|
|
|
var dtos = ObjectMapper.Map<List<ProductReceiptNote>, List<ProductReceiptNoteDTO>>(entities); |
|
|
|
foreach (var detail in dtos.SelectMany(dto => dto.Details)) |
|
|
|
var result = new List<ProductReceiptNoteDTO>(); |
|
|
|
|
|
|
|
foreach (var entity in entities) |
|
|
|
{ |
|
|
|
foreach (var detail in entity.Details) |
|
|
|
{ |
|
|
|
var dto = ObjectMapper.Map<ProductReceiptNote, ProductReceiptNoteDTO>(entity); |
|
|
|
var detailDto = ObjectMapper.Map<ProductReceiptNoteDetail, ProductReceiptNoteDetailDTO>(detail); |
|
|
|
dto.Details = new EditableList<ProductReceiptNoteDetailDTO>{ detailDto }; |
|
|
|
result.Add(dto); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
foreach (var detail in result.SelectMany(dto => dto.Details)) |
|
|
|
{ |
|
|
|
await detail.TrySetLocationAsync(LocationAclService, detail.LocationCode).ConfigureAwait(false); |
|
|
|
} |
|
|
|
var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, ExchangeDataType, dtos).ConfigureAwait(false); |
|
|
|
|
|
|
|
var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, ExchangeDataType, result).ConfigureAwait(false); |
|
|
|
await AddManyAsync(exchangeData).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|