Files
playwrite/config/defaults.py
Misaka_Company 53a1e33e45 feat: add SQL Server database persistence for extracted material plan data
Add optional database persistence feature that automatically saves extracted
discrete material plan data to SQL Server. Users can enable this feature in
the settings tab.

Changes:
- Add enable_db_persistence flag to ExtractionConfig (default: disabled)
- Create DiscreteMaterialPlanDAO for database operations with REPLACE pattern
- Update progress tracking to include database persistence stage (90-100%)
- Add database persistence checkbox in settings UI
- Remove verbose logging checkbox from data extraction UI (config-only now)
- Update extraction workflow to save merged DataFrame to database

Progress weights adjusted:
- download: 65% -> 60%
- database: 10% (new stage)
- Other stages adjusted accordingly

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-06 12:21:58 +08:00

53 lines
1.3 KiB
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
默认配置值
定义所有配置项的默认值。
"""
from config.schema import (
ERPConfig,
DatabaseConfig,
PathConfig,
ExtractionConfig,
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
),
)
# 兼容旧版本的字典格式
DEFAULT_SETTINGS_DICT = DEFAULT_APP_CONFIG.to_dict()