From ee73cde048d34860a70c8b8a37c4f4ffb3a6c16d Mon Sep 17 00:00:00 2001 From: "boxu.zheng" Date: Fri, 17 May 2024 14:38:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=9B=E5=BB=BA=E5=BA=93?= =?UTF-8?q?=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AssembleIssueJobEventHandler.cs | 55 ++++++++++--------- .../CoatingIssueJobEventHandler.cs | 55 ++++++++++--------- .../InjectionIssueJobEventHandler.cs | 20 +------ .../KittingIssueJobEventHandler.cs | 20 +------ 4 files changed, 60 insertions(+), 90 deletions(-) rename be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/{ => Issue}/AssembleIssueJobEventHandler.cs (86%) rename be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/{ => Issue}/CoatingIssueJobEventHandler.cs (86%) rename be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/{ => Issue}/InjectionIssueJobEventHandler.cs (92%) rename be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/{ => Issue}/KittingIssueJobEventHandler.cs (92%) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/AssembleIssueJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/Issue/AssembleIssueJobEventHandler.cs similarity index 86% rename from be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/AssembleIssueJobEventHandler.cs rename to be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/Issue/AssembleIssueJobEventHandler.cs index ceeb213f7..dd9e3ea8c 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/AssembleIssueJobEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/Issue/AssembleIssueJobEventHandler.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Castle.Components.DictionaryAdapter; +using Volo.Abp; using Volo.Abp.EventBus; using Volo.Abp.Uow; using Win_in.Sfs.Basedata.Application.Contracts; @@ -19,16 +20,14 @@ public class AssembleIssueJobEventHandler : , ILocalEventHandler> , ILocalEventHandler>> { - private readonly IAssembleIssueNoteAppService _assembleIssueNoteAppService; private readonly IExpectOutAppService _expectOutAppService; private readonly ILocationAppService _locationAppService; private readonly ITransferLibRequestAppService _transferLibRequestAppService; - public AssembleIssueJobEventHandler(IAssembleIssueNoteAppService assembleIssueNoteAppService, + public AssembleIssueJobEventHandler( IExpectOutAppService expectOutAppService, ILocationAppService locationAppService, ITransferLibRequestAppService transferLibRequestAppService) { - _assembleIssueNoteAppService = assembleIssueNoteAppService; _expectOutAppService = expectOutAppService; _locationAppService = locationAppService; _transferLibRequestAppService = transferLibRequestAppService; @@ -128,6 +127,25 @@ public class AssembleIssueJobEventHandler : { var locationDto = await _locationAppService.GetByCodeAsync(detail.RecommendFromLocationCode) .ConfigureAwait(false); + var locationList = await _locationAppService.GetListByGroupsAsync( + new List { detail.RecommendFromLocationGroup }).ConfigureAwait(false); + var locationListSort = locationList.OrderBy(p => p.RowCode); + + var locationDtoRowOne = new LocationDTO(); + if (locationListSort.Any()) + { + locationDtoRowOne = locationListSort.FirstOrDefault(); + } + else + { + locationDtoRowOne = await _locationAppService.GetFirstRowOneAsync().ConfigureAwait(false); + if (locationDtoRowOne == null) + { + throw new UserFriendlyException("没有找到1层的库位"); + } + } + + if (locationDto.Type == EnumLocationType.RAW) { if (!await IsMinRowAsync(assembleIssueJob).ConfigureAwait(false)) @@ -154,7 +172,7 @@ public class AssembleIssueJobEventHandler : detailInput.RecommendFromQty = detail.RecommendFromQty; detailInput.RecommendFromLot = detail.RecommendFromLot; - detailInput.RecommendFromPackingCode = detailInput.RecommendFromPackingCode; + detailInput.RecommendFromPackingCode = detail.RecommendFromPackingCode; detailInput.RecommendToLot = detail.RecommendToLot; detailInput.RecommendFromArriveDate = detail.RecommendFromArriveDate; @@ -170,7 +188,7 @@ public class AssembleIssueJobEventHandler : detailInput.RecommendToQty = detail.RecommendToQty; detailInput.RecommendToLot = detail.RecommendToLot; - detailInput.RecommendToPackingCode = detailInput.RecommendToPackingCode; + detailInput.RecommendToPackingCode = detail.RecommendToPackingCode; detailInput.RecommendToLot = detail.RecommendToLot; detailInput.RecommendToArriveDate = detail.RecommendToArriveDate; @@ -178,13 +196,13 @@ public class AssembleIssueJobEventHandler : detailInput.RecommendToProduceDate = detail.RecommendToProduceDate; detailInput.RecommendToSupplierBatch = detail.RecommendToSupplierBatch; - detailInput.RecommendToLocationCode = detail.RecommendToLocationCode; - detailInput.RecommendToLocationGroup = detail.RecommendToLocationGroup; - detailInput.RecommendToLocationArea = detail.RecommendToLocationArea; - detailInput.RecommendToLocationErpCode = detail.RecommendToLocationErpCode; - detailInput.RecommendToWarehouseCode = detail.RecommendToWarehouseCode; + detailInput.RecommendToLocationCode = locationDtoRowOne.Code; + detailInput.RecommendToLocationGroup = locationDtoRowOne.LocationGroupCode; + detailInput.RecommendToLocationArea = locationDtoRowOne.AreaCode; + detailInput.RecommendToLocationErpCode = locationDtoRowOne.ErpLocationCode; + detailInput.RecommendToWarehouseCode = locationDtoRowOne.WarehouseCode; - input.Details = new EditableList() { detailInput }; + input.Details = new EditableList { detailInput }; await _transferLibRequestAppService.CreateAsync(input).ConfigureAwait(false); } @@ -192,21 +210,6 @@ public class AssembleIssueJobEventHandler : } } - /// - /// 创建补料记录实体 - /// - /// - /// - private async Task BuildAssembleIssueNoteAsync(AssembleIssueJob entity) - { - var assembleIssueNoteCreateInput = ObjectMapper.Map(entity); - assembleIssueNoteCreateInput.JobNumber = entity.Number; - - await Task.CompletedTask.ConfigureAwait(false); - - return assembleIssueNoteCreateInput; - } - /// /// 判断是不是在最底层 如果不是则把状态变更为等待 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/CoatingIssueJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/Issue/CoatingIssueJobEventHandler.cs similarity index 86% rename from be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/CoatingIssueJobEventHandler.cs rename to be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/Issue/CoatingIssueJobEventHandler.cs index 5b39f2f07..9204bb067 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/CoatingIssueJobEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/Issue/CoatingIssueJobEventHandler.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Castle.Components.DictionaryAdapter; +using Volo.Abp; using Volo.Abp.EventBus; using Volo.Abp.Uow; using Win_in.Sfs.Basedata.Application.Contracts; @@ -19,16 +20,14 @@ public class CoatingIssueJobEventHandler : , ILocalEventHandler> , ILocalEventHandler>> { - private readonly ICoatingIssueNoteAppService _coatingIssueNoteAppService; private readonly IExpectOutAppService _expectOutAppService; private readonly ILocationAppService _locationAppService; private readonly ITransferLibRequestAppService _transferLibRequestAppService; - public CoatingIssueJobEventHandler(ICoatingIssueNoteAppService coatingIssueNoteAppService, + public CoatingIssueJobEventHandler( IExpectOutAppService expectOutAppService, ILocationAppService locationAppService, ITransferLibRequestAppService transferLibRequestAppService) { - _coatingIssueNoteAppService = coatingIssueNoteAppService; _expectOutAppService = expectOutAppService; _locationAppService = locationAppService; _transferLibRequestAppService = transferLibRequestAppService; @@ -128,6 +127,25 @@ public class CoatingIssueJobEventHandler : { var locationDto = await _locationAppService.GetByCodeAsync(detail.RecommendFromLocationCode) .ConfigureAwait(false); + var locationList = await _locationAppService.GetListByGroupsAsync( + new List { detail.RecommendFromLocationGroup }).ConfigureAwait(false); + var locationListSort = locationList.OrderBy(p => p.RowCode); + + var locationDtoRowOne = new LocationDTO(); + if (locationListSort.Any()) + { + locationDtoRowOne = locationListSort.FirstOrDefault(); + } + else + { + locationDtoRowOne = await _locationAppService.GetFirstRowOneAsync().ConfigureAwait(false); + if (locationDtoRowOne == null) + { + throw new UserFriendlyException("没有找到1层的库位"); + } + } + + if (locationDto.Type == EnumLocationType.RAW) { if (!await IsMinRowAsync(coatingIssueJob).ConfigureAwait(false)) @@ -154,7 +172,7 @@ public class CoatingIssueJobEventHandler : detailInput.RecommendFromQty = detail.RecommendFromQty; detailInput.RecommendFromLot = detail.RecommendFromLot; - detailInput.RecommendFromPackingCode = detailInput.RecommendFromPackingCode; + detailInput.RecommendFromPackingCode = detail.RecommendFromPackingCode; detailInput.RecommendToLot = detail.RecommendToLot; detailInput.RecommendFromArriveDate = detail.RecommendFromArriveDate; @@ -170,7 +188,7 @@ public class CoatingIssueJobEventHandler : detailInput.RecommendToQty = detail.RecommendToQty; detailInput.RecommendToLot = detail.RecommendToLot; - detailInput.RecommendToPackingCode = detailInput.RecommendToPackingCode; + detailInput.RecommendToPackingCode = detail.RecommendToPackingCode; detailInput.RecommendToLot = detail.RecommendToLot; detailInput.RecommendToArriveDate = detail.RecommendToArriveDate; @@ -178,13 +196,13 @@ public class CoatingIssueJobEventHandler : detailInput.RecommendToProduceDate = detail.RecommendToProduceDate; detailInput.RecommendToSupplierBatch = detail.RecommendToSupplierBatch; - detailInput.RecommendToLocationCode = detail.RecommendToLocationCode; - detailInput.RecommendToLocationGroup = detail.RecommendToLocationGroup; - detailInput.RecommendToLocationArea = detail.RecommendToLocationArea; - detailInput.RecommendToLocationErpCode = detail.RecommendToLocationErpCode; - detailInput.RecommendToWarehouseCode = detail.RecommendToWarehouseCode; + detailInput.RecommendToLocationCode = locationDtoRowOne.Code; + detailInput.RecommendToLocationGroup = locationDtoRowOne.LocationGroupCode; + detailInput.RecommendToLocationArea = locationDtoRowOne.AreaCode; + detailInput.RecommendToLocationErpCode = locationDtoRowOne.ErpLocationCode; + detailInput.RecommendToWarehouseCode = locationDtoRowOne.WarehouseCode; - input.Details = new EditableList() { detailInput }; + input.Details = new EditableList { detailInput }; await _transferLibRequestAppService.CreateAsync(input).ConfigureAwait(false); } @@ -192,21 +210,6 @@ public class CoatingIssueJobEventHandler : } } - /// - /// 创建补料记录实体 - /// - /// - /// - private async Task BuildCoatingIssueNoteAsync(CoatingIssueJob entity) - { - var coatingIssueNoteCreateInput = ObjectMapper.Map(entity); - coatingIssueNoteCreateInput.JobNumber = entity.Number; - - await Task.CompletedTask.ConfigureAwait(false); - - return coatingIssueNoteCreateInput; - } - /// /// 判断是不是在最底层 如果不是则把状态变更为等待 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/InjectionIssueJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/Issue/InjectionIssueJobEventHandler.cs similarity index 92% rename from be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/InjectionIssueJobEventHandler.cs rename to be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/Issue/InjectionIssueJobEventHandler.cs index 56f4c1fe6..a0407ec89 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/InjectionIssueJobEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/Issue/InjectionIssueJobEventHandler.cs @@ -20,16 +20,14 @@ public class InjectionIssueJobEventHandler : , ILocalEventHandler> , ILocalEventHandler>> { - private readonly IInjectionIssueNoteAppService _injectionIssueNoteAppService; private readonly IExpectOutAppService _expectOutAppService; private readonly ILocationAppService _locationAppService; private readonly ITransferLibRequestAppService _transferLibRequestAppService; - public InjectionIssueJobEventHandler(IInjectionIssueNoteAppService injectionIssueNoteAppService, + public InjectionIssueJobEventHandler( IExpectOutAppService expectOutAppService, ILocationAppService locationAppService, ITransferLibRequestAppService transferLibRequestAppService) { - _injectionIssueNoteAppService = injectionIssueNoteAppService; _expectOutAppService = expectOutAppService; _locationAppService = locationAppService; _transferLibRequestAppService = transferLibRequestAppService; @@ -147,7 +145,6 @@ public class InjectionIssueJobEventHandler : } } - if (locationDto.Type == EnumLocationType.RAW) { if (!await IsMinRowAsync(injectionIssueJob).ConfigureAwait(false)) @@ -212,21 +209,6 @@ public class InjectionIssueJobEventHandler : } } - /// - /// 创建补料记录实体 - /// - /// - /// - private async Task BuildInjectionIssueNoteAsync(InjectionIssueJob entity) - { - var injectionIssueNoteCreateInput = ObjectMapper.Map(entity); - injectionIssueNoteCreateInput.JobNumber = entity.Number; - - await Task.CompletedTask.ConfigureAwait(false); - - return injectionIssueNoteCreateInput; - } - /// /// 判断是不是在最底层 如果不是则把状态变更为等待 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/KittingIssueJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/Issue/KittingIssueJobEventHandler.cs similarity index 92% rename from be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/KittingIssueJobEventHandler.cs rename to be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/Issue/KittingIssueJobEventHandler.cs index 308cb2a0c..f5a2f1bf9 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/KittingIssueJobEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/Issue/KittingIssueJobEventHandler.cs @@ -20,16 +20,13 @@ public class KittingIssueJobEventHandler : , ILocalEventHandler> , ILocalEventHandler>> { - private readonly IKittingIssueNoteAppService _kittingIssueNoteAppService; private readonly IExpectOutAppService _expectOutAppService; private readonly ILocationAppService _locationAppService; private readonly ITransferLibRequestAppService _transferLibRequestAppService; - public KittingIssueJobEventHandler(IKittingIssueNoteAppService kittingIssueNoteAppService, - IExpectOutAppService expectOutAppService, + public KittingIssueJobEventHandler(IExpectOutAppService expectOutAppService, ILocationAppService locationAppService, ITransferLibRequestAppService transferLibRequestAppService) { - _kittingIssueNoteAppService = kittingIssueNoteAppService; _expectOutAppService = expectOutAppService; _locationAppService = locationAppService; _transferLibRequestAppService = transferLibRequestAppService; @@ -212,21 +209,6 @@ public class KittingIssueJobEventHandler : } } - /// - /// 创建补料记录实体 - /// - /// - /// - private async Task BuildKittingIssueNoteAsync(KittingIssueJob entity) - { - var kittingIssueNoteCreateInput = ObjectMapper.Map(entity); - kittingIssueNoteCreateInput.JobNumber = entity.Number; - - await Task.CompletedTask.ConfigureAwait(false); - - return kittingIssueNoteCreateInput; - } - /// /// 判断是不是在最底层 如果不是则把状态变更为等待 ///