Commit Graph

81 Commits

Author SHA1 Message Date
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
Misaka_Company
ebd53b168e refactor: improve locator precision and data extraction
Refine element selection by introducing a specific parent container `.card-table-side-box` to enhance locator accuracy. Replace the previous text-parsing approach for material codes with direct input value retrieval. Additionally, add support for extracting cumulative pending and outbound quantities to improve data completeness.
2026-01-23 13:52:52 +08:00
Misaka_Company
cf88800444 feat: Check preparation status before cleaning data
Added logic to extract and validate the "Material Preparation Status" (备料状态) before modifying discrete material plans.

The cleanup process now only proceeds if the status is "审批通过" (Approval Passed). Orders with other statuses are skipped to prevent errors during modification. This change also includes code cleanup by removing commented-out debug statements.
2026-01-23 11:11:22 +08:00
Misaka_Company
acd19025d4 Stop tracking orderID.txt 2026-01-22 18:17:40 +08:00
Misaka_Company
201f65d715 feat: implement material plan data cleaning automation
Remove manual exit prompt in main script to allow automated execution.
Add logic in DiscreteMaterialPlanCleaner to navigate the "Material Plan" popup, handling nested iframes and waiting for data to load. Implement iteration over material details to extract codes and names, handling cases where no details exist.
2026-01-22 18:14:56 +08:00
Misaka_Company
8708709cac feat: add discrete material plan data cleaning tool
Implement a new automation script and utility to handle the cleaning of
discrete material plan maintenance data.

- Add main_clean.py as the primary entry point, configuring the cleaner
  instance and reading order IDs.
- Add DiscreteMaterialPlanCleaner in utils/ utilizing Playwright to automate
  browser interactions.
- Implement logic for user authentication (login/logout), UI setup for
  queries, and processing individual orders.
- Include verbose logging and debug mode support for troubleshooting.
2026-01-22 15:55:38 +08:00
Misaka_Company
24acc39411 Update .gitignore to include orderID.txt for better file management 2026-01-20 10:49:29 +08:00
Misaka_Company
525d2920e3 Add Excel to Markdown converter with support for multiple sheets and customizable output 2026-01-20 10:48:52 +08:00
Misaka_Company
92d4572985 Refactor ExcelConverter to streamline logging and enhance summary reporting 2026-01-16 15:59:25 +08:00
Misaka_Company
bb9348d12b Refactor DiscreteMaterialPlanExtractor to use logout function from auth module and update headless mode in main script 2026-01-16 15:20:05 +08:00
Misaka_Company
93f986260e Add logout functionality to DiscreteMaterialPlanExtractor for improved session management 2026-01-16 14:59:18 +08:00
Misaka_Company
51cba4caee Refactor main script to utilize DiscreteMaterialPlanExtractor for data extraction and streamline order processing 2026-01-16 13:51:20 +08:00
Misaka_Company
c8a9c33ecc Refactor download and file merging logic to use ExcelConverter for improved data handling 2026-01-16 13:01:54 +08:00
Misaka_Company
4d441be304 Add ExcelConverter module and demo script for Excel data transformation 2026-01-16 12:51:06 +08:00
Misaka_Company
f9651ccf07 Add Excel analysis and conversion scripts for order data processing 2026-01-16 11:15:19 +08:00
Misaka_Company
537cb58f2e Enhance order number input with retry logic for improved reliability 2026-01-16 10:20:54 +08:00
Misaka_Company
01b682d122 Refactor main script to enhance batch downloading of order data and implement file merging functionality 2026-01-16 10:19:58 +08:00
Misaka_Company
b4607e93e4 Reorder order number input to improve query flow in main script 2026-01-16 09:26:53 +08:00
Misaka_Company
d75cacee2c Add locator helper module and enhance main script for element interaction 2026-01-16 08:46:02 +08:00
Misaka_Company
632940cfed Implement login module for user authentication in BIP system 2026-01-15 10:47:27 +08:00
Misaka_Company
4682e37ead Add .gitignore and CLAUDE.md for project setup and guidance 2026-01-15 10:31:12 +08:00
Misaka_Company
e3925c287f first commit 2026-01-13 10:51:01 +08:00