Implement automatic authentication based on computer name to enable
passwordless login for registered computers with fallback to manual
authentication.
Changes:
- Add SessionManager.login_by_computer_name() for silent login attempt
- Add BIPUsersDAO.authenticate_by_computer_name() for computer name lookup
- Update BIPUsersDAO.create_user() to support optional computer_name parameter
- Update main_ui.py to try silent login before showing login dialog
- Display current computer name in login dialog for user reference
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Fix parameter mismatch error when saving discrete material plan data.
Changed placeholder count from 28 to 29 to match the 29 columns in the
INSERT statement (Factory through BOMVersion).
Resolves error: "The SQL contains 28 parameter markers, but 29 parameters were supplied"
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Change from fuzzy material name matching to exact material code matching
- Migrate from MaterialsTypeToBeDeleted to MaterialsToBeDeleted table
- Add should_delete_material() for on-demand database queries
- Remove in-memory material list loading to reduce memory footprint
- Update documentation to reflect new matching logic
- Remove main scripts from git tracking (contain user-specific config)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add user login system with role-based access control:
- Admin users see all data and can filter by any manager
- Regular users only see records where ManagerName matches their username
New components:
- BIPUsersDAO: user authentication and management
- SessionManager: singleton session state management
- LoginDialog: modal login UI for app startup
- init_users.sql: initial user setup script
Permission enforcement:
- Material validation tab: hide manager filter for non-admin, force filter by current user
- Material type management: hide filter UI for non-admin, filter at database level
- Window title and status bar display current user info
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add MaterialsToBeDeletedDAO for managing material deletion records by MaterialCode
- Add MaterialValidationResult dataclass for enhanced validation results
- Add CheckboxTreeview component with selectable checkbox functionality
- Refactor material validation UI with new columns: select, material name, code, spec, model, manager
- Add double-click to edit manager name functionality
- Add select all/deselect all buttons
- Add confirm deletion button to write selected records to database
- Prioritize MaterialsToBeDeleted.ManagerName over type-based matching when displaying
- Export results to Excel with selection state
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Rename database table and related classes from MaterialsToBeDeleted to MaterialsTypeToBeDeleted for better semantic clarity.
Changes:
- Rename MaterialsToBeDeletedDAO class to MaterialsTypeToBeDeletedDAO
- Update all SQL queries to reference MaterialsTypeToBeDeleted table
- Update import statement in material_status_validator.py
- Update documentation comments
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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>
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>
Major changes:
- Add dataclass-based configuration schema with validation (config/schema.py)
- Create centralized config loader and default values (config/defaults.py, config/loader.py)
- Remove duplicate database_config.py, merge into unified structure
- Consolidate browser settings into ERP config
- Add batch_size parameter support to extractor
Bug fixes:
- Fix settings save error by updating config paths (browser.* → erp.*)
- Fix batch_size not being applied in data extraction
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add batch processing to production order query to handle SQL Server's 2100 parameter limit
- Fix material name column index from Q to R column
- Add string type conversion to prevent TypeError in material matching
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add MaterialStatusValidator tool to check material status and match materials to be deleted:
- Add get_all_materials_to_delete() function to fetch all materials from database
- Add utils/material_status_validator.py with MaterialStatusValidator class
- Add validate_material_status.py script to run the validation
- Delete obsolete materialDelete.py file
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add db/materials_to_delete.py for querying materials to delete by manager
- Add manager_name parameter to DiscreteMaterialPlanCleaner
- Implement material keyword matching logic in process_order
- Update file paths from orderID.txt to ProductionID.txt
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add db/production_order_query.py component for querying production orders
- Replace file-based orderID.txt with database-driven approach
- Read ProductionID.txt (总排号) and query [26年压力表合同数据] table
- Update both extraction and cleaning scripts to use new component
- Change parameter: order_id_file → production_id_file
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>