|
|
@ -20,27 +20,35 @@ public class ItemPackAppService |
|
|
|
{ |
|
|
|
private readonly IItemPackManager _manager; |
|
|
|
private new readonly IItemPackRepository _repository; |
|
|
|
private readonly IItemBasicAppService _itemBasicAppService; |
|
|
|
|
|
|
|
public ItemPackAppService( |
|
|
|
IItemPackRepository repository |
|
|
|
, IDistributedCache<ItemPackDTO> cache |
|
|
|
, IItemPackManager manager |
|
|
|
) : base(repository, cache) |
|
|
|
, IItemBasicAppService itemBasicAppService) : base(repository, cache) |
|
|
|
{ |
|
|
|
base.CreatePolicyName = ItemPackPermissions.Create; |
|
|
|
base.UpdatePolicyName = ItemPackPermissions.Update; |
|
|
|
base.DeletePolicyName = ItemPackPermissions.Delete; |
|
|
|
_repository = repository; |
|
|
|
_manager = manager; |
|
|
|
_itemBasicAppService = itemBasicAppService; |
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost("upsert")] |
|
|
|
|
|
|
|
public virtual async Task UpsertAsync(ItemPackEditInput input) |
|
|
|
{ |
|
|
|
var entity = ObjectMapper.Map<ItemPackEditInput, ItemPack>(input); |
|
|
|
await _repository.UpsertAsync(entity).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost("upsert-and-item-uom")] |
|
|
|
public virtual async Task UpsertAndUpsertItemUomAsync(ItemPackEditInput input) |
|
|
|
{ |
|
|
|
var entity = ObjectMapper.Map<ItemPackEditInput, ItemPack>(input); |
|
|
|
await _repository.UpsertAsync(entity).ConfigureAwait(false); |
|
|
|
await _itemBasicAppService.UpsertStdPackQtyAsync(input.ItemCode, input.Qty).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
[HttpGet("list/by-item")] |
|
|
|