|
|
@ -5,10 +5,14 @@ using System.Threading.Tasks; |
|
|
|
|
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Volo.Abp; |
|
|
|
using Volo.Abp.Caching; |
|
|
|
using Volo.Abp.Domain.Repositories; |
|
|
|
using Volo.Abp.Uow; |
|
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
|
|
using Win_in.Sfs.Basedata.Domain; |
|
|
|
using Win_in.Sfs.Basedata.Domain.Shared; |
|
|
|
using Win_in.Sfs.Shared.Domain.Shared; |
|
|
|
|
|
|
|
namespace Win_in.Sfs.Basedata.Application; |
|
|
|
|
|
|
@ -35,6 +39,33 @@ public class ItemContainerAppService |
|
|
|
_manager = manager; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 用来重写 新增实体
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <exception cref="UserFriendlyException"></exception>
|
|
|
|
[HttpPost("")] |
|
|
|
[UnitOfWork] |
|
|
|
public override async Task<ItemContainerDTO> CreateAsync(ItemContainerEditInput input) |
|
|
|
{ |
|
|
|
var existEntity = await _repository.FirstOrDefaultAsync(p=>p.ContainerCode==input.ContainerCode).ConfigureAwait(false); |
|
|
|
if (existEntity != null) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"{input.ContainerCode} 已存在"); |
|
|
|
} |
|
|
|
|
|
|
|
var itemBasic = await ItemBasicAppService.GetByCodeAsync(input.ItemCode).ConfigureAwait(false); |
|
|
|
Check.NotNull(itemBasic, "物品代码", $"物品 {input.ItemCode} 不存在"); |
|
|
|
if(itemBasic != null) |
|
|
|
{ |
|
|
|
input.BasicUom = itemBasic.BasicUom; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return await base.CreateAsync(input).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost("upsert")] |
|
|
|
public virtual async Task UpsertAsync(ItemContainerEditInput input) |
|
|
|
{ |
|
|
|