|
|
@ -104,40 +104,47 @@ public class TransferNoteEventHandler |
|
|
|
{ |
|
|
|
var transferLog = ObjectMapper.Map<TransferNoteDetail, TransferLogEditInput>(detail); |
|
|
|
|
|
|
|
if (note.UseOnTheWayLocation) |
|
|
|
var fromLocation = await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); |
|
|
|
var toLocation = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); |
|
|
|
var transferOnTheWay = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT).ConfigureAwait(false); |
|
|
|
|
|
|
|
switch (route) |
|
|
|
{ |
|
|
|
var fromLocation = await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); |
|
|
|
var toLocation = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); |
|
|
|
var transferOnTheWay = await _locationAppService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false); |
|
|
|
|
|
|
|
switch (route) |
|
|
|
{ |
|
|
|
case EnumTransferRoute.SourceToOnTheWay: |
|
|
|
transferLog.FromLocationCode = fromLocation.Code; |
|
|
|
transferLog.FromLocationArea = fromLocation.AreaCode; |
|
|
|
transferLog.FromLocationErpCode = fromLocation.ErpLocationCode; |
|
|
|
transferLog.FromLocationGroup = fromLocation.LocationGroupCode; |
|
|
|
|
|
|
|
transferLog.ToLocationCode = transferOnTheWay.Code; |
|
|
|
transferLog.ToLocationArea = transferOnTheWay.AreaCode; |
|
|
|
transferLog.ToLocationErpCode = transferOnTheWay.ErpLocationCode; |
|
|
|
transferLog.ToLocationGroup = transferOnTheWay.LocationGroupCode; |
|
|
|
break; |
|
|
|
case EnumTransferRoute.OnTheWayToDestination: |
|
|
|
transferLog.FromLocationCode = transferOnTheWay.Code; |
|
|
|
transferLog.FromLocationArea = transferOnTheWay.AreaCode; |
|
|
|
transferLog.FromLocationErpCode = transferOnTheWay.ErpLocationCode; |
|
|
|
transferLog.FromLocationGroup = transferOnTheWay.LocationGroupCode; |
|
|
|
|
|
|
|
transferLog.ToLocationCode = toLocation.Code; |
|
|
|
transferLog.ToLocationArea = toLocation.AreaCode; |
|
|
|
transferLog.ToLocationErpCode = toLocation.ErpLocationCode; |
|
|
|
transferLog.ToLocationGroup = toLocation.LocationGroupCode; |
|
|
|
break; |
|
|
|
case EnumTransferRoute.SourceToDestination: |
|
|
|
default: |
|
|
|
throw new ArgumentOutOfRangeException(nameof(route), route, null); |
|
|
|
} |
|
|
|
case EnumTransferRoute.SourceToOnTheWay: |
|
|
|
transferLog.FromLocationCode = fromLocation.Code; |
|
|
|
transferLog.FromLocationArea = fromLocation.AreaCode; |
|
|
|
transferLog.FromLocationErpCode = fromLocation.ErpLocationCode; |
|
|
|
transferLog.FromLocationGroup = fromLocation.LocationGroupCode; |
|
|
|
|
|
|
|
transferLog.ToLocationCode = transferOnTheWay.Code; |
|
|
|
transferLog.ToLocationArea = transferOnTheWay.AreaCode; |
|
|
|
transferLog.ToLocationErpCode = transferOnTheWay.ErpLocationCode; |
|
|
|
transferLog.ToLocationGroup = transferOnTheWay.LocationGroupCode; |
|
|
|
break; |
|
|
|
case EnumTransferRoute.OnTheWayToDestination: |
|
|
|
transferLog.FromLocationCode = transferOnTheWay.Code; |
|
|
|
transferLog.FromLocationArea = transferOnTheWay.AreaCode; |
|
|
|
transferLog.FromLocationErpCode = transferOnTheWay.ErpLocationCode; |
|
|
|
transferLog.FromLocationGroup = transferOnTheWay.LocationGroupCode; |
|
|
|
|
|
|
|
transferLog.ToLocationCode = toLocation.Code; |
|
|
|
transferLog.ToLocationArea = toLocation.AreaCode; |
|
|
|
transferLog.ToLocationErpCode = toLocation.ErpLocationCode; |
|
|
|
transferLog.ToLocationGroup = toLocation.LocationGroupCode; |
|
|
|
break; |
|
|
|
case EnumTransferRoute.SourceToDestination: |
|
|
|
transferLog.FromLocationCode = fromLocation.Code; |
|
|
|
transferLog.FromLocationArea = fromLocation.AreaCode; |
|
|
|
transferLog.FromLocationErpCode = fromLocation.ErpLocationCode; |
|
|
|
transferLog.FromLocationGroup = fromLocation.LocationGroupCode; |
|
|
|
|
|
|
|
transferLog.ToLocationCode = toLocation.Code; |
|
|
|
transferLog.ToLocationArea = toLocation.AreaCode; |
|
|
|
transferLog.ToLocationErpCode = toLocation.ErpLocationCode; |
|
|
|
transferLog.ToLocationGroup = toLocation.LocationGroupCode; |
|
|
|
break;; |
|
|
|
default: |
|
|
|
throw new ArgumentOutOfRangeException(nameof(route), route, null); |
|
|
|
} |
|
|
|
|
|
|
|
transferLog.TransType = TransType; |
|
|
|