|
|
@ -298,6 +298,91 @@ public class CoatingIssueJobAppService |
|
|
|
await CancelAcceptAsync(masterId).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 执行任务明细
|
|
|
|
/// </summary>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("ExecuteDetail/{masterId}")] |
|
|
|
public async Task ExecuteDetailExtAsync(Guid masterId, Guid detailId, CoatingIssueJobDetailDTO issueJobDetailDto) |
|
|
|
{ |
|
|
|
var coatingIssueJob = await _repository.GetAsync(masterId).ConfigureAwait(false); |
|
|
|
coatingIssueJob.JobStatus = EnumJobStatus.Doing; |
|
|
|
if (coatingIssueJob.IsClaims) |
|
|
|
{ |
|
|
|
if (coatingIssueJob.ClaimsUserId != _currentUser.Id.ToString()) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"该任务已被【{coatingIssueJob.ClaimsUserName}】承接"); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("该任务未被承接,请重新刷新页面,承接任务"); |
|
|
|
} |
|
|
|
|
|
|
|
var coatingIssueJobDto = ObjectMapper.Map<CoatingIssueJob, CoatingIssueJobDTO>(coatingIssueJob); |
|
|
|
|
|
|
|
var fromLocationDto = await _locationAppService.GetByCodeAsync(issueJobDetailDto.HandledFromLocationCode).ConfigureAwait(false); |
|
|
|
var toLocationDto = await _locationAppService.GetByCodeAsync(issueJobDetailDto.HandledToLocationCode).ConfigureAwait(false); |
|
|
|
|
|
|
|
issueJobDetailDto.HandledFromLocationArea = fromLocationDto.AreaCode; |
|
|
|
issueJobDetailDto.HandledFromLocationGroup = fromLocationDto.LocationGroupCode; |
|
|
|
issueJobDetailDto.HandledFromLocationErpCode = fromLocationDto.ErpLocationCode; |
|
|
|
issueJobDetailDto.HandledFromWarehouseCode = fromLocationDto.WarehouseCode; |
|
|
|
|
|
|
|
issueJobDetailDto.HandledToLocationArea = toLocationDto.AreaCode; |
|
|
|
issueJobDetailDto.HandledToLocationGroup = toLocationDto.LocationGroupCode; |
|
|
|
issueJobDetailDto.HandledToLocationErpCode = toLocationDto.ErpLocationCode; |
|
|
|
issueJobDetailDto.HandledToWarehouseCode = toLocationDto.WarehouseCode; |
|
|
|
|
|
|
|
coatingIssueJobDto.Details = new List<CoatingIssueJobDetailDTO> { issueJobDetailDto }; |
|
|
|
var coatingIssueNoteEditInput = await BuildCoatingIssueNoteAsync(coatingIssueJobDto).ConfigureAwait(false); |
|
|
|
await _coatingIssueNoteAppService.CreateAsync(coatingIssueNoteEditInput).ConfigureAwait(false); |
|
|
|
|
|
|
|
var issueJobDetail = ObjectMapper.Map<CoatingIssueJobDetailDTO, CoatingIssueJobDetail>(issueJobDetailDto); |
|
|
|
var entityDetail = coatingIssueJob.Details.Find(p => p.Id == detailId); |
|
|
|
issueJobDetail.HandledFromQty = entityDetail.HandledFromQty; |
|
|
|
issueJobDetail.HandledToQty = entityDetail.HandledToQty; |
|
|
|
|
|
|
|
issueJobDetail.HandledToQty += issueJobDetailDto.HandledToQty; |
|
|
|
issueJobDetail.HandledFromQty += issueJobDetailDto.HandledFromQty; |
|
|
|
coatingIssueJob.Details = new EditableList<CoatingIssueJobDetail> { issueJobDetail }; |
|
|
|
coatingIssueJob.CompleteUserId = _currentUser.Id; |
|
|
|
coatingIssueJob.CompleteUserName = _currentUser.Name; |
|
|
|
coatingIssueJob.CompleteTime = DateTime.Now; |
|
|
|
if (coatingIssueJob.EnumIssueSendType == EnumIssueSendType.BoxQtyType) //按箱叫料 因为任务只有1箱 所以可以直接完成
|
|
|
|
{ |
|
|
|
if (issueJobDetailDto.RecommendToPackingCode != issueJobDetailDto.HandledToPackingCode) |
|
|
|
{ |
|
|
|
await CheckPackingCodeIsUserAsync(issueJobDetailDto.HandledToPackingCode, coatingIssueJob.Number) |
|
|
|
.ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
await UpdateRequestAndjobStatusDoneAsync(coatingIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty) |
|
|
|
.ConfigureAwait(false); |
|
|
|
await _expectOutAppService.RemoveByNumberAsync(coatingIssueJob.Number).ConfigureAwait(false); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
var detail = coatingIssueJob.Details.First(p => p.Id == issueJobDetailDto.Id); |
|
|
|
if (issueJobDetail.HandledToQty >= detail.RequestQty) |
|
|
|
{ |
|
|
|
await UpdateRequestAndjobStatusDoneAsync(coatingIssueJob, issueJobDetailDto, |
|
|
|
issueJobDetailDto.HandledToQty).ConfigureAwait(false); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
await RemoveExpectOutAsync(coatingIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty) |
|
|
|
.ConfigureAwait(false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
await _repository.UpdateAsync(coatingIssueJob).ConfigureAwait(false); |
|
|
|
await CancelAcceptAsync(masterId).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 完成任务
|
|
|
|
/// </summary>
|
|
|
@ -898,7 +983,7 @@ public class CoatingIssueJobAppService |
|
|
|
details.Add(dto); |
|
|
|
|
|
|
|
|
|
|
|
//await ExecuteDetailExtAsync(itm.Id, entity.Id, dto).ConfigureAwait(false);
|
|
|
|
await ExecuteDetailExtAsync(itm.Id, entity.Id, dto).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
if (errors.Count > 0) |
|
|
|