|
@ -4,19 +4,24 @@ using System.ComponentModel.DataAnnotations; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
using System.Linq.Expressions; |
|
|
using System.Linq.Expressions; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
|
|
|
using Volo.Abp; |
|
|
using Volo.Abp.Users; |
|
|
using Volo.Abp.Users; |
|
|
using Volo.Abp.Validation; |
|
|
using Volo.Abp.Validation; |
|
|
using Win_in.Sfs.Shared.Domain.Shared; |
|
|
using Win_in.Sfs.Shared.Domain.Shared; |
|
|
|
|
|
using Win_in.Sfs.Wms.Inventory.Application.Contracts; |
|
|
|
|
|
|
|
|
namespace Win_in.Sfs.Wms.Store.Domain; |
|
|
namespace Win_in.Sfs.Wms.Store.Domain; |
|
|
|
|
|
|
|
|
public class InjectionJobManager : SfsJobManagerBase<InjectionJob, InjectionJobDetail>, IInjectionJobManager |
|
|
public class InjectionJobManager : SfsJobManagerBase<InjectionJob, InjectionJobDetail>, IInjectionJobManager |
|
|
{ |
|
|
{ |
|
|
|
|
|
private readonly IBalanceAppService _balanceAppService; |
|
|
|
|
|
private readonly IExpectOutAppService _expectOutAppService; |
|
|
|
|
|
|
|
|
public InjectionJobManager( |
|
|
public InjectionJobManager( |
|
|
IInjectionJobRepository repository |
|
|
IInjectionJobRepository repository, IBalanceAppService balanceAppService, IExpectOutAppService expectOutAppService) : base(repository) |
|
|
) : base(repository) |
|
|
|
|
|
{ |
|
|
{ |
|
|
|
|
|
_balanceAppService = balanceAppService; |
|
|
|
|
|
_expectOutAppService = expectOutAppService; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
@ -33,6 +38,28 @@ public class InjectionJobManager : SfsJobManagerBase<InjectionJob, InjectionJobD |
|
|
var inputDetail = input.Details.First(); |
|
|
var inputDetail = input.Details.First(); |
|
|
var detail = entity.Details.First(); |
|
|
var detail = entity.Details.First(); |
|
|
|
|
|
|
|
|
|
|
|
var expectOutDtos = await _expectOutAppService.GetListByItemCodeAndStatusAndPackingCodeAsync(detail.ItemCode, detail.HandledFromLocationCode, detail.HandledFromPackingCode, detail.Status, detail.HandledFromLot).ConfigureAwait(false); |
|
|
|
|
|
if (expectOutDtos.Any()) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new UserFriendlyException($" 箱码:{detail.HandledFromPackingCode}," + |
|
|
|
|
|
$" 物品代码:{detail.ItemCode}," + |
|
|
|
|
|
$" 库位代码:{detail.HandledFromLocationCode}," + |
|
|
|
|
|
$" 状态:{detail.Status}," + |
|
|
|
|
|
$" 批次:{detail.HandledFromLot}" + |
|
|
|
|
|
$" 的库存被占用【预计出】"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var balanceDto=await _balanceAppService.GetRealQtyByPackingCodeAndItemCodeAndLocationCodeAndStatusAsync(detail.HandledFromPackingCode,detail.ItemCode,detail.HandledFromLocationCode,detail.Status,detail.HandledFromLot).ConfigureAwait(false); |
|
|
|
|
|
if (balanceDto.Qty <= 0) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new UserFriendlyException($" 箱码:{detail.HandledFromPackingCode}," + |
|
|
|
|
|
$" 物品代码:{detail.ItemCode}," + |
|
|
|
|
|
$" 库位代码:{detail.HandledFromLocationCode}," + |
|
|
|
|
|
$" 状态:{detail.Status}," + |
|
|
|
|
|
$" 批次:{detail.HandledFromLot}" + |
|
|
|
|
|
$" 的可用库存不大于0,现在为{balanceDto.Qty},请检查【库存数量】和【预计出】"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
detail.HandledFromArriveDate = inputDetail.HandledFromArriveDate; |
|
|
detail.HandledFromArriveDate = inputDetail.HandledFromArriveDate; |
|
|
detail.HandledFromContainerCode = inputDetail.HandledFromContainerCode; |
|
|
detail.HandledFromContainerCode = inputDetail.HandledFromContainerCode; |
|
|
detail.HandledFromExpireDate = inputDetail.HandledFromExpireDate; |
|
|
detail.HandledFromExpireDate = inputDetail.HandledFromExpireDate; |
|
@ -68,19 +95,6 @@ public class InjectionJobManager : SfsJobManagerBase<InjectionJob, InjectionJobD |
|
|
return await base.CompleteAsync(entity, user).ConfigureAwait(false); |
|
|
return await base.CompleteAsync(entity, user).ConfigureAwait(false); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public override void CheckDetails(InjectionJob entity, AbpValidationResult result) |
|
|
|
|
|
{ |
|
|
|
|
|
var details = entity.Details; |
|
|
|
|
|
foreach (var detail in details) |
|
|
|
|
|
{ |
|
|
|
|
|
if (detail.HandledFromLocationCode == null) |
|
|
|
|
|
{ |
|
|
|
|
|
result.Errors.Add(new ValidationResult($"{detail.HandledFromLocationCode} 不能为空")); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public async Task<InjectionJob> GetAsync(Expression<Func<InjectionJob, bool>> expression) |
|
|
public async Task<InjectionJob> GetAsync(Expression<Func<InjectionJob, bool>> expression) |
|
|
{ |
|
|
{ |
|
|
return await Repository.FindAsync(expression).ConfigureAwait(false); |
|
|
return await Repository.FindAsync(expression).ConfigureAwait(false); |
|
@ -98,5 +112,10 @@ public class InjectionJobManager : SfsJobManagerBase<InjectionJob, InjectionJobD |
|
|
throw new NotImplementedException(); |
|
|
throw new NotImplementedException(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public override void CheckDetails(InjectionJob entity, AbpValidationResult result) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
#endregion
|
|
|
#endregion
|
|
|
} |
|
|
} |
|
|