refactor: restructure main_clean.py with dependency injection and interfaces
Refactor discrete material cleaner to improve maintainability and testability: - Introduce dependency injection pattern for service components - Add interfaces (IPageNavigator, IMaterialExtractor, IDeletionChecker) - Extract PageNavigator service for page navigation logic - Extract MaterialExtractor service for data extraction - Extract DatabaseDeletionChecker service for deletion logic - Add MaterialInfo data model for structured data - Centralize configuration (CleanerConfig, UIConstants) - Implement separation of concerns across services layer Also includes comprehensive execution mechanism documentation. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
5
models/__init__.py
Normal file
5
models/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
"""数据模型模块 - 定义数据结构"""
|
||||
|
||||
from models.material_info import MaterialInfo
|
||||
|
||||
__all__ = ["MaterialInfo"]
|
||||
19
models/material_info.py
Normal file
19
models/material_info.py
Normal file
@@ -0,0 +1,19 @@
|
||||
"""
|
||||
物料信息数据模型
|
||||
定义物料信息的数据结构
|
||||
"""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
|
||||
|
||||
@dataclass
|
||||
class MaterialInfo:
|
||||
"""物料信息"""
|
||||
|
||||
serial_number: int # 序号
|
||||
code: str # 物料编码
|
||||
name: str # 物料名称
|
||||
pending_quantity: str # 累计待发数量
|
||||
shipped_quantity: str # 累计出库数量
|
||||
should_delete: bool = False # 是否需要删除
|
||||
Reference in New Issue
Block a user