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..4d1ebb37b 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,44 @@ public class BalanceAppService
}
#endregion Get
+
+ ///
+ /// 库存余额更新物品基础信息
+ ///
+ [HttpPost("update/item-basic-info")]
+ public async Task UpdateItemBasicInfoAsync(BalanceUpdateItemBasicInfoDto balanceUpdateItemBasicInfoDto)
+ {
+ // 物品编码
+ var itemCodes = balanceUpdateItemBasicInfoDto.BalanceUpdateItemBasicInfos?.Select(c => c.ItemCode);
+ itemCodes = itemCodes?.Where(t => string.IsNullOrWhiteSpace(t) == false);
+ if (itemCodes == null || itemCodes.Any() == false)
+ {
+ return;
+ }
+
+ // 获取库存余额
+ var entitys = await _repository.GetListAsync(p =>
+ itemCodes.Contains(p.ItemCode)).ConfigureAwait(false);
+ if (entitys.Count <= 0)
+ {
+ return;
+ }
+
+ // 库存余额更新物品基础信息
+ var entitysGroup = entitys.GroupBy(t => t.ItemCode);
+
+ foreach (var entity in entitysGroup)
+ {
+ var balanceUpdateItemBasicInfo = balanceUpdateItemBasicInfoDto.BalanceUpdateItemBasicInfos.FirstOrDefault(t => t.ItemCode == entity.Key);
+ foreach (var item in entity)
+ {
+ item.ItemName = balanceUpdateItemBasicInfo.ItemName ?? item.ItemName;
+ item.ItemDesc1 = balanceUpdateItemBasicInfo.ItemDesc1 ?? item.ItemDesc1;
+ item.ItemDesc2 = balanceUpdateItemBasicInfo.ItemDesc2 ?? item.ItemDesc2;
+ }
+ }
+
+ await _repository.UpdateManyAsync(entitys).ConfigureAwait(false);
+ }
+
}
diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs
index a7babf41a..d0c19e6a6 100644
--- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs
+++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs
@@ -451,14 +451,14 @@ public class BalanceManager : DomainService, IBalanceManager
{
expression = expression.And(p => p.ExpireDate > DateTime.Now);
}
- //筛选有效库区
- if (validLocationAreas.Any() )
- {
- if (!string.IsNullOrEmpty(validLocationAreas[0]))
- {
- expression = expression.And(p => validLocationAreas.Contains(p.LocationArea));
- }
- }
+ //筛选有效库区 2023-6-29 李智慧 王旭 袁静雯 确认不需要做区域校验
+ //if (validLocationAreas.Any())
+ //{
+ // if (!string.IsNullOrEmpty(validLocationAreas[0]))
+ // {
+ // expression = expression.And(p => validLocationAreas.Contains(p.LocationArea));
+ // }
+ //}
var allBalances = await
(await _balanceRepository.GetDbSetAsync().ConfigureAwait(false))
.Where(expression)
@@ -606,7 +606,7 @@ public class BalanceManager : DomainService, IBalanceManager
Logger.LogDebug($"{traceId}:RequestQty:{requestQty},RemainQty:{remainingQty},AvailableQty:{balanceQty},RecommendQty:{recommendQty}");
return recommendQty;
}
-
+
///
/// 计算推荐库位
///
diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceValidateExtension.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceValidateExtension.cs
index aafbf6dba..a512067eb 100644
--- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceValidateExtension.cs
+++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceValidateExtension.cs
@@ -108,7 +108,6 @@ public static class BalanceValidateExtension
///
public static List SortByFifo(this List balances)
{
-
return balances
.OrderBy(p => p.Lot)
.ThenBy(p => p.ArriveDate)
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/BackFlusNotes/IBackFlushNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/BackFlusNotes/IBackFlushNoteAppService.cs
index 2de4b8ab2..84c8f5aa8 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/BackFlusNotes/IBackFlushNoteAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/BackFlusNotes/IBackFlushNoteAppService.cs
@@ -9,5 +9,5 @@ ISfsStoreMasterReadOnlyAppServiceBase> CreateManyAsync(List inputs);
- Task> GetListByProductRecycleNumber(string number);
+ Task> GetListByProductRecycleNumberAsync(string number);
}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/BackFlushNotes/BackFlushNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/BackFlushNotes/BackFlushNoteAppService.cs
index 07e300af2..6fd68de17 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/BackFlushNotes/BackFlushNoteAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/BackFlushNotes/BackFlushNoteAppService.cs
@@ -32,7 +32,7 @@ public class BackFlushNoteAppService :
{
var entities = ObjectMapper.Map, List>(inputs);
- entities = await ProcessingBackFlushNoteData(entities).ConfigureAwait(false);
+ entities = await ProcessingBackFlushNoteDataAsync(entities).ConfigureAwait(false);
entities = await _backFlushNoteManager.CreateManyAsync(entities).ConfigureAwait(false);
@@ -42,7 +42,7 @@ public class BackFlushNoteAppService :
}
[HttpGet("by-product-recyle-number")]
- public async Task> GetListByProductRecycleNumber(string number)
+ public async Task> GetListByProductRecycleNumberAsync(string number)
{
var entities = await _repository.GetListAsync(t => t.ProductRecycleNumber == number, true)
.ConfigureAwait(false);
@@ -54,11 +54,16 @@ public class BackFlushNoteAppService :
/// 处理数据
///
///
- private async Task> ProcessingBackFlushNoteData(List backFlushNotes)
+ private async Task> ProcessingBackFlushNoteDataAsync(List backFlushNotes)
{
if (backFlushNotes != null && backFlushNotes.Count > 0)
{
+ // 主零件号
var itemCodes = backFlushNotes.Select(t => t.ItemCode);
+ // 从零件号
+ var detailsItemCodes = backFlushNotes.SelectMany(t => t.Details).Select(t => t.ItemCode);
+ itemCodes = itemCodes.Concat(detailsItemCodes).Distinct();
+
List itemBasicDtos = await _itemBasicAppService.GetByCodesAsync(itemCodes).ConfigureAwait(false);
backFlushNotes.ForEach(t =>
@@ -70,8 +75,12 @@ public class BackFlushNoteAppService :
t.ItemDesc2 = itemBasicDto.Desc2;
t.Details.ForEach(tDetail =>
{
- tDetail.ItemDesc1 = itemBasicDto.Desc1;
- tDetail.ItemDesc2 = itemBasicDto.Desc2;
+ var detailsItemBasicDto = itemBasicDtos.FirstOrDefault(w => w.Code == tDetail.ItemCode);
+ if (detailsItemBasicDto != null)
+ {
+ tDetail.ItemDesc1 = detailsItemBasicDto.Desc1;
+ tDetail.ItemDesc2 = detailsItemBasicDto.Desc2;
+ }
});
}
});
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs
index 042e52d93..d6a62e406 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs
@@ -95,6 +95,8 @@ public class CountNoteAppService :
detail.LocationGroup = locationDto.LocationGroupCode;
detail.LocationErpCode = locationDto.ErpLocationCode;
detail.WarehouseCode = locationDto.WarehouseCode;
+ detail.PackingCode=detail.PackingCode ?? "";
+ detail.Lot = detail.Lot ?? "";
detail.ItemCode = itemcBasicDto.Code;
detail.ItemDesc1 = itemcBasicDto.Desc1;
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CountAdjustRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CountAdjustRequestEventHandler.cs
index e927211b9..c26fbd720 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CountAdjustRequestEventHandler.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CountAdjustRequestEventHandler.cs
@@ -50,6 +50,12 @@ public class CountAdjustRequestEventHandler
{
if (entity.DirectCreateNote)
{
+ entity.Details.ForEach(p =>
+ {
+ p.PackingCode = p.PackingCode ?? "";
+ p.Lot = p.Lot ?? "";
+ p.ContainerCode = p.ContainerCode ?? "";
+ });
await ThawBalancesAsync(entity).ConfigureAwait(false);
var note = await BuildCountAdjustNoteCreateInputAsync(entity).ConfigureAwait(false);