From d6d1cd1e5bab339123a1a4b9008468468a455d7b Mon Sep 17 00:00:00 2001 From: "B.E.N.S.O.N" Date: Thu, 25 Jun 2026 14:06:22 +0800 Subject: [PATCH] =?UTF-8?q?QC=E6=B7=BB=E5=8A=A0=E6=BA=AB=E5=BA=A6/?= =?UTF-8?q?=E6=BF=95=E5=BA=A6=E5=84=B2=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 3 +- .env.production | 3 +- src/app/(main)/report/ItemQcReportFilters.tsx | 93 +++++++++++++++++++ src/app/(main)/report/page.tsx | 27 +----- src/app/api/qc/actions.ts | 9 ++ src/app/api/qc/index.ts | 3 + src/app/api/qc/measurement.ts | 51 ++++++++++ src/components/PoDetail/QcStockInModal.tsx | 5 + src/components/Qc/QcForm.tsx | 48 ++++++++++ src/components/Qc/QcStockInModal.tsx | 5 + src/config/featureFlags.ts | 3 + src/config/reportConfig.ts | 11 ++- src/i18n/en/purchaseOrder.json | 1 + src/i18n/zh/purchaseOrder.json | 1 + 14 files changed, 233 insertions(+), 30 deletions(-) create mode 100644 src/app/(main)/report/ItemQcReportFilters.tsx create mode 100644 src/app/api/qc/measurement.ts create mode 100644 src/config/featureFlags.ts diff --git a/.env.development b/.env.development index 36ba276..7ead1c9 100644 --- a/.env.development +++ b/.env.development @@ -1,4 +1,5 @@ API_URL=http://localhost:8090/api NEXTAUTH_SECRET=secret NEXT_PUBLIC_API_URL=http://localhost:8090/api -NEXT_PUBLIC_MONITORING_ENABLED=false \ No newline at end of file +NEXT_PUBLIC_MONITORING_ENABLED=false +NEXT_PUBLIC_QC_MEASUREMENT_ENABLED=false \ No newline at end of file diff --git a/.env.production b/.env.production index ea6edd1..021a5c5 100644 --- a/.env.production +++ b/.env.production @@ -1,4 +1,5 @@ API_URL=http://10.10.0.81:8090/api NEXTAUTH_SECRET=secret NEXTAUTH_URL=http://10.10.0.81:3000 -NEXT_PUBLIC_API_URL=http://10.10.0.81:8090/api \ No newline at end of file +NEXT_PUBLIC_API_URL=http://10.10.0.81:8090/api +NEXT_PUBLIC_QC_MEASUREMENT_ENABLED=false \ No newline at end of file diff --git a/src/app/(main)/report/ItemQcReportFilters.tsx b/src/app/(main)/report/ItemQcReportFilters.tsx new file mode 100644 index 0000000..c383835 --- /dev/null +++ b/src/app/(main)/report/ItemQcReportFilters.tsx @@ -0,0 +1,93 @@ +"use client"; + +import React from "react"; +import { + FormHelperText, + Grid, + MenuItem, + TextField, +} from "@mui/material"; + +export type QcItemFilter = "measurable" | "non_measurable"; + +export const REP010_DEFAULT_CRITERIA: Record = { + qcItemFilter: "measurable", +}; + +interface ItemQcReportFiltersProps { + criteria: Record; + onFieldChange: (name: string, value: string) => void; +} + +const gridSize = { xs: 12, sm: 6 }; + +export default function ItemQcReportFilters({ + criteria, + onFieldChange, +}: ItemQcReportFiltersProps) { + const qcItemFilter = (criteria.qcItemFilter || "measurable") as QcItemFilter; + + return ( + + + onFieldChange("lastInDateStart", e.target.value)} + InputLabelProps={{ shrink: true }} + /> + + + onFieldChange("lastInDateEnd", e.target.value)} + InputLabelProps={{ shrink: true }} + /> + + + onFieldChange("qcType", e.target.value)} + > + 全部 + IQC + EPQC + + + + onFieldChange("itemCode", e.target.value)} + placeholder="e.g. MJ0364" + /> + + + onFieldChange("qcItemFilter", e.target.value)} + > + 只包含溫度濕度 + 不包含溫度濕度 + + + {qcItemFilter === "measurable" + ? "僅匯出已填寫實測值的溫度/濕度 QC 項目。" + : "僅匯出非溫度/濕度之其他 QC 檢驗項目。"} + + + + ); +} diff --git a/src/app/(main)/report/page.tsx b/src/app/(main)/report/page.tsx index 504ae28..83bb62b 100644 --- a/src/app/(main)/report/page.tsx +++ b/src/app/(main)/report/page.tsx @@ -393,7 +393,7 @@ export default function ReportPage() { 搜索條件: {currentReport.title} - + {currentReport.fields.map((field) => { const options = field.dynamicOptions @@ -650,30 +650,7 @@ export default function ReportPage() { {loading ? "生成 Excel..." : "下載報告 (Excel)"} - ) : currentReport.id === 'rep-006' ? ( - <> - - - - ) : currentReport.id === 'rep-010' ? ( + ) : currentReport.id === 'rep-006' || currentReport.id === 'rep-010' ? ( <>