|
|
@ -100,14 +100,18 @@ public class PurchaseReturnRequestAppService : |
|
|
|
{ |
|
|
|
//通过箱标签 查找标签服务 构造其他字段
|
|
|
|
var labelDto = await _inventoryLabelApp.GetByCodeAsync(detail.PackingCode).ConfigureAwait(false); |
|
|
|
CheckLabel(labelDto, detail); |
|
|
|
|
|
|
|
var balanceDto = await _balanceAppService.GetByPackingCodeAsync(detail.PackingCode).ConfigureAwait(false); |
|
|
|
CheckBalance(balanceDto, detail); |
|
|
|
|
|
|
|
var locationDto= await _locationAppService.GetByCodeAsync(balanceDto.LocationCode).ConfigureAwait(false); |
|
|
|
CheckLocation(locationDto, balanceDto); |
|
|
|
|
|
|
|
var purchaseOrderDto = await _purchaseOrderAppService.GetByNumberAsync(labelDto.PoNumber).ConfigureAwait(false); |
|
|
|
purchaseOrderDto = await _purchaseOrderAppService.GetAsync(purchaseOrderDto.Id).ConfigureAwait(false); |
|
|
|
CheckPurchaseOrder(purchaseOrderDto, labelDto); |
|
|
|
CheckLabel(labelDto, detail); |
|
|
|
CheckBalance(balanceDto, detail); |
|
|
|
CheckLocation(locationDto, balanceDto); |
|
|
|
|
|
|
|
purchaseReturnRequest.AsnNumber = labelDto.AsnNumber; |
|
|
|
purchaseReturnRequest.RpNumber = labelDto.RpNumber; |
|
|
|
purchaseReturnRequest.ReturnTime=DateTime.Now; |
|
|
@ -188,8 +192,21 @@ public class PurchaseReturnRequestAppService : |
|
|
|
|
|
|
|
if (purchaseOrderDto != null) |
|
|
|
{ |
|
|
|
detail.PoLine = |
|
|
|
purchaseOrderDto.Details.FirstOrDefault(p => p.ItemCode == balanceDto.ItemCode && p.Lot == balanceDto.Lot).PoLine; |
|
|
|
var purchaseOrderDetailDto=purchaseOrderDto.Details.FirstOrDefault(p => p.ItemCode == balanceDto.ItemCode && p.Lot == balanceDto.Lot); |
|
|
|
if (purchaseOrderDetailDto == null) |
|
|
|
{ |
|
|
|
purchaseOrderDetailDto = |
|
|
|
purchaseOrderDto.Details.FirstOrDefault(p => p.ItemCode == balanceDto.ItemCode); |
|
|
|
} |
|
|
|
|
|
|
|
if (purchaseOrderDetailDto == null) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"未找到物品代码为【{balanceDto.ItemCode}】,批次为【{balanceDto.Lot}】的订单详情"); |
|
|
|
} |
|
|
|
|
|
|
|
detail.PoLine = purchaseOrderDetailDto.PoLine; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -227,7 +244,7 @@ public class PurchaseReturnRequestAppService : |
|
|
|
{ |
|
|
|
if (balanceDto == null) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"库存为【{detail.PackingCode}】不存在"); |
|
|
|
throw new UserFriendlyException($"箱码为【{detail.PackingCode}】不存在"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|