|
|
@ -83,12 +83,20 @@ public class AssembleIssueJobAppService |
|
|
|
[HttpPost("add-many")] |
|
|
|
public override async Task<List<AssembleIssueJobDTO>> CreateManyAsync(List<AssembleIssueJobEditInput> inputs) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
foreach (var input in inputs) |
|
|
|
{ |
|
|
|
await CheckMinRowAndSetStatusAsync(input).ConfigureAwait(false); |
|
|
|
await CheckDimensionalStorehouseAsync(input).ConfigureAwait(false); |
|
|
|
//如果是立库 就给直接承接了
|
|
|
|
var dimensionalStorehouseflag = await CheckDimensionalStorehouseAsync(input).ConfigureAwait(false); |
|
|
|
if (dimensionalStorehouseflag) |
|
|
|
{ |
|
|
|
input.IsClaims = true; |
|
|
|
input.ClaimsUserId = "LITK"; //todo
|
|
|
|
input.ClaimsUserName = "LITK"; //todo
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var assembleIssueJobDtos = await base.CreateManyAsync(inputs).ConfigureAwait(false); |
|
|
|
foreach (var assembleIssueJobDto in assembleIssueJobDtos) |
|
|
|
{ |
|
|
@ -96,8 +104,23 @@ public class AssembleIssueJobAppService |
|
|
|
} |
|
|
|
|
|
|
|
return assembleIssueJobDtos; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[HttpPost("")] |
|
|
|
public override async Task<AssembleIssueJobDTO> CreateAsync(AssembleIssueJobEditInput input) |
|
|
|
{ |
|
|
@ -269,7 +292,80 @@ public class AssembleIssueJobAppService |
|
|
|
await CancelAcceptAsync(masterId).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 执行任务明细
|
|
|
|
/// </summary>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("ExecuteDetail/{masterId}")] |
|
|
|
public async Task ExecuteDetailExtAsync(Guid masterId, Guid detailId, AssembleIssueJobDetailDTO issueJobDetailDto) |
|
|
|
{ |
|
|
|
var assembleIssueJob = await _repository.GetAsync(masterId).ConfigureAwait(false); |
|
|
|
assembleIssueJob.JobStatus = EnumJobStatus.Doing; |
|
|
|
|
|
|
|
assembleIssueJob.ClaimsUserId = "LITK"; |
|
|
|
assembleIssueJob.ClaimsUserName = "LITK"; |
|
|
|
|
|
|
|
|
|
|
|
//if (assembleIssueJob.IsClaims)
|
|
|
|
//{
|
|
|
|
// if (assembleIssueJob.ClaimsUserId != _currentUser.Id.ToString())
|
|
|
|
// {
|
|
|
|
// throw new UserFriendlyException($"该任务已被【{assembleIssueJob.ClaimsUserName}】承接");
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
//else
|
|
|
|
//{
|
|
|
|
// throw new UserFriendlyException("该任务未被承接,请重新刷新页面,承接任务");
|
|
|
|
//}
|
|
|
|
|
|
|
|
var assembleIssueJobDto = ObjectMapper.Map<AssembleIssueJob, AssembleIssueJobDTO>(assembleIssueJob); |
|
|
|
assembleIssueJobDto.Details = new List<AssembleIssueJobDetailDTO> { issueJobDetailDto }; |
|
|
|
var assembleIssueNoteEditInput = await BuildAssembleIssueNoteAsync(assembleIssueJobDto).ConfigureAwait(false); |
|
|
|
await _assembleIssueNoteAppService.CreateAsync(assembleIssueNoteEditInput).ConfigureAwait(false); |
|
|
|
|
|
|
|
var issueJobDetail = ObjectMapper.Map<AssembleIssueJobDetailDTO, AssembleIssueJobDetail>(issueJobDetailDto); |
|
|
|
var entityDetail = assembleIssueJob.Details.Find(p => p.Id == detailId); |
|
|
|
issueJobDetail.HandledFromQty = entityDetail.HandledFromQty; |
|
|
|
issueJobDetail.HandledToQty = entityDetail.HandledToQty; |
|
|
|
|
|
|
|
issueJobDetail.HandledToQty += issueJobDetailDto.HandledToQty; |
|
|
|
issueJobDetail.HandledFromQty += issueJobDetailDto.HandledFromQty; |
|
|
|
assembleIssueJob.Details = new EditableList<AssembleIssueJobDetail> { issueJobDetail }; |
|
|
|
assembleIssueJob.CompleteUserId = _currentUser.Id; |
|
|
|
assembleIssueJob.CompleteUserName = _currentUser.Name; |
|
|
|
assembleIssueJob.CompleteTime = DateTime.Now; |
|
|
|
if (assembleIssueJob.EnumIssueSendType == EnumIssueSendType.BoxQtyType) //按箱叫料 因为任务只有1箱 所以可以直接完成
|
|
|
|
{ |
|
|
|
if (issueJobDetailDto.RecommendToPackingCode != issueJobDetailDto.HandledToPackingCode) |
|
|
|
{ |
|
|
|
await CheckPackingCodeIsUserAsync(issueJobDetailDto.HandledToPackingCode, assembleIssueJob.Number) |
|
|
|
.ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
await UpdateRequestAndjobStatusDoneAsync(assembleIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty) |
|
|
|
.ConfigureAwait(false); |
|
|
|
await _expectOutAppService.RemoveByNumberAsync(assembleIssueJob.Number).ConfigureAwait(false); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
var detail = assembleIssueJob.Details.First(p => p.Id == issueJobDetailDto.Id); |
|
|
|
if (issueJobDetail.HandledToQty >= detail.RequestQty) |
|
|
|
{ |
|
|
|
await UpdateRequestAndjobStatusDoneAsync(assembleIssueJob, issueJobDetailDto, |
|
|
|
issueJobDetailDto.HandledToQty).ConfigureAwait(false); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
await RemoveExpectOutAsync(assembleIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty) |
|
|
|
.ConfigureAwait(false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
await _repository.UpdateAsync(assembleIssueJob).ConfigureAwait(false); |
|
|
|
await CancelAcceptAsync(masterId).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -520,12 +616,6 @@ public class AssembleIssueJobAppService |
|
|
|
dto.HandledToLocationErpCode = toloc.ErpLocationCode; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dto.HandledFromLocationCode = fromloc.Code; |
|
|
|
dto.HandledFromLocationGroup = fromloc.LocationGroupCode; |
|
|
|
dto.HandledFromLocationArea = fromloc.AreaCode; |
|
|
@ -655,10 +745,28 @@ public class AssembleIssueJobAppService |
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task CheckDimensionalStorehouseAsync(AssembleIssueJobEditInput input) |
|
|
|
{ |
|
|
|
|
|
|
|
//private async Task CheckDimensionalStorehouseAsync(AssembleIssueJobEditInput input)
|
|
|
|
//{
|
|
|
|
|
|
|
|
|
|
|
|
// var jobDetailInputdetail = input.Details.FirstOrDefault();
|
|
|
|
|
|
|
|
// var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode)
|
|
|
|
// .ConfigureAwait(false);
|
|
|
|
|
|
|
|
// if (loctionDto.Type == EnumLocationType.DimensionalStorehouse)
|
|
|
|
// {
|
|
|
|
// input.JobStatus = EnumJobStatus.Wait;
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
/// <summary>
|
|
|
|
/// 判断是不是在立体库
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task<bool> CheckDimensionalStorehouseAsync(AssembleIssueJobEditInput input) |
|
|
|
{ |
|
|
|
var jobDetailInputdetail = input.Details.FirstOrDefault(); |
|
|
|
|
|
|
|
var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode) |
|
|
@ -667,6 +775,11 @@ public class AssembleIssueJobAppService |
|
|
|
if (loctionDto.Type == EnumLocationType.DimensionalStorehouse) |
|
|
|
{ |
|
|
|
input.JobStatus = EnumJobStatus.Wait; |
|
|
|
return true; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|