Browse Source

添加任务执行操作

Agv分支2024-11-19
赵新宇 6 months ago
parent
commit
bbd355442a
  1. 87
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAppService.cs
  2. 76
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/InjectionIssueJobs/InjectionIssueJobAppService.cs
  3. 74
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobAppService.cs
  4. 71
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/SparePartIssueJobs/SparePartIssueJobAppService.cs

87
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/CoatingIssueJobs/CoatingIssueJobAppService.cs

@ -298,6 +298,91 @@ public class CoatingIssueJobAppService
await CancelAcceptAsync(masterId).ConfigureAwait(false); 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>
/// 完成任务 /// 完成任务
/// </summary> /// </summary>
@ -898,7 +983,7 @@ public class CoatingIssueJobAppService
details.Add(dto); 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) if (errors.Count > 0)

76
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/InjectionIssueJobs/InjectionIssueJobAppService.cs

@ -280,6 +280,80 @@ public class InjectionIssueJobAppService
await CancelAcceptAsync(masterId).ConfigureAwait(false); await CancelAcceptAsync(masterId).ConfigureAwait(false);
} }
/// <summary>
/// 执行任务明细
/// </summary>
/// <returns></returns>
[HttpPost("ExecuteDetail/{masterId}")]
public async Task ExecuteDetailExtAsync(Guid masterId, Guid detailId, InjectionIssueJobDetailDTO issueJobDetailDto)
{
var injectionIssueJob = await _repository.GetAsync(masterId).ConfigureAwait(false);
injectionIssueJob.JobStatus = EnumJobStatus.Doing;
if (injectionIssueJob.IsClaims)
{
if (injectionIssueJob.ClaimsUserId != _currentUser.Id.ToString())
{
throw new UserFriendlyException($"该任务已被【{injectionIssueJob.ClaimsUserName}】承接");
}
}
else
{
throw new UserFriendlyException("该任务未被承接,请重新刷新页面,承接任务");
}
var injectionIssueJobDto = ObjectMapper.Map<InjectionIssueJob, InjectionIssueJobDTO>(injectionIssueJob);
injectionIssueJobDto.Details = new List<InjectionIssueJobDetailDTO> { issueJobDetailDto };
var injectionIssueNoteEditInput = await BuildInjectionIssueNoteAsync(injectionIssueJobDto).ConfigureAwait(false);
await _injectionIssueNoteAppService.CreateAsync(injectionIssueNoteEditInput).ConfigureAwait(false);
var issueJobDetail = ObjectMapper.Map<InjectionIssueJobDetailDTO, InjectionIssueJobDetail>(issueJobDetailDto);
var entityDetail = injectionIssueJob.Details.Find(p => p.Id == detailId);
issueJobDetail.HandledFromQty = entityDetail.HandledFromQty;
issueJobDetail.HandledToQty = entityDetail.HandledToQty;
issueJobDetail.HandledToQty += issueJobDetailDto.HandledToQty;
issueJobDetail.HandledFromQty += issueJobDetailDto.HandledFromQty;
injectionIssueJob.Details = new EditableList<InjectionIssueJobDetail> { issueJobDetail };
injectionIssueJob.CompleteUserId = _currentUser.Id;
injectionIssueJob.CompleteUserName = _currentUser.Name;
injectionIssueJob.CompleteTime = DateTime.Now;
if (injectionIssueJob.EnumIssueSendType == EnumIssueSendType.BoxQtyType) //按箱叫料 因为任务只有1箱 所以可以直接完成
{
if (issueJobDetailDto.RecommendToPackingCode != issueJobDetailDto.HandledToPackingCode)
{
await CheckPackingCodeIsUserAsync(issueJobDetailDto.HandledToPackingCode, injectionIssueJob.Number).ConfigureAwait(false);
}
await UpdateRequestAndjobStatusDoneAsync(injectionIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty)
.ConfigureAwait(false);
await _expectOutAppService.RemoveByNumberAsync(injectionIssueJob.Number).ConfigureAwait(false);
}
else
{
var detail = injectionIssueJob.Details.First(p => p.Id == issueJobDetailDto.Id);
if (issueJobDetail.HandledToQty >= detail.RequestQty)
{
await UpdateRequestAndjobStatusDoneAsync(injectionIssueJob, issueJobDetailDto,
issueJobDetailDto.HandledToQty).ConfigureAwait(false);
}
else
{
await RemoveExpectOutAsync(injectionIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty)
.ConfigureAwait(false);
}
}
await _repository.UpdateAsync(injectionIssueJob).ConfigureAwait(false);
await CancelAcceptAsync(masterId).ConfigureAwait(false);
}
/// <summary> /// <summary>
/// 完成任务 /// 完成任务
/// </summary> /// </summary>
@ -850,7 +924,7 @@ public class InjectionIssueJobAppService
details.Add(dto); 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) if (errors.Count > 0)

74
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobAppService.cs

@ -288,6 +288,78 @@ public class KittingIssueJobAppService
await CancelAcceptAsync(masterId).ConfigureAwait(false); await CancelAcceptAsync(masterId).ConfigureAwait(false);
} }
/// <summary>
/// 执行任务明细
/// </summary>
/// <returns></returns>
[HttpPost("ExecuteDetail/{masterId}")]
public async Task ExecuteDetailExtAsync(Guid masterId, Guid detailId, KittingIssueJobDetailDTO issueJobDetailDto)
{
var kittingIssueJob = await _repository.GetAsync(masterId).ConfigureAwait(false);
kittingIssueJob.JobStatus = EnumJobStatus.Doing;
if (kittingIssueJob.IsClaims)
{
if (kittingIssueJob.ClaimsUserId != _currentUser.Id.ToString())
{
throw new UserFriendlyException($"该任务已被【{kittingIssueJob.ClaimsUserName}】承接");
}
}
else
{
throw new UserFriendlyException("该任务未被承接,请重新刷新页面,承接任务");
}
var kittingIssueJobDto = ObjectMapper.Map<KittingIssueJob, KittingIssueJobDTO>(kittingIssueJob);
kittingIssueJobDto.Details = new List<KittingIssueJobDetailDTO> { issueJobDetailDto };
var kittingIssueNoteEditInput = await BuildKittingIssueNoteAsync(kittingIssueJobDto).ConfigureAwait(false);
await _kittingIssueNoteAppService.CreateAsync(kittingIssueNoteEditInput).ConfigureAwait(false);
var issueJobDetail = ObjectMapper.Map<KittingIssueJobDetailDTO, KittingIssueJobDetail>(issueJobDetailDto);
var entityDetail = kittingIssueJob.Details.Find(p => p.Id == detailId);
issueJobDetail.HandledFromQty = entityDetail.HandledFromQty;
issueJobDetail.HandledToQty = entityDetail.HandledToQty;
issueJobDetail.HandledToQty += issueJobDetailDto.HandledToQty;
issueJobDetail.HandledFromQty += issueJobDetailDto.HandledFromQty;
kittingIssueJob.Details = new EditableList<KittingIssueJobDetail> { issueJobDetail };
kittingIssueJob.CompleteUserId = _currentUser.Id;
kittingIssueJob.CompleteUserName = _currentUser.Name;
kittingIssueJob.CompleteTime = DateTime.Now;
if (kittingIssueJob.EnumIssueSendType == EnumIssueSendType.BoxQtyType) //按箱叫料 因为任务只有1箱 所以可以直接完成
{
if (issueJobDetailDto.RecommendToPackingCode != issueJobDetailDto.HandledToPackingCode)
{
await CheckPackingCodeIsUserAsync(issueJobDetailDto.HandledToPackingCode, kittingIssueJob.Number).ConfigureAwait(false);
}
await UpdateRequestAndjobStatusDoneAsync(kittingIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty)
.ConfigureAwait(false);
await _expectOutAppService.RemoveByNumberAsync(kittingIssueJob.Number).ConfigureAwait(false);
}
else
{
var detail = kittingIssueJob.Details.First(p => p.Id == issueJobDetailDto.Id);
if (issueJobDetail.HandledToQty >= detail.RequestQty)
{
await UpdateRequestAndjobStatusDoneAsync(kittingIssueJob, issueJobDetailDto,
issueJobDetailDto.HandledToQty).ConfigureAwait(false);
}
else
{
await RemoveExpectOutAsync(kittingIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty)
.ConfigureAwait(false);
}
}
await _repository.UpdateAsync(kittingIssueJob).ConfigureAwait(false);
await CancelAcceptAsync(masterId).ConfigureAwait(false);
}
/// <summary> /// <summary>
/// 完成任务 /// 完成任务
/// </summary> /// </summary>
@ -859,7 +931,7 @@ public class KittingIssueJobAppService
details.Add(dto); 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) if (errors.Count > 0)

71
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/SparePartIssueJobs/SparePartIssueJobAppService.cs

@ -278,6 +278,75 @@ public class SparePartIssueJobAppService
await CancelAcceptAsync(masterId).ConfigureAwait(false); await CancelAcceptAsync(masterId).ConfigureAwait(false);
} }
/// <summary>
/// 执行任务明细
/// </summary>
/// <returns></returns>
[HttpPost("ExecuteDetail/{masterId}")]
public async Task ExecuteDetailExtAsync(Guid masterId, Guid detailId, SparePartIssueJobDetailDTO issueJobDetailDto)
{
var sparePartIssueJob = await _repository.GetAsync(masterId).ConfigureAwait(false);
sparePartIssueJob.JobStatus = EnumJobStatus.Doing;
if (sparePartIssueJob.IsClaims)
{
if (sparePartIssueJob.ClaimsUserId != _currentUser.Id.ToString())
{
throw new UserFriendlyException($"该任务已被【{sparePartIssueJob.ClaimsUserName}】承接");
}
}
else
{
throw new UserFriendlyException("该任务未被承接,请重新刷新页面,承接任务");
}
var sparePartIssueJobDto = ObjectMapper.Map<SparePartIssueJob, SparePartIssueJobDTO>(sparePartIssueJob);
sparePartIssueJobDto.Details = new List<SparePartIssueJobDetailDTO> { issueJobDetailDto };
var sparePartIssueNoteEditInput = await BuildSparePartIssueNoteAsync(sparePartIssueJobDto).ConfigureAwait(false);
await _sparePartIssueNoteAppService.CreateAsync(sparePartIssueNoteEditInput).ConfigureAwait(false);
var issueJobDetail = ObjectMapper.Map<SparePartIssueJobDetailDTO, SparePartIssueJobDetail>(issueJobDetailDto);
var entityDetail = sparePartIssueJob.Details.Find(p => p.Id == detailId);
issueJobDetail.HandledFromQty = entityDetail.HandledFromQty;
issueJobDetail.HandledToQty = entityDetail.HandledToQty;
issueJobDetail.HandledToQty += issueJobDetailDto.HandledToQty;
issueJobDetail.HandledFromQty += issueJobDetailDto.HandledFromQty;
sparePartIssueJob.Details = new EditableList<SparePartIssueJobDetail> { issueJobDetail };
sparePartIssueJob.CompleteUserId = _currentUser.Id;
sparePartIssueJob.CompleteUserName = _currentUser.Name;
sparePartIssueJob.CompleteTime = DateTime.Now;
if (sparePartIssueJob.EnumIssueSendType == EnumIssueSendType.BoxQtyType) //按箱叫料 因为任务只有1箱 所以可以直接完成
{
if (issueJobDetailDto.RecommendToPackingCode != issueJobDetailDto.HandledToPackingCode)
{
await CheckPackingCodeIsUserAsync(issueJobDetailDto.HandledToPackingCode, sparePartIssueJob.Number).ConfigureAwait(false);
}
await UpdateRequestAndjobStatusDoneAsync(sparePartIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty)
.ConfigureAwait(false);
await _expectOutAppService.RemoveByNumberAsync(sparePartIssueJob.Number).ConfigureAwait(false);
}
else
{
var detail = sparePartIssueJob.Details.First(p => p.Id == issueJobDetailDto.Id);
if (issueJobDetail.HandledToQty >= detail.RequestQty)
{
await UpdateRequestAndjobStatusDoneAsync(sparePartIssueJob, issueJobDetailDto,
issueJobDetailDto.HandledToQty).ConfigureAwait(false);
}
else
{
await RemoveExpectOutAsync(sparePartIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty)
.ConfigureAwait(false);
}
}
await _repository.UpdateAsync(sparePartIssueJob).ConfigureAwait(false);
await CancelAcceptAsync(masterId).ConfigureAwait(false);
}
/// <summary> /// <summary>
/// 完成任务 /// 完成任务
/// </summary> /// </summary>
@ -837,7 +906,7 @@ public class SparePartIssueJobAppService
details.Add(dto); 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) if (errors.Count > 0)

Loading…
Cancel
Save