diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/InspectJobs/DTOs/InspectJobDetailManyDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/InspectJobs/DTOs/InspectJobDetailManyDTO.cs new file mode 100644 index 000000000..7a59e28ec --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/InspectJobs/DTOs/InspectJobDetailManyDTO.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Shared.Domain.Shared.Enums.Inspect; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public class InspectJobDetailManyDTO : InspectJobDetailDTO + , IHasPoLine + , IHasInspectUser + , IHasReceiveQty +{ + public string GuidList { get; set; } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/InspectJobs/IInspectJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/InspectJobs/IInspectJobAppService.cs index 7ed6be421..8a045ed78 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/InspectJobs/IInspectJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/InspectJobs/IInspectJobAppService.cs @@ -55,8 +55,7 @@ public interface IInspectJobAppService /// 批量设置质检状态 /// /// - /// - /// + /// /// - Task SetManyDetailStatusAsync(Guid id, List detailIdList, InspectJobDetailDTO detailDto); + Task SetManyDetailStatusAsync(Guid id, InspectJobDetailManyDTO detailManyDto); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/InspectJobs/InspectJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/InspectJobs/InspectJobAppService.cs index b14b4f5e0..35ec8c85c 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/InspectJobs/InspectJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/InspectJobs/InspectJobAppService.cs @@ -6,11 +6,8 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Volo.Abp; -using Volo.Abp.ObjectMapping; using Win_in.Sfs.Basedata.Domain.Shared; using Win_in.Sfs.FileStorage.Application.Contracts; -using Win_in.Sfs.Shared.Domain.Shared; -using Win_in.Sfs.Shared.Domain.Shared.Enums.Inspect; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain.Shared; @@ -66,7 +63,8 @@ public class InspectJobAppService var summaryDetail = ObjectMapper.Map(input); - var entity = await _inspectJobManager.CompleteSummaryDetailStatusAsync(id, summaryDetailId, summaryDetail, CurrentUser).ConfigureAwait(false); + var entity = await _inspectJobManager + .CompleteSummaryDetailStatusAsync(id, summaryDetailId, summaryDetail, CurrentUser).ConfigureAwait(false); return ObjectMapper.Map(entity); } @@ -102,7 +100,8 @@ public class InspectJobAppService /// /// [HttpPost("set-detail-nook-status/{id}")] - public virtual async Task SetDetailNoOkStatusAsync(Guid id, InspectJobDetailDTO detailDto) + public virtual async Task SetDetailNoOkStatusAsync(Guid id, + InspectJobDetailDTO detailDto) { var entity = ObjectMapper.Map(detailDto); @@ -142,18 +141,28 @@ public class InspectJobAppService } /// - /// 批量设置质检状态 + /// 批量设置质检状态 /// /// - /// - /// + /// /// [HttpPost("Set-Many-Detail-Status")] - public virtual async Task SetManyDetailStatusAsync(Guid id, List detailIdList, InspectJobDetailDTO detailDto) + public virtual async Task SetManyDetailStatusAsync(Guid id, InspectJobDetailManyDTO detailManyDto) { + var guidstr = detailManyDto.GuidList; + var guidstrList = guidstr.Split(','); + var guidList = new List(); + foreach (var guidStr in guidstrList) + { + guidList.Add(Guid.Parse(guidStr)); + } + + var detailDto = (InspectJobDetailDTO)detailManyDto; + var entityDetail = ObjectMapper.Map(detailDto); - var entity=await _inspectJobManager.SetManyDetailStatusAsync(id,detailIdList, entityDetail).ConfigureAwait(false); + var entity = await _inspectJobManager.SetManyDetailStatusAsync(id, guidList, entityDetail) + .ConfigureAwait(false); return ObjectMapper.Map(entity); } @@ -175,7 +184,9 @@ public class InspectJobAppService [HttpPost("get-job/by-detail-packing")] public virtual async Task GetInspectNoteDetailByPackingCodeAsync(string packingCode) { - var entity = (await _repository.GetListAsync(p => p.Details.Any(y => y.PackingCode == packingCode), true).ConfigureAwait(false)).FirstOrDefault(); + var entity = + (await _repository.GetListAsync(p => p.Details.Any(y => y.PackingCode == packingCode), true) + .ConfigureAwait(false)).FirstOrDefault(); var dto = ObjectMapper.Map(entity); @@ -183,18 +194,21 @@ public class InspectJobAppService } /// - /// 保存拆箱时涉及的明细修改 + /// 保存拆箱时涉及的明细修改 /// /// [HttpPost("save-detail-split-packing")] public virtual async Task SaveDetail_SplitPackingAsync(SplitPacking_UpdateJobDetailInput input) { - InspectJob job = await _repository.FindAsync(p => p.Number == input.Number).ConfigureAwait(false); - InspectJobDetail detail = job.Details.FirstOrDefault(p => p.PackingCode == input.FromPackingCode); /* && p.ReceiveQty == input.FromQty*/ + var job = await _repository.FindAsync(p => p.Number == input.Number).ConfigureAwait(false); + var detail = + job.Details.FirstOrDefault(p => + p.PackingCode == input.FromPackingCode); /* && p.ReceiveQty == input.FromQty*/ if (detail == null) { throw new UserFriendlyException($"根据PackingCode={input.FromPackingCode}取InspectDetail表为空!"); } + //插入目标箱 var newDetail = CommonHelper.CloneObj(detail); newDetail.SetId(GuidGenerator.Create()); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/InspectJobs/InspectJobManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/InspectJobs/InspectJobManager.cs index 2f39dfdeb..818a6c84d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/InspectJobs/InspectJobManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/InspectJobs/InspectJobManager.cs @@ -358,11 +358,10 @@ public class InspectJobManager : SfsJobManagerBase { var entity = await Repository.FindAsync(id).ConfigureAwait(false); - var detailList = entity.Details.Where(p => detailIdList.Contains(p.Id)).ToList(); - - detailList.ForEach(detail => + foreach (var detailId in detailIdList) { - switch (detail.DetailInspectStatus) + var detail = entity.Details.Find(p => p.Id == detailId); + switch (inspectJobDetail.DetailInspectStatus) { case EnumDetailInspectStatus.DefaultOK: detail.DetailInspectStatus = EnumDetailInspectStatus.DefaultOK; @@ -403,7 +402,7 @@ public class InspectJobManager : SfsJobManagerBase detail.CrackQty = 0; break; } - }); + } await SetSummaryAllQtyAsync(entity).ConfigureAwait(false); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/AssembleIssueRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Issue/AssembleIssueRequestEventHandler.cs similarity index 99% rename from be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/AssembleIssueRequestEventHandler.cs rename to be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Issue/AssembleIssueRequestEventHandler.cs index f42900984..910d057b8 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/AssembleIssueRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Issue/AssembleIssueRequestEventHandler.cs @@ -339,6 +339,8 @@ public class AssembleIssueRequestEventHandler { var inputJobs = new List(); + var jobs = await _assembleIssueJobAppService.GetByRequestNumberAsync(assembleIssueRequest.Number).ConfigureAwait(false); + //已用的库存的集合 useBalanceList = useBalanceList; @@ -347,7 +349,7 @@ public class AssembleIssueRequestEventHandler //当前零件的集合 var inputDetails = assembleIssueRequestDetailList; //获取请求下 这个零件和这个库位一个需要多少箱 - var sumBoxQty = inputDetails.Sum(p => p.BoxQty - p.IssuedQty); + var sumBoxQty = inputDetails.Sum(p => p.BoxQty -jobs.Count); //获取生产线 var productionLineDto = await _productionLineAppService .GetByLocationCodeAsync(inputDetails.First().ToLocationCode).ConfigureAwait(false); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CoatingIssueRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Issue/CoatingIssueRequestEventHandler.cs similarity index 99% rename from be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CoatingIssueRequestEventHandler.cs rename to be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Issue/CoatingIssueRequestEventHandler.cs index 8bd491fae..2202ae0f4 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CoatingIssueRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Issue/CoatingIssueRequestEventHandler.cs @@ -338,6 +338,8 @@ public class CoatingIssueRequestEventHandler { var inputJobs = new List(); + var jobs = await _coatingIssueJobAppService.GetByRequestNumberAsync(coatingIssueRequest.Number).ConfigureAwait(false); + //已用的库存的集合 useBalanceList = useBalanceList; @@ -346,7 +348,7 @@ public class CoatingIssueRequestEventHandler //当前零件的集合 var inputDetails = coatingIssueRequestDetailList; //获取请求下 这个零件和这个库位一个需要多少箱 - var sumBoxQty = inputDetails.Sum(p => p.BoxQty - p.IssuedQty); + var sumBoxQty = inputDetails.Sum(p => p.BoxQty - jobs.Count); //获取生产线 var productionLineDto = await _productionLineAppService .GetByLocationCodeAsync(inputDetails.First().ToLocationCode).ConfigureAwait(false); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/InjectionIssueRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Issue/InjectionIssueRequestEventHandler.cs similarity index 99% rename from be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/InjectionIssueRequestEventHandler.cs rename to be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Issue/InjectionIssueRequestEventHandler.cs index a187d80b1..992fa6aca 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/InjectionIssueRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Issue/InjectionIssueRequestEventHandler.cs @@ -338,6 +338,8 @@ public class InjectionIssueRequestEventHandler { var inputJobs = new List(); + var jobs=await _injectionIssueJobAppService.GetByRequestNumberAsync(injectionIssueRequest.Number).ConfigureAwait(false); + //已用的库存的集合 useBalanceList = useBalanceList; @@ -345,8 +347,8 @@ public class InjectionIssueRequestEventHandler { //当前零件的集合 var inputDetails = injectionIssueRequestDetailList; - //获取请求下 这个零件和这个库位一个需要多少箱 - var sumBoxQty = inputDetails.Sum(p => p.BoxQty - p.IssuedQty); + //获取请求下 这个零件和这个库位一共需要多少箱 + var sumBoxQty = inputDetails.Sum(p => p.BoxQty - jobs.Count); //获取生产线 var productionLineDto = await _productionLineAppService .GetByLocationCodeAsync(inputDetails.First().ToLocationCode).ConfigureAwait(false); 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/Issue/KittingIssueRequestEventHandler.cs similarity index 99% rename from be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/KittingIssueRequestEventHandler.cs rename to be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Issue/KittingIssueRequestEventHandler.cs index bc7cb02fb..6728afda7 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/Issue/KittingIssueRequestEventHandler.cs @@ -15,6 +15,7 @@ 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; +using static Win_in.Sfs.Wms.Store.Domain.Shared.StoreSettings; namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest; @@ -338,6 +339,8 @@ public class KittingIssueRequestEventHandler { var inputJobs = new List(); + var jobs = await _kittingIssueJobAppService.GetByRequestNumberAsync(kittingIssueRequest.Number).ConfigureAwait(false); + //已用的库存的集合 useBalanceList = useBalanceList; @@ -346,7 +349,7 @@ public class KittingIssueRequestEventHandler //当前零件的集合 var inputDetails = kittingIssueRequestDetailList; //获取请求下 这个零件和这个库位一个需要多少箱 - var sumBoxQty = inputDetails.Sum(p => p.BoxQty - p.IssuedQty); + var sumBoxQty = inputDetails.Sum(p => p.BoxQty - jobs.Count); //获取生产线 var productionLineDto = await _productionLineAppService .GetByLocationCodeAsync(inputDetails.First().ToLocationCode).ConfigureAwait(false);