|
|
@ -475,11 +475,14 @@ public class UnplannedIssueJobAppService |
|
|
|
public override async Task<UnplannedIssueJobDTO> CompleteAsync(Guid id, UnplannedIssueJobDTO dto) |
|
|
|
{ |
|
|
|
var job = await _repository.GetAsync(id).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var facQuery=job.FacDetails.GroupBy(p => new { p.ItemCode }).Select(p=>new {ItemCode= p.Key.ItemCode,Qty= p.Sum(itm=>itm.RecommendQty) }); |
|
|
|
var query=dto.Details.GroupBy(p => new { p.ItemCode }).Select(p => new { ItemCode = p.Key.ItemCode, Qty = p.Sum(itm => itm.HandledQty) }); |
|
|
|
var errorQuery = from itm in facQuery join itm1 in query on itm.ItemCode equals itm1.ItemCode where itm1.Qty < itm.Qty select itm.ItemCode ; |
|
|
|
var errorList = errorQuery.ToList(); |
|
|
|
if (errorList.Count > 0) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"零件{string.Join(",",errorList)}实际数量大于推荐数量!"); |
|
|
|
} |
|
|
|
|
|
|
|
var handleDto = new UnplannedIssueJobDTO(); |
|
|
|
//using (var uow = _unitOfWorkManager.Begin())
|
|
|
@ -495,8 +498,6 @@ public class UnplannedIssueJobAppService |
|
|
|
handleDto = ObjectMapper.Map<UnplannedIssueJob, UnplannedIssueJobDTO>(handleResult); |
|
|
|
await _expectOutAppService.RemoveAsync(dto.Number).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handleResult.CompleteUserName = dto.Worker; |
|
|
|
handleResult.JobStatus = EnumJobStatus.Done; |
|
|
|
job = await _repository.UpdateAsync(handleResult).ConfigureAwait(false); |
|
|
|