|
|
@ -28,20 +28,17 @@ 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, |
|
|
|
ItemPackAppService itemPackAppService) |
|
|
|
IItemBasicManager manager) |
|
|
|
: base(repository, cache) |
|
|
|
{ |
|
|
|
_repository = repository; |
|
|
|
_itemValidator = itemValidator; |
|
|
|
_manager = manager; |
|
|
|
this.itemPackAppService = itemPackAppService; |
|
|
|
base.CreatePolicyName = ItemBasicPermissions.Create; |
|
|
|
base.UpdatePolicyName = ItemBasicPermissions.Update; |
|
|
|
base.DeletePolicyName = ItemBasicPermissions.Delete; |
|
|
@ -193,22 +190,6 @@ public class ItemBasicAppService |
|
|
|
await _repository.UpsertAsyncByInterface(entity).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost("upsert-stdpackqty")] |
|
|
|
public virtual async Task UpsertStdPackQtyAsync(string itemCode,decimal stdpackqty) |
|
|
|
{ |
|
|
|
var itemBasic=await _repository.GetAsync(p=>p.Code== itemCode).ConfigureAwait(false); |
|
|
|
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 => |
|
|
@ -230,4 +211,16 @@ public class ItemBasicAppService |
|
|
|
|
|
|
|
return itemCategorys.ToDictionary(x => x.CategoryCode, y => y.Value); |
|
|
|
} |
|
|
|
|
|
|
|
#region 东阳
|
|
|
|
|
|
|
|
[HttpPut("upsert-stdpackqty")] |
|
|
|
public virtual async Task UpsertStdPackQtyAsync(string itemCode, decimal stdpackqty) |
|
|
|
{ |
|
|
|
var itemBasic = await _repository.GetAsync(p => p.Code == itemCode).ConfigureAwait(false); |
|
|
|
itemBasic.StdPackQty = stdpackqty; |
|
|
|
await _repository.UpdateAsync(itemBasic).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
|
} |
|
|
|