diff --git a/firstleg/src/main/java/com/baiyue/firstleg/mapper/DropshipPalletizationMapper.java b/firstleg/src/main/java/com/baiyue/firstleg/mapper/DropshipPalletizationMapper.java index b4bdb608a..c3674d0a7 100644 --- a/firstleg/src/main/java/com/baiyue/firstleg/mapper/DropshipPalletizationMapper.java +++ b/firstleg/src/main/java/com/baiyue/firstleg/mapper/DropshipPalletizationMapper.java @@ -206,7 +206,11 @@ public interface DropshipPalletizationMapper { @Select(""" SELECT c.tenant_id,c.inbound_id,o.inbound_code, - COALESCE(NULLIF(o.destination_name,''),NULLIF(o.destination_code,''),'—') destination_warehouse, + CASE REPLACE(UPPER(COALESCE(o.destination_code,'')),'.','') + WHEN 'NJDF' THEN '纽约 NJDF' + WHEN 'CADF' THEN '洛杉矶 CADF' + ELSE REPLACE(COALESCE(NULLIF(o.destination_name,''),NULLIF(o.destination_code,''),'—'),'.','') + END destination_warehouse, COUNT(DISTINCT c.id) carton_count, SUM(COALESCE(q.item_quantity,c.actual_sku_quantity,0)) item_quantity FROM fl_dropship_pallet_carton c @@ -217,7 +221,11 @@ public interface DropshipPalletizationMapper { GROUP BY c.tenant_id,c.inbound_id,o.inbound_code,o.destination_name,o.destination_code UNION ALL SELECT p.tenant_id,p.inbound_id,o.inbound_code, - COALESCE(NULLIF(o.destination_name,''),NULLIF(o.destination_code,''),'—') destination_warehouse, + CASE REPLACE(UPPER(COALESCE(o.destination_code,'')),'.','') + WHEN 'NJDF' THEN '纽约 NJDF' + WHEN 'CADF' THEN '洛杉矶 CADF' + ELSE REPLACE(COALESCE(NULLIF(o.destination_name,''),NULLIF(o.destination_code,''),'—'),'.','') + END destination_warehouse, 0 carton_count,0 item_quantity FROM fl_dropship_pallet p JOIN fl_inbound_order o ON o.id=p.inbound_id AND o.tenant_id=p.tenant_id diff --git a/firstleg/src/test/java/com/baiyue/firstleg/service/InboundCartonLabelPrintServiceTest.java b/firstleg/src/test/java/com/baiyue/firstleg/service/InboundCartonLabelPrintServiceTest.java index 39514f66b..af6b08ff9 100644 --- a/firstleg/src/test/java/com/baiyue/firstleg/service/InboundCartonLabelPrintServiceTest.java +++ b/firstleg/src/test/java/com/baiyue/firstleg/service/InboundCartonLabelPrintServiceTest.java @@ -65,7 +65,7 @@ class InboundCartonLabelPrintServiceTest { assertThat(request.getValue().pageSpec().heightMm()).isEqualByComparingTo("297"); assertThat(request.getValue().documents()).singleElement().satisfies(document -> { assertThat(document.palletNo()).isEqualTo("DP-260911-0001"); - assertThat(document.destinationWarehouse()).isEqualTo("纽约 N.JDF"); + assertThat(document.destinationWarehouse()).isEqualTo("纽约 NJDF"); assertThat(document.palletSequence()).isEqualTo(1); assertThat(document.totalPallets()).isEqualTo(2); assertThat(document.inboundRows()).singleElement().satisfies(row -> { @@ -248,7 +248,7 @@ class InboundCartonLabelPrintServiceTest { inbound.setTenantId(10001L); inbound.setInboundId(70001L); inbound.setInboundCode("PCHK2608040174"); - inbound.setDestinationWarehouse("纽约 N.JDF"); + inbound.setDestinationWarehouse("纽约 NJDF"); inbound.setCartonCount(palletId == 90001L ? 1 : 0); inbound.setItemQuantity(palletId == 90001L ? 19 : 0); when(palletization.printInboundRows(palletId)).thenReturn(List.of(inbound)); diff --git a/print/AGENTS.md b/print/AGENTS.md index 51489cc3f..f1589d6f3 100644 --- a/print/AGENTS.md +++ b/print/AGENTS.md @@ -4,7 +4,7 @@ - 本模块是无数据库的无状态 PDF 渲染服务;调用方传入完整 `labels[]` 或 `documents[]`,模块在内存中生成一次性多页 PDF 并同步返回。 - 不保存模板、任务、历史或文件,不连接数据库、File 服务或打印机,不反查或修正业务数据。 -- 当前支持 `INBOUND_MARK_V1`(`100mm x 100mm`)、`DROPSHIP_PALLET_A4_V2`、`SEA_FREIGHT_SHIPPING_INSTRUCTION_A4_V1` 和 `BILL_OF_LADING_CONFIRMATION_A4_V1`(后三者均为 `210mm x 297mm`);一件代发托盘模板每托固定一页,展示托盘 Code 128 一维码、目的仓、最多 10 行入仓码/客户昵称汇总和最多 34 行 SKU 汇总,不展示作业状态、重量或体积。新尺寸或布局必须使用新模板编码。 +- 当前支持 `INBOUND_MARK_V1`(`100mm x 100mm`)、`DROPSHIP_PALLET_A4_V2`、`SEA_FREIGHT_SHIPPING_INSTRUCTION_A4_V1` 和 `BILL_OF_LADING_CONFIRMATION_A4_V1`(后三者均为 `210mm x 297mm`);一件代发托盘模板采用黑白打印版,每托固定一页,展示托盘 Code 128 一维码、目的仓、最多 10 行入仓码/客户昵称汇总和最多 34 行 SKU 汇总,不展示作业状态、重量或体积。新尺寸或布局必须使用新模板编码。 ## 快速索引 diff --git a/print/README.md b/print/README.md index 974181371..bc2e22e8e 100644 --- a/print/README.md +++ b/print/README.md @@ -8,7 +8,7 @@ - 服务发现名:`print-service`。 - 内部地址:`POST /internal/print/v1/pdfs/inbound-marks`。 -- 一件代发 A4 托盘信息单:`POST /internal/print/v1/pdfs/dropship-pallet-a4-documents`;模板固定为 `DROPSHIP_PALLET_A4_V2`,每托一页 A4,包含托盘 Code 128 一维码、目的仓、托盘序号、最多 10 行入仓码/客户昵称汇总和最多 34 行 SKU 汇总,不展示作业状态、重量或体积。 +- 一件代发 A4 托盘信息单:`POST /internal/print/v1/pdfs/dropship-pallet-a4-documents`;模板固定为 `DROPSHIP_PALLET_A4_V2`,采用黑白打印版,每托一页 A4,包含托盘 Code 128 一维码、目的仓、托盘序号、最多 10 行入仓码/客户昵称汇总和最多 34 行 SKU 汇总,不展示作业状态、重量或体积。 - A4 海运单据内部地址:`POST /internal/print/v1/pdfs/freight-a4-documents`。 - 海外仓排车 BOL 内部地址:`POST /internal/print/v1/pdfs/dispatch-bol-documents`;模板固定为 `DISPATCH_BILL_OF_LADING_A4_V2`,每个 document 对应一张 A4、包含 1-26 行明细。调用方首张按 18 行、续页按 26 行稳定分页;同页连续相同柜号和托盘号由 Print 纵向合并显示。 - 本地直连:`http://127.0.0.1:9207`。 diff --git a/print/output/pdf/dropship-pallet-a4-v2-preview.pdf b/print/output/pdf/dropship-pallet-a4-v2-preview.pdf index 80d212ce2..26657aeb5 100644 Binary files a/print/output/pdf/dropship-pallet-a4-v2-preview.pdf and b/print/output/pdf/dropship-pallet-a4-v2-preview.pdf differ diff --git a/print/src/test/java/com/baiyue/print/controller/InternalPdfControllerTest.java b/print/src/test/java/com/baiyue/print/controller/InternalPdfControllerTest.java index c4c30dd46..7580e4193 100644 --- a/print/src/test/java/com/baiyue/print/controller/InternalPdfControllerTest.java +++ b/print/src/test/java/com/baiyue/print/controller/InternalPdfControllerTest.java @@ -273,7 +273,7 @@ class InternalPdfControllerTest { "downloadFileName": "DP-260911-0034-A4托盘信息单.pdf", "documents": [{ "palletNo": "DP-260911-0034", - "destinationWarehouse": "纽约 N.JDF", + "destinationWarehouse": "纽约 NJDF", "palletSequence": 1, "totalPallets": 3, "barcodeContent": "DP-260911-0034", diff --git a/print/src/test/java/com/baiyue/print/service/DropshipPalletA4PdfServiceGenerationTest.java b/print/src/test/java/com/baiyue/print/service/DropshipPalletA4PdfServiceGenerationTest.java index 2fc14607a..d6deed2ee 100644 --- a/print/src/test/java/com/baiyue/print/service/DropshipPalletA4PdfServiceGenerationTest.java +++ b/print/src/test/java/com/baiyue/print/service/DropshipPalletA4PdfServiceGenerationTest.java @@ -27,7 +27,7 @@ class DropshipPalletA4PdfServiceGenerationTest { @Test void generatesOneA4PageWithPalletBarcodeAndSkuDetails() throws Exception { DropshipPalletA4PdfDtos.Document document = new DropshipPalletA4PdfDtos.Document( - "DP-260911-0034", "纽约 N.JDF", 1, 3, "DP-260911-0034", + "DP-260911-0034", "纽约 NJDF", 1, 3, "DP-260911-0034", List.of(new DropshipPalletA4PdfDtos.InboundRow( "NYEXX2609110249", "小虫科技", 3, 90)), List.of( @@ -44,7 +44,7 @@ class DropshipPalletA4PdfServiceGenerationTest { assertThat(pdf.getPage(0).getMediaBox().getWidth()).isCloseTo(PdfUnits.mmToPt(210), org.assertj.core.data.Offset.offset(.002f)); assertThat(pdf.getPage(0).getMediaBox().getHeight()).isCloseTo(PdfUnits.mmToPt(297), org.assertj.core.data.Offset.offset(.002f)); assertThat(new PDFTextStripper().getText(pdf)) - .contains("DP-260911-0034", "N.JDF", "NYEXX2609110249", + .contains("DP-260911-0034", "NJDF", "NYEXX2609110249", "SKU-001", "SKU-002", "40", "50") .containsOnlyOnce("DP-260911-0034") .doesNotContain("状态", "待封托", "已封托", "重量", "体积"); @@ -64,7 +64,7 @@ class DropshipPalletA4PdfServiceGenerationTest { "SKU-" + String.format("%03d", index), 2, index * 5, "5-10")); } DropshipPalletA4PdfDtos.Document document = new DropshipPalletA4PdfDtos.Document( - "DP-260911-0034", "纽约 N.JDF", 1, 1, + "DP-260911-0034", "纽约 NJDF", 1, 1, "DP-260911-0034", inboundRows, rows); var generated = service.generate(new DropshipPalletA4PdfDtos.Request( DropshipPalletA4PdfDtos.TEMPLATE, @@ -85,7 +85,7 @@ class DropshipPalletA4PdfServiceGenerationTest { rows.add(new DropshipPalletA4PdfDtos.SkuRow("SKU-" + index, 1, 1, "1")); } DropshipPalletA4PdfDtos.Document document = new DropshipPalletA4PdfDtos.Document( - "DP-260911-0034", "纽约 N.JDF", 1, 1, "DP-260911-0034", + "DP-260911-0034", "纽约 NJDF", 1, 1, "DP-260911-0034", List.of(new DropshipPalletA4PdfDtos.InboundRow("INBOUND", "客户", 35, 35)), rows); assertThatThrownBy(() -> service.generate(new DropshipPalletA4PdfDtos.Request(