diff --git a/src/app/(main)/report/ItemQcReportFilters.tsx b/src/app/(main)/report/ItemQcReportFilters.tsx index c3838352..990b4f8b 100644 --- a/src/app/(main)/report/ItemQcReportFilters.tsx +++ b/src/app/(main)/report/ItemQcReportFilters.tsx @@ -8,10 +8,10 @@ import { TextField, } from "@mui/material"; -export type QcItemFilter = "measurable" | "non_measurable"; +export type QcItemFilter = "all" | "measurable"; export const REP010_DEFAULT_CRITERIA: Record = { - qcItemFilter: "measurable", + qcItemScope: "all", }; interface ItemQcReportFiltersProps { @@ -21,18 +21,19 @@ interface ItemQcReportFiltersProps { const gridSize = { xs: 12, sm: 6 }; +/** FP-MTMS Version Checklist | Functions Ref. No. 64 | v1.0.0 | 2026-08-11 */ export default function ItemQcReportFilters({ criteria, onFieldChange, }: ItemQcReportFiltersProps) { - const qcItemFilter = (criteria.qcItemFilter || "measurable") as QcItemFilter; + const qcItemFilter = (criteria.qcItemScope || "all") as QcItemFilter; return ( onFieldChange("lastInDateStart", e.target.value)} @@ -42,7 +43,7 @@ export default function ItemQcReportFilters({ onFieldChange("lastInDateEnd", e.target.value)} @@ -54,10 +55,10 @@ export default function ItemQcReportFilters({ fullWidth select label="QC 類型" - value={criteria.qcType || ""} + value={criteria.qcType || "all"} onChange={(e) => onFieldChange("qcType", e.target.value)} > - 全部 + 全部 IQC EPQC @@ -75,17 +76,17 @@ export default function ItemQcReportFilters({ onFieldChange("qcItemFilter", e.target.value)} + label="QC 項目範圍" + value={qcItemFilter === "measurable" ? "measurable" : "all"} + onChange={(e) => onFieldChange("qcItemScope", e.target.value)} > + 全部 QC 項目 只包含溫度濕度 - 不包含溫度濕度 {qcItemFilter === "measurable" - ? "僅匯出已填寫實測值的溫度/濕度 QC 項目。" - : "僅匯出非溫度/濕度之其他 QC 檢驗項目。"} + ? "僅匯出溫度/濕度 QC 項目(與 production 舊預設相同)。" + : "匯出全部 QC 檢驗項目(含溫度/濕度)。"} diff --git a/src/app/(main)/report/page.tsx b/src/app/(main)/report/page.tsx index ddc3c912..1de84bd4 100644 --- a/src/app/(main)/report/page.tsx +++ b/src/app/(main)/report/page.tsx @@ -44,7 +44,7 @@ interface ItemCodeWithName { } /** FP-MTMS Version Checklist | Functions Ref. No. 39 | v1.0.0 | 2026-08-03 */ -/** FP-MTMS Version Checklist | Functions Ref. No. 60 | v1.0.0 | 2026-08-10 */ +/** FP-MTMS Version Checklist | Functions Ref. No. 60 | v1.0.1 | 2026-08-11 */ export default function ReportPage() { const { data: session } = useSession() as { data: SessionWithTokens | null }; const includeGrnFinancialColumns = @@ -74,7 +74,8 @@ export default function ReportPage() { const handleSelectReport = (reportId: string) => { if (reportId === selectedReportId) return; setSelectedReportId(reportId); - setCriteria({}); + // rep-010: default QC item scope to all (show label, not empty select) + setCriteria(reportId === 'rep-010' ? { qcType: 'all', qcItemScope: 'all' } : {}); }; const handleFieldChange = (name: string, value: string | string[]) => { @@ -252,6 +253,28 @@ export default function ReportPage() { return p.toString(); }; + /** FP-MTMS Version Checklist | Functions Ref. No. 64 | v1.0.0 | 2026-08-11 */ + /** rep-010:qcItemScope → includeMeasurable / includeOther;qcType=all 不傳篩選 */ + const buildRep010QueryString = (): string => { + const p = new URLSearchParams(); + Object.entries(criteria).forEach(([key, value]) => { + if (key === 'qcItemScope') return; + if (key === 'qcType' && String(value).trim().toLowerCase() === 'all') return; + if (value != null && String(value).trim() !== '') { + p.set(key, String(value)); + } + }); + const scope = (criteria.qcItemScope || 'all').trim().toLowerCase(); + if (scope === 'measurable') { + p.set('includeMeasurable', 'true'); + p.set('includeOther', 'false'); + } else { + p.set('includeMeasurable', 'true'); + p.set('includeOther', 'true'); + } + return p.toString(); + }; + const handlePrint = async () => { if (!currentReport) return; if (!validateRequiredFields()) return; @@ -293,6 +316,8 @@ export default function ReportPage() { let queryParams = currentReport.id === 'rep-012' ? buildRep012QueryString() + : currentReport.id === 'rep-010' + ? buildRep010QueryString() : new URLSearchParams(criteria).toString(); // rep-016: single-day UI — mirror dateStart to dateEnd for backend API. if (currentReport.id === 'rep-016') { @@ -359,6 +384,8 @@ export default function ReportPage() { const queryParams = currentReport.id === 'rep-012' ? buildRep012QueryString() + : currentReport.id === 'rep-010' + ? buildRep010QueryString() : new URLSearchParams(criteria).toString(); const url = `${currentReport.apiEndpoint}?${queryParams}`; diff --git a/src/config/reportConfig.ts b/src/config/reportConfig.ts index 4f3156d3..e38a9fcc 100644 --- a/src/config/reportConfig.ts +++ b/src/config/reportConfig.ts @@ -207,6 +207,7 @@ export const REPORTS: ReportDefinition[] = [ { label: "貨品編號 Item Code", name: "itemCode", type: "text", required: false}, ] }, + { id: "rep-014", @@ -236,18 +237,29 @@ export const REPORTS: ReportDefinition[] = [ }, { id: "rep-010", + /** FP-MTMS Version Checklist | Functions Ref. No. 64 | v1.0.0 | 2026-08-11 */ title: "庫存品質檢測報告", apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-item-qc-fail`, fields: [ - { label: "QC 檢測日期:由 Last In Date Start", name: "lastInDateStart", type: "date", required: false }, - { label: "QC 檢測日期:至 Last In Date End", name: "lastInDateEnd", type: "date", required: false }, + { label: "QC 檢測日期:由 QC Date Start", name: "lastInDateStart", type: "date", required: false }, + { label: "QC 檢測日期:至 QC Date End", name: "lastInDateEnd", type: "date", required: false }, { label: "QC 類型", name: "qcType", type: "select", required: false, options: [ - { label: "全部", value: "" }, - { label: "IQC", value: "IQC" }, - { label: "EPQC", value: "EPQC" }, + { label: "全部", value: "all" }, + { label: "IQC(採購)", value: "IQC" }, + { label: "EPQC(工單)", value: "EPQC" }, ] }, { label: "貨品編號 Item Code", name: "itemCode", type: "text", required: false}, + { + label: "QC 項目範圍", + name: "qcItemScope", + type: "select", + required: false, + options: [ + { label: "全部 QC 項目", value: "all" }, + { label: "只包含溫度濕度", value: "measurable" }, + ], + }, ] }, { id: "rep-013", @@ -386,14 +398,14 @@ export const REPORTS: ReportDefinition[] = [ ], }, { - /** FP-MTMS Version Checklist | Functions Ref. No. 60 | v1.0.0 | 2026-08-10 */ + /** FP-MTMS Version Checklist | Functions Ref. No. 60 | v1.0.1 | 2026-08-11 */ id: "rep-018", title: "送貨訂單與倉存單位不符報告", apiEndpoint: `${NEXT_PUBLIC_API_URL}/report/print-do-inventory-uom-mismatch`, responseType: "excel", fields: [ { - label: "預計到貨日期 Estimated Arrival Date", + label: "預計送貨日期 Estimated Arrival Date", name: "deliveryDate", type: "date", required: true, @@ -405,7 +417,7 @@ export const REPORTS: ReportDefinition[] = [ type: "select", required: false, options: [ - { label: "全部 All (2F+4F)", value: "All" }, + { label: "全部", value: "All" }, { label: "2F", value: "2F" }, { label: "4F", value: "4F" }, ],