From 790a473117ca7270580102d39ef29ce5cf7de7f8 Mon Sep 17 00:00:00 2001 From: liuyunfeng Date: Tue, 21 May 2024 10:06:16 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=94=B9=20=20=E6=8B=86=E7=AE=B1=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Notes/TransferNotes/TransferNoteAppService.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs index 9451fe2e9..8596f6c4e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs @@ -409,7 +409,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase /// /// /// - private async Task WriteSplitPackingRec(TransferNoteEditInput transferNoteEditInput) + private async Task WriteSplitPackingRec(TransferNoteEditInput transferNoteEditInput, SplitPacking_UpdateJobDetailInput updateJobDetailInput = null) { List recLst = new List(); foreach (var inputDetail in transferNoteEditInput.Details) @@ -421,6 +421,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase packRec.FromStdPackQty = inputDetail.StdPackQty; packRec.FromUom = inputDetail.Uom; packRec.FromQty = inputDetail.Qty; + packRec.ToPackingCode = inputDetail.ToPackingCode; //packRec.ToTopPackingCode = inputDetail.; packRec.ToStdPackQty = inputDetail.StdPackQty; @@ -438,6 +439,11 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase //packRec.TaskOrderNumber = inputDetail.; //任务单 //packRec.ReceiptRecNumber = inputDetail.; //收货记录单 //packRec.PutOnShelfNumber = inputDetail.; //上架单 + if (updateJobDetailInput != null) + { + packRec.FromQty = updateJobDetailInput.FromQty; + packRec.ToQty = updateJobDetailInput.ToQty; + } recLst.Add(packRec); } var ret = await _splitPackingRecAppService.BatchInsertAsync(recLst).ConfigureAwait(false); @@ -455,7 +461,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase { var jobRet = await _purchaseReceiptJobAppService.SaveDetail_SplitPackingAsync(updateJobDetailInput).ConfigureAwait(false); var requestRet = await _purchaseReceiptRequestAppService.SaveDetail_SplitPackingAsync(updateJobDetailInput, jobRet.PurchaseReceiptRequestNumber).ConfigureAwait(false); - bool ret = await WriteSplitPackingRec(transferNoteEditInput).ConfigureAwait(false); //采购收货-目检-拆箱时,还没有入库,不涉及库存操作 + bool ret = await WriteSplitPackingRec(transferNoteEditInput, updateJobDetailInput).ConfigureAwait(false); //采购收货-目检-拆箱时,还没有入库,不涉及库存操作 return ret; } From e390ed2b4d398b72d522a4caa49f2ba17c47ee08 Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Tue, 21 May 2024 13:31:33 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=B8=89=E6=96=B9=E5=BA=93=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ThirdLocationJobAppService.cs | 58 ++++++++++++++----- .../Jobs/ThirdLocationJobAutoMapperProfile.cs | 4 +- .../Jobs/ThirdLocationJobEventHandler.cs | 13 +++-- .../ThirdLocationNoteEventHandler.cs | 5 ++ 4 files changed, 61 insertions(+), 19 deletions(-) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs index 6a631835f..a2e73a8be 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs @@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Mvc; using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.ObjectMapping; +using Volo.Abp.Uow; using Win_in.Sfs.Basedata.Domain.Shared; using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain.Shared; @@ -33,6 +34,49 @@ public class ThirdLocationJobAppService _thirdLocationJobManager = thirdLocationJobManager; } + /// + /// 完成任务 + /// + /// + /// + /// + [HttpPost("handle/{id}")] + [UnitOfWork] + public override async Task CompleteAsync(Guid id, ThirdLocationJobDTO dto) + { + var handleEntity = ObjectMapper.Map(dto); + var job = await _repository.GetAsync(id).ConfigureAwait(false); + if (job.JobStatus is EnumJobStatus.Closed or EnumJobStatus.Cancelled or EnumJobStatus.None or EnumJobStatus.Done)//需要考虑下 多次提交的问题 所以不判断 进行中 + { + throw new UserFriendlyException($"任务状态错误:编号为【{job.Number}】的任务已经【{job.JobStatus.GetDisplayName()}】"); + } + if(dto.Details.Count==0) + { + throw new UserFriendlyException($"任务错误:编号为【{job.Number} 的任务未包含明细"); + } + else + { + if (dto.Details[0].HandledQty > job.Details[0].RecommendQty) + { + throw new UserFriendlyException($"任务错误:编号为【{job.Number}】的实际数量【{dto.Details[0].HandledQty}】不能大于申请数量【{dto.Details[0].RecommendQty}】"); + } + if(dto.Details[0].ToLocationCode != job.Details[0].ToLocationCode) + { + throw new UserFriendlyException($"任务错误:编号为【{job.Number}】的实际目标库位【{dto.Details[0].ToLocationCode}】与申请目标库位【{job.Details[0].ToLocationCode}】不一致"); + } + } + + + var handleResult = await _thirdLocationJobManager.CompleteAsync(handleEntity,CurrentUser).ConfigureAwait(false); + //判断申请是否执行完成 + if (job.JobStatus == EnumJobStatus.Done) + { + + } + var handleDto = ObjectMapper.Map(handleResult); + return handleDto; + } + /// /// 根据物品和库位 检查是否存在发料任务 /// @@ -76,19 +120,7 @@ public class ThirdLocationJobAppService await _thirdLocationJobManager.CancelAsync(thirdLocationJob).ConfigureAwait(false); } - - /// - /// 根据叫料请求类型获取发料任务 - /// - /// - /// - /// 叫料请求类型: - /// 人工拉动:Issue_Manual; - /// 线边拉动:Issue_WIP; - /// - /// - /// - /// + [HttpPost("by-type/{requestType}")] public virtual async Task> GetListByTypeAsync(SfsJobRequestInputBase requestInput, string requestType, bool includeDetails = false, CancellationToken cancellationToken = default) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ThirdLocationJobAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ThirdLocationJobAutoMapperProfile.cs index 1731bd5e6..308e7c130 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ThirdLocationJobAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ThirdLocationJobAutoMapperProfile.cs @@ -69,6 +69,7 @@ public partial class StoreEventAutoMapperProfile : Profile ; CreateMap() .ForMember(x => x.Qty, y => y.MapFrom(d => d.HandledQty)) + .ForMember(x => x.FromLocationCode, y => y.MapFrom(d => d.RecommendFromLocationCode)) .ForMember(x => x.IssueTime, y => y.MapFrom(d => DateTime.Now)) .ForMember(x => x.FromPackingCode, y => y.MapFrom(d => d.HandledPackingCode)) .ForMember(x => x.ToPackingCode, y => y.MapFrom(d => d.HandledPackingCode)) @@ -79,8 +80,7 @@ public partial class StoreEventAutoMapperProfile : Profile .ForMember(x => x.SupplierBatch, y => y.MapFrom(d => d.HandledSupplierBatch)) .ForMember(x => x.ArriveDate, y => y.MapFrom(d => d.HandledArriveDate)) .ForMember(x => x.ProduceDate, y => y.MapFrom(d => d.HandledProduceDate)) - .ForMember(x => x.ExpireDate, y => y.MapFrom(d => d.ExpiredTime)) - .ForMember(x => x.FromLocationCode, y => y.MapFrom(d => d.HandledFromLocationCode)) + .ForMember(x => x.ExpireDate, y => y.MapFrom(d => d.ExpiredTime)) .ForMember(x => x.FromLocationArea, y => y.MapFrom(d => d.HandledFromLocationArea)) .ForMember(x => x.FromLocationGroup, y => y.MapFrom(d => d.HandledFromLocationGroup)) .ForMember(x => x.FromLocationErpCode, y => y.MapFrom(d => d.HandledFromLocationErpCode)) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs index 31d1acd4e..d23c13f61 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs @@ -41,10 +41,10 @@ public class ThirdLocationJobEventHandler : entity.CompleteTime = Clock.Now; entity.JobStatus = EnumJobStatus.Done; - foreach (var detail in eventData.Entity.Details) - { - detail.SetHandledFromRecommend(); - } + //foreach (var detail in eventData.Entity.Details) + //{ + // detail.SetHandledFromRecommend(); + //} var thirdLocationNote = await BuildThirdLocationNoteAsync(entity).ConfigureAwait(false); await _thirdLocationNoteAppService.CreateAsync(thirdLocationNote).ConfigureAwait(false); @@ -80,6 +80,11 @@ public class ThirdLocationJobEventHandler : detail.FromLocationErpCode = locationFrom.ErpLocationCode; detail.FromWarehouseCode = locationFrom.WarehouseCode; detail.FromStatus = EnumInventoryStatus.OK; + + detail.FromPackingCode = ""; + detail.ToPackingCode = ""; + detail.FromLot = ""; + detail.ToLot = ""; } return thirdLocationNoteCreateInput; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ThirdLocationNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ThirdLocationNoteEventHandler.cs index c46ab6697..5e7f69cdb 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ThirdLocationNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ThirdLocationNoteEventHandler.cs @@ -46,6 +46,11 @@ public class ThirdLocationNoteEventHandler if (!string.IsNullOrEmpty(entity.RequestNumber)) { var thirdLocationRequest = await _thirdLocationRequestManager.GetByNumberAsync(entity.RequestNumber).ConfigureAwait(false); + foreach(var item in thirdLocationRequest.Details) + { + item.IssuedQty = entity.Details[0].RecommendQty; + item.ReceivedQty = entity.Details[0].HandledQty; + } await _thirdLocationRequestManager.CompleteAsync(thirdLocationRequest).ConfigureAwait(false); } } From 46adbcdc73fcb0d0c0897af25c7a1be9ed513757 Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Tue, 21 May 2024 14:30:16 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=B8=89=E6=96=B9=E5=BA=93=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E5=B7=B2=E5=8F=91=E6=95=B0=E9=87=8F=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ThirdLocationJobAppService.cs | 6 ++--- .../ThirdLocationNoteEventHandler.cs | 25 +++++++++++++------ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs index a2e73a8be..55281ef5f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs @@ -98,10 +98,10 @@ public class ThirdLocationJobAppService return dtos; } - [HttpPost("cancel-by-request/{assembleNumber}")] - public virtual async Task CancelByMaterialRequestAsync(string assembleNumber) + [HttpPost("cancel-by-request/{thirdLocationNumber}")] + public virtual async Task CancelByMaterialRequestAsync(string thirdLocationNumber) { - var entities = await _repository.GetListAsync(p => p.RequestNumber == assembleNumber).ConfigureAwait(false); + var entities = await _repository.GetListAsync(p => p.RequestNumber == thirdLocationNumber).ConfigureAwait(false); foreach (var entity in entities) { await _thirdLocationJobManager.CancelAsync(entity).ConfigureAwait(false); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ThirdLocationNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ThirdLocationNoteEventHandler.cs index 5e7f69cdb..24d813bd1 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ThirdLocationNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ThirdLocationNoteEventHandler.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; using Volo.Abp.EventBus; using Volo.Abp.Uow; using Win_in.Sfs.Basedata.Application.Contracts; @@ -10,6 +11,7 @@ using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Event.Transaction; +using static ClosedXML.Excel.XLPredefinedFormat; namespace Win_in.Sfs.Wms.Store.Event.Transactions; @@ -23,12 +25,14 @@ public class ThirdLocationNoteEventHandler private readonly ILocationAppService _locationAppService; private readonly IThirdLocationRequestManager _thirdLocationRequestManager; + private readonly IThirdLocationRequestRepository _ThirdLocationRequestRepository; public ThirdLocationNoteEventHandler(ILocationAppService locationAppService - , IThirdLocationRequestManager thirdLocationRequestManager) + , IThirdLocationRequestRepository ThirdLocationRequestRepository, IThirdLocationRequestManager thirdLocationRequestManager) { _locationAppService = locationAppService; _thirdLocationRequestManager = thirdLocationRequestManager; + _ThirdLocationRequestRepository = ThirdLocationRequestRepository; } [UnitOfWork] @@ -44,14 +48,21 @@ public class ThirdLocationNoteEventHandler await TransferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); if (!string.IsNullOrEmpty(entity.RequestNumber)) - { - var thirdLocationRequest = await _thirdLocationRequestManager.GetByNumberAsync(entity.RequestNumber).ConfigureAwait(false); - foreach(var item in thirdLocationRequest.Details) + { + //var thirdLocationRequest = await _thirdLocationRequestManager.GetByNumberAsync(entity.RequestNumber).ConfigureAwait(false); + + var entities = await _ThirdLocationRequestRepository.GetListAsync(p => p.Number == entity.RequestNumber, "Number", true).ConfigureAwait(false); + if(entities.Count>0) { - item.IssuedQty = entity.Details[0].RecommendQty; - item.ReceivedQty = entity.Details[0].HandledQty; + foreach (var item in entities[0].Details) + { + item.IssuedQty = entity.Details[0].RecommendQty; + item.ReceivedQty = entity.Details[0].HandledQty; + } + await _thirdLocationRequestManager.CompleteAsync(entities[0]).ConfigureAwait(false); + } - await _thirdLocationRequestManager.CompleteAsync(thirdLocationRequest).ConfigureAwait(false); + } }