一件代发拣货
This commit is contained in:
@@ -26,7 +26,12 @@ public final class InboundMarkPdfDtos {
|
||||
String warehouseText,
|
||||
String cartonText,
|
||||
String routeText,
|
||||
String qrContent
|
||||
String qrContent,
|
||||
String skuCode
|
||||
) {
|
||||
public Label(String topCode, String warehouseText, String cartonText,
|
||||
String routeText, String qrContent) {
|
||||
this(topCode, warehouseText, cartonText, routeText, qrContent, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,9 @@ 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,7 +110,8 @@ 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"))));
|
||||
normalizeQr(label.qrContent(), field(index, "qrContent")),
|
||||
normalizeOptional(label.skuCode(), field(index, "skuCode"))));
|
||||
}
|
||||
return new NormalizedRequest(normalizeFileName(request.downloadFileName()), List.copyOf(labels));
|
||||
}
|
||||
@@ -165,6 +166,14 @@ 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)
|
||||
|
||||
@@ -160,6 +160,11 @@ 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]
|
||||
|
||||
Reference in New Issue
Block a user