This commit is contained in:
2026-08-17 14:50:00 +08:00
parent a34b5d5ba0
commit 4abcb2b80f
6 changed files with 31 additions and 10 deletions
@@ -50,4 +50,17 @@ class LoadingPickPdaTaskSqlContractTest {
.contains("label.inbound_detail_id = plan_item.inbound_detail_id")
.contains("label.box_code AS boxCode");
}
@Test
void taskDetailResolvesOnlyTheActiveBookingOwnedByItsCurrentPlan() throws Exception {
String sql = LoadingPickTaskMapper.class
.getDeclaredMethod("selectActiveBookingByTask", long.class)
.getAnnotation(Select.class).value()[0];
assertThat(sql)
.contains("plan.id=task.loading_plan_id")
.contains("booking.id=plan.container_booking_id")
.contains("task.id=#{taskId}")
.contains("booking.record_status='ACTIVE'");
}
}
@@ -79,7 +79,7 @@ class LoadingPickServiceTest {
booking.setContainerNo("CSLU1234567");
booking.setSourceType("SIMULATION");
booking.setRecordStatus("ACTIVE");
when(smartLoadingRepository.booking(99L)).thenReturn(booking);
when(repository.activeBookingByTask(20L)).thenReturn(booking);
}
@Test
@@ -228,6 +228,7 @@ class LoadingPickServiceTest {
when(repository.taskByCabinet("CAB-001", 101L)).thenReturn(task);
when(repository.taskByPlan(10L, 101L)).thenReturn(task);
when(smartLoadingRepository.booking(40L)).thenReturn(booking);
when(repository.activeBookingByTask(20L)).thenReturn(booking);
when(repository.items(20L, 101L)).thenReturn(List.of());
when(repository.cartonLabels(20L)).thenReturn(List.of());
@@ -272,13 +273,8 @@ class LoadingPickServiceTest {
@Test
void taskDetailRejectsMergedContainerSource() {
LoadingPickTaskEntity task = task();
ContainerBookingEntity merged = new ContainerBookingEntity();
merged.setId(99L);
merged.setSourceType("OCEAN_BOOKING");
merged.setRecordStatus("MERGED");
merged.setMergedIntoContainerBookingId(88L);
when(repository.task(20L)).thenReturn(task);
when(smartLoadingRepository.booking(99L)).thenReturn(merged);
when(repository.activeBookingByTask(20L)).thenReturn(null);
when(repository.items(20L, 101L)).thenReturn(List.of());
when(repository.cartonLabels(20L)).thenReturn(List.of());