Browse Source

修改接口传递标包

集成Redis
郑勃旭 2 years ago
parent
commit
423129169f
  1. 1
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ItemBasics/IItemBasicAppService.cs
  2. 1
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ItemPacks/IItemPackAppService.cs
  3. 12
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemPacks/ItemPackAppService.cs
  4. 8
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Items/ItemBasicAppService.cs

1
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ItemBasics/IItemBasicAppService.cs

@ -24,4 +24,5 @@ public interface IItemBasicAppService
Task<Dictionary<string, EnumItemManageType>> GetManageTypesAsync(List<string> itemCodes); Task<Dictionary<string, EnumItemManageType>> GetManageTypesAsync(List<string> itemCodes);
Task UpsertAsyncByInterface(ItemBasicEditInput input); Task UpsertAsyncByInterface(ItemBasicEditInput input);
Task UpsertStdPackQtyAsync(string itemCode,decimal stdpackqty);
} }

1
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ItemPacks/IItemPackAppService.cs

@ -8,4 +8,5 @@ public interface IItemPackAppService : ISfsBaseDataAppServiceBase<ItemPackDTO, S
{ {
Task<List<ItemPackDTO>> GetListByItemCodeAsync(string itemCode); Task<List<ItemPackDTO>> GetListByItemCodeAsync(string itemCode);
Task UpsertAndUpsertItemUomAsync(ItemPackEditInput input);
} }

12
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ItemPacks/ItemPackAppService.cs

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

8
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Items/ItemBasicAppService.cs

@ -189,6 +189,14 @@ public class ItemBasicAppService
var entity = ObjectMapper.Map<ItemBasicEditInput, ItemBasic>(input); var entity = ObjectMapper.Map<ItemBasicEditInput, ItemBasic>(input);
await _repository.UpsertAsyncByInterface(entity).ConfigureAwait(false); 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<Func<ItemBasic, bool>> BuildSearchExpression(string keyWord) protected override Expression<Func<ItemBasic, bool>> BuildSearchExpression(string keyWord)
{ {
Expression<Func<ItemBasic, bool>> expression = p => Expression<Func<ItemBasic, bool>> expression = p =>

Loading…
Cancel
Save