Browse Source

修改标包

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

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

@ -24,6 +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); Task UpsertStdPackQtyAsync(string itemCode, decimal stdpackqty);
Task<ItemBasicDTO> CreateByInterfaceAsync(ItemBasicEditInput input);
} }

3
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<ItemPackDTO, SfsBaseDataRequestInputBase, ItemPackEditInput>, ISfsUpsertAppService<ItemPackEditInput> public interface IItemPackAppService : ISfsBaseDataAppServiceBase<ItemPackDTO, SfsBaseDataRequestInputBase, ItemPackEditInput>, ISfsUpsertAppService<ItemPackEditInput>
{ {
Task<List<ItemPackDTO>> GetListByItemCodeAsync(string itemCode); Task<List<ItemPackDTO>> GetListByItemCodeAsync(string itemCode);
Task UpsertAndItemBasicUomAsync(string itemCode,decimal stdPackQty);
Task UpsertAndUpsertItemUomAsync(ItemPackEditInput input);
} }

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

@ -1,5 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
@ -20,7 +21,6 @@ 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
@ -33,7 +33,6 @@ public class ItemPackAppService
base.DeletePolicyName = ItemPackPermissions.Delete; base.DeletePolicyName = ItemPackPermissions.Delete;
_repository = repository; _repository = repository;
_manager = manager; _manager = manager;
_itemBasicAppService = itemBasicAppService;
} }
[HttpPost("upsert")] [HttpPost("upsert")]
@ -43,14 +42,6 @@ public class ItemPackAppService
await _repository.UpsertAsync(entity).ConfigureAwait(false); 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")] [HttpGet("list/by-item")]
public virtual async Task<List<ItemPackDTO>> GetListByItemCodeAsync(string itemCode) public virtual async Task<List<ItemPackDTO>> GetListByItemCodeAsync(string itemCode)
{ {
@ -66,4 +57,14 @@ public class ItemPackAppService
await base.CheckItemBasicPackUomAsync(importInput.ItemCode, importInput.BasicUom, validationRresult).ConfigureAwait(false); await base.CheckItemBasicPackUomAsync(importInput.ItemCode, importInput.BasicUom, validationRresult).ConfigureAwait(false);
await base.CheckItemPackAsync(importInput.PackCode, 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);
}
} }

35
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 ItemValidator _itemValidator;
private readonly IItemBasicManager _manager; private readonly IItemBasicManager _manager;
private new readonly IItemBasicRepository _repository; private new readonly IItemBasicRepository _repository;
private readonly ItemPackAppService itemPackAppService;
public ItemBasicAppService( public ItemBasicAppService(
IItemBasicRepository repository, IItemBasicRepository repository,
IDistributedCache<ItemBasicDTO> cache, IDistributedCache<ItemBasicDTO> cache,
ItemValidator itemValidator, ItemValidator itemValidator,
IItemBasicManager manager, IItemBasicManager manager)
ItemPackAppService itemPackAppService)
: base(repository, cache) : base(repository, cache)
{ {
_repository = repository; _repository = repository;
_itemValidator = itemValidator; _itemValidator = itemValidator;
_manager = manager; _manager = manager;
this.itemPackAppService = itemPackAppService;
base.CreatePolicyName = ItemBasicPermissions.Create; base.CreatePolicyName = ItemBasicPermissions.Create;
base.UpdatePolicyName = ItemBasicPermissions.Update; base.UpdatePolicyName = ItemBasicPermissions.Update;
base.DeletePolicyName = ItemBasicPermissions.Delete; base.DeletePolicyName = ItemBasicPermissions.Delete;
@ -193,22 +190,6 @@ public class ItemBasicAppService
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);
}
[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) protected override Expression<Func<ItemBasic, bool>> BuildSearchExpression(string keyWord)
{ {
Expression<Func<ItemBasic, bool>> expression = p => Expression<Func<ItemBasic, bool>> expression = p =>
@ -230,4 +211,16 @@ public class ItemBasicAppService
return itemCategorys.ToDictionary(x => x.CategoryCode, y => y.Value); 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
} }

Loading…
Cancel
Save