|
|
@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Mvc; |
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
using Volo.Abp; |
|
|
|
using Volo.Abp.Application.Dtos; |
|
|
|
using Volo.Abp.Domain.Entities; |
|
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
|
|
using Win_in.Sfs.Shared.Domain; |
|
|
|
using Win_in.Sfs.Shared.Domain.Shared; |
|
|
@ -54,6 +55,21 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
Dictionary<TransferNote, EntityState> dictionary) |
|
|
|
{ |
|
|
|
var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); |
|
|
|
foreach (var addTransferNote in addList) |
|
|
|
{ |
|
|
|
foreach (var detail in addTransferNote.Details) |
|
|
|
{ |
|
|
|
var balanceDto = await _balanceAppService.GetByItemLocationPackingAndStatusAsync(detail.FromPackingCode, |
|
|
|
detail.ItemCode, detail.FromLocationCode, detail.FromStatus).ConfigureAwait(false); |
|
|
|
|
|
|
|
if (balanceDto.Qty < detail.Qty || balanceDto.Qty < 0) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"您申请的【ERP料号】{detail.ItemCode}【库位】{detail.FromLocationCode}【箱码】{detail.FromPackingCode}【状态】{detail.FromStatus}【数量】{detail.Qty}的库存," |
|
|
|
+ $"在实际库存中查询到【ERP料号】{balanceDto.ItemCode}【库位】{balanceDto.LocationCode}【箱码】{balanceDto.PackingCode}【状态】{balanceDto.Status}【数量】{balanceDto.Qty}" |
|
|
|
+ $"【库存不足】"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
foreach (var transferNote in addList) |
|
|
|
{ |
|
|
@ -312,7 +328,20 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
{ |
|
|
|
var entity = ObjectMapper.Map<TransferNoteEditInput, TransferNote>(input); |
|
|
|
|
|
|
|
entity=await _transferNoteManager.CreateAsync(entity).ConfigureAwait(false); |
|
|
|
foreach (var detail in entity.Details) |
|
|
|
{ |
|
|
|
var balanceDto = await _balanceAppService.GetByItemLocationPackingAndStatusAsync(detail.FromPackingCode, |
|
|
|
detail.ItemCode, detail.FromLocationCode, detail.FromStatus).ConfigureAwait(false); |
|
|
|
|
|
|
|
if (balanceDto.Qty < detail.Qty || balanceDto.Qty < 0) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"您申请的【ERP料号】{detail.ItemCode}【库位】{detail.FromLocationCode}【箱码】{detail.FromPackingCode}【状态】{detail.FromStatus}【数量】{detail.Qty}的库存," |
|
|
|
+ $"在实际库存中查询到【ERP料号】{balanceDto.ItemCode}【库位】{balanceDto.LocationCode}【箱码】{balanceDto.PackingCode}【状态】{balanceDto.Status}【数量】{balanceDto.Qty}" |
|
|
|
+ $"【库存不足】"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
entity =await _transferNoteManager.CreateAsync(entity).ConfigureAwait(false); |
|
|
|
|
|
|
|
var dto = ObjectMapper.Map<TransferNote, TransferNoteDTO>(entity); |
|
|
|
|
|
|
@ -333,6 +362,19 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase |
|
|
|
|
|
|
|
foreach (var entity in entitys) |
|
|
|
{ |
|
|
|
foreach (var detail in entity.Details) |
|
|
|
{ |
|
|
|
var balanceDto = await _balanceAppService.GetByItemLocationPackingAndStatusAsync(detail.FromPackingCode, |
|
|
|
detail.ItemCode, detail.FromLocationCode, detail.FromStatus).ConfigureAwait(false); |
|
|
|
|
|
|
|
if (balanceDto.Qty < detail.Qty || balanceDto.Qty < 0) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"您申请的【ERP料号】{detail.ItemCode}【库位】{detail.FromLocationCode}【箱码】{detail.FromPackingCode}【状态】{detail.FromStatus}【数量】{detail.Qty}的库存," |
|
|
|
+ $"在实际库存中查询到【ERP料号】{balanceDto.ItemCode}【库位】{balanceDto.LocationCode}【箱码】{balanceDto.PackingCode}【状态】{balanceDto.Status}【数量】{balanceDto.Qty}" |
|
|
|
+ $"【库存不足】"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
resultEntity.Add(await _transferNoteManager.CreateAsync(entity).ConfigureAwait(false)); |
|
|
|
_ = ObjectMapper.Map<TransferNote, TransferNoteDTO>(entity); |
|
|
|
} |
|
|
|