Commit Graph

71 Commits

Author SHA1 Message Date
Misaka_Company
e5f6f4ee0c feat: add MaterialCode-based deduplication to material validation queries
Implement database-level deduplication using ROW_NUMBER() window function
to remove duplicate material records based on MaterialCode field.

Changes:
- Add query_all_distinct_by_material_code() to deduplicate full table results
- Add query_by_source_numbers_distinct() to deduplicate filtered results
- Update validator to use new deduplication methods with statistics logging
- Retention strategy: keep earliest record (CreateDate ASC, SequenceNumber ASC)

Benefits:
- Reduces data redundancy from 54,358 to 1,679 records (96.91% reduction)
- Improves validation result readability by removing duplicate materials
- Maintains backward compatibility with existing query methods

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-24 16:22:35 +08:00
Misaka_Company
0644bdfb11 feat: add column sorting functionality to material validation table
Add sorting capability for "选择" and "材料名称" columns in the CheckboxTreeview:
- Click column header to cycle through: asc (↑) → desc (↓) → unsort
- Sort "选择" column by checkbox state (checked/unchecked)
- Sort "材料名称" column alphabetically
- Preserve checkbox states during sorting using move() instead of delete+insert
- Separate event handlers for cell clicks and heading clicks

Implementation details:
- Added 6 new helper methods to CheckboxTreeview class
- Store original headings to properly display sort arrows
- Use identify_region() to distinguish between cell and heading clicks
- Column index conversion (#1/#2) to column identifiers

The sorting is a pure frontend feature with no database changes.
Available to all users without permission restrictions.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-24 15:45:55 +08:00
Misaka_Company
4fcb29f488 docs: add comprehensive material validation interface documentation
Add detailed documentation for the material validation interface including:
- System architecture with Mermaid diagrams
- Data flow visualization
- Core component descriptions
- Database table structures
- Dual-priority matching algorithm
- Permission control (Admin vs User)
- Interactive features (checkbox sync, manager filter, table editing)
- Usage scenarios and technical points

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-24 15:00:38 +08:00
Misaka_Company
88b2216db0 fix: prevent AttributeError for User users by skipping filter area creation
- Modified _create_widgets() to conditionally create filter area only for admin users
- Modified _create_filter_checkboxes() to return early for non-admin users
- This prevents AttributeError when accessing self.filter_frame for User users
- Admin users retain full filtering functionality
- Fixes the 'MaterialTypeManagementDialog' object has no attribute 'filter_frame' error

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-24 14:41:17 +08:00
Misaka_Company
ac94b1cb82 refactor: clean up code by removing redundant comments and docstrings
- Remove unused imports (redirect_stdout) from data_extraction_tab.py
- Update docstring to reflect stability fixes in data_extraction_tab.py
- Strip excessive inline comments while preserving essential ones
- Improve code readability by reducing visual noise

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-13 15:19:05 +08:00
Misaka_Company
ed7eaf038b refactor: optimize performance and code quality with significant improvements
Performance optimizations:
- Pre-load database materials into HashSet (O(1) lookup) instead of O(n) per material query
- Add 60s safety timeout on loading waits to prevent deadlocks
- Simplify navigation loop with while True pattern

Code quality improvements:
- Replace print-based logging with proper logging module
- Add _get_input_value() helper to reduce duplication
- Move all imports to top of file (re, time, TimeoutError)
- Remove redundant docstrings and consolidate logic
- Add detailed module docstring explaining optimizations

Bug fixes:
- Fix iframe variable naming conflicts (detail_main_frame, detail_inner_frame)
- Add error handling for individual order processing failures
- Simplify setup_query_interface() logic
- Change password to placeholder for security

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-13 13:57:59 +08:00
Misaka_Company
82819ae9d1 refactor: improve button navigation logic with proper state detection
- Add button-wrapper element locator for accessing action/navigation buttons
- Create dedicated button objects (delete, next material, collapse)
- Add _is_button_enabled() method using Playwright's is_enabled()
- Replace index-based navigation with button state-driven loop
- Add row number change detection to wait for data loading
- Simplify navigation logic with explicit button click handling

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-13 13:06:17 +08:00
Misaka
3b491d7b36 refactor: optimize settings and validation tabs for User users
Material Validation Tab:
- Remove file selection area (file_group and related frames)
- Move output file path configuration to settings
- For User users: hide data source selection, only show shared production IDs

Settings Tab:
- Add "validation output file" configuration to path settings group
- Show "save settings" button for User users
- Add User-only mode to only show path settings group

Changes:
- material_validation_tab.py: Restructure control panel, update export_paths
- settings_tab.py: Add validation output filename, add save button for users

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-11 22:40:07 +08:00
Misaka
28d7db26db feat: add line numbers to Production ID input widget
- Integrate tklinenums library for line number display
- Line numbers appear on the left side in black color
- Line numbers are always visible (even with placeholder)
- Line numbers sync with text scrolling
- Add tklinenums>=1.7.0 to requirements.txt

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-11 22:10:38 +08:00
Misaka
ee0b4187d7 feat: add auto-show scrollbar for Production ID input widget
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>
2026-02-11 21:59:56 +08:00
Misaka
6f8df2f2e6 feat: add Production ID input widget and UI configuration
- 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>
2026-02-11 21:47:17 +08:00
Misaka
62f323d420 refactor: remove data query tab and related code
- 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>
2026-02-11 21:01:58 +08:00
Misaka
b9184bbe3e fix: handle material validation filter for non-admin users
- 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>
2026-02-11 20:59:08 +08:00
Misaka_Company
35b568d647 feat: add cumulative pending quantity validation before material deletion
Added validation to check if cumulative pending quantity is empty before allowing material deletion, with appropriate emoji indicators for delete eligibility.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-10 17:57:03 +08:00
Misaka_Company
d18bedcd77 feat: implement user type-based UI access control
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>
2026-02-10 17:30:26 +08:00
Misaka_Company
db461e39f9 feat: add Admin user selection dialog (管理员用户选择对话框)
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>
2026-02-10 17:05:42 +08:00
Misaka_Company
6d81d5cb76 feat: add computer name-based silent login (无感登录)
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>
2026-02-10 16:44:47 +08:00
Misaka_Company
7264fdc71a fix: handle DatabaseType enum conversion in config management
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>
2026-02-10 16:20:17 +08:00
Misaka_Company
72468ddf23 fix: correct SQL parameter count in DiscreteMaterialPlanDAO batch insert
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>
2026-02-10 16:18:17 +08:00
Misaka_Company
21f5827cd3 chore: remove init_users.sql
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-10 10:56:45 +08:00
Misaka_Company
cff5e78c1d refactor: optimize material deletion with exact code matching and database queries
- 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>
2026-02-10 10:53:53 +08:00
Misaka
6ec7484036 docs: add comprehensive configuration management documentation
Add complete documentation for the configuration system including:
- Architecture design with Mermaid diagrams (5 diagrams)
- Detailed explanation of all 6 configuration modules
- Complete environment variable reference table
- Configuration loading and validation flow
- Usage examples and migration guide
- Troubleshooting section

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-09 23:34:34 +08:00
Misaka
b88ce96194 docs: add comprehensive database architecture documentation
Create detailed database architecture documentation with Mermaid diagrams including:
- Class hierarchy and design patterns (Factory, DAO, Strategy, Template Method)
- Connection management flows and lifecycle
- Database table structures and entity relationships
- SQL dialect handling for SQL Server and MySQL
- Data flow and batch processing logic
- Code examples and best practices

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-09 23:14:40 +08:00
Misaka
aaa46ef282 feat: migrate configuration to .env environment variables
This commit implements a complete migration from JSON-based configuration
to .env environment variables, providing better security and flexibility.

Key Changes:
- Add python-dotenv dependency for environment variable support
- Create config/env_loader.py with type conversion utilities
- Add from_env() class methods to all config dataclasses
- Update ConfigLoader to prioritize environment variables
- Add save_to_env() method for .env file management
- Implement database connection factory pattern
- Add base DAO and connection classes for better abstraction
- Support both SQL Server and MySQL with unified interface
- Create migration script (scripts/migrate_to_env.py)
- Update GUI to read/write .env files
- Add comprehensive migration documentation

New Files:
- config/env_loader.py - Environment variable loader
- db/base_connection.py - Base database connection interface
- db/base_dao.py - Base DAO with common utilities
- db/connection_factory.py - Factory for creating connections
- db/mysql_connection.py - MySQL-specific connection
- db/sqlserver_connection.py - SQL Server-specific connection
- db/table_name_converter.py - SQL dialect converter
- scripts/migrate_to_env.py - Configuration migration tool
- docs/ENV_MIGRATION.md - Complete migration guide
- .env.example - Environment variable template

Testing:
- Verified MySQL connection (8.0.44)
- Tested all DAO operations
- Confirmed 150 tables accessible
- Validated configuration loading

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-09 22:39:14 +08:00
Misaka_Company
04b99292ad feat: implement user authentication and permission-based data filtering
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>
2026-02-09 18:17:31 +08:00
Misaka_Company
57c23f4608 feat: add manager filter to material validation tab
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>
2026-02-09 17:32:59 +08:00
Misaka_Company
2496694f05 ux: add custom result dialog with visual success/failure icons
- 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>
2026-02-09 16:00:15 +08:00
Misaka_Company
192443c3b9 feat: implement inline editing with proper status tracking
- 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>
2026-02-09 15:35:20 +08:00
Misaka_Company
2fb44a2a9b feat: add material type management dialog with checkbox filter
- 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>
2026-02-09 13:17:25 +08:00
Misaka_Company
13d6c20383 refactor: sync all rows with database on confirmation
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>
2026-02-06 17:42:32 +08:00
Misaka_Company
cd21e54abf feat: add material deletion confirmation with checkbox UI
- 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>
2026-02-06 16:40:28 +08:00
Misaka_Company
0ef1b86f12 refactor: rename MaterialsToBeDeleted to MaterialsTypeToBeDeleted
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>
2026-02-06 14:15:51 +08:00
Misaka_Company
ca1a1f3219 refactor: remove Excel data source options from material validation UI
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>
2026-02-06 13:38:48 +08:00
Misaka_Company
2096a51f55 feat: add database-driven material validation with multi-mode support
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>
2026-02-06 13:08:31 +08:00
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
Misaka_Company
3180ccacb8 feat: enhance progress reporting granularity in data extraction workflow
- Break down query phase into 3 detailed steps (read file, query database, complete)
- Split download batch process into 7 granular steps per batch (clear, fill, search, wait, select, configure, download)
- Divide conversion phase into 2 steps per file plus 3 final steps (merge, cleanup)
- Add 'action' parameter to all progress reports for better categorization
- Improve user feedback with more detailed status messages and completion indicators

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-05 15:17:18 +08:00
Misaka_Company
2ca53f6a55 style: normalize code formatting across the codebase
- Standardize quote style (single to double quotes)
- Improve code formatting consistency
- Apply formatting to utilities, GUI components, and tools
- Update imports and docstrings for consistency

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-05 14:56:35 +08:00
Misaka_Company
c34a300f0b docs: add progress callback mechanism documentation
Add comprehensive documentation for _report_progress mechanism:
- System architecture with mermaid diagrams
- Complete sequence diagram showing data flow
- Progress calculation logic with stage weights
- Code examples and usage patterns
- Design considerations (thread safety, decoupling, fault tolerance)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-05 14:38:08 +08:00
Misaka_Company
13bc4520bf refactor: centralize configuration management with type-safe schema
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>
2026-02-05 14:27:28 +08:00
Misaka_Company
885d87dff8 feat: add progress callback mechanism for real-time updates in data extraction
- 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>
2026-02-05 14:06:30 +08:00
Misaka_Company
71621dc8a0 feat: add Tkinter GUI application for ERP automation tools
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>
2026-02-05 13:33:23 +08:00
Misaka_Company
c9e68a2bf0 fix: handle large dataset queries and type conversion
- 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>
2026-02-05 11:28:33 +08:00
Misaka_Company
c6b97443e5 feat: add material status validation tool
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>
2026-02-05 10:11:13 +08:00
Misaka_Company
a78afe383f fix: adjust footer detection logic in excel converter
Changed footer detection to look ahead at the next row instead of the current row, and simplified to only check for '制单人'.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-05 08:39:18 +08:00
Misaka_Company
c176063bfa feat: add material matching logic for discrete material plan cleaner
- 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>
2026-01-23 16:50:14 +08:00
Misaka_Company
902ff9b831 refactor: use database for production order queries
- 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>
2026-01-23 16:06:40 +08:00
Misaka_Company
1e2eed76e2 chore: remove obsolete login.py
The login functionality has been moved to utils/auth.py, and the old login.py file is no longer used.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-23 15:17:12 +08:00
Misaka_Company
60b6fecbb3 chore: move scripts to tools directory
Move analyze_excel.py, excel_to_markdown.py, and locator_helper.py
into the tools/ subdirectory to improve project organization.
2026-01-23 15:12:33 +08:00
Misaka_Company
bbf84b7f8c docs: update project structure and add database documentation
- Add tests/ directory to .gitignore
- Document database connectivity with pyodbc and config
- Add project structure and file organization guidelines
- Update installation steps to use requirements.txt
- Document new dependencies: pandas, openpyxl, pyodbc
2026-01-23 15:00:55 +08:00
Misaka_Company
4b0a882b69 refactor: improve material code input selection
Replace the class-based locator strategy with a text-based filter using regex to accurately identify the material code input field. This change targets elements matching "材料编码" followed by 11 digits, increasing reliability. Also uncommented page2.pause() to assist with debugging the iteration loop.
2026-01-23 14:30:35 +08:00