From 718fd8c021e16b373a97c5cd0ea4e5de70576ee9 Mon Sep 17 00:00:00 2001 From: "boxu.zheng" Date: Mon, 15 Apr 2024 13:15:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B3=A8=E5=A1=91=20?= =?UTF-8?q?=E5=8F=91=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Balances/IBalanceAppService.cs | 13 ++--- .../Balances/BalanceAppService.cs | 20 +++++--- .../InjectionJobs/InjectionJobManager.cs | 49 +++++++++++++------ .../Requests/InjectionRequestEventHandler.cs | 5 ++ 4 files changed, 60 insertions(+), 27 deletions(-) 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 9be64b26d..f5fd91884 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 @@ -110,12 +110,6 @@ public interface IBalanceAppService Task> GetByHoldLocationCodeAndNoOkAsync(SfsInventoryRequestInputBase sfsRequestDTO, bool includeDetails = false, CancellationToken cancellationToken = default); - /// - /// 获取 【实际库存余额】(不包含预计入,抛出预计出) - /// - /// - Task GetRealQtyByPackingCodeAndItemCodeAndLocationCodeAndStatusAsync(string packingCode, string itemCode, string locationCode, EnumInventoryStatus status); - Task> GetListByLocationCodeAndItemCodeAsync(string locationCode, string itemCode); Task> GetListByLocationCodeAndStatusAsync(string locationCode, EnumInventoryStatus status); @@ -174,4 +168,11 @@ public interface IBalanceAppService /// /// Task> GetUsableListAsync(RecommendBalanceRequestInput input); + + /// + /// 获取 【实际库存余额】(不包含预计入,计算了预计出) + /// + /// + Task GetRealQtyByPackingCodeAndItemCodeAndLocationCodeAndStatusAsync(string packingCode, + string itemCode, string locationCode, EnumInventoryStatus status,string lot); } 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 a38fc1c14..ba9815c9b 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 @@ -39,6 +39,7 @@ public class BalanceAppService private readonly IBalanceManager _balanceManager; private readonly IItemBasicAppService _itemBasicAppService; private readonly IStdCostPriceSheetAppService _stdCostPriceSheetAppService; + private readonly IExpectOutAppService _expectOutAppService; public BalanceAppService( IBalanceRepository repository, @@ -47,7 +48,8 @@ public class BalanceAppService ILocationAclService locationAclService, IItemBasicAclService itemBasicAclService, IItemBasicAppService itemBasicAppService, - IStdCostPriceSheetAppService stdCostPriceSheetAppService) : base(repository) + IStdCostPriceSheetAppService stdCostPriceSheetAppService, + IExpectOutAppService expectOutAppService) : base(repository) { _repository = repository; _transferLogManager = transferLogManager; @@ -56,6 +58,7 @@ public class BalanceAppService _itemBasicAclService = itemBasicAclService; _itemBasicAppService = itemBasicAppService; _stdCostPriceSheetAppService = stdCostPriceSheetAppService; + _expectOutAppService = expectOutAppService; } #region Update @@ -803,12 +806,12 @@ public class BalanceAppService } /// - /// 获取 【实际库存余额】(不包含预计入,抛出预计出) + /// 获取 【实际库存余额】(不包含预计入,计算了预计出) /// /// - [HttpPost("get-real-qty-by-packing-and-item-and-location-and-status")] + [HttpPost("get-real-qty-by-packing-and-item-and-location-and-status-and-lot")] public async Task GetRealQtyByPackingCodeAndItemCodeAndLocationCodeAndStatusAsync(string packingCode, - string itemCode, string locationCode, EnumInventoryStatus status) + string itemCode, string locationCode, EnumInventoryStatus status,string lot) { var entity = await _repository.FirstOrDefaultAsync(c => c.PackingCode == packingCode && c.ItemCode == itemCode && c.LocationCode == locationCode && @@ -818,9 +821,14 @@ public class BalanceAppService throw new UserFriendlyException($"未找到箱码为 {packingCode},物料代码为 {itemCode},库位代码为 {locationCode} 的库存"); } - //TODO 减去预计出 - + var expectOutDtos=await _expectOutAppService.GetListByItemCodeAndStatusAndPackingCodeAsync(itemCode,locationCode,packingCode,status,lot).ConfigureAwait(false); var dto = ObjectMapper.Map(entity); + + foreach (var expectOutDto in expectOutDtos) + { + dto.Qty -= expectOutDto.Qty; + } + return dto; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/InjectionJobs/InjectionJobManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/InjectionJobs/InjectionJobManager.cs index 349e5d32e..8d953c3a6 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/InjectionJobs/InjectionJobManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/InjectionJobs/InjectionJobManager.cs @@ -4,19 +4,24 @@ using System.ComponentModel.DataAnnotations; using System.Linq; using System.Linq.Expressions; using System.Threading.Tasks; +using Volo.Abp; using Volo.Abp.Users; using Volo.Abp.Validation; using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Wms.Inventory.Application.Contracts; namespace Win_in.Sfs.Wms.Store.Domain; public class InjectionJobManager : SfsJobManagerBase, IInjectionJobManager { + private readonly IBalanceAppService _balanceAppService; + private readonly IExpectOutAppService _expectOutAppService; public InjectionJobManager( - IInjectionJobRepository repository - ) : base(repository) + IInjectionJobRepository repository, IBalanceAppService balanceAppService, IExpectOutAppService expectOutAppService) : base(repository) { + _balanceAppService = balanceAppService; + _expectOutAppService = expectOutAppService; } /// @@ -33,6 +38,28 @@ public class InjectionJobManager : SfsJobManagerBase GetAsync(Expression> expression) { return await Repository.FindAsync(expression).ConfigureAwait(false); @@ -98,5 +112,10 @@ public class InjectionJobManager : SfsJobManagerBase