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>
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 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>
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>