fix(overseas): repair pallet transitions and transfer queries

This commit is contained in:
2026-09-29 14:18:20 +08:00
parent 875d2497f4
commit 8df0f4e823
11 changed files with 114 additions and 31 deletions
@@ -48,6 +48,22 @@ class WarehousePalletTransitionServiceTest {
assertEquals(4, captor.getValue().getBeforeVersion());
}
@Test void releasesOccupiedPalletAtSameLargeLocationId() {
long locationId = 2104611550538616833L;
when(mapper.lockPublicPallet(88L, 10L)).thenReturn(pallet("P-LARGE", "OCCUPIED", 4, locationId));
when(mapper.lockPublicLocation(88L, locationId)).thenReturn(location(locationId, "STORAGE", "OCCUPIED"));
when(mapper.transitionLocation(88L, locationId, "OCCUPIED", "IDLE")).thenReturn(1);
when(mapper.transition(88L, 10L, "IDLE", locationId, 4)).thenReturn(1);
var response = service.apply(10L, new PalletTransitionRequests.Apply(
88L, 4, "IDLE", locationId, "large-location-release", "swap"));
assertEquals("IDLE", response.afterStatus());
assertEquals(locationId, response.afterLocationId());
verify(mapper, times(1)).lockPublicLocation(88L, locationId);
verify(mapper).transitionLocation(88L, locationId, "OCCUPIED", "IDLE");
}
@Test void exactReplayDoesNotMutatePhysicalPalletAgain() {
WarehousePalletOperationEntity existing = operation();
when(mapper.findOperation("operation-1")).thenReturn(existing);