diff --git a/app/Services/WorkOrderService.php b/app/Services/WorkOrderService.php index 32d2119f..d6e9f774 100644 --- a/app/Services/WorkOrderService.php +++ b/app/Services/WorkOrderService.php @@ -2495,7 +2495,10 @@ public function storeItemInspection(int $workOrderId, int $itemId, array $data): : null; $isStock = $order && $order->order_type_code === 'STOCK'; - if ($isStock) { + // 절곡(bending) 공정: 모든 item이 한 단위 → 검사 완료 시 전체 step 일괄 완료 + $isBending = in_array($processType, ['bending', 'bending_wip']); + + if ($isStock || $isBending) { // 미완료 단계 일괄 완료 WorkOrderStepProgress::where('work_order_id', $workOrder->id) ->where('status', '!=', 'completed') @@ -2510,14 +2513,14 @@ public function storeItemInspection(int $workOrderId, int $itemId, array $data): $this->updateStatus($workOrder->id, WorkOrder::STATUS_COMPLETED); } } else { - // 일반 수주: 모든 공정 단계 완료 확인 → WO 자동 완료 + // 일반 수주 (비절곡): 모든 공정 단계 완료 확인 → WO 자동 완료 $this->autoCompleteWorkOrderIfAllStepsDone($workOrder, $tenantId, $userId); } return [ 'item_id' => $item->id, 'inspection_data' => $item->getInspectionData(), - 'work_order_completed' => $isStock && $workOrder->fresh()->status === WorkOrder::STATUS_COMPLETED, + 'work_order_completed' => $workOrder->fresh()->status === WorkOrder::STATUS_COMPLETED, ]; }