{{-- 절곡 중간검사 DATA 전용 렌더링 React BendingInspectionContent.tsx와 동일한 구조 데이터 소스: work_order_items.options.inspection_data (스냅샷) - 제품 구조, 도면치수, 측정값이 모두 포함된 완전한 스냅샷 - 정책 변경 시에도 저장 시점의 문서 그대로 유지 필요 변수: - $inspectionData: inspection_data 스냅샷 (array|null) - $docData: document_data collection (fallback용) - $document: Document model --}} @php // inspection_data 스냅샷에서 제품 목록 로드 $products = $inspectionData['products'] ?? []; $snapshotJudgment = $inspectionData['judgment'] ?? null; $inadequateContent = $inspectionData['inadequateContent'] ?? ''; // 스냅샷이 없으면 INITIAL_PRODUCTS 하드코딩 fallback (레거시 호환) if (empty($products)) { $products = [ ['id' => 'guide-rail-wall', 'category' => 'KWE01', 'productName' => '가이드레일', 'productType' => '벽면형', 'lengthDesignValue' => '3000', 'widthDesignValue' => 'N/A', 'bendingStatus' => null, 'lengthMeasured' => '', 'widthMeasured' => '', 'gapPoints' => [ ['point' => '①', 'designValue' => '30', 'measured' => ''], ['point' => '②', 'designValue' => '80', 'measured' => ''], ['point' => '③', 'designValue' => '45', 'measured' => ''], ['point' => '④', 'designValue' => '40', 'measured' => ''], ['point' => '⑤', 'designValue' => '34', 'measured' => ''], ]], ['id' => 'guide-rail-side', 'category' => 'KWE01', 'productName' => '가이드레일', 'productType' => '측면형', 'lengthDesignValue' => '3000', 'widthDesignValue' => 'N/A', 'bendingStatus' => null, 'lengthMeasured' => '', 'widthMeasured' => '', 'gapPoints' => [ ['point' => '①', 'designValue' => '28', 'measured' => ''], ['point' => '②', 'designValue' => '75', 'measured' => ''], ['point' => '③', 'designValue' => '42', 'measured' => ''], ['point' => '④', 'designValue' => '38', 'measured' => ''], ['point' => '⑤', 'designValue' => '32', 'measured' => ''], ]], ['id' => 'case', 'category' => 'KWE01', 'productName' => '케이스', 'productType' => '500X380', 'lengthDesignValue' => '3000', 'widthDesignValue' => 'N/A', 'bendingStatus' => null, 'lengthMeasured' => '', 'widthMeasured' => '', 'gapPoints' => [ ['point' => '①', 'designValue' => '380', 'measured' => ''], ['point' => '②', 'designValue' => '50', 'measured' => ''], ['point' => '③', 'designValue' => '240', 'measured' => ''], ['point' => '④', 'designValue' => '50', 'measured' => ''], ]], ['id' => 'bottom-finish', 'category' => 'KWE01', 'productName' => '하단마감재', 'productType' => '60X40', 'lengthDesignValue' => '3000', 'widthDesignValue' => 'N/A', 'bendingStatus' => null, 'lengthMeasured' => '', 'widthMeasured' => '', 'gapPoints' => [ ['point' => '①', 'designValue' => '60', 'measured' => ''], ['point' => '②', 'designValue' => '64', 'measured' => ''], ]], ['id' => 'bottom-l-bar', 'category' => 'KWE01', 'productName' => '하단L-BAR', 'productType' => '17X60', 'lengthDesignValue' => '3000', 'widthDesignValue' => 'N/A', 'bendingStatus' => null, 'lengthMeasured' => '', 'widthMeasured' => '', 'gapPoints' => [ ['point' => '①', 'designValue' => '17', 'measured' => ''], ]], ['id' => 'smoke-w50', 'category' => 'KWE01', 'productName' => '연기차단재', 'productType' => "W50\n가이드레일용", 'lengthDesignValue' => '3000', 'widthDesignValue' => '', 'bendingStatus' => null, 'lengthMeasured' => '', 'widthMeasured' => '', 'gapPoints' => [ ['point' => '①', 'designValue' => '50', 'measured' => ''], ['point' => '②', 'designValue' => '12', 'measured' => ''], ]], ['id' => 'smoke-w80', 'category' => 'KWE01', 'productName' => '연기차단재', 'productType' => "W80\n케이스용", 'lengthDesignValue' => '3000', 'widthDesignValue' => '', 'bendingStatus' => null, 'lengthMeasured' => '', 'widthMeasured' => '', 'gapPoints' => [ ['point' => '①', 'designValue' => '80', 'measured' => ''], ['point' => '②', 'designValue' => '12', 'measured' => ''], ]], ]; } // 제품 ID → 메타 정보 매핑 (스냅샷에 category/productName/productType가 없을 경우 보완) $productMeta = [ 'guide-rail-wall' => ['category' => 'KWE01', 'productName' => '가이드레일', 'productType' => '벽면형'], 'guide_rail_wall' => ['category' => 'KWE01', 'productName' => '가이드레일', 'productType' => '벽면형'], 'guide-rail-side' => ['category' => 'KWE01', 'productName' => '가이드레일', 'productType' => '측면형'], 'guide_rail_side' => ['category' => 'KWE01', 'productName' => '가이드레일', 'productType' => '측면형'], 'case' => ['category' => 'KWE01', 'productName' => '케이스', 'productType' => '500X380'], 'bottom-finish' => ['category' => 'KWE01', 'productName' => '하단마감재', 'productType' => '60X40'], 'bottom_finish' => ['category' => 'KWE01', 'productName' => '하단마감재', 'productType' => '60X40'], 'bottom-l-bar' => ['category' => 'KWE01', 'productName' => '하단L-BAR', 'productType' => '17X60'], 'bottom_l_bar' => ['category' => 'KWE01', 'productName' => '하단L-BAR', 'productType' => '17X60'], 'smoke-w50' => ['category' => 'KWE01', 'productName' => '연기차단재', 'productType' => "W50\n가이드레일용"], 'smoke_w50' => ['category' => 'KWE01', 'productName' => '연기차단재', 'productType' => "W50\n가이드레일용"], 'smoke-w80' => ['category' => 'KWE01', 'productName' => '연기차단재', 'productType' => "W80\n케이스용"], 'smoke_w80' => ['category' => 'KWE01', 'productName' => '연기차단재', 'productType' => "W80\n케이스용"], ]; // 종합판정 결정 $overallResult = $snapshotJudgment ?? ($docData->where('field_key', 'overall_result')->first()?->field_value ?? ''); $isOverallPass = in_array(strtolower($overallResult), ['pass', 'ok', '적합', '합격']); @endphp

■ 중간검사 DATA

{{-- 1단 헤더 --}} {{-- 2단 헤더 (서브라벨) --}} @foreach($products as $pIdx => $product) @php $gapPoints = $product['gapPoints'] ?? []; $gapCount = count($gapPoints); if ($gapCount === 0) $gapCount = 1; $productId = $product['id'] ?? ''; $meta = $productMeta[$productId] ?? []; $category = $product['category'] ?? ($meta['category'] ?? ''); $productName = $product['productName'] ?? ($meta['productName'] ?? $productId); $productType = $product['productType'] ?? ($meta['productType'] ?? ''); // 스냅샷 필드 (React 저장 형식: lengthDesignValue, lengthMeasured 등) $lengthDesign = $product['lengthDesignValue'] ?? ($product['lengthDesign'] ?? ''); $lengthMeasured = $product['lengthMeasured'] ?? ''; $widthDesign = $product['widthDesignValue'] ?? ($product['widthDesign'] ?? ''); $widthMeasured = $product['widthMeasured'] ?? ''; // 절곡상태 $statusVal = $product['bendingStatus'] ?? null; // 판정: 양호→적, 불량→부 $judgmentVal = null; if ($statusVal === '양호' || strtolower($statusVal ?? '') === 'pass' || strtolower($statusVal ?? '') === 'ok') { $judgmentVal = '적'; } elseif ($statusVal === '불량' || strtolower($statusVal ?? '') === 'fail' || strtolower($statusVal ?? '') === 'ng') { $judgmentVal = '부'; } @endphp @for($gIdx = 0; $gIdx < max($gapCount, 1); $gIdx++) @if($gIdx === 0) {{-- 분류 --}} {{-- 제품명 --}} {{-- 타입 --}} {{-- 겉모양/절곡상태 --}} {{-- 길이 도면치수 --}} {{-- 길이 측정값 --}} {{-- 너비 도면치수 --}} {{-- 너비 측정값 --}} @endif {{-- 간격 포인트 --}} @if(!empty($gapPoints)) @php $gap = $gapPoints[$gIdx] ?? []; @endphp @else @endif @if($gIdx === 0) {{-- 판정 --}} @endif @endfor @endforeach
분류 제품명 타입 겉모양/
절곡상태
길이 너비 간격 판정
도면치수 측정값 도면치수 측정값 포인트 도면치수 측정값
{{ $category }} {{ $productName }} {{ $productType }} @if($statusVal === '양호' || strtolower($statusVal ?? '') === 'pass' || strtolower($statusVal ?? '') === 'ok') @elseif($statusVal === '불량' || strtolower($statusVal ?? '') === 'fail' || strtolower($statusVal ?? '') === 'ng') @else - @endif {{ $lengthDesign ?: '-' }} {{ $lengthMeasured ?: '-' }} {{ $widthDesign ?: '-' }} {{ $widthMeasured ?: '-' }} {{ $gap['point'] ?? '' }} {{ $gap['designValue'] ?? '' }} {{ ($gap['measured'] ?? '') ?: '-' }} - - - @if($judgmentVal === '적') @elseif($judgmentVal === '부') @else - @endif
{{-- 종합판정 --}}
종합판정: @if($overallResult) @if($isOverallPass) 적합 @else 부적합 @endif @else 미판정 @endif