贴标申请,仓储转运

This commit is contained in:
2026-09-17 17:37:29 +08:00
parent 3b8b6f5aa2
commit 29f05b7b09
106 changed files with 5019 additions and 471 deletions
@@ -59,6 +59,26 @@ class PalletLabelPrintServiceTest {
verify(print, never()).generateInboundMarks(any(), any(), any());
}
@Test
void transferLabelIncludesTransferNumberAndMakesAnUnknownDestinationExplicit() {
pallet.setPalletCode("ABCD1234567-ABE3-003");
pallet.setFbaWarehouseCode(null);
byte[] pdf = "%PDF-transfer-label".getBytes(java.nio.charset.StandardCharsets.US_ASCII);
when(print.generateInboundMarks(anyString(), anyString(), any()))
.thenReturn(ResponseEntity.ok().contentType(MediaType.APPLICATION_PDF).body(pdf));
service.printTransfer(200L, 9L, "WTR-20260916-1", "request-transfer");
var request = ArgumentCaptor.forClass(PrintPdfClient.Request.class);
verify(print).generateInboundMarks(eq("test-token"), eq("request-transfer"), request.capture());
assertThat(request.getValue().labels()).singleElement().satisfies(label -> {
assertThat(label.topCode()).isEqualTo("ABCD1234567-ABE3-003");
assertThat(label.cartonText()).isEqualTo("转运单 WTR-20260916-1");
assertThat(label.warehouseText()).isEqualTo("目的仓待定");
assertThat(label.routeText()).isEqualTo("洛杉矶仓");
});
}
@Test
void refusesWrongWarehouseBeforeCallingPrint() {
when(resources.pallet(0L, 201L, 9L)).thenThrow(new BizException(ResultCode.NOT_FOUND, "托盘不存在"));
@@ -262,7 +262,8 @@ class WarehouseResourceServiceTest {
ArgumentCaptor<WarehousePalletEntity> captor = ArgumentCaptor.forClass(WarehousePalletEntity.class);
verify(repository).insertPallet(captor.capture());
assertThat(captor.getValue().getPalletCode()).matches("PLT-US-LAX-01-[0-9]{8}-[0-9]+");
assertThat(captor.getValue().getPalletCode()).matches("PLT-USLAX01-[0-9]{6}-[0-9A-Z]+");
assertThat(captor.getValue().getPalletCode()).hasSizeLessThanOrEqualTo(34);
assertThat(captor.getValue().getLocationId()).isEqualTo(30003L);
assertThat(captor.getValue().getId()).isNotNull();
}
@@ -283,7 +284,7 @@ class WarehouseResourceServiceTest {
ArgumentCaptor<WarehousePalletEntity> captor = ArgumentCaptor.forClass(WarehousePalletEntity.class);
verify(repository).insertPallet(captor.capture());
assertThat(captor.getValue().getPalletCode()).hasSizeLessThanOrEqualTo(64);
assertThat(captor.getValue().getPalletCode()).hasSizeLessThanOrEqualTo(34);
}
@Test