优化
This commit is contained in:
@@ -17,6 +17,7 @@ import com.baiyue.firstleg.entity.LoadingPickItemEntity;
|
||||
import com.baiyue.firstleg.entity.LoadingPickOperationEntity;
|
||||
import com.baiyue.firstleg.entity.LoadingPickTaskEntity;
|
||||
import com.baiyue.firstleg.entity.LoadingPlanItemEntity;
|
||||
import com.baiyue.firstleg.entity.ContainerBookingEntity;
|
||||
import com.baiyue.firstleg.entity.InboundStatusHistoryEntity;
|
||||
import com.baiyue.firstleg.loading.mapper.LoadingInboundMapper;
|
||||
import com.baiyue.firstleg.loading.bridge.dto.LoadingModelBridgeDtos.Link;
|
||||
@@ -30,6 +31,7 @@ import com.baiyue.firstleg.oceanbooking.entity.OceanBookingContainerAllocationEn
|
||||
import com.baiyue.firstleg.oceanbooking.entity.OceanBookingEntity;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.mockito.InOrder;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
@@ -70,6 +72,16 @@ class LoadingPickServiceTest {
|
||||
@Resource
|
||||
private LoadingPickService service;
|
||||
|
||||
@BeforeEach
|
||||
void activeOperationalContainer() {
|
||||
ContainerBookingEntity booking = new ContainerBookingEntity();
|
||||
booking.setId(99L);
|
||||
booking.setContainerNo("CSLU1234567");
|
||||
booking.setSourceType("SIMULATION");
|
||||
booking.setRecordStatus("ACTIVE");
|
||||
when(smartLoadingRepository.booking(99L)).thenReturn(booking);
|
||||
}
|
||||
|
||||
@Test
|
||||
void opensTaskOnlyAfterReleasedBookingAndRealContainerNumber() {
|
||||
var booking = new com.baiyue.firstleg.entity.ContainerBookingEntity();
|
||||
@@ -212,6 +224,7 @@ class LoadingPickServiceTest {
|
||||
task.setContainerBookingId(40L); task.setCabinetNo("CAB-001");
|
||||
var booking = new com.baiyue.firstleg.entity.ContainerBookingEntity();
|
||||
booking.setId(40L); booking.setContainerNo("MSCU-NEW");
|
||||
booking.setSourceType("SIMULATION"); booking.setRecordStatus("ACTIVE");
|
||||
when(repository.taskByCabinet("CAB-001", 101L)).thenReturn(task);
|
||||
when(repository.taskByPlan(10L, 101L)).thenReturn(task);
|
||||
when(smartLoadingRepository.booking(40L)).thenReturn(booking);
|
||||
@@ -224,6 +237,53 @@ class LoadingPickServiceTest {
|
||||
assertThat(byCabinet.id()).isEqualTo(20L);
|
||||
assertThat(byPlan.id()).isEqualTo(20L);
|
||||
assertThat(byCabinet.currentContainerNo()).isEqualTo("MSCU-NEW");
|
||||
assertThat(byCabinet.sourceType()).isEqualTo("SIMULATION");
|
||||
assertThat(byCabinet.recordStatus()).isEqualTo("ACTIVE");
|
||||
assertThat(byCabinet.mergedIntoContainerBookingId()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
void pendingTasksExposeServerFilteredContainerLifecycle() {
|
||||
var row = new com.baiyue.firstleg.mapper.LoadingPickTaskMapper.PendingTaskRow();
|
||||
row.setTaskId(20L);
|
||||
row.setLoadingPlanId(10L);
|
||||
row.setContainerBookingId(99L);
|
||||
row.setCabinetNo("CAB-001");
|
||||
row.setContainerNo("MSCU-001");
|
||||
row.setSourceType("SIMULATION");
|
||||
row.setRecordStatus("ACTIVE");
|
||||
row.setMergedIntoContainerBookingId(null);
|
||||
row.setWarehouseId(101L);
|
||||
row.setTaskStatus("LOADING");
|
||||
row.setWorkflowStatus("UNASSIGNED");
|
||||
row.setVersion(0);
|
||||
row.setAssignmentVersion(0);
|
||||
row.setItemCount(1);
|
||||
row.setPendingItemCount(1);
|
||||
when(repository.pendingTasks(9L, null)).thenReturn(List.of(row));
|
||||
|
||||
var result = service.pendingTasks(9L, null).get(0);
|
||||
|
||||
assertThat(result.sourceType()).isEqualTo("SIMULATION");
|
||||
assertThat(result.recordStatus()).isEqualTo("ACTIVE");
|
||||
assertThat(result.mergedIntoContainerBookingId()).isNull();
|
||||
}
|
||||
|
||||
@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.items(20L, 101L)).thenReturn(List.of());
|
||||
when(repository.cartonLabels(20L)).thenReturn(List.of());
|
||||
|
||||
assertThatThrownBy(() -> service.task(20L, 101L))
|
||||
.isInstanceOf(BizException.class).hasMessageContaining("已非有效存续记录");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -345,6 +405,9 @@ class LoadingPickServiceTest {
|
||||
assertThat(result.loadingVersion()).isEqualTo(7);
|
||||
assertThat(result.loadingPlanId()).isEqualTo(10L);
|
||||
assertThat(result.containerBookingId()).isEqualTo(99L);
|
||||
assertThat(result.sourceType()).isEqualTo("SIMULATION");
|
||||
assertThat(result.recordStatus()).isEqualTo("ACTIVE");
|
||||
assertThat(result.mergedIntoContainerBookingId()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user