| @@ -39,7 +39,7 @@ export interface StockInLineEntry { | |||||
| dnNo?: string; | dnNo?: string; | ||||
| } | } | ||||
| export interface PurchaseQcResult{ | |||||
| export interface QcResult{ | |||||
| id?: number; | id?: number; | ||||
| qcItemId: number; | qcItemId: number; | ||||
| qcPassed?: boolean; | qcPassed?: boolean; | ||||
| @@ -66,7 +66,7 @@ export interface StockInInput { | |||||
| expiryDate: string; | expiryDate: string; | ||||
| uom: Uom; | uom: Uom; | ||||
| } | } | ||||
| export interface PurchaseQCInput { | |||||
| export interface QCInput { | |||||
| status: string; | status: string; | ||||
| acceptQty: number; | acceptQty: number; | ||||
| passingQty: number; | passingQty: number; | ||||
| @@ -75,7 +75,7 @@ export interface PurchaseQCInput { | |||||
| totalWeight?: number; | totalWeight?: number; | ||||
| qcAccept: boolean; | qcAccept: boolean; | ||||
| qcDecision?: number; | qcDecision?: number; | ||||
| qcResult: PurchaseQcResult[]; | |||||
| qcResult: QcResult[]; | |||||
| } | } | ||||
| export interface EscalationInput { | export interface EscalationInput { | ||||
| status: string; | status: string; | ||||
| @@ -102,7 +102,7 @@ export interface PutAwayInput { | |||||
| } | } | ||||
| export type ModalFormInput = Partial< | export type ModalFormInput = Partial< | ||||
| PurchaseQCInput & StockInInput & PutAwayInput | |||||
| QCInput & StockInInput & PutAwayInput | |||||
| > & { | > & { | ||||
| escalationLog? : Partial<EscalationInput> | escalationLog? : Partial<EscalationInput> | ||||
| }; | }; | ||||
| @@ -35,7 +35,7 @@ import ShoppingCartIcon from "@mui/icons-material/ShoppingCart"; | |||||
| import PlayArrowIcon from "@mui/icons-material/PlayArrow"; | import PlayArrowIcon from "@mui/icons-material/PlayArrow"; | ||||
| import { PurchaseOrderLine } from "@/app/api/po"; | import { PurchaseOrderLine } from "@/app/api/po"; | ||||
| import { StockInLine } from "@/app/api/stockIn"; | import { StockInLine } from "@/app/api/stockIn"; | ||||
| import { createStockInLine, PurchaseQcResult } from "@/app/api/stockIn/actions"; | |||||
| import { createStockInLine, QcResult } from "@/app/api/stockIn/actions"; | |||||
| import { usePathname, useRouter, useSearchParams } from "next/navigation"; | import { usePathname, useRouter, useSearchParams } from "next/navigation"; | ||||
| import { | import { | ||||
| returnWeightUnit, | returnWeightUnit, | ||||
| @@ -140,7 +140,7 @@ function PoInputGrid({ | |||||
| setEntries(stockInLine); | setEntries(stockInLine); | ||||
| }, [stockInLine]) | }, [stockInLine]) | ||||
| const [modalInfo, setModalInfo] = useState< | const [modalInfo, setModalInfo] = useState< | ||||
| StockInLine & { qcResult?: PurchaseQcResult[] } & { escalationResult?: EscalationResult[] } | |||||
| StockInLine & { qcResult?: QcResult[] } & { escalationResult?: EscalationResult[] } | |||||
| >(); | >(); | ||||
| const pathname = usePathname() | const pathname = usePathname() | ||||
| const router = useRouter(); | const router = useRouter(); | ||||
| @@ -1,6 +1,6 @@ | |||||
| "use client"; | "use client"; | ||||
| import { PurchaseQcResult, PutAwayInput, PutAwayLine } from "@/app/api/stockIn/actions"; | |||||
| import { PutAwayInput, PutAwayLine } from "@/app/api/stockIn/actions"; | |||||
| import { | import { | ||||
| Autocomplete, | Autocomplete, | ||||
| Box, | Box, | ||||
| @@ -1,6 +1,6 @@ | |||||
| "use client"; | "use client"; | ||||
| import { PurchaseQcResult, PurchaseQCInput } from "@/app/api/stockIn/actions"; | |||||
| import { QcResult, QCInput } from "@/app/api/stockIn/actions"; | |||||
| import { | import { | ||||
| Box, | Box, | ||||
| Card, | Card, | ||||
| @@ -90,7 +90,7 @@ const QcComponent: React.FC<Props> = ({ itemDetail, disabled = false }) => { | |||||
| resetField, | resetField, | ||||
| setError, | setError, | ||||
| clearErrors, | clearErrors, | ||||
| } = useFormContext<PurchaseQCInput>(); | |||||
| } = useFormContext<QCInput>(); | |||||
| const [tabIndex, setTabIndex] = useState(0); | const [tabIndex, setTabIndex] = useState(0); | ||||
| const [rowSelectionModel, setRowSelectionModel] = useState<GridRowSelectionModel>(); | const [rowSelectionModel, setRowSelectionModel] = useState<GridRowSelectionModel>(); | ||||
| @@ -103,8 +103,9 @@ const QcComponent: React.FC<Props> = ({ itemDetail, disabled = false }) => { | |||||
| const value = watch('qcResult'); //console.log("%c QC update!", "color:green", value); | const value = watch('qcResult'); //console.log("%c QC update!", "color:green", value); | ||||
| return Array.isArray(value) ? [...value] : []; | return Array.isArray(value) ? [...value] : []; | ||||
| }, [watch('qcResult')]); | }, [watch('qcResult')]); | ||||
| const [qcHistory, setQcHistory] = useState<PurchaseQcResult[]>([]); | |||||
| const [qcResult, setQcResult] = useState<PurchaseQcResult[]>([]); | |||||
| const [qcHistory, setQcHistory] = useState<QcResult[]>([]); | |||||
| const [qcResult, setQcResult] = useState<QcResult[]>([]); | |||||
| const [newQcData, setNewQcData] = useState<QcResult[]>([]); | |||||
| const detailMode = useMemo(() => { | const detailMode = useMemo(() => { | ||||
| const isDetailMode = itemDetail.status == "escalated" || isNaN(itemDetail.jobOrderId); | const isDetailMode = itemDetail.status == "escalated" || isNaN(itemDetail.jobOrderId); | ||||
| @@ -140,7 +141,7 @@ const QcComponent: React.FC<Props> = ({ itemDetail, disabled = false }) => { | |||||
| } | } | ||||
| // W I P // | // W I P // | ||||
| const validateFieldFail = (field : FieldPath<PurchaseQCInput>, condition: boolean, message: string) : boolean => { | |||||
| const validateFieldFail = (field : FieldPath<QCInput>, condition: boolean, message: string) : boolean => { | |||||
| // console.log("Checking if " + message) | // console.log("Checking if " + message) | ||||
| if (condition) { setError(field, { message: message}); return false; } | if (condition) { setError(field, { message: message}); return false; } | ||||
| else { clearErrors(field); return true; } | else { clearErrors(field); return true; } | ||||
| @@ -224,7 +225,7 @@ const QcComponent: React.FC<Props> = ({ itemDetail, disabled = false }) => { | |||||
| return <Checkbox checked={!!value} onChange={handleChange} sx={{ p: 0 }} />; | return <Checkbox checked={!!value} onChange={handleChange} sx={{ p: 0 }} />; | ||||
| } | } | ||||
| const qcDisabled = (row : PurchaseQcResult) => { | |||||
| const qcDisabled = (row : QcResult) => { | |||||
| return disabled || isExist(row.escalationLogId); | return disabled || isExist(row.escalationLogId); | ||||
| }; | }; | ||||
| @@ -418,7 +419,7 @@ const QcComponent: React.FC<Props> = ({ itemDetail, disabled = false }) => { | |||||
| // const [openCollapse, setOpenCollapse] = useState(false) | // const [openCollapse, setOpenCollapse] = useState(false) | ||||
| const [isCollapsed, setIsCollapsed] = useState<boolean>(true); | const [isCollapsed, setIsCollapsed] = useState<boolean>(true); | ||||
| const onFailedOpenCollapse = useCallback((qcItems: PurchaseQcResult[]) => { | |||||
| const onFailedOpenCollapse = useCallback((qcItems: QcResult[]) => { | |||||
| const isFailed = qcItems.some((qc) => !qc.qcPassed) | const isFailed = qcItems.some((qc) => !qc.qcPassed) | ||||
| // console.log(isFailed) | // console.log(isFailed) | ||||
| if (isFailed) { | if (isFailed) { | ||||
| @@ -487,7 +488,7 @@ const QcComponent: React.FC<Props> = ({ itemDetail, disabled = false }) => { | |||||
| }, [itemDetail]) | }, [itemDetail]) | ||||
| const dummyQcHeader = useMemo(() => { | const dummyQcHeader = useMemo(() => { | ||||
| const d = itemDetail;console.log("I am checking now", d); | |||||
| const d = itemDetail; | |||||
| if (d.itemId == 23239 || d.itemNo == "PP2277" || d.itemName == "烚意粉") { | if (d.itemId == 23239 || d.itemNo == "PP2277" || d.itemName == "烚意粉") { | ||||
| return dummyQcHeader_E2; | return dummyQcHeader_E2; | ||||
| } else { | } else { | ||||
| @@ -36,7 +36,7 @@ import { isEmpty } from "lodash"; | |||||
| import { EscalationCombo } from "@/app/api/user"; | import { EscalationCombo } from "@/app/api/user"; | ||||
| import { truncateSync } from "fs"; | import { truncateSync } from "fs"; | ||||
| import { ModalFormInput, StockInLineInput, StockInLine } from "@/app/api/stockIn"; | import { ModalFormInput, StockInLineInput, StockInLine } from "@/app/api/stockIn"; | ||||
| import { PurchaseQcResult, StockInLineEntry, updateStockInLine, printQrCodeForSil, PrintQrCodeForSilRequest } from "@/app/api/stockIn/actions"; | |||||
| import { StockInLineEntry, updateStockInLine, printQrCodeForSil, PrintQrCodeForSilRequest } from "@/app/api/stockIn/actions"; | |||||
| import { fetchStockInLineInfo } from "@/app/api/stockIn/actions"; | import { fetchStockInLineInfo } from "@/app/api/stockIn/actions"; | ||||
| import { fetchQcResult } from "@/app/api/qc/actions"; | import { fetchQcResult } from "@/app/api/qc/actions"; | ||||
| import { fetchEscalationLogsByStockInLines } from "@/app/api/escalation/actions"; | import { fetchEscalationLogsByStockInLines } from "@/app/api/escalation/actions"; | ||||
| @@ -1,8 +1,6 @@ | |||||
| "use client"; | "use client"; | ||||
| import { | import { | ||||
| PurchaseQcResult, | |||||
| PurchaseQCInput, | |||||
| StockInInput, | StockInInput, | ||||
| } from "@/app/api/stockIn/actions"; | } from "@/app/api/stockIn/actions"; | ||||
| import { | import { | ||||
| @@ -1,8 +1,6 @@ | |||||
| "use client"; | "use client"; | ||||
| import { | import { | ||||
| PurchaseQcResult, | |||||
| PurchaseQCInput, | |||||
| StockInInput, | StockInInput, | ||||
| } from "@/app/api/stockIn/actions"; | } from "@/app/api/stockIn/actions"; | ||||
| import { | import { | ||||