feat(reject-history): fix Pareto datasources, multi-select filtering, and UX enhancements
- Fix dimension Pareto datasources: PJ_TYPE/PRODUCTLINENAME from DW_MES_CONTAINER, WORKFLOWNAME from DW_MES_LOTWIPHISTORY via WIPTRACKINGGROUPKEYID, EQUIPMENTNAME from LOTREJECTHISTORY only (no WIP fallback), workcenter dimension uses WORKCENTER_GROUP - Add multi-select Pareto click filtering with chip display and detail list integration - Add TOP 20 display scope selector for TYPE/WORKFLOW/機台 dimensions - Pass Pareto selection (dimension + values) through to list/export endpoints - Enable TRACE_WORKER_ENABLED=true by default in start_server.sh and .env.example - Archive reject-history-pareto-datasource-fix and reject-history-pareto-ux-enhancements - Update reject-history-api and reject-history-page specs with new Pareto behaviors Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -87,6 +87,16 @@ The API SHALL provide CSV export using the same filter and metric semantics as l
|
||||
- **THEN** CSV headers SHALL include both `REJECT_TOTAL_QTY` and `DEFECT_QTY`
|
||||
- **THEN** export rows SHALL follow the same semantic definitions as summary/list endpoints
|
||||
|
||||
#### Scenario: Cached export supports full detail-filter parity
|
||||
- **WHEN** `GET /api/reject-history/export-cached` is called with an existing `query_id`
|
||||
- **THEN** the endpoint SHALL apply primary policy toggles, supplementary filters, trend-date filters, metric filter, and Pareto-selected item filters
|
||||
- **THEN** returned rows SHALL match the same filtered detail dataset semantics used by `GET /api/reject-history/view`
|
||||
|
||||
#### Scenario: CSV encoding and escaping are stable
|
||||
- **WHEN** either export endpoint returns CSV
|
||||
- **THEN** response charset SHALL be `utf-8-sig`
|
||||
- **THEN** values containing commas, quotes, or newlines SHALL be CSV-escaped correctly
|
||||
|
||||
### Requirement: Reject History API SHALL centralize SQL in reject_history SQL directory
|
||||
The service SHALL load SQL from dedicated files under `src/mes_dashboard/sql/reject_history/`.
|
||||
|
||||
|
||||
22
openspec/specs/reject-history-detail-export-parity/spec.md
Normal file
22
openspec/specs/reject-history-detail-export-parity/spec.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# reject-history-detail-export-parity Specification
|
||||
|
||||
## Purpose
|
||||
TBD - created by archiving change reject-history-pareto-ux-enhancements. Update Purpose after archive.
|
||||
## Requirements
|
||||
### Requirement: Cached reject-history export SHALL support Pareto multi-select filter parity
|
||||
The cached export endpoint SHALL support Pareto multi-select context so that exported rows match the currently drilled-down detail scope.
|
||||
|
||||
#### Scenario: Apply selected Pareto dimension values
|
||||
- **WHEN** export request provides `pareto_dimension` and one or more `pareto_values`
|
||||
- **THEN** the backend SHALL apply an OR-match filter against the mapped dimension column
|
||||
- **THEN** only rows matching selected values SHALL be exported
|
||||
|
||||
#### Scenario: No Pareto selection keeps existing behavior
|
||||
- **WHEN** `pareto_values` is absent or empty
|
||||
- **THEN** export SHALL apply no extra Pareto-selected-item filter
|
||||
- **THEN** existing supplementary and interactive filters SHALL still apply
|
||||
|
||||
#### Scenario: Invalid Pareto dimension is rejected
|
||||
- **WHEN** `pareto_dimension` is not one of supported dimensions
|
||||
- **THEN** API SHALL return HTTP 400 with descriptive validation error
|
||||
|
||||
@@ -77,25 +77,30 @@ The page SHALL show both quantity trend and rate trend to avoid mixing unit scal
|
||||
The page SHALL provide a Pareto view for loss reasons and support downstream filtering.
|
||||
|
||||
#### Scenario: Pareto rendering and ordering
|
||||
- **WHEN** reason Pareto data is loaded
|
||||
- **WHEN** Pareto data is loaded
|
||||
- **THEN** items SHALL be sorted by selected metric descending
|
||||
- **THEN** a cumulative percentage line SHALL be shown
|
||||
|
||||
#### Scenario: Default 80% cumulative display mode
|
||||
#### Scenario: Pareto 80% filter is managed in supplementary filters
|
||||
- **WHEN** the page first loads Pareto
|
||||
- **THEN** it SHALL default to "only cumulative top 80%" mode
|
||||
- **THEN** Pareto SHALL only render categories within the cumulative 80% threshold under current filters
|
||||
- **THEN** supplementary filters SHALL include "Pareto 僅顯示累計前 80%" control
|
||||
- **THEN** the control SHALL default to enabled
|
||||
|
||||
#### Scenario: Full Pareto toggle mode
|
||||
- **WHEN** user turns OFF the 80% cumulative display mode
|
||||
- **THEN** Pareto SHALL render all categories after applying current filters
|
||||
- **THEN** switching mode SHALL NOT reset existing time/reason/workcenter-group filters
|
||||
#### Scenario: TYPE/WORKFLOW/機台 support display scope selector
|
||||
- **WHEN** Pareto dimension is `TYPE`, `WORKFLOW`, or `機台`
|
||||
- **THEN** the UI SHALL provide `全部顯示` and `只顯示 TOP 20` options
|
||||
- **THEN** `全部顯示` SHALL still respect the current 80% cumulative filter setting
|
||||
|
||||
#### Scenario: Pareto click filtering
|
||||
- **WHEN** user clicks a Pareto bar or row
|
||||
- **THEN** the selected reason SHALL become an active filter chip
|
||||
- **THEN** detail list SHALL reload with that reason
|
||||
- **THEN** clicking the same reason again SHALL clear the reason filter
|
||||
#### Scenario: Pareto click filtering supports multi-select
|
||||
- **WHEN** user clicks Pareto bars or table rows
|
||||
- **THEN** clicked items SHALL become active selected chips
|
||||
- **THEN** multiple selected items SHALL be supported at the same time
|
||||
- **THEN** detail list SHALL reload using current selected Pareto items as additional filter criteria
|
||||
|
||||
#### Scenario: Re-click clears selected item only
|
||||
- **WHEN** user clicks an already selected Pareto item
|
||||
- **THEN** only that item SHALL be removed from selection
|
||||
- **THEN** remaining selected items SHALL stay active
|
||||
|
||||
### Requirement: Reject History page SHALL show paginated detail rows
|
||||
The page SHALL provide a paginated detail table for investigation and traceability.
|
||||
@@ -112,10 +117,15 @@ The page SHALL provide a paginated detail table for investigation and traceabili
|
||||
### Requirement: Reject History page SHALL support CSV export from current filter context
|
||||
The page SHALL allow users to export records using the exact active filters.
|
||||
|
||||
#### Scenario: Export with current filters
|
||||
#### Scenario: Export with all active filters
|
||||
- **WHEN** user clicks "匯出 CSV"
|
||||
- **THEN** export request SHALL include the current filter state and active reason filter
|
||||
- **THEN** downloaded file SHALL contain both `REJECT_TOTAL_QTY` and `DEFECT_QTY`
|
||||
- **THEN** export request SHALL include current primary filters, supplementary filters, trend-date filters, metric filters, and Pareto-selected items
|
||||
- **THEN** downloaded file SHALL contain exactly the same rows currently represented by the detail list filter context
|
||||
|
||||
#### Scenario: Export remains UTF-8 Excel compatible
|
||||
- **WHEN** CSV export is downloaded
|
||||
- **THEN** the file SHALL be encoded in UTF-8 with BOM
|
||||
- **THEN** Chinese headers and values SHALL render correctly in common spreadsheet tools
|
||||
|
||||
### Requirement: Reject History page SHALL provide robust feedback states
|
||||
The page SHALL provide loading, empty, and error states without breaking interactions.
|
||||
|
||||
Reference in New Issue
Block a user