When content overflows in the Production ID text input, the scrollbar
now automatically appears. When content fits within the visible area,
the scrollbar is hidden.
- Changed layout from pack to grid for dynamic scrollbar control
- Added yview-based overflow detection (last < 1.0 indicates overflow)
- Added debounce mechanism to prevent excessive checks
- Bound events: KeyRelease, ButtonRelease, Configure, Paste
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add ProductionIdInput widget with placeholder and multi-line support
- Add UIConfig class for font family, font size, and input width settings
- Refactor data extraction tab to use horizontal PanedWindow layout
- Left panel: Production ID text input (draggable width)
- Right panel: control panel and log output
- Share Production IDs between data extraction and material validation tabs
- Add UI settings group in settings page (font selection, size, input width)
- For User users: automatically use shared Production IDs, simplified UI
- Apply font settings to input and log widgets
- Use sashpos() to set initial pane width correctly
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Remove DataQueryTab class and data_query_tab.py file
- Remove data query tab from main window
- Update about dialog to remove data query feature description
- Update database description from "SQL Server" to generic "数据库"
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Fix _get_selected_managers() to return current username for non-admin users
- Fix _restore_manager_filter_state() to skip checkbox operations for non-admin users
- Initialize filter_frame attribute for non-admin users to avoid AttributeError
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Restrict settings interface and material validation features based on user type:
- SettingsTab: User type only sees "Test ERP Connection" and "Test Database Connection" buttons; Admin sees full configuration interface
- MaterialValidationTab: Hide manager filter and data source options from non-admin users; default to database_filtered mode
- test_db_connection(): Read from config directly to support User type without UI variables
- Add backward compatibility: no session_manager defaults to full interface
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
When an Admin user logs in, display a centered dialog allowing them to
select which user identity to use for the session. The Admin adopts the
selected user's permissions and operates as that user throughout the session.
Changes:
- Add UserSelectionDialog class in gui/user_selection_dialog.py
- Add SessionManager.switch_user() method to switch user identity
- Add SessionManager.get_original_admin() method to retrieve original admin
- Update MainWindow status bar to show when Admin operates as another user
- Display format: "当前用户: {username} ({type}) - 以 {admin_username} 身份登录"
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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 type conversion issues when handling DatabaseType enum values in
configuration loading and GUI updates.
- config/loader.py: Handle both enum and string types for DB_TYPE
- config/schema.py: Properly convert db_type when it's already a string
- gui/config_manager.py: Add Enum type conversion with validation in set_nested_value
These changes prevent AttributeError when accessing .value on string values
and ensure proper type handling throughout the configuration system.
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 checkbox-based manager filter functionality to material validation page:
- Canvas-based filter UI with 6-column grid layout for manager checkboxes
- Select All / Deselect All quick action buttons
- Filter source: union of MaterialsToBeDeleted and MaterialsTypeToBeDeleted tables
- Auto-include records with empty manager field for editing
- Preserve filter state across validation runs
- Support for MaterialValidationResult dataclass objects
- Refresh filter and results after confirm deletion operation
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add ResultDialog class with green checkmark (✓) for success
- Add red X (✕) icon for failure/partial failure
- Center result dialog on screen
- Use color-coded backgrounds (green/red) for better visual feedback
- Replace standard messagebox for more intuitive result display
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add EditableTreeview class for inline cell editing
- Handle invisible cells by scrolling to view before editing
- For new rows, allow partial input without validation errors
- Only validate completeness when saving, not during editing
- Add proper exception handling in edit callbacks
- Track original values for modified records
- Use temp keys for new rows that get updated when data is complete
- Fix status update to show after new row data is entered
- Clear edit state before destroying Entry to prevent duplicate callbacks
This enables users to:
- Double-click or press F2 to edit cells directly
- Press Insert to add new rows
- Press Delete to remove selected rows
- See visual indicators (green/yellow) for new/modified rows
- Get accurate status updates for pending changes
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add MaterialTypeManagementDialog for managing MaterialsTypeToBeDeleted table
- Implement checkbox-based filtering by manager name with dynamic manager list
- Support CRUD operations: create, read, update, delete with local caching
- Add "类型管理" button in material validation tab to open the dialog
- Include select all/deselect all functionality for manager filters
- Track pending changes and show unsaved changes warning
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Changed "确认删除" button to process ALL table rows (both checked and unchecked):
- Checked rows (☑): Upsert MaterialCode and ManagerName to database
- Unchecked rows (☐): Delete MaterialCode from database
- Validation: Checked rows must have ManagerName
This replaces the previous behavior that only processed checked items.
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>
Simplify material validation tab by removing Excel-related data source options and associated logic, keeping only database-driven validation modes.
Changes:
- Remove Excel file and Excel full workflow radio buttons from UI
- Remove Excel file selector components (excel_existing_frame, excel_full_frame)
- Update _on_source_mode_change to handle only database modes
- Simplify start_validation input validation for database modes only
- Update _validation_worker to call only database validation methods
The UI now presents only two data source options:
1. Database - Full table validation
2. Database - ProductionID filtered validation
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 ProgressInfo and ProgressCalculator classes for structured progress tracking
- Implement RealtimeOutput for immediate log display without buffering
- Add progress callback support to DiscreteMaterialPlanExtractor
- Use queue-based thread-safe communication for GUI progress updates
- Fix log output issue where all content appeared at once after completion
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Implement a comprehensive GUI application with the following features:
- Data Extraction tab: Extract material plan data from ERP system
- Material Validation tab: Validate material status and match deletions
- Data Query tab: Query database for production order information
- Settings tab: Manage ERP, database, browser, and path configurations
Key components:
- MainWindow: Tabbed interface with status bar
- ConfigManager: JSON-based configuration management
- LogText: Custom read-only text widget with colored logging
- FileSelector: Reusable file/directory selection component
- ProgressDialog: Modal progress dialog for long operations
Technical details:
- Thread-safe UI updates using root.after()
- Stdout capture for legacy script integration
- Event-based readonly mode allowing copy/select operations
- Custom widget composition to avoid Tkinter ScrolledText issues
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>