From 0a5be39f44b5a3fd263af31aba38dcb7a4e6fd79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Sun, 22 Mar 2026 09:17:24 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20[inspection]=20=EC=A0=88=EA=B3=A1=20?= =?UTF-8?q?=EA=B2=80=EC=82=AC=20=EC=B8=A1=EC=A0=95=EA=B0=92=20=ED=97=88?= =?UTF-8?q?=EC=9A=A9=EC=98=A4=EC=B0=A8=20=EC=B4=88=EA=B3=BC=20=EC=8B=9C=20?= =?UTF-8?q?=EC=9E=90=EB=8F=99=20=EB=B6=80=EC=A0=81=ED=95=A9=20=ED=8C=90?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WorkerScreen/InspectionInputModal.tsx | 36 +++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/components/production/WorkerScreen/InspectionInputModal.tsx b/src/components/production/WorkerScreen/InspectionInputModal.tsx index d2443877..32b7109a 100644 --- a/src/components/production/WorkerScreen/InspectionInputModal.tsx +++ b/src/components/production/WorkerScreen/InspectionInputModal.tsx @@ -753,20 +753,50 @@ export function InspectionInputModal({ if (useTemplateMode && templateData?.template) { return computeDynamicJudgment(templateData.template, dynamicFormValues, workItemDimensions); } - // 절곡 7개 제품 전용 판정 + // 절곡 7개 제품 전용 판정 (절곡상태 + 측정값 허용오차 검증) if (isBendingProcess) { let allGood = true; let allFilled = true; - for (const p of bendingProducts) { + const LENGTH_TOLERANCE = 4; // 길이 허용오차 ±4mm + const GAP_TOLERANCE = 2; // 간격 허용오차 ±2mm + + for (let pIdx = 0; pIdx < bendingProducts.length; pIdx++) { + const p = bendingProducts[pIdx]; + const def = effectiveProductDefs[pIdx]; + if (!def) continue; + + // 절곡상태 불량 → 즉시 fail if (p.bendingStatus === 'bad') return 'fail'; if (p.bendingStatus !== 'good') { allGood = false; allFilled = false; } if (!p.lengthMeasured) allFilled = false; + + // 길이 측정값 허용오차 검증 + if (p.lengthMeasured && def.lengthDesign && def.lengthDesign !== '-' && def.lengthDesign !== 'N/A') { + const design = parseFloat(def.lengthDesign); + const measured = parseFloat(p.lengthMeasured); + if (!isNaN(design) && !isNaN(measured) && Math.abs(measured - design) > LENGTH_TOLERANCE) { + return 'fail'; + } + } + + // 간격 측정값 허용오차 검증 + for (let gi = 0; gi < (def.gapPoints?.length || 0); gi++) { + const gapMeasured = p.gapMeasured[gi]; + const gapDesign = def.gapPoints[gi]?.design; + if (gapMeasured && gapDesign) { + const design = parseFloat(gapDesign); + const measured = parseFloat(gapMeasured); + if (!isNaN(design) && !isNaN(measured) && Math.abs(measured - design) > GAP_TOLERANCE) { + return 'fail'; + } + } + } } if (allGood && allFilled) return 'pass'; return null; } return computeJudgment(processType, formData); - }, [useTemplateMode, templateData, dynamicFormValues, workItemDimensions, processType, formData, bendingProducts]); + }, [useTemplateMode, templateData, dynamicFormValues, workItemDimensions, processType, formData, bendingProducts, effectiveProductDefs]); // 판정값 자동 동기화 (이전 형식 데이터 로드 시 첫 번째 동기화 건너뜀) useEffect(() => {