|
|
@ -10,6 +10,7 @@ using Volo.Abp; |
|
|
|
using Volo.Abp.Caching; |
|
|
|
using Volo.Abp.Domain.Repositories; |
|
|
|
using Volo.Abp.ObjectMapping; |
|
|
|
using Volo.Abp.Uow; |
|
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
|
|
using Win_in.Sfs.Basedata.Domain; |
|
|
|
using Win_in.Sfs.Basedata.Domain.Shared; |
|
|
@ -40,6 +41,32 @@ public class ErpLocationItemAppService |
|
|
|
_manager = manager; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 用来重写 新增实体
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <exception cref="UserFriendlyException"></exception>
|
|
|
|
[HttpPost("")] |
|
|
|
[UnitOfWork] |
|
|
|
public override async Task<ErpLocationItemDTO> CreateAsync(ErpLocationItemEditInput input) |
|
|
|
{ |
|
|
|
var itemBasic = await ItemBasicAppService.GetByCodeAsync(input.ItemCode).ConfigureAwait(false); |
|
|
|
Check.NotNull(itemBasic, "物品代码", $"物品 {input.ItemCode} 不存在"); |
|
|
|
|
|
|
|
var erpLocation = await ErpLocationAppService.GetByCodeAsync(input.ErpLocationCode).ConfigureAwait(false); |
|
|
|
Check.NotNull(erpLocation, "储位代码", $"储位 {input.ErpLocationCode} 不存在"); |
|
|
|
|
|
|
|
var entity = await _repository.FirstOrDefaultAsync(p => p.ItemCode == input.ItemCode && p.ErpLocationCode == input.ErpLocationCode).ConfigureAwait(false); |
|
|
|
|
|
|
|
if(entity != null) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"物品{input.ItemCode}和储位{input.ErpLocationCode} 对应关系已存在"); |
|
|
|
} |
|
|
|
|
|
|
|
return await base.CreateAsync(input).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 检查物料和储位对应关系是否存在
|
|
|
|
/// </summary>
|
|
|
|