diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ItemBasics/IItemBasicAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ItemBasics/IItemBasicAppService.cs index fc4f917d3..d483db207 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ItemBasics/IItemBasicAppService.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ItemBasics/IItemBasicAppService.cs @@ -24,4 +24,5 @@ public interface IItemBasicAppService Task> GetManageTypesAsync(List itemCodes); Task UpsertAsyncByInterface(ItemBasicEditInput input); + Task UpsertStdPackQtyAsync(string itemCode,decimal stdpackqty); } diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ItemPacks/IItemPackAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ItemPacks/IItemPackAppService.cs index f9964032a..3ded042ac 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ItemPacks/IItemPackAppService.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ItemPacks/IItemPackAppService.cs @@ -8,4 +8,5 @@ public interface IItemPackAppService : ISfsBaseDataAppServiceBase> GetListByItemCodeAsync(string itemCode); + Task UpsertAndUpsertItemUomAsync(ItemPackEditInput input); } diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemPacks/ItemPackAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemPacks/ItemPackAppService.cs index 91ef0c829..20ee3e866 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemPacks/ItemPackAppService.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemPacks/ItemPackAppService.cs @@ -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 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(input); + await _repository.UpsertAsync(entity).ConfigureAwait(false); + } + [HttpPost("upsert-and-item-uom")] + public virtual async Task UpsertAndUpsertItemUomAsync(ItemPackEditInput input) + { + var entity = ObjectMapper.Map(input); await _repository.UpsertAsync(entity).ConfigureAwait(false); + await _itemBasicAppService.UpsertStdPackQtyAsync(input.ItemCode, input.Qty).ConfigureAwait(false); } [HttpGet("list/by-item")] diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Items/ItemBasicAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Items/ItemBasicAppService.cs index a5a2ac756..71429f1af 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Items/ItemBasicAppService.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Items/ItemBasicAppService.cs @@ -189,6 +189,14 @@ public class ItemBasicAppService var entity = ObjectMapper.Map(input); 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); + } protected override Expression> BuildSearchExpression(string keyWord) { Expression> expression = p =>