fix(print): remove SKU from carton labels while retaining dropship A4 details

This commit is contained in:
2026-09-20 11:22:29 +08:00
parent 78a36d1a39
commit bbf000a38a
11 changed files with 16 additions and 29 deletions
@@ -49,7 +49,7 @@ public interface PrintPdfClient {
}
record Label(String topCode, String warehouseText, String cartonText,
String routeText, String qrContent, String skuCode) {
String routeText, String qrContent) {
}
record FreightA4PdfRequest(String templateCode, PageSpec pageSpec,
@@ -200,7 +200,7 @@ public class InboundCartonLabelPrintService {
private PrintPdfClient.Label toPrintLabel(InboundCartonLabels.Label label) {
return new PrintPdfClient.Label(label.topCode(), label.warehouseText(), label.cartonText(),
label.routeText(), label.boxCode(), label.skuCode());
label.routeText(), label.boxCode());
}
private ResponseEntity<byte[]> requirePdf(ResponseEntity<byte[]> response) {
@@ -109,7 +109,7 @@ class InboundCartonLabelPrintServiceTest {
}
@Test
void forwardsStableLabelsAndOnlySafePdfHeaders() {
void forwardsStableLabelsWithoutSkuAndOnlySafePdfHeaders() throws Exception {
when(labels.list(10001L, 70001L, List.of(1))).thenReturn(batch());
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_PDF);
@@ -132,6 +132,9 @@ class InboundCartonLabelPrintServiceTest {
assertThat(label.qrContent()).isEqualTo("PCHK2608040174#19-1");
assertThat(label.cartonText()).isEqualTo("CTNS:19-1");
});
assertThat(batch().labels().get(0).skuCode()).isEqualTo("SKU-BOX-ONLY-IN-BUSINESS-DATA");
assertThat(new ObjectMapper().writeValueAsString(request.getValue()))
.doesNotContain("skuCode", "SKU-BOX-ONLY-IN-BUSINESS-DATA");
assertThat(response.getBody()).containsExactly(1, 2, 3);
assertThat(response.getHeaders().getFirst("X-Print-Page-Count")).isEqualTo("1");
assertThat(response.getHeaders()).doesNotContainKey("X-Internal-Service-Token");
@@ -229,6 +232,7 @@ class InboundCartonLabelPrintServiceTest {
InboundCartonLabels.Label label = new InboundCartonLabels.Label(
1L, 2L, 1, "音箱", 19, "PCHK2608040174#19-1", 19, 1,
"50x40x30cm", new BigDecimal("50"), new BigDecimal("40"), new BigDecimal("30"),
"SKU-BOX-ONLY-IN-BUSINESS-DATA",
"PCHK2608040174", "MCC1", "CTNS:19-1", "洛杉矶普船海卡");
return new InboundCartonLabels.Batch(70001L, 80001L, "PCHK2608040174", 19, List.of(label));
}