|
|
@ -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; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 完成任务
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="id"></param>
|
|
|
|
/// <param name="dto"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("handle/{id}")] |
|
|
|
[UnitOfWork] |
|
|
|
public override async Task<ThirdLocationJobDTO> CompleteAsync(Guid id, ThirdLocationJobDTO dto) |
|
|
|
{ |
|
|
|
var handleEntity = ObjectMapper.Map<ThirdLocationJobDTO, ThirdLocationJob>(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<ThirdLocationJob, ThirdLocationJobDTO>(handleResult); |
|
|
|
return handleDto; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 根据物品和库位 检查是否存在发料任务
|
|
|
|
/// </summary>
|
|
|
@ -76,19 +120,7 @@ public class ThirdLocationJobAppService |
|
|
|
await _thirdLocationJobManager.CancelAsync(thirdLocationJob).ConfigureAwait(false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 根据叫料请求类型获取发料任务
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="requestInput"></param>
|
|
|
|
/// <param name="requestType">
|
|
|
|
/// 叫料请求类型:
|
|
|
|
/// 人工拉动:Issue_Manual;
|
|
|
|
/// 线边拉动:Issue_WIP;
|
|
|
|
/// </param>
|
|
|
|
/// <param name="includeDetails"></param>
|
|
|
|
/// <param name="cancellationToken"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
[HttpPost("by-type/{requestType}")] |
|
|
|
public virtual async Task<PagedResultDto<ThirdLocationJobDTO>> GetListByTypeAsync(SfsJobRequestInputBase requestInput, |
|
|
|
string requestType, bool includeDetails = false, CancellationToken cancellationToken = default) |
|
|
|