certflow.config.models module¶
配置数据模型
使用 Pydantic 定义配置数据结构,提供类型验证和自动补全.
- class certflow.config.models.RootConfig(*, app=<factory>, paths=<factory>, sales_plan=<factory>, certificate=<factory>, import_deduplication=<factory>, database=<factory>, logging=<factory>, ui=<factory>, color_mapping=<factory>, numbering=None, duplicate_check=None, unique_key=None, priority_rules=None, export=None, sales_plan_fill=None, field_fallbacks=None, field_fill_rules=None, sales_importer=None, qualified_list=None, import_mapping=None, export_debug=None, test_report=None, report=<factory>, printer=None, environment=None, colors=None, field_templates=None, print_templates=None, vba_import=None, completed_orders_backfill=None, query_page=<factory>, main_window=<factory>, window=<factory>, title_bar=<factory>, nav_buttons=<factory>, correction_queue=<factory>, welcome_page=<factory>, import_page=<factory>, log_page=<factory>, status_bar=<factory>, styles=<factory>, grouping=None, sorting=None, id_generator=None, production_status=None, import_config=None, import_placeholder=<factory>, bom_import=<factory>, sync=None, print=None, background=None, print_log_empty_markers=None, output=None, dictionary=<factory>, lookup_tables=<factory>, quarantine=<factory>, sort_rules=<factory>)[源代码]¶
基类:
_StrictModel根配置模型
所有配置的顶层容器,聚合所有子配置模块. 顶层已闭环为 extra='forbid'(任务 2.3 / §六 UI 域严格校验),未建模键触发 ValidationError,杜绝顶层键拼写错误/死配置静默失效;嵌套 UI 段结构由 UIConfigModel 顶层闸门二次把关(见 ui_config.py)。
- 参数:
app (AppConfig)
paths (PathsConfig)
sales_plan (SalesPlanConfig)
certificate (CertificateConfig)
import_deduplication (ImportDeduplicationConfig)
database (DatabaseConfig)
logging (LoggingConfig)
ui (UIConfig)
color_mapping (ColorMappingConfig)
numbering (NumberingConfig | None)
duplicate_check (DuplicateCheckConfig | None)
unique_key (UniqueKeyConfig | None)
priority_rules (PriorityRulesConfig | None)
export (ExportConfig | None)
sales_plan_fill (SalesPlanFillConfig | None)
field_fill_rules (dict[str, list[FieldFillRule]] | None)
sales_importer (SalesImporterConfig | None)
import_mapping (ImportMappingConfig | None)
export_debug (ExportDebugConfig | None)
test_report (TestReportConfig | None)
printer (PrinterConfig | None)
environment (EnvironmentConfig | None)
colors (ColorsConfig | None)
vba_import (VBAImportConfig | None)
completed_orders_backfill (CompletedOrdersBackfillConfig | None)
grouping (GroupingConfig | None)
sorting (SortingConfig | None)
id_generator (IdGeneratorConfig | None)
production_status (ProductionStatusConfig | None)
import_config (ImportConfig | None)
import_placeholder (ImportPlaceholderConfig | None)
bom_import (BomImportConfig | None)
sync (SyncConfig | None)
print (PrintConfig | None)
background (BackgroundConfig | None)
print_log_empty_markers (PrintLogEmptyMarkersConfig | None)
output (OutputConfig | None)
dictionary (DictionaryConfig)
lookup_tables (LookupTablesConfig)
quarantine (QuarantineConfig)
sort_rules (SortRulesConfig)
- paths¶
路径配置
- Type:
- sales_plan¶
销售计划配置
- Type:
- certificate¶
合格证配置
- Type:
- import_deduplication¶
导入去重配置
- database¶
数据库配置
- Type:
- logging¶
日志配置
- Type:
- color_mapping¶
颜色映射配置
- Type:
- numbering¶
编号规则配置(V2)
- Type:
NumberingConfig | None
- duplicate_check¶
重复检查配置(V2)
- Type:
DuplicateCheckConfig | None
- unique_key¶
唯一键配置(V2)
- Type:
UniqueKeyConfig | None
- priority_rules¶
优先级规则配置(V2)
- Type:
PriorityRulesConfig | None
- export¶
导出配置(V2)
- Type:
ExportConfig | None
- sales_plan_fill¶
销售计划填充配置(V2)
- Type:
SalesPlanFillConfig | None
- field_fill_rules¶
字段填充规则配置(V2)
- Type:
dict[str, list[FieldFillRule]] | None
- sales_importer¶
销售计划导入器配置(V2)
- Type:
SalesImporterConfig | None
- import_mapping¶
导入列映射配置(V2)
- Type:
ImportMappingConfig | None
- export_debug¶
导出调试配置(V2)
- Type:
ExportDebugConfig | None
- test_report¶
试压报告配置(V2)
- Type:
TestReportConfig | None
- printer¶
打印机配置(V2)
- Type:
PrinterConfig | None
- environment¶
环境信息配置(V2)
- Type:
EnvironmentConfig | None
- colors¶
颜色常量配置(V2)
- Type:
ColorsConfig | None
- vba_import¶
VBA导入配置(V2)
- Type:
VBAImportConfig | None
- id_generator¶
唯一键生成策略配置
- Type:
IdGeneratorConfig | None
- production_status¶
生产状态配置
- Type:
ProductionStatusConfig | None
- import_config¶
导入配置(与 QueryView 风格一致)
- Type:
ImportConfig | None
- sync¶
数据库同步配置(WebDAV)
- Type:
SyncConfig | None
- print¶
打印引擎配置
- Type:
PrintConfig | None
- background¶
底板预览配置
- Type:
BackgroundConfig | None
- print_log_empty_markers¶
打印日志空值默认标记配置
- Type:
PrintLogEmptyMarkersConfig | None
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- paths: PathsConfig¶
- sales_plan: SalesPlanConfig¶
- certificate: CertificateConfig¶
- import_deduplication: ImportDeduplicationConfig¶
- database: DatabaseConfig¶
- logging: LoggingConfig¶
- color_mapping: ColorMappingConfig¶
- numbering: NumberingConfig | None¶
- duplicate_check: DuplicateCheckConfig | None¶
- unique_key: UniqueKeyConfig | None¶
- priority_rules: PriorityRulesConfig | None¶
- export: ExportConfig | None¶
- sales_plan_fill: SalesPlanFillConfig | None¶
- sales_importer: SalesImporterConfig | None¶
- import_mapping: ImportMappingConfig | None¶
- export_debug: ExportDebugConfig | None¶
- test_report: TestReportConfig | None¶
- printer: PrinterConfig | None¶
- environment: EnvironmentConfig | None¶
- colors: ColorsConfig | None¶
- vba_import: VBAImportConfig | None¶
- completed_orders_backfill: CompletedOrdersBackfillConfig | None¶
- grouping: GroupingConfig | None¶
- sorting: SortingConfig | None¶
- id_generator: IdGeneratorConfig | None¶
- production_status: ProductionStatusConfig | None¶
- import_config: ImportConfig | None¶
- import_placeholder: ImportPlaceholderConfig | None¶
- sync: SyncConfig | None¶
- print: PrintConfig | None¶
- background: BackgroundConfig | None¶
- print_log_empty_markers: PrintLogEmptyMarkersConfig | None¶
- output: OutputConfig | None¶
- dictionary: DictionaryConfig¶
- lookup_tables: LookupTablesConfig¶
- quarantine: QuarantineConfig¶
- sort_rules: SortRulesConfig¶
- classmethod validate_log_level(v)[源代码]¶
验证日志级别是否有效
- 参数:
v (LoggingConfig) -- 待验证的日志配置对象
- 返回:
验证通过的日志配置对象
- 返回类型:
- 抛出:
ValueError -- 当日志级别不在有效值范围内时抛出
- class certflow.config.models.AppConfig(*, name='CertFlow', version='2.0.0', year=2026, organization='CertFlow Team', debug=False)[源代码]¶
基类:
_StrictModel应用基础配置模型
定义应用程序的基本信息,包括名称、版本、组织等元数据.
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.PathsConfig(*, database=<factory>, temp=<factory>, logs='logs', resources='resources', templates=<factory>, sales_plan=None, qualified_list=None, nameplate_db=None, quality_cert=None, transfer_docs=None, backup=None, output=None, excel_layout=None, images=None, fonts=None, report_archive=<factory>, report_templates_dir='templates/reports')[源代码]¶
基类:
_StrictModel路径配置集合模型
聚合所有文件路径相关的配置,包括数据库、临时文件、日志等路径.
- 参数:
database (DatabasePaths)
temp (TempPaths)
logs (str)
resources (str)
templates (TemplatePaths)
report_archive (ReportArchiveConfig)
report_templates_dir (str)
- database¶
数据库路径配置
- Type:
DatabasePaths
- temp¶
临时文件路径配置
- Type:
TempPaths
- templates¶
模板文件路径配置
- Type:
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- database: DatabasePaths¶
- temp: TempPaths¶
- templates: TemplatePaths¶
- report_archive: ReportArchiveConfig¶
- class certflow.config.models.TemplatePaths(*, base='data/templates/', certificate_chinese='data/templates/中文合格证模板.xlsx', certificate_bilingual='data/templates/中英文合格证模板.xlsx', certificate_russian='', test_report_small='', test_report_medium='', quality_cert_file='', report_master='data/xlsx/各种报告的xlsx文件模板.xlsx')[源代码]¶
基类:
_StrictModel模板路径配置模型
定义各类模板文件的存储路径.
- 参数:
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.SalesPlanConfig(*, excel_config=<factory>, column_mapping=<factory>, header_detection=None, styled_import_columns=<factory>, header_row=2, data_start_row=3, required_fields=<factory>, valid_row_check=<factory>, pn_convert=<factory>, import_gate=<factory>, dual_field_mapping=<factory>)[源代码]¶
基类:
_StrictModel销售计划配置模型
定义销售计划Excel文件的解析规则,包括列映射、表头位置等.
- 参数:
excel_config (ExcelReadConfig)
column_mapping (ColumnMappingConfig)
header_detection (HeaderDetectionConfig | None)
header_row (int)
data_start_row (int)
valid_row_check (ValidRowCheck)
pn_convert (PnConvertConfig)
import_gate (ImportGateConfig)
dual_field_mapping (DualFieldMappingConfig)
- excel_config¶
Excel 读取配置
- Type:
- column_mapping¶
列映射配置
- Type:
ColumnMappingConfig
- header_detection¶
表头自动检测配置
- Type:
HeaderDetectionConfig | None
- valid_row_check¶
有效行检查配置
- Type:
ValidRowCheck
- pn_convert¶
公称压力 Lb→MPa 换算(#30 P0 DN/PN 字典 DB 化)
- Type:
PnConvertConfig
- import_gate¶
导入门控(#30 P1 无单号行跳过/隔离/标黄)
- Type:
ImportGateConfig
- dual_field_mapping¶
双字段映射(合同信息 ↔ 合格证打印信息),蓝图 §4.2.1
- Type:
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- excel_config: ExcelReadConfig¶
- column_mapping: ColumnMappingConfig¶
- header_detection: HeaderDetectionConfig | None¶
- valid_row_check: ValidRowCheck¶
- pn_convert: PnConvertConfig¶
- import_gate: ImportGateConfig¶
- dual_field_mapping: DualFieldMappingConfig¶
- class certflow.config.models.ExcelReadConfig(*, sheet_name=0, header_row=1, skip_rows=None, use_cols=None)[源代码]¶
基类:
_StrictModelExcel 读取配置模型
定义 Excel 文件读取时的基本参数.
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.HeaderDetectionConfig(*, enabled=True, keywords=<factory>, max_rows=20)[源代码]¶
基类:
_StrictModel表头自动检测配置模型
定义表头检测的启停和匹配规则.
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.DualFieldMappingConfig(*, pairs=<factory>, import_mode='lazy')[源代码]¶
基类:
_StrictModel双字段映射配置(合同信息 ↔ 合格证打印信息),蓝图 §4.2.1。
- import_mode¶
copy / override / lazy(默认 lazy,不破坏既有行为) - copy:合同值同时写入 cert_*(杜绝"改合同静默跟随"风险) - override:仅当 Excel 显式提供 cert 列时才写 cert_* - lazy:保持现状(cert_* 留空,打印时回退合同值)
- Type:
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.SuffixRule(*, field=None, keywords, suffix, exclude=None)[源代码]¶
基类:
_StrictModel合格证后缀规则模型
根据关键词匹配规则生成证书编号后缀.
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.CertificateConfig(*, prefix='CERT', date_format='%Y%m%d', format_template='{prefix}{date}{seq:04d}', suffix_rules=<factory>, defaults=<factory>, numbering=<factory>, issue_date_source='sync_numbering_ym', inspector_id=<factory>, print_duplicate_check=<factory>)[源代码]¶
基类:
_StrictModel合格证配置模型
定义合格证编号的生成规则.
- 参数:
- suffix_rules¶
后缀匹配规则列表
- Type:
- numbering¶
编号时机与编码模式配置(步骤 6)
- Type:
CertificateNumberingConfig
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- suffix_rules: list[SuffixRule]¶
- numbering: CertificateNumberingConfig¶
- inspector_id: InspectorIdConfig¶
- print_duplicate_check: PrintDuplicateCheckConfig¶
- class certflow.config.models.ImportDeduplicationConfig(*, strategy='skip', check_within_file=True, check_against_db=True, unique_key_fields=<factory>, update_on_duplicate=True, monitored_fields=<factory>, on_collision='quarantine', duplicate_handling=None, unique_key_generation=None, field_normalization=None)[源代码]¶
基类:
_StrictModel导入去重配置模型
定义数据导入时的重复检测和处理策略.
- 参数:
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.DatabaseConfig(*, type='sqlite', echo=False, pool_size=5, max_overflow=10)[源代码]¶
基类:
_StrictModel数据库配置模型
定义数据库连接参数和行为.
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.LoggingConfig(*, level='INFO', file='logs/certflow.log', format='{time:YYYY-MM-DD HH:mm:ss} | {level: <8} | {name}:{function}:{line} - {message}', rotation='10 MB', retention='30 days', compression='zip', debug_modules=<factory>)[源代码]¶
基类:
_StrictModel日志配置模型
定义日志输出格式、轮转策略等参数.
- 参数:
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.UIConfig(*, window=<factory>, table=<factory>, status_bar=<factory>, query_page=<factory>, **extra_data)[源代码]¶
基类:
_StrictModelUI配置集合模型
聚合所有用户界面相关的配置.
- 参数:
- window¶
窗口配置
- Type:
WindowConfig
- table¶
表格配置
- Type:
TableConfig
- status_bar¶
状态栏配置
- Type:
StatusBarConfig
- model_config = {'extra': 'allow'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- window: WindowConfig¶
- table: TableConfig¶
- status_bar: StatusBarConfig¶
- class certflow.config.models.ColorMappingConfig(*, status_colors=<factory>, priority_colors=<factory>, vba_colors=None, font_color_to_shipping=None, bg_color_to_status=None, theme_font_colors=None, font_colors=None, bg_colors=None)[源代码]¶
基类:
_StrictModel颜色映射配置模型
定义状态和优先级到颜色的映射关系.
- 参数:
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.NumberingConfig(*, prefix='V', format='{prefix}{year}{month}{seq:03d}{suffix}', suffixes=<factory>, auto_number_mode=None, suffix_rules=<factory>, no_cert_categories=<factory>, yellow_skip_enabled=False)[源代码]¶
基类:
_StrictModel编号规则配置模型(V2新增)
定义V2版本的自动编号生成规则.
- 参数:
- suffix_rules¶
后缀规则列表
- Type:
- suffix_rules: list[NumberingSuffixRule]¶
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.NumberingSuffixRule(*, field=None, keywords=<factory>, suffix='', exclude=None)[源代码]¶
基类:
_StrictModel编号后缀规则模型(V2新增)
根据字段值或关键词匹配规则生成编号后缀.
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.DuplicateCheckConfig(*, fields=<factory>)[源代码]¶
基类:
_StrictModel重复检查配置模型(V2新增)
定义数据重复检查的字段列表.
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.UniqueKeyConfig(*, separator='|', date_to_serial=True, fields=<factory>, key_field_fallbacks=None, tiers=None, require_numbered=False)[源代码]¶
基类:
_StrictModel唯一标识规则配置模型(V2新增)
定义唯一键的生成规则.
- 参数:
- fields¶
构成唯一键的字段列表(V2 旧格式,兼容保留)
- Type:
- fields: list[UniqueKeyField]¶
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.UniqueKeyField(*, name, required=False)[源代码]¶
基类:
_StrictModel唯一键字段模型(V2新增)
定义构成唯一键的字段及其约束.
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.PriorityRulesConfig(*, high_threshold=10000, medium_threshold=5000, high_label='高', medium_label='中', low_label='低', high_color='#e74c3c', medium_color='#f39c12', low_color='#27ae60')[源代码]¶
基类:
_StrictModel优先级规则配置模型(V2新增)
定义基于金额的优先级判定规则和颜色.
- 参数:
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.ExportConfig(*, hyperlink_column=44, hyperlink_ref_prefix='AR', hyperlink_width=20, summary=None, access=None)[源代码]¶
基类:
_StrictModel导出配置模型(V2新增)
定义数据导出的格式和行为.
- 参数:
- access¶
Access 导出开关(export.access.enabled)
- Type:
ExportAccessConfig | None
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.SalesImporterConfig(*, field_mapping=<factory>, color_columns=None, selection_info_columns=None)[源代码]¶
基类:
_StrictModel销售计划导入器配置模型(V2新增)
定义销售计划Excel导入的字段映射和颜色列配置.
- 参数:
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.VBAImportConfig(*, sales_plan_files=None, qualified_list=None, field_mapping=<factory>, color_mapping=None, duplicate_check_fields=None)[源代码]¶
基类:
_StrictModelVBA导入逻辑配置模型(V2新增)
定义VBA导入功能的文件路径、字段映射和重复检查规则.
- 参数:
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.PrintLayoutConfig(*, label_x=3, value_x=20, start_y=22, line_spacing=6.5, font_size=9, x_offset=14, y_offset=0)[源代码]¶
基类:
_StrictModel打印布局配置模型
定义打印坐标、偏移和字体大小.
- 参数:
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.PrintFontConfig(*, name='SimSun', weight=400)[源代码]¶
基类:
_StrictModel打印字体配置模型
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.PrintFieldConfig(*, label, key, offset=0)[源代码]¶
基类:
_StrictModel打印字段配置模型
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.TestReportConfig(*, company_name='', form_code='')[源代码]¶
基类:
_StrictModel试压报告配置模型(V2新增)
定义试压报告的相关配置.
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.PrinterConfig(*, default='')[源代码]¶
基类:
_StrictModel打印机配置模型(V2新增)
定义默认打印机设置.
- 参数:
default (str)
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.EnvironmentConfig(*, computer_name='${COMPUTERNAME:Unknown}', username='${USERNAME:Unknown}')[源代码]¶
基类:
_StrictModel环境信息配置模型(V2新增)
定义运行时环境信息,支持环境变量替换.
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.ColorsConfig(*, yellow=65535, blue=16711680, red=255, green=65280, light_blue=15773696)[源代码]¶
基类:
_StrictModel颜色常量值配置模型(V2新增)
定义VBA中使用的颜色常量值.
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.ImportMappingConfig(*, preprocessor=None, column_mapping=None, default_values=None)[源代码]¶
基类:
_StrictModel数据导入列映射配置模型(V2新增)
定义Excel导入时的预处理、列映射和默认值.
- 参数:
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.GroupingConfig(*, group_keys=<factory>, group_keys_no_project=<factory>, numbering=<factory>)[源代码]¶
基类:
_StrictModel分组配置(V3新增)
第一层分组:按业务键分组,生成组内序号
- 参数:
numbering (GroupingNumberingConfig)
- numbering: GroupingNumberingConfig¶
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.GroupingNumberingConfig(*, use_global_prefix=True, prefix_format='G{:03d}', seq_format='{:03d}', separator='-', full_seq_field='group_seq', group_index_field='_group_index', group_key_field='_group_key')[源代码]¶
基类:
_StrictModel分组序号配置
- 参数:
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.SortingConfig(*, keys=<factory>)[源代码]¶
基类:
_StrictModel排序配置(V3新增)
第二层排序:组内按产品键排序
- 参数:
keys (list[SortingKey])
- keys: list[SortingKey]¶
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.SortingKey(*, field, order='asc')[源代码]¶
基类:
_StrictModel排序键配置(V3新增)
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.CompletedOrdersBackfillConfig(*, file_path='temp/excel/已完成工单【202601--202612】.xlsx', match_field='生产令号', source_field='供货类型', db_match_field='production_order_no', db_target_field='supply_type', overwrite_existing=False, backup_before_update=True, backup_suffix='_before_supply_type_backfill')[源代码]¶
基类:
_StrictModel已完成工单回填配置模型
定义从"已完成工单"Excel的月份工作表中读取"供货类型"字段并回填到数据库的规则。
核心设计:
只处理月份工作表(2026-01~2026-12)
按字段名称(列标题)匹配,不依赖列号/列字母
通过 production_order_no 匹配(同一生产令号所有记录回填相同值)
- 参数:
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.ProductionStatusConfig(*, values=<factory>, default='待生产', ui_labels=None, transitions=None, auto_upgrade=None, inference_rules=None, query_keywords=None, ui=None, context_menu=None, shipped_actions=None)[源代码]¶
基类:
_StrictModel生产状态配置模型
所有状态值、图标、流转规则、自动升级规则均由此模型定义, 新增状态只需修改 config.yaml,无需改动任何代码.
- 参数:
default (str)
ui_labels (dict[str, ProductionStatusUILabel] | None)
auto_upgrade (list[ProductionStatusAutoUpgradeRule] | None)
inference_rules (list[ProductionStatusInferenceRule] | None)
ui (ProductionStatusUIConfig | None)
context_menu (ProductionStatusContextMenu | None)
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- ui_labels: dict[str, ProductionStatusUILabel] | None¶
- auto_upgrade: list[ProductionStatusAutoUpgradeRule] | None¶
- inference_rules: list[ProductionStatusInferenceRule] | None¶
- class certflow.config.models.ProductionStatusUILabel(*, icon='', label='')[源代码]¶
基类:
_StrictModel生产状态 UI 标签模型
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.ProductionStatusAutoUpgradeRule(*, condition, set_to=None, set_all_docs_done=None)[源代码]¶
基类:
_StrictModel自动升级规则模型
定义文档完成后自动升级生产状态的规则,按顺序匹配,命中即停止. condition 是 Python 表达式,可用变量: progress_percent, is_ready_to_ship, production_status.
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.ProductionStatusInferenceRule(*, patterns, set_to)[源代码]¶
基类:
_StrictModel状态推断规则模型
从 execution_status 自由文本中通过正则匹配推断生产状态.
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.ProductionStatusUIConfig(*, show_raw_execution_tooltip=True, show_icon_for_inferred=True, inferred_icon='📋')[源代码]¶
基类:
_StrictModel生产状态 UI 显示配置
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.ProductionStatusContextMenu(*, view_raw_execution=None)[源代码]¶
基类:
_StrictModel生产状态右键菜单配置
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.IdGeneratorConfig(*, empty_marker_prefix='【空白', new_data_fields=<factory>, old_data_fields=<factory>)[源代码]¶
基类:
_StrictModel唯一键生成策略配置模型
定义用于生成数据记录唯一键的字段组合和空值标记前缀.
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.ImportConfig(*, default_strategy='smart', auto_save=True, views=None)[源代码]¶
基类:
_StrictModel导入配置模型(与 QueryView 风格一致)
- 参数:
default_strategy (str)
auto_save (bool)
views (dict[str, ImportViewConfig] | None)
- views: dict[str, ImportViewConfig] | None¶
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.ImportViewConfig(*, name='', icon='', required_fields=<factory>, columns=None)[源代码]¶
基类:
_StrictModel导入视图配置模型
- columns: list[ImportColumnConfig] | None¶
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.ImportColumnConfig(*, field, label, type=None, required=False)[源代码]¶
基类:
_StrictModel导入列配置模型
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.ImportPlaceholderConfig(*, create_placeholder_dirs=False, skip_confirm_when_no_conflict=True)[源代码]¶
基类:
_StrictModel导入期占位目录配置(B0-4 — 批次0 B-CreateDIR/F 已定稿)
决策(2026-07-14):测试期整表批量导入会在测试机泛滥生成大量空订单目录, 故改为配置驱动开关、默认关闭。
- create_placeholder_dirs¶
是否恢复 VBA 式导入期按订单组预建占位项目文件夹。 False(默认):导入只写 SQLite,绝不碰磁盘;下游写文件时由写端 os.makedirs(parents=True, exist_ok=True) 惰性建目录。 True:导入期按订单组(计划日期+订货单位+项目名称)预建空项目资料文件夹, 命名统一沿用 paths.report_archive.folder 的 pattern/tokens/兜底文本。
- Type:
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.PrintConfig[源代码]¶
基类:
_StrictModel打印引擎配置模型(合并后)
注意:与
certflow.config.print_config.RuntimePrintConfig``(运行时聚合类)同名, 本类为 pydantic 引擎配置模型,仅描述 ``print段结构。- escp: PrintEscpConfig | None¶
- layout: PrintLayoutConfig | None¶
- font: PrintFontConfig | None¶
- print_fields: list[PrintFieldConfig] | None¶
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.PrintEscpConfig(*, x_offset=14, y_offset=0)[源代码]¶
基类:
_StrictModelESC/P-K 打印配置
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.SyncConfig(*, webdav=None)[源代码]¶
基类:
_StrictModel数据库同步配置模型
- 参数:
webdav (SyncWebdavConfig | None)
- webdav: SyncWebdavConfig | None¶
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.SyncWebdavConfig(*, url='', username='', password='', remote_path='/certflow.db')[源代码]¶
基类:
_StrictModelWebDAV 同步配置
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.BackgroundConfig(*, show_in_preview=True, opacity=0.3, image_path='')[源代码]¶
基类:
_StrictModel底板预览配置模型
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.SalesPlanFillConfig(*, columns=None)[源代码]¶
基类:
_StrictModel销售计划批量填充配置模型
- 参数:
columns (list[SalesPlanFillColumn] | None)
- columns: list[SalesPlanFillColumn] | None¶
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.SalesPlanFillColumn(*, name)[源代码]¶
基类:
_StrictModel销售计划填充列配置
- 参数:
name (str)
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.ExportDebugConfig(*, fields=None)[源代码]¶
基类:
_StrictModel导出调试配置模型
- 参数:
fields (list[ExportDebugField] | None)
- fields: list[ExportDebugField] | None¶
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.ExportDebugField(*, field, use_fallback=False)[源代码]¶
基类:
_StrictModel导出调试字段配置
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.FieldFillRule(*, source='auto', pattern='', transforms=None)[源代码]¶
基类:
_StrictModel单条字段填充规则
- 参数:
source (str)
pattern (str)
transforms (dict[str, FieldFillTransform] | None)
- transforms: dict[str, FieldFillTransform] | None¶
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.FieldFillTransform(*, field='', transform='')[源代码]¶
基类:
_StrictModel字段填充转换规则
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.PrintLogEmptyMarkersConfig(*, customer='【空白订货单位】', project_name='【空白项目名称】', product_name='【空白产品名称】', product_model='【空白产品型号】', dn='空白公称通径', pn='空白公称压力', medium='【空白适用介质】', temperature='【空白适用温度】', body_material='【未录入阀体材质】', stem_material='【未录入阀杆材质】', disc_material='【未录入启闭件材质】', tech_requirements='【空白技术要求】', equipment_no='【空白设备位号】', sub_project='【空白子项目】', sales_sn='【空白销售部产品编号】', category='【空白销售部种类】', weight='【空白销售部重量要求】', seq_no='【空白序号】', requisition_no='【空白营销部要货单号】', max_inlet_head='【空白】', max_boost_head='【空白】')[源代码]¶
基类:
_StrictModel打印日志空值默认标记配置模型
对应 VBA 将打印内容添加到Access数据库() 中的 Br(1..51) 赋值.
- 参数:
customer (str)
project_name (str)
product_name (str)
product_model (str)
dn (str)
pn (str)
medium (str)
temperature (str)
body_material (str)
stem_material (str)
disc_material (str)
tech_requirements (str)
equipment_no (str)
sub_project (str)
sales_sn (str)
category (str)
weight (str)
seq_no (str)
requisition_no (str)
max_inlet_head (str)
max_boost_head (str)
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.OutputConfig(*, shared=<factory>, targets=<factory>, default_target='print', layout_groups=<factory>)[源代码]¶
基类:
_StrictModel统一输出总配置(output.*,驱动 OutputView)
- 参数:
shared (OutputSharedConfig)
targets (dict[str, OutputTargetConfig])
default_target (str)
layout_groups (list[LayoutGroupConfig])
- targets: dict[str, OutputTargetConfig]¶
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.OutputTargetConfig(*, engine='escp', controls=<factory>, run='', required_fields=<factory>, defaults=<factory>, dual_code=<factory>, options=<factory>)[源代码]¶
基类:
_StrictModel单个输出目标配置(output.targets.<name>)
- 参数:
- dual_code: ScanDualCodeConfig¶
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class certflow.config.models.HistoryBackfillConfig(*, enabled=True, source='print_logs', key=<factory>, fallback_fields=<factory>)[源代码]¶
基类:
_StrictModel历史回填兜底配置(output.shared.history_backfill,§11.2)
- model_config = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
基类:
_StrictModel统一输出共享配置(output.shared)
- 参数:
guard_ref (str)
history_backfill (HistoryBackfillConfig)
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].