Commit Graph

249 Commits

Author SHA1 Message Date
Misaka_Company
6ad916998c feat: add IPC handlers for Playwright browser download 2026-03-24 15:41:09 +08:00
Misaka_Company
32df3cea67 feat: add Playwright browser download service and preload types 2026-03-24 15:33:52 +08:00
Misaka
c09e0eb4e7 test: cover renderer state helpers 2026-03-21 19:45:19 +08:00
Misaka
86614efa22 refactor: lazy load renderer dialogs 2026-03-21 19:32:03 +08:00
Misaka
16ac892c93 refactor: isolate extractor and update dialog state 2026-03-21 19:28:01 +08:00
Misaka
1fc2eab816 refactor: split cleaner page layout 2026-03-21 19:15:35 +08:00
Misaka
2baf55bd2e refactor: split app bootstrap and shell 2026-03-21 19:05:10 +08:00
Misaka
13db99d51d refactor: extract update catalog decisions 2026-03-21 18:14:08 +08:00
Misaka
84c6b81959 refactor: split update service responsibilities 2026-03-21 18:06:10 +08:00
Misaka
9a1f5a483e fix: harden startup flow and auth re-entry 2026-03-21 11:02:17 +08:00
Misaka
ed65312fff refactor: split preload api by domain 2026-03-21 10:49:13 +08:00
Misaka
26c05f3726 refactor: move ipc orchestration into application services 2026-03-21 10:40:36 +08:00
Misaka
546d005c19 refactor: split main process bootstrap flow 2026-03-21 10:33:33 +08:00
Misaka
2b4a09dabe fix: resolve lint and typecheck issues 2026-03-21 09:33:07 +08:00
Misaka
2fba07fd8f fix: restore full typecheck stability 2026-03-21 09:17:58 +08:00
Misaka
7b57545127 refactor: extract cleaner hook helpers and api 2026-03-21 09:02:45 +08:00
Misaka
b979b73ba1 refactor: split validation handler responsibilities 2026-03-21 08:54:35 +08:00
Misaka
7d73592d41 Merge remote-tracking branch 'origin/dev' into dev 2026-03-20 23:25:32 +08:00
Misaka
6ad9463e73 feat: rebuild portable auto-update flow 2026-03-20 21:20:28 +08:00
Misaka_Company
7644b8d4ea feat(report-viewer): add searchable combobox for report selection
Replace native select dropdown with Headless UI Combobox component to enable:
- Search/filter functionality for reports
- Better UX with keyboard navigation
- Improved visual feedback for selected items
- Empty state handling for no matches

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 17:33:16 +08:00
test
5e50a8fbcf feat(report-viewer): add syntax highlighting and GitHub-style markdown rendering
Add rehype plugins for enhanced markdown rendering:
- rehype-highlight: syntax highlighting for code blocks
- rehype-slug: generates heading IDs for anchoring
- rehype-autolink-headings: auto-links headings
- github-markdown-css: GitHub-flavored markdown styling

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 20:13:40 +08:00
Misaka_Company
29f29f6a9e feat(cleaner): expand protected row number range to 2000-7999
Change the protected row number range from 7000-7999 to 2000-7999 to prevent deletion of materials in this broader range.

- Updated isMaterialDeletable() method logic
- Updated getSkipReason() error messages
- Updated test cases to reflect new range boundaries
- Updated documentation templates and error collection guide

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 13:14:09 +08:00
google-labs-jules[bot]
a020ee537d feat: Add Report Viewer Dialog to Cleaner Page
Added a new "View Reports" button to the CleanerPage which opens a new ReportViewerDialog. This dialog lists all available execution reports stored in S3 for the current user, or for all users if the current user is an admin.
The reports are downloaded as Markdown and rendered using react-markdown.
Added three new IPC channels to fetch and download reports using the existing RustfsService and S3Client.

Co-authored-by: luwamgere15-crypto <255338376+luwamgere15-crypto@users.noreply.github.com>
2026-03-17 23:03:13 +00:00
test
f5514dd721 Merge branch 'dev' 2026-03-17 22:03:01 +08:00
test
b94640ca81 fix(modal): prevent accidental closure during execution
- Add disableBackdropClick prop to Modal component
- Prevent closing ExecutionReportDialog by clicking backdrop during execution
- Complements existing disableEscapeKey behavior for ongoing operations

This prevents users from accidentally interrupting long-running operations by clicking outside the dialog.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 22:02:00 +08:00
test
b8163d7d4f refactor(cleaner): improve order number tracking and error reporting
- Add QueryResultRow interface to represent query results with order numbers
- Add collectQueryResultRows() method to extract order numbers upfront before processing
- Add extractOrderNumberFromQueryRow() helper to parse order numbers from query result cells
- Process rows with order number context instead of just row indexes
- Use actual order numbers in error details instead of BATCH_ROW_X placeholders
- Pass expected order number to detail processing for better validation
- Fix retry success handling to properly update statistics when retries succeed

This change provides better error context by associating each processed row with its actual order number from the query results, improving traceability and debugging.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 21:53:13 +08:00
Misaka_Company
fbcc656b99 fix(order-resolver): support case-insensitive production ID lookup
Add case-insensitive comparison for production ID database queries:
- SQL Server: use COLLATE SQL_Latin1_General_CP1_CI_AS
- MySQL: use UPPER() function for both field and input
- Map lookup: store keys in lowercase for consistent matching

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-17 16:37:59 +08:00
Misaka_Company
3854c0f048 Merge branch 'dev-rustfs' into dev 2026-03-17 15:49:31 +08:00
Misaka_Company
7bc6daf1b7 feat(rustfs): add test script, dependencies, and configuration template
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-17 15:49:20 +08:00
Misaka_Company
db44618ee5 feat(rustfs): integrate report upload into cleaner execution flow
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-17 15:48:50 +08:00
Misaka_Company
2d17a6b792 feat(rustfs): add RustFS configuration schema and manager support
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-17 15:48:16 +08:00
Misaka_Company
e8aa7d21a8 feat(rustfs): add RustFS object storage service for report persistence
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-17 15:30:00 +08:00
Misaka_Company
defeb01808 fix: show elapsed time in execution result dialog
- Remove setStartTime(null) from finally block to preserve start time for result display
- Add resetStartTime function to useCleaner hook
- Call resetStartTime when execution report dialog closes
- Add useEffect to update timer when execution completes

Now the total elapsed time (总耗时) will be shown in the result dialog after execution completes.
2026-03-17 14:50:57 +08:00
Misaka_Company
b289fb9624 fix: use updateProcessConcurrency to persist slider changes to config.yaml
- CleanerPage now uses updateProcessConcurrency instead of setProcessConcurrency
- This ensures slider changes are persisted to config.yaml via IPC
- Remove unused queryBatchSize and setProcessConcurrency from destructuring
2026-03-17 10:57:24 +08:00
test
103effcfca ♻️ style: format code with Prettier and fix .gitattributes
- Add *.yaml text eol=lf rule to .gitattributes for consistent line endings
- Format cleaner.ts with Prettier (parameter and chain formatting)
- Format CleanerPage.tsx (JSX formatting)
- Format cleaner.test.ts (array formatting)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-16 22:42:16 +08:00
test
6a2fba0e57 refactor(cleaner): batch query and controlled parallel order processing 2026-03-16 21:47:13 +08:00
Misaka_Company
9248be6310 ♻️ refactor(ui): use global toast system in SettingsPage
- Replace local message state with global showSuccess/showError
- Remove inline message display component from SettingsPage
- Center toast notifications for better visibility

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 16:16:06 +08:00
Misaka_Company
ad8b3deb00 feat(order-resolver): add deduplication logic for production order number resolution
- Add P0: DISTINCT in SQL query to prevent database duplicates
- Add P1: Input layer deduplication to avoid redundant queries
- Add P2: Return layer deduplication in getValidOrderNumbers()
- Optimize resolve() to use batch query instead of loop queries
- Add getDeduplicationReport() for human-readable mapping summary
- Improve extraction logs to show deduplication statistics
- Only log merged mappings (multiple productionIDs → one order number)
- Remove duplicate marking as error (normal business scenario)
- Bump version to 1.0.1

Example log output:
  输入 5 个总排号 → 解析为 2 个唯一订单号(3 个重复已合并)
  重复合并详情:
    SC70202603120085 ← 26B12214、26B12213、26B12212 (共 3 个总排号)
    SC70202603120131 ← 26B12125、26B12126 (共 2 个总排号)
2026-03-16 16:02:52 +08:00
Misaka_Company
cccc4e4c8c feat(ui): display version and git hash in header
Add version info display below "ERP Auto" logo showing format:
${version}(${git-hash})

- Inject __APP_VERSION__ and __GIT_HASH__ via vite define
- Add TypeScript declarations for global constants
- Simplify portable artifact name (remove version)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 15:00:38 +08:00
Misaka_Company
9e577a2226 fix(types): add missing clearSharedProductionIds to ValidationAPI
The method was implemented in preload/index.ts but missing from the
type definition, causing TypeScript compilation to fail.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 09:59:36 +08:00
Misaka_Company
715dfb4d71 feat(cleaner): add automatic retry mechanism for failed orders
- Add retry logic with max 2 attempts per failed order
- Track retry statistics (retriedOrders, successfulRetries)
- Generate detailed retry report section in execution reports
- Display retry metrics in ExecutionReportDialog UI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 15:59:10 +08:00
test
a25ffd75c5 Merge branch 'dev' of github.com:Misaka-Dev-Hub/ERPAuto into dev 2026-03-10 19:20:54 +08:00
Misaka_Company
8eaba79c26 fix(order-resolver): correct SQL Server table name conversion for productionId lookup
- Fix getTableName to properly split schema_tablename format
- Convert productionContractData_26年压力表合同数据 to [productionContractData].[26年压力表合同数据]
- Extend productionId pattern to support 1-6 digit serial numbers

Co-Authored-By: Claude (glm-5) <noreply@anthropic.com>
2026-03-09 09:31:32 +08:00
test
77fabf2018 fix(shared-state): clear shared Production IDs when input is cleared
Fixes a bug where clearing the order number input in the extraction page
did not clear the shared Production IDs in the main process. This caused
the data cleanup page to continue using stale data when filtering by
Production ID.

Changes:
- Add VALIDATION_CLEAR_SHARED_PRODUCTION_IDS IPC channel
- Register handler to clear shared Production IDs by sender ID
- Expose clearSharedProductionIds API in preload script
- Update ExtractorPage to call clear when order numbers are empty

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-08 21:58:56 +08:00
test
13187ddce1 feat(validation): add source number validation checks with localized error messages
Add validation to detect and report when no order numbers are found from Production IDs (either from shared inputs or file). Provides clear Chinese error messages to guide users when their inputs don't match any database records.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-08 19:18:54 +08:00
test
33b17e278d refactor(ui): replace native alerts with toast notifications and confirm dialogs
This commit refactors all native browser alert() and confirm() dialogs to use
the app's custom UI components for consistent user experience.

**Changes:**
- Add ConfirmDialog component with danger/warning/info variants
- Add useConfirmDialog hook for promise-based dialog API
- Add formatListMessage utility for truncating long lists
- Replace 18 alert() calls with toast notifications in useCleaner.ts
- Replace 7 alert()/confirm() calls in MaterialTypeManagementDialog.tsx
- Render Toast component in App.tsx for global notifications
- Add keyboard shortcuts (Enter to confirm, Escape to cancel)

**Benefits:**
- Consistent UI design across all notifications
- Non-blocking notifications for better UX
- Better accessibility with proper ARIA roles and focus management
- Multi-line message support with truncation for long lists

**Files Modified:**
- src/renderer/src/components/ui/ConfirmDialog.tsx (new)
- src/renderer/src/stores/useAppStore.ts (add formatListMessage)
- src/renderer/src/hooks/useCleaner.ts (refactor error handling)
- src/renderer/src/components/MaterialTypeManagementDialog.tsx (refactor dialogs)
- src/renderer/src/pages/CleanerPage.tsx (add ConfirmDialog)
- src/renderer/src/App.tsx (render Toast component)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-08 19:13:25 +08:00
test
bcfe0eecca fix(a11y): improve focus restoration with timing fixes, validation, and error handling
Core improvements:
- Fix focus restoration timing by using queueMicrotask only (removed double-layer async)
- Add comprehensive error handling with dev-mode logging for all failure scenarios
- Validate element visibility (display: none, visibility: hidden) before restoring focus
- Check disabled state and implement fallback to nearest focusable ancestor
- Add findNearestFocusableElement() helper for robust fallback strategy
- Add tabindex="-1" to focusable selectors for better focus management
- Use preventScroll option when calling focus() to prevent scroll jumps

Additional fixes:
- Remove unnecessary type conversion in Modal.tsx
- Fix TypeScript unused variable errors in main process
- Clean up unused imports in bip-users-dao.ts
- Add ARIA attributes and focus management to LoginDialog
- Add triggerRef support to UserSelectionDialog and ExecutionReportDialog
- Refactor ExecutionReportDialog to use Modal component
- Improve MaterialTypeManagementDialog with focus management

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-08 18:29:39 +08:00
test
9a640b96e6 test(e2e): improve dialog focus tests and code quality
Test improvements:
- Add error handling for Electron app launch in headless environments
- Update dialog selectors to use ARIA attributes for better reliability
- Implement actual test logic (previously skipped placeholders)
- Add screenshot capture evidence for test results
- Update test descriptions to match actual dialog types

Code quality improvements:
- Change 'let' to 'const' for variables that are not reassigned
- Improves code clarity and follows best practices

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-08 17:59:35 +08:00
test
5b4d7fab49 refactor(a11y): optimize dialog focus management with centralized Escape handling
Enhanced the useDialogFocus hook to support conditional Escape key handling,
removing redundant Escape key listeners from individual dialog components.

Changes:
- Added shouldCloseOnEscape option to useDialogFocus (boolean or function callback)
- Removed redundant Escape key handlers from Modal, ExecutionReportDialog, and LoginDialog
- ExecutionReportDialog now uses shouldCloseOnEscape: () => !isExecuting to prevent
  closing during execution
- LoginDialog no longer has manual focus effect (handled by initialFocusSelector)
- Fixed React hooks order violations in ExecutionReportDialog
- Added proper TypeScript return types throughout

Benefits:
- Centralized Escape key logic in one place
- Consistent behavior across all dialogs
- Reduced code duplication (~50 lines removed)
- Easier to maintain and extend

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-03-08 17:58:16 +08:00
test
72d8d981b1 feat(a11y): add focus management to UserSelectionDialog and ExecutionReportDialog
UserSelectionDialog:
- Add ARIA attributes (role, aria-modal, aria-labelledby)
- Integrate useDialogFocus hook with FocusLock
- Add Escape key handling (was missing)
- Initial focus on first user card

ExecutionReportDialog:
- Add ARIA attributes with dynamic aria-labelledby
- Add aria-live for progress updates
- Integrate useDialogFocus hook with FocusLock
- Escape key only closes when not executing
2026-03-08 17:16:53 +08:00