|
|
@ -8,6 +8,7 @@ using IdentityServer4.Models; |
|
|
|
using Volo.Abp; |
|
|
|
using Volo.Abp.EventBus; |
|
|
|
using Volo.Abp.SettingManagement; |
|
|
|
using Volo.Abp.Uow; |
|
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
|
|
using Win_in.Sfs.Shared.Domain.Shared; |
|
|
|
using Win_in.Sfs.Shared.Event; |
|
|
@ -25,6 +26,7 @@ public class ThirdLocationRequestEventHandler |
|
|
|
, ILocalEventHandler<SfsAbortedEntityEventData<ThirdLocationRequest>> |
|
|
|
, ILocalEventHandler<SfsCompletedEntityEventData<ThirdLocationRequest>> |
|
|
|
, ILocalEventHandler<SfsCreatedEntityEventData<ThirdLocationRequest>> |
|
|
|
, ILocalEventHandler<SfsCancelledEntityEventData<ThirdLocationRequest>> |
|
|
|
, ILocalEventHandler<SfsCreatedEntityEventData<List<ThirdLocationRequest>>> |
|
|
|
{ |
|
|
|
private readonly IThirdLocationJobAppService _thirdLocationJobAppService; |
|
|
@ -105,7 +107,6 @@ public class ThirdLocationRequestEventHandler |
|
|
|
: EnumTransferRoute.SourceToDestination; |
|
|
|
transferLogs.AddRange(await BuildTransferLogsAsync(entity, route).ConfigureAwait(false)); |
|
|
|
|
|
|
|
|
|
|
|
await _transferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); |
|
|
|
|
|
|
|
} |
|
|
@ -198,6 +199,46 @@ public class ThirdLocationRequestEventHandler |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private async Task<List<TransferLogEditInput>> BuildCancelTransferLogsAsync(ThirdLocationRequest thirdLocationRequest) |
|
|
|
{ |
|
|
|
var transferLogs = new List<TransferLogEditInput>(); |
|
|
|
foreach (var detail in thirdLocationRequest.Details.Where(detail => detail.Qty != 0)) |
|
|
|
{ |
|
|
|
var transferLog = ObjectMapper.Map<ThirdLocationRequestDetail, TransferLogEditInput>(detail); |
|
|
|
|
|
|
|
LocationDTO fromLocationDTO = null; |
|
|
|
LocationDTO toLocationDTO = null; |
|
|
|
|
|
|
|
fromLocationDTO = await _locationAppService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false); |
|
|
|
toLocationDTO = await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); |
|
|
|
|
|
|
|
transferLog.FromLocationCode = fromLocationDTO.Code; |
|
|
|
transferLog.FromLocationArea = fromLocationDTO.AreaCode; |
|
|
|
transferLog.FromLocationErpCode = fromLocationDTO.ErpLocationCode; |
|
|
|
transferLog.FromLocationGroup = fromLocationDTO.LocationGroupCode; |
|
|
|
transferLog.FromWarehouseCode = fromLocationDTO.WarehouseCode; |
|
|
|
|
|
|
|
transferLog.ToLocationCode = toLocationDTO.Code; |
|
|
|
transferLog.ToLocationArea = toLocationDTO.AreaCode; |
|
|
|
transferLog.ToLocationErpCode = toLocationDTO.ErpLocationCode; |
|
|
|
transferLog.ToLocationGroup = toLocationDTO.LocationGroupCode; |
|
|
|
transferLog.ToWarehouseCode = toLocationDTO.WarehouseCode; |
|
|
|
transferLog.TransSubType = Enum.Parse<EnumTransSubType>(thirdLocationRequest.Type); |
|
|
|
transferLog.TransType = TransType; |
|
|
|
transferLog.DocNumber = thirdLocationRequest.Number; |
|
|
|
transferLog.JobNumber = ""; |
|
|
|
|
|
|
|
transferLog.FromPackingCode = ""; |
|
|
|
transferLog.FromLot = ""; |
|
|
|
transferLog.ToPackingCode = ""; |
|
|
|
transferLog.ToLot = ""; |
|
|
|
transferLog.FromStatus = EnumInventoryStatus.OK; |
|
|
|
transferLog.ToStatus = EnumInventoryStatus.OK; |
|
|
|
transferLogs.Add(transferLog); |
|
|
|
} |
|
|
|
|
|
|
|
return transferLogs; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 驳回后
|
|
|
@ -209,6 +250,23 @@ public class ThirdLocationRequestEventHandler |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 取消后
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="eventData"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[UnitOfWork] |
|
|
|
public virtual async Task HandleEventAsync(SfsCancelledEntityEventData<ThirdLocationRequest> eventData) |
|
|
|
{ |
|
|
|
var entity = eventData.Entity; |
|
|
|
|
|
|
|
var transferLogs = new List<TransferLogEditInput>(); |
|
|
|
transferLogs.AddRange(await BuildCancelTransferLogsAsync(entity).ConfigureAwait(false)); |
|
|
|
|
|
|
|
await _transferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 完成后
|
|
|
|
/// </summary>
|
|
|
|