fix(firstleg): use short cabinet pallet identities
This commit is contained in:
@@ -53,7 +53,7 @@ class ContainerServiceTest {
|
||||
@BeforeEach
|
||||
void setUpWarehouse() {
|
||||
when(documentNumbers.next("CB")).thenReturn("CB-260818-0001");
|
||||
when(documentNumbers.next("CAB")).thenReturn("CAB-260818-0001");
|
||||
when(documentNumbers.nextCabinetNo()).thenReturn("D0001");
|
||||
when(smartLoadingService.createForContainer(anyLong(), anyLong(), anyString())).thenAnswer(invocation ->
|
||||
new com.baiyue.firstleg.dto.SmartLoadingDtos.Plan(501L, "LP-260818-0001", "EDITING",
|
||||
invocation.getArgument(0, Long.class), null, null, 0, true, true, null,
|
||||
@@ -77,7 +77,7 @@ class ContainerServiceTest {
|
||||
ContainerBookingEntity saved = captor.getValue();
|
||||
assertThat(created).isSameAs(saved);
|
||||
assertThat(saved.getBookingNo()).isEqualTo("CB-260818-0001");
|
||||
assertThat(saved.getCabinetNo()).isEqualTo("CAB-260818-0001");
|
||||
assertThat(saved.getCabinetNo()).isEqualTo("D0001");
|
||||
assertThat(saved.getContainerNo()).isNull();
|
||||
assertThat(saved.getOceanBookingId()).isNull();
|
||||
assertThat(saved.getChannelGroupCode()).isEqualTo("MATSON_CLX");
|
||||
|
||||
+14
-2
@@ -42,11 +42,23 @@ class FirstlegDocumentNumberGeneratorTest {
|
||||
assertThat(generator.next("OB")).isEqualTo("OB-260818-0001");
|
||||
assertThat(generator.next("TA")).isEqualTo("TA-260818-0001");
|
||||
assertThat(generator.next("CB")).isEqualTo("CB-260818-0001");
|
||||
assertThat(generator.next("CAB")).isEqualTo("CAB-260818-0001");
|
||||
assertThat(generator.next("LP")).isEqualTo("LP-260818-0001");
|
||||
assertThat(generator.nextCabinetNo()).isEqualTo("D0001");
|
||||
|
||||
verify(jdbc).update(org.mockito.ArgumentMatchers.startsWith("INSERT INTO fl_document_sequence"),
|
||||
eq("OB:20260818"));
|
||||
verify(jdbc).update(org.mockito.ArgumentMatchers.startsWith("INSERT INTO fl_document_sequence"),
|
||||
eq("CABINET"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void cabinetSequenceDoesNotResetOrStopAtFourDigits() {
|
||||
JdbcTemplate jdbc = mock(JdbcTemplate.class);
|
||||
when(jdbc.queryForObject("SELECT LAST_INSERT_ID()", Long.class)).thenReturn(9_999L, 10_000L);
|
||||
FirstlegDocumentNumberGenerator generator = new FirstlegDocumentNumberGenerator(jdbc, CLOCK);
|
||||
|
||||
assertThat(generator.nextCabinetNo()).isEqualTo("D9999");
|
||||
assertThat(generator.nextCabinetNo()).isEqualTo("D10000");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -56,6 +68,6 @@ class FirstlegDocumentNumberGeneratorTest {
|
||||
assertThatThrownBy(() -> generator.next("MSCU")).isInstanceOf(IllegalArgumentException.class);
|
||||
|
||||
when(jdbc.queryForObject("SELECT LAST_INSERT_ID()", Long.class)).thenReturn(10_000L);
|
||||
assertThatThrownBy(() -> generator.next("CAB")).isInstanceOf(BizException.class);
|
||||
assertThatThrownBy(() -> generator.next("LP")).isInstanceOf(BizException.class);
|
||||
}
|
||||
}
|
||||
|
||||
+11
-8
@@ -22,9 +22,11 @@ class LoadingPalletLabelServiceTest {
|
||||
ReflectionTestUtils.setField(service, "printClient", print);
|
||||
ReflectionTestUtils.setField(service, "internalToken", "test-token");
|
||||
var label1 = new com.baiyue.firstleg.dto.LoadingListDtos.PalletLabel(1L, 1L, 1L, 1L,
|
||||
"IN-1", "MSCU6639870", "SCK8", "141", "FBA destination", 1, "MSCU6639870-141-001");
|
||||
"IN-1", "MSCU6639870", "SCK8", "141", "FBA destination", 1,
|
||||
"D0002-141-001");
|
||||
var label2 = new com.baiyue.firstleg.dto.LoadingListDtos.PalletLabel(2L, 1L, 1L, 1L,
|
||||
"IN-1", "MSCU6639870", "SCK8", "141", "FBA destination", 2, "MSCU6639870-141-002");
|
||||
"IN-1", "MSCU6639870", "SCK8", "141", "FBA destination", 2,
|
||||
"D0002-141-002");
|
||||
var manifest = new com.baiyue.firstleg.dto.LoadingListDtos.PalletLabelManifest(10L, "LP-1", "MSCU6639870", 2,
|
||||
List.of(new com.baiyue.firstleg.dto.LoadingListDtos.PalletLabelGroup("SCK8", "141", "FBA destination", 2, List.of(label1, label2))));
|
||||
org.mockito.Mockito.doReturn(manifest).when(service).prepare(10L, 20L);
|
||||
@@ -39,16 +41,16 @@ class LoadingPalletLabelServiceTest {
|
||||
assertThat(requests.get(0).pageSpec().widthMm()).isEqualByComparingTo("297");
|
||||
assertThat(requests.get(0).pageSpec().heightMm()).isEqualByComparingTo("210");
|
||||
assertThat(requests.get(0).labels()).extracting(com.baiyue.firstleg.client.PrintPdfClient.FbaPalletLabel::palletCode)
|
||||
.containsExactly("MSCU6639870-141-001", "MSCU6639870-141-002");
|
||||
.containsExactly("D0002-141-001", "D0002-141-002");
|
||||
assertThat(requests.get(1).labels()).singleElement().satisfies(label -> {
|
||||
assertThat(label.fbaWarehouseCode()).isEqualTo("SCK8");
|
||||
assertThat(label.palletCode()).isEqualTo("MSCU6639870-141-001");
|
||||
assertThat(label.palletCode()).isEqualTo("D0002-141-001");
|
||||
});
|
||||
org.mockito.Mockito.verify(print, org.mockito.Mockito.never()).generateInboundMarks(any(), any(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void generatesStableIndexesPerContainerAndFbaAndSkipsDropship() {
|
||||
void generatesStableIndexesPerCabinetAndFbaAndSkipsDropship() {
|
||||
LoadingPalletLabelMapper mapper = mock(LoadingPalletLabelMapper.class);
|
||||
LoadingPalletLabelService service = new LoadingPalletLabelService();
|
||||
ReflectionTestUtils.setField(service, "mapper", mapper);
|
||||
@@ -72,13 +74,14 @@ class LoadingPalletLabelServiceTest {
|
||||
assertThat(manifest.groups()).extracting(group -> group.destinationWarehouseInternalCode())
|
||||
.containsExactly("154", "CADF");
|
||||
assertThat(saved).extracting(LoadingPalletLabelMapper.LabelRow::getPalletCode)
|
||||
.containsExactly("MSCU6639870-154-001", "MSCU6639870-CADF-001",
|
||||
"MSCU6639870-CADF-002", "MSCU6639870-CADF-003");
|
||||
.containsExactly("D0002-154-001", "D0002-CADF-001",
|
||||
"D0002-CADF-002", "D0002-CADF-003");
|
||||
}
|
||||
|
||||
private LoadingPalletLabelMapper.SourceRow source(long itemId, String destination, int pallets, String fulfillment) {
|
||||
var row = new LoadingPalletLabelMapper.SourceRow(); row.setPlanId(10L); row.setPlanNo("LP-1");
|
||||
row.setPlanStatus("LOADING"); row.setContainerNo("MSCU6639870"); row.setWarehouseId(20L);
|
||||
row.setPlanStatus("LOADING"); row.setContainerNo("MSCU6639870"); row.setCabinetNo("D0002");
|
||||
row.setWarehouseId(20L);
|
||||
row.setItemId(itemId); row.setAccountId(100L); row.setInboundId(itemId + 1000);
|
||||
row.setInboundCode("RK-" + itemId); row.setDestinationWarehouseCode(destination);
|
||||
row.setDestinationWarehouseId("LAX9".equals(destination) ? 101L : 102L);
|
||||
|
||||
Reference in New Issue
Block a user