|
|
@@ -50,6 +50,8 @@ interface Props { |
|
|
// itemDetail: StockInLine & { qcResult?: PurchaseQcResult[] } & { escResult?: EscalationResult[] }; |
|
|
// itemDetail: StockInLine & { qcResult?: PurchaseQcResult[] } & { escResult?: EscalationResult[] }; |
|
|
// qc: QcItemWithChecks[]; |
|
|
// qc: QcItemWithChecks[]; |
|
|
disabled: boolean; |
|
|
disabled: boolean; |
|
|
|
|
|
/** When true, use smaller typography and input size to match 來貨詳情 section (e.g. in QcStockInModal). */ |
|
|
|
|
|
compactLayout?: boolean; |
|
|
// qcItems: QcData[] |
|
|
// qcItems: QcData[] |
|
|
// setQcItems: Dispatch<SetStateAction<QcData[]>> |
|
|
// setQcItems: Dispatch<SetStateAction<QcData[]>> |
|
|
} |
|
|
} |
|
|
@@ -62,7 +64,7 @@ type EntryError = |
|
|
|
|
|
|
|
|
type QcRow = TableRow<Partial<QcResult>, EntryError>; |
|
|
type QcRow = TableRow<Partial<QcResult>, EntryError>; |
|
|
// fetchQcItemCheck |
|
|
// fetchQcItemCheck |
|
|
const QcComponent: React.FC<Props> = ({ itemDetail, disabled = false }) => { |
|
|
|
|
|
|
|
|
const QcComponent: React.FC<Props> = ({ itemDetail, disabled = false, compactLayout = false }) => { |
|
|
const { t } = useTranslation("purchaseOrder"); |
|
|
const { t } = useTranslation("purchaseOrder"); |
|
|
const apiRef = useGridApiRef(); |
|
|
const apiRef = useGridApiRef(); |
|
|
const { |
|
|
const { |
|
|
@@ -421,10 +423,13 @@ useEffect(() => { |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const headerVariant = compactLayout ? "subtitle1" : "h5"; |
|
|
|
|
|
const subVariant = compactLayout ? "body2" : "subtitle1"; |
|
|
|
|
|
const sub2Variant = compactLayout ? "body2" : "subtitle2"; |
|
|
const QcHeader = useMemo(() => () => { |
|
|
const QcHeader = useMemo(() => () => { |
|
|
if (qcCategory === undefined || qcCategory === null) { |
|
|
if (qcCategory === undefined || qcCategory === null) { |
|
|
return ( |
|
|
return ( |
|
|
<Typography variant="h5" component="h2" sx={{ fontWeight: 'bold', color: '#333' }}> |
|
|
|
|
|
|
|
|
<Typography variant={headerVariant} component="h2" sx={{ fontWeight: 'bold', color: '#333' }}> |
|
|
N/A |
|
|
N/A |
|
|
</Typography> |
|
|
</Typography> |
|
|
); |
|
|
); |
|
|
@@ -432,19 +437,19 @@ useEffect(() => { |
|
|
return ( |
|
|
return ( |
|
|
<> |
|
|
<> |
|
|
<Box sx={{ mb: 2, p: 2, backgroundColor: '#f5f5f5', borderRadius: 1 }}> |
|
|
<Box sx={{ mb: 2, p: 2, backgroundColor: '#f5f5f5', borderRadius: 1 }}> |
|
|
<Typography variant="h5" component="h2" sx={{ fontWeight: 'bold', color: '#333' }}> |
|
|
|
|
|
|
|
|
<Typography variant={headerVariant} component="h2" sx={{ fontWeight: 'bold', color: '#333' }}> |
|
|
{qcCategory?.name} ({qcCategory?.code}) |
|
|
{qcCategory?.name} ({qcCategory?.code}) |
|
|
</Typography> |
|
|
</Typography> |
|
|
<Typography variant="subtitle1" sx={{ color: '#666' }}> |
|
|
|
|
|
|
|
|
<Typography variant={subVariant} sx={{ color: '#666' }}> |
|
|
<b>品檢類型</b>:{qcType} |
|
|
<b>品檢類型</b>:{qcType} |
|
|
</Typography> |
|
|
</Typography> |
|
|
<Typography variant="subtitle2" sx={{ color: '#666' }}> |
|
|
|
|
|
|
|
|
<Typography variant={sub2Variant} sx={{ color: '#666' }}> |
|
|
{formattedDesc(qcCategory?.description)} |
|
|
{formattedDesc(qcCategory?.description)} |
|
|
</Typography> |
|
|
</Typography> |
|
|
</Box> |
|
|
</Box> |
|
|
</> |
|
|
</> |
|
|
); |
|
|
); |
|
|
}, [qcType, qcCategory]); |
|
|
|
|
|
|
|
|
}, [qcType, qcCategory, headerVariant, subVariant, sub2Variant]); |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<> |
|
|
<> |
|
|
@@ -513,7 +518,7 @@ useEffect(() => { |
|
|
)} |
|
|
)} |
|
|
<Grid item xs={12}> |
|
|
<Grid item xs={12}> |
|
|
<Card sx={{p:2}}> |
|
|
<Card sx={{p:2}}> |
|
|
<Typography variant="h6" display="block" marginBlockEnd={1}> |
|
|
|
|
|
|
|
|
<Typography variant={compactLayout ? "subtitle1" : "h6"} display="block" marginBlockEnd={1}> |
|
|
{t("Qc Decision")} |
|
|
{t("Qc Decision")} |
|
|
</Typography> |
|
|
</Typography> |
|
|
<FormControl> |
|
|
<FormControl> |
|
|
@@ -566,6 +571,7 @@ useEffect(() => { |
|
|
// type="number" |
|
|
// type="number" |
|
|
id="accQty" |
|
|
id="accQty" |
|
|
label={t("acceptQty")} |
|
|
label={t("acceptQty")} |
|
|
|
|
|
size={compactLayout ? "small" : "medium"} |
|
|
sx={{ width: '150px' }} |
|
|
sx={{ width: '150px' }} |
|
|
// value={Number(accQty)} |
|
|
// value={Number(accQty)} |
|
|
defaultValue={Number(accQty)} |
|
|
defaultValue={Number(accQty)} |
|
|
@@ -618,6 +624,7 @@ useEffect(() => { |
|
|
<TextField |
|
|
<TextField |
|
|
type="number" |
|
|
type="number" |
|
|
label={t("rejectQty")} |
|
|
label={t("rejectQty")} |
|
|
|
|
|
size={compactLayout ? "small" : "medium"} |
|
|
sx={{ width: '150px' }} |
|
|
sx={{ width: '150px' }} |
|
|
value={ |
|
|
value={ |
|
|
(!Boolean(errors.acceptQty) && qcDecision !== undefined && qcDecision != 3) ? |
|
|
(!Boolean(errors.acceptQty) && qcDecision !== undefined && qcDecision != 3) ? |
|
|
|