fix: [inspection] 절곡 검사 측정값 허용오차 초과 시 자동 부적합 판정
This commit is contained in:
@@ -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(() => {
|
||||
|
||||
Reference in New Issue
Block a user