From f0985d7ab33fd013e220cf5db6b74dd667512805 Mon Sep 17 00:00:00 2001 From: lvzb <35200379@qq.com> Date: Sat, 11 May 2024 11:35:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=9D=9E=E7=94=9F=E4=BA=A7=E9=A2=86?= =?UTF-8?q?=E6=96=99=E9=80=80=E6=96=99=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Requests/UnplannedIssueRequestEventHandler.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/UnplannedIssueRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/UnplannedIssueRequestEventHandler.cs index 545e6961f..6f9c964f1 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/UnplannedIssueRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/UnplannedIssueRequestEventHandler.cs @@ -82,10 +82,10 @@ public class UnplannedIssueRequestEventHandler public virtual async Task HandleEventAsync(SfsHandledEntityEventData eventData) { var entity = eventData.Entity; - if (entity.UnplannedIssueType == Shared.Domain.Shared.Enums.Store.EnumUnplannedIssueType.Wip&&!string.IsNullOrEmpty(entity.OANumber)) - { - entity.RequestStatus = EnumRequestStatus.Completed; - } + //if (entity.UnplannedIssueType == Shared.Domain.Shared.Enums.Store.EnumUnplannedIssueType.Wip&&!string.IsNullOrEmpty(entity.OANumber)) + //{ + // entity.RequestStatus = EnumRequestStatus.Completed; + //} if (entity.DirectCreateNote) { var note = await BuildUnplannedIssueNoteCreateInputAsync(entity).ConfigureAwait(false); From d24740b5d6c44009b24626bce74545a2248e8fa3 Mon Sep 17 00:00:00 2001 From: "boxu.zheng" Date: Sat, 11 May 2024 11:37:32 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../KittingIssueRequestEventHandler.cs | 50 +++++++++++++++++-- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/KittingIssueRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/KittingIssueRequestEventHandler.cs index 878b02ee0..1ccb8b4f3 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/KittingIssueRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/KittingIssueRequestEventHandler.cs @@ -2,14 +2,17 @@ using System.Collections.Generic; using System.Linq; using System.Text.Json; using System.Threading.Tasks; +using AutoMapper; using Castle.Components.DictionaryAdapter; using Volo.Abp; +using Volo.Abp.AutoMapper; using Volo.Abp.EventBus; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Domain.Shared.Enums.Store; using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Wms.Inventory.Application.Contracts; +using Win_in.Sfs.Wms.Inventory.Domain; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; @@ -28,6 +31,7 @@ public class KittingIssueRequestEventHandler private readonly IProductionLineItemAppService _productionLineItemAppService; private readonly ILocationAppService _locationAppService; private readonly IBalanceAppService _balanceAppService; + private IMapper _mapper; //private readonly IKittingIssueRequestManager _kittingIssueRequestManager; public KittingIssueRequestEventHandler( @@ -329,7 +333,7 @@ public class KittingIssueRequestEventHandler ( KittingIssueRequest kittingIssueRequest, List kittingIssueRequestDetailList, - List recommendbalanceDtos, + List recommendbalanceDtos, List useBalanceList) { var inputJobs = new List(); @@ -368,7 +372,7 @@ public class KittingIssueRequestEventHandler if (usableList.Any()) { var firstUsable = usableList.First(); - useBalanceList.Add(firstUsable); + useBalanceList.Add((BalanceDTO)firstUsable); usableList.Remove(firstUsable); var kittingIssueJobEditInput = @@ -533,6 +537,7 @@ public class KittingIssueRequestEventHandler IsPackingCode = true }; var usableList = await _balanceAppService.GetUsableListAsync(input).ConfigureAwait(false); + var sortByFifoAsync=await SortByFifoAsync(usableList).ConfigureAwait(false); //因为是按箱叫料 先把值赋值给箱数量上 kittingIssueRequestDetail.BoxQty = kittingIssueRequestDetail.Qty; @@ -543,7 +548,7 @@ public class KittingIssueRequestEventHandler kittingIssueJobEditInputs.AddRange( await CreateKittingIssueJobWithBoxQtyTypeAsync(kittingIssueRequest, new EditableList { kittingIssueRequestDetail }, - usableList, + sortByFifoAsync, useBalanceList).ConfigureAwait(false)); } } @@ -660,4 +665,43 @@ public class KittingIssueRequestEventHandler //await _kittingIssueRequestManager.UpdateAsync(kittingIssueRequest).ConfigureAwait(false); } + + /// + /// 排序规则 1.批次正序 2.底层 3.到货日期正序 4.数量倒序(整箱优先) 5.库位正序 6.箱码正序 + /// + /// + /// + public async Task> SortByFifoAsync(List balances) + { + var sortBalances = new List(); + var config = new MapperConfiguration(cfg => + { + cfg.CreateMap() + .Ignore(x => x.LocationRow); + }); + _mapper = new Mapper(config); + + var resultBalances = _mapper.Map, List>(balances); + foreach (var resultBalance in resultBalances) + { + var locationDto=await _locationAppService.GetByCodeAsync(resultBalance.LocationCode).ConfigureAwait(false); + resultBalance.LocationRow = locationDto.RowCode; + } + + resultBalances + .OrderBy(p => p.Lot) + .OrderBy(p=>p.LocationRow) + .ThenBy(p => p.PutInTime) + .ThenBy(p => p.Qty)//2023-9-14 苑静雯 从小数开始发料 + .ThenBy(p => p.LocationCode) + .ThenBy(p => p.PackingCode) + .ToList(); + + return resultBalances; + } +} + +public class SortBalance: BalanceDTO +{ + public int LocationRow { get; set; } }