瀏覽代碼

update qc for DEMO

master
kelvinsuen 2 月之前
父節點
當前提交
c76d72e032
共有 2 個文件被更改,包括 193 次插入18 次删除
  1. +44
    -17
      src/components/PoDetail/QcComponent.tsx
  2. +149
    -1
      src/components/PoDetail/dummyQcTemplate.tsx

+ 44
- 17
src/components/PoDetail/QcComponent.tsx 查看文件

@@ -48,8 +48,10 @@ import { NEXT_PUBLIC_API_URL } from "@/config/api";
import axiosInstance from "@/app/(main)/axios/axiosInstance";
import EscalationComponent from "./EscalationComponent";
import QcDataGrid from "./QCDatagrid";
import { dummyEscalationHistory, dummyQCData } from "./dummyQcTemplate";
import { escape, min } from "lodash";
import { dummyEscalationHistory,
dummyQcData_A1, dummyQcData_E1, dummyQcData_E2,
dummyQcHeader_A1, dummyQcHeader_E1, dummyQcHeader_E2 } from "./dummyQcTemplate";
import { escape, isNull, min } from "lodash";
import { PanoramaSharp } from "@mui/icons-material";
import EscalationLogTable from "../DashboardPage/escalation/EscalationLogTable";
import { EscalationResult } from "@/app/api/escalation";
@@ -389,7 +391,7 @@ const QcComponent: React.FC<Props> = ({ itemDetail, disabled = false }) => {
useEffect(() => {
console.log("%c Qc Record updated:", "color:green", qcRecord);
if (qcRecord.length < 1) { // New QC
const fetchedQcData = dummyQCData; //TODO fetch from DB
const fetchedQcData = dummyQcData; //TODO fetch from DB
setValue("qcResult", fetchedQcData);
} else {
if (itemDetail?.status == "escalated") { // Copy the previous QC data for editing
@@ -470,6 +472,33 @@ const QcComponent: React.FC<Props> = ({ itemDetail, disabled = false }) => {
} else { return 60}
};

// For DEMO
const dummyQcData = useMemo(() => {
const d = itemDetail;
if (d.itemId == 23239 || d.itemNo == "PP2277" || d.itemName == "烚意粉") {
return dummyQcData_E2;
} else {
if (d.jobOrderId === null) {
return dummyQcData_A1;
} else {
return dummyQcData_E1;
}
}
}, [itemDetail])

const dummyQcHeader = useMemo(() => {
const d = itemDetail;console.log("I am checking now", d);
if (d.itemId == 23239 || d.itemNo == "PP2277" || d.itemName == "烚意粉") {
return dummyQcHeader_E2;
} else {
if (d.jobOrderId === null) {
return dummyQcHeader_A1;
} else {
return dummyQcHeader_E1;
}
}
}, [itemDetail])

return (
<>
<Grid container justifyContent="flex-start" alignItems="flex-start">
@@ -498,14 +527,13 @@ const QcComponent: React.FC<Props> = ({ itemDetail, disabled = false }) => {
<Box sx={{ mb: 2, p: 2, backgroundColor: '#f5f5f5', borderRadius: 1 }}>
<Typography variant="h5" component="h2" sx={{ fontWeight: 'bold', color: '#333' }}>
Group A - 急凍貨類 (QCA1-MEAT01)
{dummyQcHeader.name}
</Typography>
<Typography variant="subtitle1" sx={{ color: '#666' }}>
<b>品檢類型</b>:IQC
<b>品檢類型</b>:{dummyQcHeader.type}
</Typography>
<Typography variant="subtitle2" sx={{ color: '#666' }}>
記錄探測溫度的時間,請在1小時内完成卸貨盤點入庫,以保障食品安全<br/>
監察方法:目視檢查、嗅覺檢查和使用適當的食物溫度計,檢查食物溫度是否符合指標
{dummyQcHeader.description}
</Typography>
</Box>
{/* <QcDataGrid<ModalFormInput, QcData, EntryError>
@@ -545,16 +573,15 @@ const QcComponent: React.FC<Props> = ({ itemDetail, disabled = false }) => {
<EscalationLogTable type="qc" items={itemDetail.escResult || []}/>
<CollapsibleCard title={t("QC Record")}>
<Box sx={{ mb: 2, p: 2, backgroundColor: '#f5f5f5', borderRadius: 1 }}>
<Typography variant="h5" component="h2" sx={{ fontWeight: 'bold', color: '#333' }}>
Group A - 急凍貨類 (QCA1-MEAT01)
</Typography>
<Typography variant="subtitle1" sx={{ color: '#666' }}>
<b>品檢類型</b>:IQC
</Typography>
<Typography variant="subtitle2" sx={{ color: '#666' }}>
記錄探測溫度的時間,請在1小時内完成卸貨盤點入庫,以保障食品安全<br/>
監察方法:目視檢查、嗅覺檢查和使用適當的食物溫度計,檢查食物溫度是否符合指標
</Typography>
<Typography variant="h5" component="h2" sx={{ fontWeight: 'bold', color: '#333' }}>
{dummyQcHeader.name}
</Typography>
<Typography variant="subtitle1" sx={{ color: '#666' }}>
<b>品檢類型</b>:{dummyQcHeader.type}
</Typography>
<Typography variant="subtitle2" sx={{ color: '#666' }}>
{dummyQcHeader.description}
</Typography>
</Box>
<StyledDataGrid
columns={qcColumns}


+ 149
- 1
src/components/PoDetail/dummyQcTemplate.tsx 查看文件

@@ -10,7 +10,7 @@ import { QcData } from "@/app/api/qc"
// remarks: string | undefined
// }

export const dummyQCData: QcData[] = [
export const dummyQcData_A1: QcData[] = [
{
id: 1,
qcItemId: 4,
@@ -63,6 +63,154 @@ export const dummyQCData: QcData[] = [
},
]

export const dummyQcHeader_A1: any = {
name: "收貨要求 A1 - 急凍貨類 (QCA1-MEAT01)",
type: "IQC",
description: <>記錄探測溫度的時間,請在1小時内完成卸貨盤點入庫,以保障食品安全<br/>監察方法:目視檢查、嗅覺檢查和使用適當的食物溫度計,檢查食物溫度是否符合指標</>,

}

export const dummyQcHeader_E1: any = {
name: "收貨要求 E1 - 通過加熱製成的醬汁或食物 (QCE1-HEAT01)",
type: "EPQC",
description: "包裝後需用冷卻水池降溫",

}

export const dummyQcHeader_E2: any = {
name: "收貨要求 E2 - 室溫攪拌混合製成的醬汁或食物(無需加熱烹調) (QCA1-MIX01)",
type: "EPQC",
description: "不需使用冷卻水池降溫",

}

// For DEMO 2025/10/03
export const dummyQcData_E1: QcData[] = [
{
id: 1,
qcItemId: 25,
code: "包裝",
description: "包裝不嚴密,液體滲漏。包裝不乾淨,則不合格",
name: "包裝",
qcPassed: undefined,
failQty: undefined,
remarks: undefined,
},
{
id: 2,
qcItemId: 26,
code: "標籤",
description: "標籤名稱或日期錯誤、不清晰或缺失,則不合格",
name: "標籤",
qcPassed: undefined,
failQty: undefined,
remarks: undefined,
},
{
id: 3,
qcItemId: 27,
code: "肉質",
description: "肉質生熟程度不一致,或裁切尺寸不一致,則不合格",
name: "肉質",
qcPassed: undefined,
failQty: undefined,
remarks: undefined,
},
{
id: 4,
qcItemId: 28,
code: "異物",
description: "有異物,無法通過金屬探測器,則不合格",
name: "異物",
qcPassed: undefined,
failQty: undefined,
remarks: undefined,
},
{
id: 5,
qcItemId: 29,
code: "重量",
description: "超過製程要求的誤差+/-5%,則不合格",
name: "重量",
qcPassed: undefined,
failQty: undefined,
remarks: undefined,
},
{
id: 6,
qcItemId: 30,
code: "冷卻水池",
description: "未能於2小時內冷卻至20°C以下。冷卻水池水溫太高,或冷卻池中的成品太多,則不合格",
name: "冷卻水池",
qcPassed: undefined,
failQty: undefined,
remarks: undefined,
},
{
id: 7,
qcItemId: 31,
code: "冷庫",
description: "2小時內,未能及時入冷庫,冷卻至4°C或以下,則不合格",
name: "冷庫",
qcPassed: undefined,
failQty: undefined,
remarks: undefined,
},
]
// For PP2277 - 23293
export const dummyQcData_E2: QcData[] = [
{
id: 1,
qcItemId: 25,
code: "包裝",
description: "包裝不嚴密,液體滲漏。包裝不乾淨,則不合格",
name: "包裝",
qcPassed: undefined,
failQty: undefined,
remarks: undefined,
},
{
id: 2,
qcItemId: 26,
code: "標籤",
description: "標籤名稱或日期錯誤、不清晰或缺失,則不合格",
name: "標籤",
qcPassed: undefined,
failQty: undefined,
remarks: undefined,
},
{
id: 3,
qcItemId: 32,
code: "顔色",
description: "食材有破損、缺口、變質或醬汁有異常顏色狀態,則不合格",
name: "顔色",
qcPassed: undefined,
failQty: undefined,
remarks: undefined,
},
{
id: 4,
qcItemId: 28,
code: "異物",
description: "有異物,無法通過金屬探測器,則不合格",
name: "異物",
qcPassed: undefined,
failQty: undefined,
remarks: undefined,
},
{
id: 5,
qcItemId: 33,
code: "重量",
description: "沒有達到或超出重量要求,則不合格",
name: "重量",
qcPassed: undefined,
failQty: undefined,
remarks: undefined,
},
]

export interface EscalationData {
id: number,
escalation: string,


Loading…
取消
儲存