fix: paginate dropship pallet print details
This commit is contained in:
+38
@@ -18,6 +18,7 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -108,6 +109,43 @@ class InboundCartonLabelPrintServiceTest {
|
||||
assertThat(response.getBody()).containsExactly(4, 5, 6);
|
||||
}
|
||||
|
||||
@Test
|
||||
void splitsLargeDropshipPalletDetailsAcrossPrintableA4Pages() {
|
||||
Pallet pallet = dropshipPallet("OPEN");
|
||||
stubPalletFacts(90001L);
|
||||
List<DropshipPalletizationMapper.PrintSkuRow> skuRows = new ArrayList<>();
|
||||
for (int index = 1; index <= 35; index++) {
|
||||
DropshipPalletizationMapper.PrintSkuRow row = new DropshipPalletizationMapper.PrintSkuRow();
|
||||
row.setSkuCode("SKU-" + index);
|
||||
row.setCartonCount(1);
|
||||
row.setItemQuantity(index);
|
||||
row.setMinUnitsPerCarton(index);
|
||||
row.setMaxUnitsPerCarton(index);
|
||||
skuRows.add(row);
|
||||
}
|
||||
when(palletization.printSkuRows(90001L)).thenReturn(skuRows);
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_PDF);
|
||||
when(print.generateDropshipPalletA4Documents(org.mockito.ArgumentMatchers.anyString(),
|
||||
org.mockito.ArgumentMatchers.eq("request-large"), org.mockito.ArgumentMatchers.any()))
|
||||
.thenReturn(new ResponseEntity<>(new byte[] {1}, headers,
|
||||
org.springframework.http.HttpStatus.OK));
|
||||
|
||||
service.generateDropshipPallet(pallet, "PCHK2608040174", "request-large");
|
||||
|
||||
ArgumentCaptor<PrintPdfClient.DropshipPalletA4PdfRequest> request =
|
||||
ArgumentCaptor.forClass(PrintPdfClient.DropshipPalletA4PdfRequest.class);
|
||||
verify(print).generateDropshipPalletA4Documents(org.mockito.ArgumentMatchers.eq("internal-token"),
|
||||
org.mockito.ArgumentMatchers.eq("request-large"), request.capture());
|
||||
assertThat(request.getValue().documents()).hasSize(2).allSatisfy(document -> {
|
||||
assertThat(document.palletNo()).isEqualTo("DP-260911-0001");
|
||||
assertThat(document.inboundRows()).isNotEmpty().hasSizeLessThanOrEqualTo(10);
|
||||
assertThat(document.skuRows()).hasSizeLessThanOrEqualTo(34);
|
||||
});
|
||||
assertThat(request.getValue().documents().get(0).skuRows()).hasSize(34);
|
||||
assertThat(request.getValue().documents().get(1).skuRows()).hasSize(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
void forwardsStableLabelsWithoutSkuAndOnlySafePdfHeaders() throws Exception {
|
||||
when(labels.list(10001L, 70001L, List.of(1))).thenReturn(batch());
|
||||
|
||||
Reference in New Issue
Block a user