fix(overseas): preserve shared overflow locations during pallet moves
This commit is contained in:
+21
@@ -64,6 +64,27 @@ class WarehousePalletTransitionServiceTest {
|
||||
verify(mapper).transitionLocation(88L, locationId, "OCCUPIED", "IDLE");
|
||||
}
|
||||
|
||||
@Test void movingIntoAndOutOfSharedOverflowKeepsItActive() {
|
||||
WarehouseLocationEntity overflow = location(20L, "SHARED_OVERFLOW", "ACTIVE");
|
||||
overflow.setLocationCode("A0"); overflow.setSharedOverflow(true);
|
||||
WarehousePalletEntity pallet = pallet("P-1", "OCCUPIED", 4);
|
||||
when(mapper.lockPublicPallet(88L, 10L)).thenReturn(pallet);
|
||||
when(mapper.lockPublicLocation(88L, 11L)).thenReturn(location(11L, "STORAGE", "OCCUPIED"));
|
||||
when(mapper.lockPublicLocation(88L, 20L)).thenReturn(overflow);
|
||||
when(mapper.transitionLocation(88L, 11L, "OCCUPIED", "IDLE")).thenReturn(1);
|
||||
when(mapper.transition(88L, 10L, "OCCUPIED", 20L, 4)).thenReturn(1);
|
||||
service.apply(10L, new PalletTransitionRequests.Apply(88L, 4, "OCCUPIED", 20L, "into-overflow", "move"));
|
||||
|
||||
pallet.setLocationId(20L); pallet.setVersion(5);
|
||||
when(mapper.lockPublicLocation(88L, 11L)).thenReturn(location(11L, "STORAGE", "IDLE"));
|
||||
when(mapper.transitionLocation(88L, 11L, "IDLE", "OCCUPIED")).thenReturn(1);
|
||||
when(mapper.transition(88L, 10L, "OCCUPIED", 11L, 5)).thenReturn(1);
|
||||
service.apply(10L, new PalletTransitionRequests.Apply(88L, 5, "OCCUPIED", 11L, "out-of-overflow", "restore"));
|
||||
|
||||
verify(mapper, never()).transitionLocation(eq(88L), eq(20L), anyString(), anyString());
|
||||
assertEquals("ACTIVE", overflow.getStatus());
|
||||
}
|
||||
|
||||
@Test void exactReplayDoesNotMutatePhysicalPalletAgain() {
|
||||
WarehousePalletOperationEntity existing = operation();
|
||||
when(mapper.findOperation("operation-1")).thenReturn(existing);
|
||||
|
||||
Reference in New Issue
Block a user