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 529f49661..e44da0e5f 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,6 +24,5 @@ public interface IItemBasicAppService Task> GetManageTypesAsync(List itemCodes); Task UpsertAsyncByInterface(ItemBasicEditInput input); - Task UpsertStdPackQtyAsync(string itemCode,decimal stdpackqty); - Task CreateByInterfaceAsync(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 3ded042ac..6e390a8ed 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 @@ -7,6 +7,5 @@ namespace Win_in.Sfs.Basedata.Application.Contracts; public interface IItemPackAppService : ISfsBaseDataAppServiceBase, ISfsUpsertAppService { Task> GetListByItemCodeAsync(string itemCode); - - Task UpsertAndUpsertItemUomAsync(ItemPackEditInput input); + Task UpsertAndItemBasicUomAsync(string itemCode,decimal stdPackQty); } 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 20ee3e866..a8f463d9f 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 @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; +using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; @@ -20,7 +21,6 @@ public class ItemPackAppService { private readonly IItemPackManager _manager; private new readonly IItemPackRepository _repository; - private readonly IItemBasicAppService _itemBasicAppService; public ItemPackAppService( IItemPackRepository repository @@ -33,7 +33,6 @@ public class ItemPackAppService base.DeletePolicyName = ItemPackPermissions.Delete; _repository = repository; _manager = manager; - _itemBasicAppService = itemBasicAppService; } [HttpPost("upsert")] @@ -43,14 +42,6 @@ public class ItemPackAppService 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")] public virtual async Task> GetListByItemCodeAsync(string itemCode) { @@ -66,4 +57,14 @@ public class ItemPackAppService await base.CheckItemBasicPackUomAsync(importInput.ItemCode, importInput.BasicUom, validationRresult).ConfigureAwait(false); await base.CheckItemPackAsync(importInput.PackCode, validationRresult).ConfigureAwait(false); } + + [HttpPut("upsert-and-item-basic-std-pack")] + public async Task UpsertAndItemBasicUomAsync(string itemCode,decimal stdPackQty) + { + var itemPacks=await _repository.GetListAsync(p => p.ItemCode == itemCode).ConfigureAwait(false); + var entity=itemPacks.First(); + entity.Qty = stdPackQty; + await _repository.UpsertAsync(entity).ConfigureAwait(false); + await ItemBasicAppService.UpsertStdPackQtyAsync(itemCode, stdPackQty).ConfigureAwait(false); + } } 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 e7c04f185..710271fd8 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 @@ -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 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 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> BuildSearchExpression(string keyWord) { Expression> 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 }