fix: block receiving before pallet materialization
This commit is contained in:
+19
-1
@@ -85,6 +85,7 @@ class ReceivingContainerServiceBehaviorTest {
|
||||
ReflectionTestUtils.setField(service, "sourceObjectMapper", new ObjectMapper().findAndRegisterModules());
|
||||
service.initializeObjectMapper();
|
||||
org.mockito.Mockito.lenient().when(shippingGates.receivingAvailable(any(), any())).thenReturn(1);
|
||||
org.mockito.Mockito.lenient().when(pallets.selectCount(any())).thenReturn(1L);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -256,6 +257,23 @@ class ReceivingContainerServiceBehaviorTest {
|
||||
verify(plans).updateById(unassigned);
|
||||
}
|
||||
|
||||
@Test
|
||||
void prepareRejectsManualPlanBeforeRealPalletsAreMaterialized() {
|
||||
InboundPlan plan = plan("TSTU0195472");
|
||||
InboundPlanLine planLine = line("FBA");
|
||||
LastlegOrder order = containerOrder(1L, "100", "TSTU0195472", "BOOKING-472", "IN-472");
|
||||
when(plans.selectList(any())).thenReturn(List.of(plan));
|
||||
when(lines.selectList(any())).thenReturn(List.of(planLine));
|
||||
when(orders.selectList(any())).thenReturn(List.of(order));
|
||||
when(pallets.selectCount(any())).thenReturn(0L);
|
||||
|
||||
assertThatThrownBy(() -> service.prepare("7", "receiver", 100L, "TSTU0195472",
|
||||
new ReceivingContainerRequests.Action("missing-real-pallets")))
|
||||
.isInstanceOf(ResponseStatusException.class)
|
||||
.hasMessageContaining("尚未完整绑定真实托盘");
|
||||
verify(sessions, never()).insert(any(ReceivingContainerSession.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void candidatesHideContainersReservedByAnotherOperator() {
|
||||
InboundPlan available = plan("CONT-A");
|
||||
@@ -778,7 +796,7 @@ class ReceivingContainerServiceBehaviorTest {
|
||||
private static InboundPlan plan(String containerNo) {
|
||||
InboundPlan value = new InboundPlan();
|
||||
value.setId(2L); value.setPlanNo("PLAN-1"); value.setCustomerId("100"); value.setContainerNo(containerNo);
|
||||
value.setStatus("SIGNED"); value.setOverseasWarehouseId(100L);
|
||||
value.setStatus("SIGNED"); value.setOverseasWarehouseId(100L); value.setPalletCount(1);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user