|
|
@@ -55,13 +55,13 @@ const style = { |
|
|
width: { xs: "90%", sm: "90%", md: "90%" }, |
|
|
width: { xs: "90%", sm: "90%", md: "90%" }, |
|
|
height: { xs: "90%", sm: "90%", md: "90%" }, |
|
|
height: { xs: "90%", sm: "90%", md: "90%" }, |
|
|
}; |
|
|
}; |
|
|
interface CommonProps extends Omit<ModalProps, "children"> { |
|
|
|
|
|
|
|
|
interface CommonProps extends Omit<ModalProps, "children" | "onClose"> { |
|
|
// itemDetail: StockInLine & { qcResult?: PurchaseQcResult[] } & { escResult?: EscalationResult[] } | undefined; |
|
|
// itemDetail: StockInLine & { qcResult?: PurchaseQcResult[] } & { escResult?: EscalationResult[] } | undefined; |
|
|
inputDetail: StockInLineInput | undefined; |
|
|
inputDetail: StockInLineInput | undefined; |
|
|
session: SessionWithTokens | null; |
|
|
session: SessionWithTokens | null; |
|
|
warehouse?: any[]; |
|
|
warehouse?: any[]; |
|
|
printerCombo: PrinterCombo[]; |
|
|
printerCombo: PrinterCombo[]; |
|
|
onClose: () => void; |
|
|
|
|
|
|
|
|
onClose: (updatedStockInLine?: StockInLine) => void; |
|
|
skipQc?: Boolean; |
|
|
skipQc?: Boolean; |
|
|
printSource?: "stockIn" | "productionProcess"; |
|
|
printSource?: "stockIn" | "productionProcess"; |
|
|
} |
|
|
} |
|
|
@@ -229,7 +229,16 @@ const QcStockInModal: React.FC<Props> = ({ |
|
|
...defaultNewValue, |
|
|
...defaultNewValue, |
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const closeWithResult = useCallback( |
|
|
|
|
|
(updatedStockInLine?: StockInLine) => { |
|
|
|
|
|
setStockInLineInfo(undefined); |
|
|
|
|
|
formProps.reset({}); |
|
|
|
|
|
onClose?.(updatedStockInLine); |
|
|
|
|
|
}, |
|
|
|
|
|
[onClose], |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
const closeHandler = useCallback<NonNullable<ModalProps["onClose"]>>( |
|
|
const closeHandler = useCallback<NonNullable<ModalProps["onClose"]>>( |
|
|
() => { |
|
|
() => { |
|
|
setStockInLineInfo(undefined); |
|
|
setStockInLineInfo(undefined); |
|
|
@@ -412,6 +421,9 @@ const QcStockInModal: React.FC<Props> = ({ |
|
|
// const qcData = data; |
|
|
// const qcData = data; |
|
|
|
|
|
|
|
|
console.log("QC Data for submission:", qcData); |
|
|
console.log("QC Data for submission:", qcData); |
|
|
|
|
|
|
|
|
|
|
|
let qcRes: StockInLine | undefined; |
|
|
|
|
|
|
|
|
if (data.qcDecision == 3) { // Escalate |
|
|
if (data.qcDecision == 3) { // Escalate |
|
|
if (data.escalationLog?.handlerId == undefined) { alert("請選擇上報負責同事!"); return; } |
|
|
if (data.escalationLog?.handlerId == undefined) { alert("請選擇上報負責同事!"); return; } |
|
|
else if (data.escalationLog?.handlerId < 1) { alert("上報負責同事資料有誤"); return; } |
|
|
else if (data.escalationLog?.handlerId < 1) { alert("上報負責同事資料有誤"); return; } |
|
|
@@ -425,12 +437,14 @@ const QcStockInModal: React.FC<Props> = ({ |
|
|
} |
|
|
} |
|
|
console.log("Escalation Data for submission", escalationLog); |
|
|
console.log("Escalation Data for submission", escalationLog); |
|
|
|
|
|
|
|
|
setIsSubmitting(true); //TODO improve |
|
|
|
|
|
await postStockInLine({...qcData, escalationLog}); |
|
|
|
|
|
|
|
|
setIsSubmitting(true); |
|
|
|
|
|
const resEscalate = await postStockInLine({...qcData, escalationLog}); |
|
|
|
|
|
qcRes = Array.isArray(resEscalate.entity) ? resEscalate.entity[0] : (resEscalate.entity as StockInLine); |
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
setIsSubmitting(true); //TODO improve |
|
|
|
|
|
await postStockInLine(qcData); |
|
|
|
|
|
|
|
|
setIsSubmitting(true); |
|
|
|
|
|
const resNormal = await postStockInLine(qcData); |
|
|
|
|
|
qcRes = Array.isArray(resNormal.entity) ? resNormal.entity[0] : (resNormal.entity as StockInLine); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (qcData.qcAccept) { |
|
|
if (qcData.qcAccept) { |
|
|
@@ -485,10 +499,10 @@ const QcStockInModal: React.FC<Props> = ({ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
closeHandler({}, "backdropClick"); |
|
|
|
|
|
|
|
|
closeWithResult(qcRes); |
|
|
// setTabIndex(1); // Need to go Putaway tab? |
|
|
// setTabIndex(1); // Need to go Putaway tab? |
|
|
} else { |
|
|
} else { |
|
|
closeHandler({}, "backdropClick"); |
|
|
|
|
|
|
|
|
closeWithResult(qcRes); |
|
|
} |
|
|
} |
|
|
setIsSubmitting(false); |
|
|
setIsSubmitting(false); |
|
|
msg("已更新來貨狀態"); |
|
|
msg("已更新來貨狀態"); |
|
|
|