diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/DTOs/BalanceUpdateItemBasicInfoDto.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/DTOs/BalanceUpdateItemBasicInfoDto.cs new file mode 100644 index 000000000..3b40cfb2e --- /dev/null +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/DTOs/BalanceUpdateItemBasicInfoDto.cs @@ -0,0 +1,45 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace Win_in.Sfs.Wms.Inventory.Application.Contracts; + +/// +/// 库存更新物品基础信息 +/// +public class BalanceUpdateItemBasicInfoDto +{ + /// + /// 库存更新物品基础信息 + /// + public List BalanceUpdateItemBasicInfos { get; set; } +} + +/// +/// 库存更新物品基础信息 +/// +public class BalanceUpdateItemBasicInfo +{ + /// + /// 物品编码 + /// + [Display(Name = "物品编码")] + public string ItemCode { get; set; } + + /// + /// 物品名称 + /// + [Display(Name = "物品名称")] + public string ItemName { get; set; } + + /// + /// 物品描述1 + /// + [Display(Name = "物品描述1")] + public string ItemDesc1 { get; set; } + + /// + /// 物品描述2 + /// + [Display(Name = "物品描述2")] + public string ItemDesc2 { get; set; } +} diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/IBalanceAppService.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/IBalanceAppService.cs index 9c6dcd45c..cf79d0628 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/IBalanceAppService.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/IBalanceAppService.cs @@ -151,4 +151,10 @@ public interface IBalanceAppService string lot, string locationCode, EnumInventoryStatus status); + + /// + /// 库存余额更新物品基础信息 + /// + Task UpdateItemBasicInfoAsync(BalanceUpdateItemBasicInfoDto balanceUpdateItemBasicInfoDto); + } diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs index bcfbbed1c..b7aae9a1b 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs @@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Volo.Abp; using Volo.Abp.Application.Dtos; +using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Repositories; using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain; @@ -650,4 +651,39 @@ public class BalanceAppService } #endregion Get + + /// + /// 库存余额更新物品基础信息 + /// + [HttpPost("update/item-basic-info")] + public async Task UpdateItemBasicInfoAsync(BalanceUpdateItemBasicInfoDto balanceUpdateItemBasicInfoDto) + { + // 物品编码 + var itemCodes = balanceUpdateItemBasicInfoDto.BalanceUpdateItemBasicInfos?.Select(c => c.ItemCode); + if (itemCodes == null || itemCodes.Any() == false) + { + return; + } + + // 获取库存余额 + var entitys = await _repository.GetListAsync(p => + itemCodes.Contains(p.ItemCode)).ConfigureAwait(false); + if (entitys.Count <= 0) + { + return; + } + + // 库存余额更新物品基础信息 + entitys.ForEach(entity => + { + var balanceUpdateItemBasicInfo = balanceUpdateItemBasicInfoDto.BalanceUpdateItemBasicInfos.FirstOrDefault(t => t.ItemCode == entity.ItemCode); + + entity.ItemName = balanceUpdateItemBasicInfo.ItemName; + entity.ItemDesc1 = balanceUpdateItemBasicInfo.ItemDesc1; + entity.ItemDesc2 = balanceUpdateItemBasicInfo.ItemDesc2; + }); + + await _repository.UpdateManyAsync(entitys).ConfigureAwait(false); + } + }