|
|
@ -99,23 +99,23 @@ public class CoatingIssueJobAppService |
|
|
|
[HttpPost("invalid")] |
|
|
|
public override async Task CancelAsync(Guid id) |
|
|
|
{ |
|
|
|
var kittingJob = await _repository.GetAsync(id).ConfigureAwait(false); |
|
|
|
if (kittingJob == null) |
|
|
|
var coatingJob = await _repository.GetAsync(id).ConfigureAwait(false); |
|
|
|
if (coatingJob == null) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"未找到ID为 {id} 的任务"); |
|
|
|
} |
|
|
|
|
|
|
|
if (kittingJob.JobStatus == EnumJobStatus.Open || kittingJob.JobStatus == EnumJobStatus.Partial || |
|
|
|
kittingJob.JobStatus == EnumJobStatus.Wait) |
|
|
|
if (coatingJob.JobStatus == EnumJobStatus.Open || coatingJob.JobStatus == EnumJobStatus.Partial || |
|
|
|
coatingJob.JobStatus == EnumJobStatus.Wait) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"任务状态不是{kittingJob.JobStatus == EnumJobStatus.Open}、" + |
|
|
|
$"{kittingJob.JobStatus == EnumJobStatus.Partial}、" + |
|
|
|
$"{kittingJob.JobStatus == EnumJobStatus.Wait}"); |
|
|
|
throw new UserFriendlyException($"任务状态不是{coatingJob.JobStatus == EnumJobStatus.Open}、" + |
|
|
|
$"{coatingJob.JobStatus == EnumJobStatus.Partial}、" + |
|
|
|
$"{coatingJob.JobStatus == EnumJobStatus.Wait}"); |
|
|
|
} |
|
|
|
|
|
|
|
await _expectOutAppService.RemoveByNumberAsync(kittingJob.Number).ConfigureAwait(false); |
|
|
|
kittingJob.JobStatus = EnumJobStatus.Cancelled; |
|
|
|
await _repository.UpdateAsync(kittingJob).ConfigureAwait(false); |
|
|
|
await _expectOutAppService.RemoveByNumberAsync(coatingJob.Number).ConfigureAwait(false); |
|
|
|
coatingJob.JobStatus = EnumJobStatus.Cancelled; |
|
|
|
await _repository.UpdateAsync(coatingJob).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost("cancel-by-request/{requestNumber}")] |
|
|
|