|
|
@ -2,6 +2,7 @@ using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using DocumentFormat.OpenXml.Bibliography; |
|
|
|
using Volo.Abp; |
|
|
|
using Volo.Abp.EventBus; |
|
|
|
using Volo.Abp.EventBus.Local; |
|
|
|
using Volo.Abp.SettingManagement; |
|
|
@ -46,38 +47,51 @@ public class TransferRequestEventHandler |
|
|
|
[UnitOfWork] |
|
|
|
public async Task HandleEventAsync(SfsHandledEntityEventData<TransferRequest> eventData) |
|
|
|
{ |
|
|
|
var entity = eventData.Entity; |
|
|
|
var enumTransSubType = Enum.Parse<EnumTransSubType>(entity.Type); |
|
|
|
|
|
|
|
if (entity.DirectCreateNote) |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
var input = ObjectMapper.Map<TransferRequest, TransferNote>(entity); |
|
|
|
|
|
|
|
//获取在途库
|
|
|
|
var locationDto = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT) |
|
|
|
.ConfigureAwait(false); |
|
|
|
var entity = eventData.Entity; |
|
|
|
var enumTransSubType = Enum.Parse<EnumTransSubType>(entity.Type); |
|
|
|
|
|
|
|
var transferOnTheWayLocation = |
|
|
|
await SettingManager.GetOrNullGlobalAsync(StoreSettings.Common.TransferOnTheWayLocation) |
|
|
|
if (entity.DirectCreateNote) |
|
|
|
{ |
|
|
|
var input = ObjectMapper.Map<TransferRequest, TransferNote>(entity); |
|
|
|
|
|
|
|
//获取在途库
|
|
|
|
var locationDto = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT) |
|
|
|
.ConfigureAwait(false); |
|
|
|
|
|
|
|
input.Details.ForEach(p => { p.OnTheWayLocationCode = locationDto.Code; }); |
|
|
|
var transferOnTheWayLocation = |
|
|
|
await SettingManager.GetOrNullGlobalAsync(StoreSettings.Common.TransferOnTheWayLocation) |
|
|
|
.ConfigureAwait(false); |
|
|
|
|
|
|
|
await _transferNoteManager.CreateAsync(input).ConfigureAwait(false); |
|
|
|
} |
|
|
|
input.Details.ForEach(p => { p.OnTheWayLocationCode = locationDto.Code; }); |
|
|
|
|
|
|
|
switch (enumTransSubType) |
|
|
|
await _transferNoteManager.CreateAsync(input).ConfigureAwait(false); |
|
|
|
|
|
|
|
switch (enumTransSubType) |
|
|
|
{ |
|
|
|
case EnumTransSubType.Transfer_Inside: |
|
|
|
case EnumTransSubType.Transfer_Area: |
|
|
|
break; |
|
|
|
case EnumTransSubType.Transfer_Warehouse: |
|
|
|
case EnumTransSubType.Transfer_Customer: |
|
|
|
case EnumTransSubType.Transfer_WIP: |
|
|
|
// entity.Handle();
|
|
|
|
entity.Complete(); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception e) |
|
|
|
{ |
|
|
|
case EnumTransSubType.Transfer_Inside: |
|
|
|
case EnumTransSubType.Transfer_Area: |
|
|
|
break; |
|
|
|
case EnumTransSubType.Transfer_Warehouse: |
|
|
|
case EnumTransSubType.Transfer_Customer: |
|
|
|
case EnumTransSubType.Transfer_WIP: |
|
|
|
// entity.Handle();
|
|
|
|
entity.Complete(); |
|
|
|
break; |
|
|
|
throw new UserFriendlyException($"{e.Message}"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|