Browse Source

修改标包

集成Redis
郑勃旭 2 years ago
parent
commit
6df12322a1
  1. 1
      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. 33
      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

@ -25,5 +25,4 @@ public interface IItemBasicAppService
Task UpsertAsyncByInterface(ItemBasicEditInput input);
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>
{
Task<List<ItemPackDTO>> GetListByItemCodeAsync(string itemCode);
Task UpsertAndUpsertItemUomAsync(ItemPackEditInput input);
Task UpsertAndItemBasicUomAsync(string itemCode,decimal stdPackQty);
}

21
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<ItemPackEditInput, ItemPack>(input);
await _repository.UpsertAsync(entity).ConfigureAwait(false);
await _itemBasicAppService.UpsertStdPackQtyAsync(input.ItemCode, input.Qty).ConfigureAwait(false);
}
[HttpGet("list/by-item")]
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.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);
}
}

33
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<ItemBasicDTO> 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<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)
{
Expression<Func<ItemBasic, bool>> 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
}

Loading…
Cancel
Save