This commit enhances the material validation functionality to support database-driven workflows alongside the existing Excel-based approach. ## New Features ### DAO Layer - Add ProductionContractDataDAO for querying production contract data - Add MaterialsToBeDeletedDAO with full CRUD operations - Enhance DiscreteMaterialPlanDAO with query_all(), query_by_source_numbers(), and get_unique_material_names() methods ### Validation Modes Support for 4 validation modes in MaterialValidationTab: 1. Database Full - Query all materials from DiscreteMaterialPlanData 2. Database Filtered - Query by ProductionID.txt file 3. Excel Existing - Validate from existing Excel file 4. Excel Full - Complete workflow with ERP extraction ### Configuration - Add ValidationConfig dataclass with data_source, batch_size, match_mode, enable_crud_operations, and default_manager fields - Update ConfigLoader to support validation configuration - Add validation settings section in SettingsTab GUI ### Query Chain Implementation of full query chain: ProductionID.txt (总排号) → productionContractData (生产订单号) → DiscreteMaterialPlanData (SourceNumber) → MaterialName → MaterialsToBeDeleted comparison ## Backward Compatibility All existing Excel-based validation methods remain unchanged, ensuring no breaking changes for existing workflows. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
62 lines
1.5 KiB
Python
62 lines
1.5 KiB
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
默认配置值
|
|
|
|
定义所有配置项的默认值。
|
|
"""
|
|
from config.schema import (
|
|
ERPConfig,
|
|
DatabaseConfig,
|
|
PathConfig,
|
|
ExtractionConfig,
|
|
ValidationConfig,
|
|
AppConfig,
|
|
)
|
|
|
|
|
|
# 默认配置
|
|
DEFAULT_APP_CONFIG = AppConfig(
|
|
erp=ERPConfig(
|
|
url="https://68.11.34.30:8082/",
|
|
username="BLDpengqiangqiang",
|
|
password="Cqbld123456.",
|
|
headless=True,
|
|
ignore_https_errors=True,
|
|
auto_close_browser=True,
|
|
),
|
|
database=DatabaseConfig(
|
|
server="192.168.110.114",
|
|
database="CompanyDB",
|
|
username="peng",
|
|
password="Cqbld123456.",
|
|
driver="ODBC Driver 18 for SQL Server",
|
|
trust_server_certificate="yes",
|
|
),
|
|
paths=PathConfig(
|
|
data_dir="D:/python/playwrite/data/",
|
|
production_id_file="ProductionID.txt",
|
|
default_output="离散备料计划维护_合并.xlsx",
|
|
validation_output="物料状态校验结果.xlsx",
|
|
),
|
|
extraction=ExtractionConfig(
|
|
batch_size=100,
|
|
verbose=True,
|
|
auto_convert=True,
|
|
merge_batches=True,
|
|
enable_db_persistence=False, # Disabled by default
|
|
),
|
|
validation=ValidationConfig(
|
|
data_source="database_full",
|
|
use_database=True,
|
|
batch_size=2000,
|
|
enable_crud_operations=False,
|
|
default_manager="",
|
|
match_mode="substring",
|
|
),
|
|
)
|
|
|
|
|
|
# 兼容旧版本的字典格式
|
|
DEFAULT_SETTINGS_DICT = DEFAULT_APP_CONFIG.to_dict()
|