fix(firstleg): allow corrective evidence after completion failure
This commit is contained in:
+3
-1
@@ -159,7 +159,9 @@ public class CabinetLoadingEvidenceService {
|
||||
if (assignment == null || !Objects.equals(assignment.getAssigneeId(), operatorId)) {
|
||||
throw new BizException(ResultCode.FORBIDDEN, "PDA任务未由当前操作人领取");
|
||||
}
|
||||
if (mutable && !"LOADING".equals(task.getTaskStatus())) throw conflict("PDA任务不在装柜作业中,证据不可修改");
|
||||
if (mutable && !Set.of("LOADING", "COMPLETION_FAILED").contains(task.getTaskStatus())) {
|
||||
throw conflict("PDA任务不在可补证状态,证据不可修改");
|
||||
}
|
||||
return new Scope(task, task.getContainerBookingId());
|
||||
}
|
||||
|
||||
|
||||
+17
@@ -81,6 +81,23 @@ class CabinetLoadingEvidenceServiceTest {
|
||||
verify(mapper).byContainer(99L);
|
||||
}
|
||||
|
||||
@Test
|
||||
void completionFailedTaskMayUploadCorrectiveEvidenceForSameRecoveryFlow() throws Exception {
|
||||
LoadingPickTaskEntity task = loadingPicks.task(20L);
|
||||
task.setTaskStatus("COMPLETION_FAILED");
|
||||
when(objectMapper.writeValueAsString(org.mockito.ArgumentMatchers.any())).thenReturn("request");
|
||||
var metadata = new LoadingEvidenceFileClient.FileMetadata(301L, "PLATFORM", 0L,
|
||||
"LOADING_PHOTO_STEP_1", "99", "photo.png", "image/png");
|
||||
when(files.validate(org.mockito.ArgumentMatchers.anyString(), org.mockito.ArgumentMatchers.eq(99L),
|
||||
org.mockito.ArgumentMatchers.eq("PHOTO_STEP_1"), org.mockito.ArgumentMatchers.eq(301L)))
|
||||
.thenReturn(com.baiyue.common.core.api.ApiResponse.success(metadata));
|
||||
|
||||
service.upsert(20L, "retry-photo-1", new com.baiyue.firstleg.dto.LoadingEvidenceDtos.UpsertRequest(
|
||||
8L, 0, "PHOTO_STEP_1", 301L, null, "corrective"), 9L, "operator");
|
||||
|
||||
verify(mapper).insert(org.mockito.ArgumentMatchers.any(CabinetLoadingEvidenceEntity.class));
|
||||
}
|
||||
|
||||
private static CabinetLoadingEvidenceEntity evidence(String type) {
|
||||
CabinetLoadingEvidenceEntity value = new CabinetLoadingEvidenceEntity();
|
||||
value.setEvidenceType(type); value.setStatus("ACTIVE"); value.setContainerBookingId(99L);
|
||||
|
||||
Reference in New Issue
Block a user