fix: [inspection] STOCK 작업지시 검사항목 API에서 해당 부품만 반환

- buildBendingInspectionItems: work_order.options.bending_info 참조 추가
- isStockProduction이면 bendingInfo에 있는 섹션만 포함
- 가이드레일만 있으면 하단마감재/케이스/연기차단재 제외
- getInspectionConfig 응답에 is_stock_production 플래그 추가
This commit is contained in:
김보곤
2026-03-21 20:09:09 +09:00
parent 68c0494673
commit 488d592149

View File

@@ -2677,9 +2677,10 @@ public function getInspectionConfig(int $workOrderId): array
$items = [];
$finishingType = null;
$woBendingInfo = $workOrder->options['bending_info'] ?? null;
if ($processType === 'bending') {
$finishingType = $this->resolveFinishingType($productCode);
$items = $this->buildBendingInspectionItems($firstItem);
$items = $this->buildBendingInspectionItems($firstItem, $woBendingInfo);
}
return [
@@ -2689,6 +2690,7 @@ public function getInspectionConfig(int $workOrderId): array
'finishing_type' => $finishingType,
'template_id' => $templateId,
'items' => $items,
'is_stock_production' => ! empty($woBendingInfo['isStockProduction']),
];
}
@@ -2744,7 +2746,7 @@ private function resolveFinishingType(?string $productCode): string
* 절곡 bending_info에서 검사 대상 구성품 + 간격 기준치 빌드
* 마감유형(S1/S2/S3)에 따라 gap_points가 달라짐
*/
private function buildBendingInspectionItems(?WorkOrderItem $firstItem): array
private function buildBendingInspectionItems(?WorkOrderItem $firstItem, ?array $woBendingInfo = null): array
{
if (! $firstItem) {
return [];
@@ -2755,12 +2757,14 @@ private function buildBendingInspectionItems(?WorkOrderItem $firstItem): array
$typeProfiles = self::BENDING_GAP_PROFILES[$finishingType] ?? self::BENDING_GAP_PROFILES['S1'];
$commonProfiles = self::BENDING_GAP_PROFILES['common'];
$bendingInfo = $firstItem->options['bending_info'] ?? null;
// work_order.options.bending_info 우선, 없으면 item.options.bending_info
$bendingInfo = $woBendingInfo ?? ($firstItem->options['bending_info'] ?? null);
$isStock = ! empty($bendingInfo['isStockProduction']);
$items = [];
// 가이드레일 벽면 (벽면형 또는 혼합형)
$guideRail = $bendingInfo['guideRail'] ?? null;
$hasWall = ! $bendingInfo || ($guideRail && ($guideRail['wall'] ?? false));
$hasWall = ! $isStock && (! $bendingInfo || ($guideRail && ($guideRail['wall'] ?? false)));
$hasSide = $guideRail && ($guideRail['side'] ?? false);
if ($hasWall) {
@@ -2781,37 +2785,48 @@ private function buildBendingInspectionItems(?WorkOrderItem $firstItem): array
];
}
// 하단마감재 (항상 포함, 마감유형별 gap_points 다름)
$profile = $typeProfiles['bottom_bar'];
$items[] = [
'id' => 'bottom_bar',
'name' => $profile['name'],
'gap_points' => $profile['gap_points'],
];
// STOCK 단일부품: bendingInfo에 해당 섹션이 있을 때만 포함
$hasBottomBar = ! $isStock || ! empty($bendingInfo['bottomBar']);
$hasShutterBox = ! $isStock || ! empty($bendingInfo['shutterBox']);
$hasSmokeBarrier = ! $isStock || ! empty($bendingInfo['smokeBarrier']);
// 케이스 (항상 포함, 공통)
$profile = $commonProfiles['case_box'];
$items[] = [
'id' => 'case_box',
'name' => $profile['name'],
'gap_points' => $profile['gap_points'],
];
// 하단마감재
if ($hasBottomBar) {
$profile = $typeProfiles['bottom_bar'];
$items[] = [
'id' => 'bottom_bar',
'name' => $profile['name'],
'gap_points' => $profile['gap_points'],
];
}
// 연기차단재 W50 (항상 포함, 공통)
$profile = $commonProfiles['smoke_w50'];
$items[] = [
'id' => 'smoke_w50',
'name' => $profile['name'],
'gap_points' => $profile['gap_points'],
];
// 케이스
if ($hasShutterBox) {
$profile = $commonProfiles['case_box'];
$items[] = [
'id' => 'case_box',
'name' => $profile['name'],
'gap_points' => $profile['gap_points'],
];
}
// 연기차단재 W80 (항상 포함, 공통)
$profile = $commonProfiles['smoke_w80'];
$items[] = [
'id' => 'smoke_w80',
'name' => $profile['name'],
'gap_points' => $profile['gap_points'],
];
// 연기차단재 W50
if ($hasSmokeBarrier) {
$profile = $commonProfiles['smoke_w50'];
$items[] = [
'id' => 'smoke_w50',
'name' => $profile['name'],
'gap_points' => $profile['gap_points'],
];
// 연기차단재 W80
$profile = $commonProfiles['smoke_w80'];
$items[] = [
'id' => 'smoke_w80',
'name' => $profile['name'],
'gap_points' => $profile['gap_points'],
];
}
return $items;
}