This commit is contained in:
2026-09-18 09:59:07 +08:00
parent 13a8dde0a5
commit 4f59f7bd28
45 changed files with 358 additions and 157 deletions
@@ -280,6 +280,23 @@ class InventoryCommandServiceTest {
verify(balances, never()).updateById(any(InventoryBalance.class));
}
@Test
void holdsAllAvailablePositionsForOneInboundOrder() {
InventoryBalance balance = balance(200L, 5);
InventoryPosition position = position(201L, 200L, 5);
when(commands.lockInboundAvailablePositions("100", 101L)).thenReturn(List.of(position));
when(commands.lockPosition("100", 201L)).thenReturn(position);
when(commands.lockBalance("100", 200L)).thenReturn(balance);
service.holdInboundOrderInventory("100", "7", 101L, "ORD-1", "质检暂扣");
assertEquals(0L, position.getAvailablePackages());
assertEquals(5L, position.getHoldPackages());
assertEquals(0L, balance.getAvailablePackages());
assertEquals(5L, balance.getHoldPackages());
verify(ledgers).insert(any(InventoryLedger.class));
}
@Test
void replayUsesPersistedResultWithoutMutatingInventoryAgain() throws Exception {
var request = stockIn("IN-1", "stock-in-1", 12, 24);