diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReturnJobs/PurchaseReturnJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReturnJobs/PurchaseReturnJobAppService.cs index 95a45fa06..6af1a3003 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReturnJobs/PurchaseReturnJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReturnJobs/PurchaseReturnJobAppService.cs @@ -77,6 +77,12 @@ public class PurchaseReturnJobAppService public override async Task CompleteAsync(Guid id, PurchaseReturnJobDTO 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()}】"); + } + var handleDto = new PurchaseReturnJobDTO(); var handleEntity = ObjectMapper.Map(dto); @@ -85,19 +91,14 @@ public class PurchaseReturnJobAppService await _purchaseReturnJobManager.CompleteAsync(handleEntity, CurrentUser).ConfigureAwait(false); handleDto = ObjectMapper.Map(handleResult); - if (job.JobStatus is EnumJobStatus.Closed or EnumJobStatus.Cancelled or EnumJobStatus.None - or EnumJobStatus.Done) //需要考虑下 多次提交的问题 所以不判断 进行中 - { - throw new UserFriendlyException($"任务状态错误:编号为【{job.Number}】的任务已经【{job.JobStatus.GetDisplayName()}】"); - } - + handleResult.CompleteUserName = dto.Worker; handleResult.JobStatus = EnumJobStatus.Done; job = await _repository.UpdateAsync(handleResult).ConfigureAwait(false); await UpdateRequestStatusAsync(job.PurchaseReturnRequestNumber).ConfigureAwait(false); - + return handleDto;