Browse Source

抛异常提示

dev_DY_CC
赵新宇 7 months ago
parent
commit
ffb8bd04ee
  1. 58
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/TransferRequestEventHandler.cs

58
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/TransferRequestEventHandler.cs

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

Loading…
Cancel
Save