15 changed files with 316 additions and 50 deletions
@ -0,0 +1,57 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.EventBus; |
||||
|
using Volo.Abp.Uow; |
||||
|
using Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
using Win_in.Sfs.Shared.Event; |
||||
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Event.DataExchanges |
||||
|
{ |
||||
|
public class ItemTransformNoteEventHandler |
||||
|
: StoreDataExchangeEventHandlerBase<ItemTransformNote> |
||||
|
, ILocalEventHandler<SfsCreatedEntityEventData<ItemTransformNote>> |
||||
|
, ILocalEventHandler<SfsCreatedEntityEventData<List<ItemTransformNote>>> |
||||
|
{ |
||||
|
private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.Item_Transform; |
||||
|
private const EnumTransSubType TransSubType = EnumTransSubType.Item_Transform; |
||||
|
private readonly ILocationAppService _locationAppService; |
||||
|
|
||||
|
public ItemTransformNoteEventHandler(ILocationAppService locationAppService) |
||||
|
{ |
||||
|
_locationAppService = locationAppService; |
||||
|
} |
||||
|
|
||||
|
[Volo.Abp.Uow.UnitOfWork] |
||||
|
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<ItemTransformNote> eventData) |
||||
|
{ |
||||
|
var entity = eventData.Entity; |
||||
|
await AddExchangeDataAsync(entity); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
[Volo.Abp.Uow.UnitOfWork] |
||||
|
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<ItemTransformNote>> eventData) |
||||
|
{ |
||||
|
var entities = eventData.Entity; |
||||
|
await AddExchangeDataAsync(entities); |
||||
|
} |
||||
|
|
||||
|
protected override async Task AddExchangeDataAsync(List<ItemTransformNote> entities) |
||||
|
{ |
||||
|
var dtos = ObjectMapper.Map<List<ItemTransformNote>, List<ItemTransformNoteDTO>>(entities); |
||||
|
|
||||
|
foreach (var dto in dtos) |
||||
|
{ |
||||
|
dto.Type = TransSubType.ToString(); |
||||
|
} |
||||
|
|
||||
|
var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, ExchangeDataType, dtos); |
||||
|
await AddManyAsync(exchangeData); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,48 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.EventBus; |
||||
|
using Volo.Abp.Uow; |
||||
|
using Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
using Win_in.Sfs.Shared.Event; |
||||
|
using Win_in.Sfs.Wms.Inventory.Domain.Acl.Location; |
||||
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
using ILocationAclService = Win_in.Sfs.Wms.Store.Domain.Acl.Location.ILocationAclService; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Event.DataExchanges |
||||
|
{ |
||||
|
public class TransferNoteEventHandler : |
||||
|
StoreDataExchangeEventHandlerBase<TransferNote> |
||||
|
, ILocalEventHandler<SfsCreatedEntityEventData<TransferNote>> |
||||
|
{ |
||||
|
private readonly Domain.Acl.Location.ILocationAclService _locationAclService; |
||||
|
|
||||
|
public TransferNoteEventHandler(ILocationAclService locationAclService) |
||||
|
{ |
||||
|
_locationAclService = locationAclService; |
||||
|
} |
||||
|
|
||||
|
[UnitOfWork] |
||||
|
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<TransferNote> eventData) |
||||
|
{ |
||||
|
var entity = eventData.Entity; |
||||
|
await AddExchangeDataAsync(entity).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
protected override async Task AddExchangeDataAsync(List<TransferNote> entities) |
||||
|
{ |
||||
|
var dtos = ObjectMapper.Map<List<TransferNote>, List<TransferNoteDTO>>(entities); |
||||
|
foreach (var detail in dtos.SelectMany(dto => dto.Details)) |
||||
|
{ |
||||
|
await detail.TrySetLocationAsync(_locationAclService).ConfigureAwait(false); |
||||
|
} |
||||
|
var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, EnumExchangeDataType.Transfer, dtos).ConfigureAwait(false); |
||||
|
await AddManyAsync(exchangeData).ConfigureAwait(false); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,56 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.EventBus; |
||||
|
using Volo.Abp.Uow; |
||||
|
using Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
using Win_in.Sfs.Shared.Event; |
||||
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
using Win_in.Sfs.Wms.Store.Domain.Acl.Location; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Event.DataExchanges |
||||
|
{ |
||||
|
public class WipWarehouseAdjustNoteEventHandler |
||||
|
: StoreDataExchangeEventHandlerBase<WipWarehouseAdjustNote> |
||||
|
, ILocalEventHandler<SfsCreatedEntityEventData<WipWarehouseAdjustNote>> |
||||
|
, ILocalEventHandler<SfsCreatedEntityEventData<List<WipWarehouseAdjustNote>>> |
||||
|
{ |
||||
|
private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.WipAdjust; |
||||
|
|
||||
|
private ILocationAclService _locationAclService; |
||||
|
|
||||
|
public WipWarehouseAdjustNoteEventHandler(ILocationAclService locationAclService) |
||||
|
{ |
||||
|
_locationAclService = locationAclService; |
||||
|
} |
||||
|
|
||||
|
[Volo.Abp.Uow.UnitOfWork] |
||||
|
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<WipWarehouseAdjustNote> eventData) |
||||
|
{ |
||||
|
var entity = eventData.Entity; |
||||
|
await AddExchangeDataAsync(entity); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
[Volo.Abp.Uow.UnitOfWork] |
||||
|
public virtual async Task HandleEventAsync(SfsCreatedEntityEventData<List<WipWarehouseAdjustNote>> eventData) |
||||
|
{ |
||||
|
var entities = eventData.Entity; |
||||
|
await AddExchangeDataAsync(entities); |
||||
|
} |
||||
|
|
||||
|
protected override async Task AddExchangeDataAsync(List<WipWarehouseAdjustNote> entities) |
||||
|
{ |
||||
|
var dtos = ObjectMapper.Map<List<WipWarehouseAdjustNote>, List<WipWarehouseAdjustNoteDTO>>(entities); |
||||
|
foreach (var detail in dtos.SelectMany(dto => dto.Details)) |
||||
|
{ |
||||
|
await detail.TrySetLocationAsync(_locationAclService).ConfigureAwait(false); |
||||
|
} |
||||
|
var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, ExchangeDataType, dtos).ConfigureAwait(false); |
||||
|
await AddManyAsync(exchangeData).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
Loading…
Reference in new issue