|
|
@ -99,6 +99,10 @@ public class PurchaseReturnRequestAppService : |
|
|
|
var labelDto = await _inventoryLabelApp.GetByCodeAsync(detail.PackingCode).ConfigureAwait(false); |
|
|
|
var balanceDto = await BalanceAclService.GetByPackingCodeAsync(detail.PackingCode).ConfigureAwait(false); |
|
|
|
var locationDto= await _locationAppService.GetByCodeAsync(balanceDto.LocationCode).ConfigureAwait(false); |
|
|
|
CheckLabel(labelDto, detail); |
|
|
|
CheckBalance(balanceDto, detail); |
|
|
|
CheckLocation(locationDto, balanceDto); |
|
|
|
|
|
|
|
var purchaseOrderDto= await _purchaseOrderAppService.GetByNumberAsync(labelDto.PoNumber).ConfigureAwait(false); |
|
|
|
purchaseOrderDto = await _purchaseOrderAppService.GetAsync(purchaseOrderDto.Id).ConfigureAwait(false); |
|
|
|
|
|
|
@ -187,6 +191,52 @@ public class PurchaseReturnRequestAppService : |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#region 校验
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 校验库位
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="locationDto"></param>
|
|
|
|
/// <param name="balanceDto"></param>
|
|
|
|
/// <exception cref="UserFriendlyException"></exception>
|
|
|
|
private static void CheckLocation(LocationDTO locationDto, BalanceDTO balanceDto) |
|
|
|
{ |
|
|
|
if (locationDto == null) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"库位为【{balanceDto.LocationCode}】不存在"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 校验库存
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="balanceDto"></param>
|
|
|
|
/// <param name="detail"></param>
|
|
|
|
/// <exception cref="UserFriendlyException"></exception>
|
|
|
|
private static void CheckBalance(BalanceDTO balanceDto, PurchaseReturnRequestDetail detail) |
|
|
|
{ |
|
|
|
if (balanceDto == null) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"库存为【{detail.PackingCode}】不存在"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 校验标签
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="labelDto"></param>
|
|
|
|
/// <param name="detail"></param>
|
|
|
|
/// <exception cref="UserFriendlyException"></exception>
|
|
|
|
private static void CheckLabel(InventoryLabelDto labelDto, PurchaseReturnRequestDetail detail) |
|
|
|
{ |
|
|
|
if (labelDto == null) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"标签为【{detail.PackingCode}】不存在"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 校验
|
|
|
|