- Fix multi-WO display: auto-select all tree roots after resolve so detail panel loads data for every work order, not just the first seed CID - Disable scroll-wheel zoom on lineage tree (roam: 'move') to prevent accidental layout jumps while preserving drag-pan - Add batch API endpoints (get_lot_history_batch, get_lot_associations_batch) to avoid N parallel requests hitting rate limits - Remove redundant Split sub-tab from LOT detail (tree already shows splits) - Rename 退貨 → 報廢 to match actual reject/scrap data semantics - Hide internal ID columns (CONTAINERID, EQUIPMENTID, RESOURCEID) from history table display - Add timeline scroll container and time range header for long timelines - Remove obsolete migration and architecture docs no longer needed Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3.6 KiB
3.6 KiB
1. Contract and Skeleton Setup
- 1.1 Create backend blueprint scaffold
src/mes_dashboard/routes/reject_history_routes.pyand register it insrc/mes_dashboard/routes/__init__.py - 1.2 Create service scaffold
src/mes_dashboard/services/reject_history_service.pywith SQL loader helpers - 1.3 Create frontend entry scaffold
frontend/src/reject-history/index.html,frontend/src/reject-history/main.js, andfrontend/src/reject-history/App.vue - 1.4 Add Vite input for
reject-historyinfrontend/vite.config.js
2. SQL and Metric Semantics Implementation
- 2.1 Finalize base query
src/mes_dashboard/sql/reject_history/performance_daily.sqlfor five-reject-sum + defect separation - 2.2 Add API-specific SQL files in
src/mes_dashboard/sql/reject_history/(summary, trend, reason_pareto, list, export) - 2.3 Implement
MOVEIN_QTYdedupe byHISTORYMAINLINEIDwith deterministic fallback key - 2.4 Implement consistent rate calculations (
REJECT_RATE_PCT,DEFECT_RATE_PCT,REJECT_SHARE_PCT) with zero-denominator handling
3. Backend API Routes
- 3.1 Implement
GET /api/reject-history/summarywith date/filter validation - 3.2 Implement
GET /api/reject-history/trendwithgranularityvalidation (day|week|month) - 3.3 Implement
GET /api/reject-history/reason-paretowithmetric_modevalidation (reject_total|defect) - 3.4 Implement
GET /api/reject-history/listwith paging bounds and reason/category filters - 3.5 Implement
GET /api/reject-history/exportand CSV output contract - 3.6 Apply configured rate limiting to list/export endpoints
4. Frontend Visual and Interaction Implementation
- 4.1 Build page header with title, data timestamp, and semantic badges for charge-off reject vs non-charge-off defect
- 4.2 Build filter panel (date range + dimensions + query/clear actions) and wire it to all API calls
- 4.3 Implement KPI card row (8 cards) with warm/cool semantic color lanes and zh-TW number formatting
- 4.4 Implement dual trend charts (quantity trend + rate trend) using ECharts with synchronized date buckets
- 4.5 Implement reason Pareto chart/table with
metric_modeswitch and cumulative percentage line - 4.6 Implement detail table with pagination, active filter chips, and empty/error states
- 4.7 Implement CSV export action using current filter context
- 4.8 Add responsive rules so filter/cards/charts/table stay usable on tablet/mobile widths
5. Shell and Route Governance Integration
- 5.1 Add
/reject-historycontract entry tofrontend/src/portal-shell/routeContracts.js - 5.2 Add
/reject-historyloader tofrontend/src/portal-shell/nativeModuleRegistry.js - 5.3 Add
/reject-historypage metadata (drawer/order/status) todata/page_status.json - 5.4 Add Flask page route
/reject-historyusingsend_from_directorywith dist fallback HTML
6. Tests and Quality Gates
- 6.1 Add service tests in
tests/test_reject_history_service.pycovering formulas, dedupe, and edge cases - 6.2 Add route tests in
tests/test_reject_history_routes.pycovering validation, payload shape, and rate-limit behavior - 6.3 Add/extend route-contract parity and shell coverage tests for
/reject-history - 6.4 Add frontend smoke/integration test for query flow and major visual sections
7. Documentation and Rollout
- 7.1 Update implementation notes under
docs/reject_history_performance.mdto match API/UI field names - 7.2 Document rollout policy (
devvisibility first, thenreleased) and rollback path - 7.3 Run end-to-end verification checklist and capture evidence before implementation handoff