From 488d592149578f64428435fa93e5944ff677c34b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Sat, 21 Mar 2026 20:09:09 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20[inspection]=20STOCK=20=EC=9E=91?= =?UTF-8?q?=EC=97=85=EC=A7=80=EC=8B=9C=20=EA=B2=80=EC=82=AC=ED=95=AD?= =?UTF-8?q?=EB=AA=A9=20API=EC=97=90=EC=84=9C=20=ED=95=B4=EB=8B=B9=20?= =?UTF-8?q?=EB=B6=80=ED=92=88=EB=A7=8C=20=EB=B0=98=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - buildBendingInspectionItems: work_order.options.bending_info 참조 추가 - isStockProduction이면 bendingInfo에 있는 섹션만 포함 - 가이드레일만 있으면 하단마감재/케이스/연기차단재 제외 - getInspectionConfig 응답에 is_stock_production 플래그 추가 --- app/Services/WorkOrderService.php | 79 ++++++++++++++++++------------- 1 file changed, 47 insertions(+), 32 deletions(-) diff --git a/app/Services/WorkOrderService.php b/app/Services/WorkOrderService.php index 6847ebe1..7e36d14a 100644 --- a/app/Services/WorkOrderService.php +++ b/app/Services/WorkOrderService.php @@ -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; }