certflow.services.report_migration package

Submodules

Module contents

报告迁移引擎(批次4 / B4-3)。

把 VBA 的「Excel 模板 → 坐标填值 → 分页」复现为 PySide6 原生实现:

  • report_fill_engine:泛型填充+分页引擎(openpyxl,cell-by-cell 写值, 绕开 VBA 解合并/重合并 hack)。

  • report_template_spec:12 套「字段→坐标」模板规格(ZhiBaoShuSpec)。

  • material_provider:质保书材质块的可插拔解析器(阀体/阀杆/启闭件)。

本包为纯 openpyxl 实现,不依赖 PySide,可在无头环境直接测试。

下游由 certflow.services.report_output_service.ReportOutputService 接管 (双存根 xlsx+pdf、印章、VBA 同款文件夹命名、报告目录索引)。

class certflow.services.report_migration.ReportFillEngine(provider, material_annotation=False)[源代码]

基类:object

参数:
fill(wb_out, template_ws, spec, records, sheet_name='报告', report_date=None, page_numbers=None)[源代码]
参数:
返回类型:

Worksheet

class certflow.services.report_migration.ZhiBaoShuSpec(name: 'str', k: 'int', 单条行数: 'int', page_row_count: 'int', page_col_count: 'int', title_rows: 'tuple[int, int]'=(1, 4), product_start: 'int' = 5, material_header_rows: 'tuple[int, int]'=(11, 13), material_start: 'int' = 14, footer_rows: 'tuple[int, int]'=(27, 29), has_material: 'bool' = True, date_row: 'int' = 2, date_col: 'int' = 8, number_row: 'int' = 2, number_col: 'int' = 15, number_prefix: 'str' = 'C/1 编号:', report_code: 'str' = '9.1-13', date_label: 'str' = '日期:', date_fmt: 'str' = '%Y.%m.%d', product_row_span: 'int' = 1, product_block: 'bool' = True, caizhi: 'bool' = False, product_cols: 'dict[str, int]'=<factory>, product_merges: 'dict[str, tuple[int, int]]'=<factory>, material_cols: 'dict[str, int]'=<factory>)[源代码]

基类:object

参数:
name: str
k: int
单条行数: int
page_row_count: int
page_col_count: int
title_rows: tuple[int, int] = (1, 4)
product_start: int = 5
material_header_rows: tuple[int, int] = (11, 13)
material_start: int = 14
footer_rows: tuple[int, int] = (27, 29)
has_material: bool = True
date_row: int = 2
date_col: int = 8
number_row: int = 2
number_col: int = 15
number_prefix: str = 'C/1 编号:'
report_code: str = '9.1-13'
date_label: str = '日期:'
date_fmt: str = '%Y.%m.%d'
product_row_span: int = 1
product_block: bool = True
caizhi: bool = False
product_cols: dict[str, int]
product_merges: dict[str, tuple[int, int]]
material_cols: dict[str, int]
certflow.services.report_migration.zhibaoshu_5hang()[源代码]
返回类型:

ZhiBaoShuSpec

certflow.services.report_migration.zhibaoshu_6hang()[源代码]
返回类型:

ZhiBaoShuSpec

certflow.services.report_migration.zhibaoshu_9hang_biaozhunhao()[源代码]

质保书9行【只有标准号】:仅写标准号(无出厂编号列,试验标准在 col8),单号前缀 C/0。

返回类型:

ZhiBaoShuSpec

certflow.services.report_migration.zhibaoshu_9hang_bianhao_biaozhun()[源代码]

质保书9行【有编号与标准】:出厂编号(col8) + 标准号(col10),单号前缀 C/1。

返回类型:

ZhiBaoShuSpec

certflow.services.report_migration.zhibaoshu_9hang_bianhao_biaozhun_wendu()[源代码]

质保书9行【有编号与标准及温度】:出厂编号 + 标准号 + 适用温度(col12),单号前缀 C/1。

返回类型:

ZhiBaoShuSpec

certflow.services.report_migration.shiyan_report_zhong()[源代码]

产品压力试验检测报告(中:每页25台,无材质块)。

返回类型:

ZhiBaoShuSpec

certflow.services.report_migration.shiyan_report_shao()[源代码]

产品压力试验检测报告(少:每页13台,无材质块)。

返回类型:

ZhiBaoShuSpec

certflow.services.report_migration.shiyan_report_zhongwen_shao()[源代码]

中英文试压报告模板-少:双语表头,每页 13 台,无材质块。

返回类型:

ZhiBaoShuSpec

certflow.services.report_migration.shiyan_report_zhongying()[源代码]

试压(中英):双语,每产品占 2 行(合并),每页 10 台,无材质块。

报告单号代号 8.2-20(区别于质保书/中英文试压的 9.1-13);日期格只存日期本身。

返回类型:

ZhiBaoShuSpec

certflow.services.report_migration.caizhi_1hang()[源代码]

材质1行:产品材质证明书,每产品 1 行材质(无独立产品表)。

返回类型:

ZhiBaoShuSpec

certflow.services.report_migration.caizhi_2hang()[源代码]

材质2行:产品材质证明书,每产品 2 行材质。

返回类型:

ZhiBaoShuSpec

certflow.services.report_migration.caizhi_3hang()[源代码]

材质3行:产品材质证明书,每产品 3 行材质(模板首例有阀体/阀杆/阀瓣样本)。

返回类型:

ZhiBaoShuSpec