|
|
@ -28,17 +28,20 @@ public class ItemBasicAppService |
|
|
|
private readonly ItemValidator _itemValidator; |
|
|
|
private readonly IItemBasicManager _manager; |
|
|
|
private new readonly IItemBasicRepository _repository; |
|
|
|
private readonly ItemPackAppService itemPackAppService; |
|
|
|
|
|
|
|
public ItemBasicAppService( |
|
|
|
IItemBasicRepository repository, |
|
|
|
IDistributedCache<ItemBasicDTO> cache, |
|
|
|
ItemValidator itemValidator, |
|
|
|
IItemBasicManager manager) |
|
|
|
IItemBasicManager manager, |
|
|
|
ItemPackAppService itemPackAppService) |
|
|
|
: base(repository, cache) |
|
|
|
{ |
|
|
|
_repository = repository; |
|
|
|
_itemValidator = itemValidator; |
|
|
|
_manager = manager; |
|
|
|
this.itemPackAppService = itemPackAppService; |
|
|
|
base.CreatePolicyName = ItemBasicPermissions.Create; |
|
|
|
base.UpdatePolicyName = ItemBasicPermissions.Update; |
|
|
|
base.DeletePolicyName = ItemBasicPermissions.Delete; |
|
|
@ -197,6 +200,15 @@ public class ItemBasicAppService |
|
|
|
itemBasic.StdPackQty = stdpackqty; |
|
|
|
await _repository.UpdateAsync(itemBasic).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost("create-by-interface")] |
|
|
|
public async Task<ItemBasicDTO> CreateByInterfaceAsync(ItemBasicEditInput input) |
|
|
|
{ |
|
|
|
var packDtos =await itemPackAppService.GetListByItemCodeAsync(input.Code).ConfigureAwait(false); |
|
|
|
input.StdPackQty = packDtos.First().Qty; |
|
|
|
return await base.CreateAsync(input).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
protected override Expression<Func<ItemBasic, bool>> BuildSearchExpression(string keyWord) |
|
|
|
{ |
|
|
|
Expression<Func<ItemBasic, bool>> expression = p => |
|
|
|