Add sign-off receipt report and refine packing list: single-line info bar, real-glyph row height, auto-paginated detail table

- Packing list: info bar changed to a single-line three-column layout (schedule no. | order no. | box no.); packing date moved to bottom-right on the same row as the total; date separator changed to slash
- Packing list: range column widened 20->30mm; quantity/position-no./remark start shifted right 10mm; remark column narrowed to compensate; total width unchanged
- Packing list: detail cells now use line_spacing=1.0 + valign=top; separators changed to thin solid lines at row bottom (+1mm line spacing); placeholder empty rows no longer step y
- Packing list: row height estimation now uses fpdf2's same simhei glyph measured width (replacing rough character-count estimate); _clean adds control-character cleanup
- New sign-off receipt report reports/sign_receipt: master+detail linked query, ReportBro auto-paginated table, PyMuPDF stamped footer (document no. / page no. / sign-off column)
- run.py: required params now read from each report's config.yaml; default output path auto-generated; added transform.stamp_footer post-processing hook
- .gitignore: ignore .workbuddy/
This commit is contained in:
Misaka_Company
2026-08-04 08:55:09 +08:00
parent 22b764ef19
commit df8f25f6da
11 changed files with 1503 additions and 70 deletions

View File

@@ -0,0 +1,38 @@
name: sign_receipt
title: 签收单
description: 按签收单序列号生成 PDF一次发货的集合视图含多排产号多箱明细 + 收发方签收信息)
renderer: reportbro-lib
params:
receipt_no:
description: 签收单序列号11位YYYYMMDD + 3位当日序号如 20260803001
required: true
files:
query.sql: 参数化查询(:receipt_no主表头 LEFT JOIN 明细链路,按 (箱号,产品) 聚合
transform.py: build_context(rows) → 单头标量 + 明细预展开(r0_*..r19_*) + 行高估算
_build_template.py: 样式定义 + 运行时按数据动态布局的文档元素生成(无边框列表式)
fields:
receipt_no: 签收单序列号(主键)
seq: "当日顺序号receipt_date: 序列号日期部分"
shipper_name/address/phone: 发货单位/地址/电话
receiver_name/address/phone: 收货人/地址/电话
customer_order_no: 客户订单编号
customer_total_no: 客户提供的外部总排行号(与内部排产号无关)
transport_mode: 运输方式
ship_date: "发货日期sign_date/signed_by: 签收日期/签收人(回写)"
maker: "制单人receipt_remark: 备注"
r{i}_product_name: 产品名称(合同表[客户名称]
r{i}_model: 产品型号
r{i}_range_: 量程
r{i}_qty: 数量
r{i}_contract_order_no: 合同号/订单号(合同表[订单号]
r{i}_box_no: 箱号
total_boxes: "合计箱数(按 paichan_no+box_no 去重total_qty: 合计件数"
notes:
- 单位:一个序列号一份 PDF一次发货的集合视图
- 纸张A4 纵向(默认)。内容多时同 A4 纵向,本期统一 A4 纵向
- 排版无边框、单色、字体驱动的列表式复用装箱单方案ReportBro 表格行高不自适应故弃用)
- 明细行预展开为标量参数 r0_*..r19_*;模板按 row_heights 累加 y 坐标定位
- 产品信息按总排号双表 LEFT JOIN压力表/温度计合同表)取 COALESCE
- 合计箱数 = 去重 (paichan_no, box_no);合计件数 = SUM(qty)
- 中文通过 additional_fonts 注册 simhei.ttf 渲染(见 core/fonts.py
- 预留最多 20 行明细;超过可在 _build_template.MAX_ROWS 与 transform.MAX_ROWS 同步调大