This commit is contained in:
2026-09-09 12:02:12 +08:00
parent 9d492cb5ed
commit c3ae15abfe
19 changed files with 325 additions and 13 deletions
@@ -212,6 +212,28 @@ class RelabelApplicationServiceTest {
assertEquals(2, created.getValue().getPackageCount());
}
@Test
void createAllowsDifferentCartonMarksToUseTheSameApproximateInventoryPosition() {
RelabelRequests.Item first = carton("SKU-A", "BOX-1", "FBA-1", "ONT8");
RelabelRequests.Item second = carton("SKU-B", "BOX-2", "FBA-2", "ONT8");
RelabelRequests.Create request = new RelabelRequests.Create("CUSTOMER-1", "WH-1",
LocalDateTime.of(2026, 9, 10, 10, 0), "Li", "13800000000", BigDecimal.ONE,
null, "key-same-position", List.of(first, second));
RelabelApplication persisted = application(11L, "FBR-1", "10001", "key-same-position", null,
RelabelApplicationService.PENDING_PROCESSING);
persisted.setLastlegOrderId(21L);
when(applications.findNo(eq("10001"), any())).thenReturn(persisted);
when(items.selectList(any())).thenReturn(List.of(item(31L, 11L, "SKU-A", 1, 1)));
when(histories.selectList(any())).thenReturn(List.of());
when(orders.selectById(21L)).thenReturn(order(21L, "10001", "LMO-RELABEL-1",
RelabelApplicationService.PENDING_PROCESSING));
service.create("10001", "operator-1", request);
verify(inventoryCommands, times(2)).hold(eq("10001"), eq("operator-1"), any());
verify(items, times(2)).insert(any(RelabelItem.class));
}
@Test
void createRejectsCartonWithoutDetailOrDefaultDestinationWarehouse() {
RelabelRequests.Create request = new RelabelRequests.Create("CUSTOMER-1", null,