This commit is contained in:
2026-09-02 15:42:22 +08:00
parent 2902ab6077
commit ecf4eb1211
6 changed files with 12 additions and 3 deletions
@@ -101,6 +101,7 @@ class PdaPalletOperationServiceTest {
@Test void inventoryLedgerStoresStateSemanticsInsteadOfLongPalletCodes() {
InventoryBalance balance = new InventoryBalance(); balance.setId(200L); balance.setCustomerId("100");
balance.setCustomerName("Customer 100");
balance.setOverseasWarehouseId("88"); balance.setInboundOrderId(300L); balance.setInboundCode("IN-1");
InventoryPosition position = new InventoryPosition(); position.setId(100L); position.setPalletId(20L);
position.setPalletNo("PDAOPS-ADMIN-API-20260825095854036-SWAP-TARGET");
@@ -115,6 +116,7 @@ class PdaPalletOperationServiceTest {
ArgumentCaptor<InventoryLedger> ledger = ArgumentCaptor.forClass(InventoryLedger.class);
verify(ledgers).insert(ledger.capture());
assertEquals("Customer 100", ledger.getValue().getCustomerName());
assertEquals("OCCUPIED", ledger.getValue().getStatusFrom());
assertEquals("OCCUPIED", ledger.getValue().getStatusTo());
assertEquals("PDAOPS-LONG-LOCATION-CODE", ledger.getValue().getWarehouseLocationCode());
@@ -71,6 +71,7 @@ class PdaInventoryMoveServiceTest {
position.setPickedPackages(0L); position.setReceivingPackages(0L); position.setVersion(4L);
when(moves.lockPositions("900", 30L)).thenReturn(List.of(position));
InventoryBalance balance = new InventoryBalance(); balance.setId(10L); balance.setCustomerId("100");
balance.setCustomerName("Customer 100");
balance.setOverseasWarehouseId("900"); balance.setInboundOrderId(50L); balance.setInboundCode("IN-1");
when(balances.selectById(10L)).thenReturn(balance);
when(physical.apply(eq(900L), any(PalletPhysicalGateway.PalletReference.class), eq("OCCUPIED"),
@@ -91,6 +92,7 @@ class PdaInventoryMoveServiceTest {
assertThat(response.status()).isEqualTo("COMPLETED");
ArgumentCaptor<InventoryLedger> ledger = ArgumentCaptor.forClass(InventoryLedger.class);
verify(ledgers).insert(ledger.capture());
assertThat(ledger.getValue().getCustomerName()).isEqualTo("Customer 100");
assertThat(ledger.getValue().getStatusFrom()).isEqualTo("OCCUPIED");
assertThat(ledger.getValue().getStatusTo()).isEqualTo("OCCUPIED");
assertThat(ledger.getValue().getWarehouseLocationCode()).isEqualTo(targetLocationCode);
@@ -123,6 +123,7 @@ class PdaStocktakeServiceTest {
position.setAllocatedPackages(0L); position.setPickedPackages(0L); position.setReceivingPackages(0L);
position.setVersion(3L);
InventoryBalance balance = new InventoryBalance(); balance.setId(10L); balance.setCustomerId("100");
balance.setCustomerName("Customer 100");
balance.setOverseasWarehouseId("900"); balance.setAvailablePackages(5L); balance.setVersion(8L);
when(inventory.lockPosition(11L, "100", "900")).thenReturn(position);
when(inventory.lockBalance(10L, "100", "900")).thenReturn(balance);
@@ -141,6 +142,7 @@ class PdaStocktakeServiceTest {
assertThat(ledger.getValue().getDeltaPackages()).isEqualTo(2L);
assertThat(ledger.getValue().getAfterPackages()).isEqualTo(7L);
assertThat(ledger.getValue().getBusinessType()).isEqualTo("STOCKTAKE_ADJUST");
assertThat(ledger.getValue().getCustomerName()).isEqualTo("Customer 100");
assertThat(response.task().status()).isEqualTo("SUBMITTED");
}
}