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] =?UTF-8?q?=E4=B8=89=E6=96=B9=E5=BA=93=E5=A2=9E=E5=8A=A0?=
=?UTF-8?q?=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);
}
}