Browse Source

upDATE

reset-do-picking-order
Tommy\2Fi-Staff 2 weeks ago
parent
commit
656a222976
3 changed files with 18 additions and 10 deletions
  1. +14
    -7
      src/components/Qc/QcComponent.tsx
  2. +2
    -2
      src/components/Qc/QcForm.tsx
  3. +2
    -1
      src/components/Qc/QcStockInModal.tsx

+ 14
- 7
src/components/Qc/QcComponent.tsx View File

@@ -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) ?


+ 2
- 2
src/components/Qc/QcForm.tsx View File

@@ -133,7 +133,7 @@ const QcForm: React.FC<Props> = ({ rows, disabled = false }) => {
{ {
field: "failQty", field: "failQty",
headerName: t("failedQty"), headerName: t("failedQty"),
flex: 0.5,
flex: 0.8,
// editable: true, // editable: true,
renderCell: (params) => { renderCell: (params) => {
const index = getRowIndex(params);//params.api.getRowIndexRelativeToVisibleRows(params.id); const index = getRowIndex(params);//params.api.getRowIndexRelativeToVisibleRows(params.id);
@@ -174,7 +174,7 @@ const QcForm: React.FC<Props> = ({ rows, disabled = false }) => {
{ {
field: "remarks", field: "remarks",
headerName: t("remarks"), headerName: t("remarks"),
flex: 2,
flex: 1.7,
renderCell: (params) => { renderCell: (params) => {
// const index = Number(params.id);//params.api.getRowIndexRelativeToVisibleRows(params.id); // const index = Number(params.id);//params.api.getRowIndexRelativeToVisibleRows(params.id);
const index = getRowIndex(params);//params.api.getRowIndexRelativeToVisibleRows(params.id); const index = getRowIndex(params);//params.api.getRowIndexRelativeToVisibleRows(params.id);


+ 2
- 1
src/components/Qc/QcStockInModal.tsx View File

@@ -705,7 +705,7 @@ const printQrcode = useCallback(
{tabIndex === 0 && {tabIndex === 0 &&
<Box> <Box>
<Grid item xs={12}> <Grid item xs={12}>
<Typography variant="h6" display="block" marginBlockEnd={1}>
<Typography variant="subtitle1" display="block" marginBlockEnd={1} fontWeight={600}>
{t("Delivery Detail")} {t("Delivery Detail")}
</Typography> </Typography>
</Grid> </Grid>
@@ -719,6 +719,7 @@ const printQrcode = useCallback(
<QcComponent <QcComponent
itemDetail={stockInLineInfo} itemDetail={stockInLineInfo}
disabled={viewOnly || showPutaway} disabled={viewOnly || showPutaway}
compactLayout
/>) />)
} }
<Stack direction="row" justifyContent="flex-end" gap={1} sx={{pt:2}}> <Stack direction="row" justifyContent="flex-end" gap={1} sx={{pt:2}}>


Loading…
Cancel
Save