fix(print): remove SKU from carton labels while retaining dropship A4 details
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
- 本模块是无数据库的无状态 PDF 渲染服务;调用方传入完整 `labels[]` 或 `documents[]`,模块在内存中生成一次性多页 PDF 并同步返回。
|
||||
- 不保存模板、任务、历史或文件,不连接数据库、File 服务或打印机,不反查或修正业务数据。
|
||||
- `INBOUND_MARK_V1` 箱唛不接收或展示 SKU(包括一件代发箱唛),二维码仅编码稳定箱码;SKU 明细由一件代发 A4 托盘信息单展示,不能重新加入箱唛版面。
|
||||
- 当前支持 `INBOUND_MARK_V1`(100×100 mm)、`FBA_PALLET_A4_LANDSCAPE_V1`(297×210 mm),以及纵向 A4 的 `DROPSHIP_PALLET_A4_V2`、`SEA_FREIGHT_SHIPPING_INSTRUCTION_A4_V1`、`BILL_OF_LADING_CONFIRMATION_A4_V1`、`DISPATCH_BILL_OF_LADING_A4_V2`。FBA 模板由国内和海外统一使用,每托一页,只展示 SCK8 等 FBA 仓码、完整托盘号的 Code 128 条码和完整托盘号;141 等内部编号保留在托盘号中。一件代发每托一页,展示托盘 Code 128、目的仓、最多 10 行入仓码/客户昵称和最多 34 行 SKU,不展示状态、重量或体积。新尺寸或布局必须使用新模板编码。
|
||||
|
||||
## 快速索引
|
||||
|
||||
@@ -38,6 +38,8 @@ Firstleg 从冻结标签的 `destinationWarehouseCode/palletCode` 映射;海
|
||||
|
||||
### 2.1 入仓标签
|
||||
|
||||
所有头程箱唛(包括一件代发订单的箱唛)均不打印 SKU,标签请求不包含 `skuCode`。箱内 SKU 快照由业务服务保留用于清点、组托;一件代发 A4 托盘信息单继续展示 SKU 明细。二维码只使用稳定箱码。
|
||||
|
||||
```http
|
||||
POST /internal/print/v1/pdfs/inbound-marks HTTP/1.1
|
||||
Content-Type: application/json
|
||||
|
||||
@@ -26,12 +26,7 @@ public final class InboundMarkPdfDtos {
|
||||
String warehouseText,
|
||||
String cartonText,
|
||||
String routeText,
|
||||
String qrContent,
|
||||
String skuCode
|
||||
String qrContent
|
||||
) {
|
||||
public Label(String topCode, String warehouseText, String cartonText,
|
||||
String routeText, String qrContent) {
|
||||
this(topCode, warehouseText, cartonText, routeText, qrContent, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,9 +41,6 @@ public class InboundMarkV1Renderer {
|
||||
drawCenteredText(stream, units, font, label.warehouseText(), 36, 26);
|
||||
drawCenteredText(stream, units, font, label.cartonText(), 22, 37);
|
||||
drawCenteredText(stream, units, font, label.routeText(), 21, 47);
|
||||
if (label.skuCode() != null) {
|
||||
drawCenteredText(stream, units, font, "SKU: " + label.skuCode(), 14, 55);
|
||||
}
|
||||
qrRenderer.draw(stream, qrMatrix, QR_LEFT_PT, QR_BOTTOM_PT, QR_SIZE_PT);
|
||||
drawCenteredText(stream, units, font, label.qrContent(), 12, 85.5);
|
||||
drawCenteredText(stream, units, font, "MADE IN CHINA", 14, 92);
|
||||
|
||||
@@ -110,8 +110,7 @@ public class InboundMarkPdfService {
|
||||
normalizeRequired(label.warehouseText(), field(index, "warehouseText")),
|
||||
normalizeRequired(label.cartonText(), field(index, "cartonText")),
|
||||
normalizeRequired(label.routeText(), field(index, "routeText")),
|
||||
normalizeQr(label.qrContent(), field(index, "qrContent")),
|
||||
normalizeOptional(label.skuCode(), field(index, "skuCode"))));
|
||||
normalizeQr(label.qrContent(), field(index, "qrContent"))));
|
||||
}
|
||||
return new NormalizedRequest(normalizeFileName(request.downloadFileName()), List.copyOf(labels));
|
||||
}
|
||||
@@ -166,14 +165,6 @@ public class InboundMarkPdfService {
|
||||
return normalized;
|
||||
}
|
||||
|
||||
private String normalizeOptional(String value, String field) {
|
||||
if (value == null || value.isBlank()) return null;
|
||||
String normalized = Normalizer.normalize(value.trim(), Normalizer.Form.NFC);
|
||||
if (normalized.codePointCount(0, normalized.length()) > 64) invalid(field + " must not exceed 64 characters");
|
||||
normalized.codePoints().forEach(codePoint -> { if (isForbiddenControl(codePoint)) invalid(field + " contains a control character"); });
|
||||
return normalized;
|
||||
}
|
||||
|
||||
private boolean isForbiddenControl(int codePoint) {
|
||||
int type = Character.getType(codePoint);
|
||||
return Character.isISOControl(codePoint)
|
||||
|
||||
@@ -229,6 +229,7 @@ components:
|
||||
enum: [100]
|
||||
InboundMarkLabel:
|
||||
type: object
|
||||
description: 箱唛仅展示入仓码、仓库、箱序、线路、稳定箱码二维码及产地,不包含 SKU;SKU 明细由一件代发 A4 托盘信息单展示。
|
||||
required: [topCode, warehouseText, cartonText, routeText, qrContent]
|
||||
properties:
|
||||
topCode:
|
||||
@@ -244,11 +245,6 @@ components:
|
||||
minLength: 1
|
||||
maxLength: 34
|
||||
pattern: '^[\\x20-\\x7E]+$'
|
||||
skuCode:
|
||||
type: string
|
||||
maxLength: 64
|
||||
nullable: true
|
||||
description: 一件代发箱唛显示的 SKU;二维码仍只使用 qrContent 稳定箱码
|
||||
FreightA4PdfRequest:
|
||||
type: object
|
||||
required: [templateCode, pageSpec, documents]
|
||||
|
||||
+2
-1
@@ -50,7 +50,8 @@ class InboundMarkPdfServiceGenerationTest {
|
||||
stripper.setEndPage(1);
|
||||
assertThat(stripper.getText(document))
|
||||
.contains("PCHK2608040174", "MCC1", "CTNS:2-1", "洛杉矶普船海卡",
|
||||
"PCHK2608040174#2-1", "MADE IN CHINA");
|
||||
"PCHK2608040174#2-1", "MADE IN CHINA")
|
||||
.doesNotContain("SKU");
|
||||
stripper.setStartPage(2);
|
||||
stripper.setEndPage(2);
|
||||
assertThat(stripper.getText(document)).contains("CTNS:2-2", "PCHK2608040174#2-2");
|
||||
|
||||
Reference in New Issue
Block a user