feat(API): 중간검사 문서 템플릿 동적 연동 - process_steps ↔ document_templates 연결

- process_steps 테이블에 document_template_id FK 추가 (migration)
- ProcessStep 모델에 documentTemplate BelongsTo 관계 추가
- ProcessStepService에서 documentTemplate eager loading
- StoreProcessStepRequest/UpdateProcessStepRequest에 document_template_id 유효성 검증
- WorkOrderService에 getInspectionTemplate(), createInspectionDocument() 메서드 추가
- WorkOrderController에 inspection-template/inspection-document 엔드포인트 추가
- DocumentService.formatTemplateForReact() 접근자 public으로 변경
- i18n 메시지 키 추가 (inspection_document_created, no_inspection_template)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-10 08:35:57 +09:00
parent 7adfc6d536
commit e885b1ca45
12 changed files with 232 additions and 3 deletions

View File

@@ -218,4 +218,24 @@ public function inspectionReport(int $id)
return $this->service->getInspectionReport($id);
}, __('message.work_order.fetched'));
}
/**
* 작업지시의 검사용 문서 템플릿 조회
*/
public function inspectionTemplate(int $id)
{
return ApiResponse::handle(function () use ($id) {
return $this->service->getInspectionTemplate($id);
}, __('message.work_order.fetched'));
}
/**
* 검사 완료 시 검사 문서(Document) 생성
*/
public function createInspectionDocument(Request $request, int $id)
{
return ApiResponse::handle(function () use ($request, $id) {
return $this->service->createInspectionDocument($id, $request->all());
}, __('message.work_order.inspection_document_created'));
}
}

View File

@@ -18,6 +18,7 @@ public function rules(): array
'is_required' => ['nullable', 'boolean'],
'needs_approval' => ['nullable', 'boolean'],
'needs_inspection' => ['nullable', 'boolean'],
'document_template_id' => ['nullable', 'integer', 'exists:document_templates,id'],
'is_active' => ['nullable', 'boolean'],
'connection_type' => ['nullable', 'string', 'max:20'],
'connection_target' => ['nullable', 'string', 'max:255'],
@@ -32,6 +33,7 @@ public function attributes(): array
'is_required' => '필수여부',
'needs_approval' => '승인필요여부',
'needs_inspection' => '검사필요여부',
'document_template_id' => '문서양식',
'is_active' => '사용여부',
'connection_type' => '연결유형',
'connection_target' => '연결대상',

View File

@@ -18,6 +18,7 @@ public function rules(): array
'is_required' => ['nullable', 'boolean'],
'needs_approval' => ['nullable', 'boolean'],
'needs_inspection' => ['nullable', 'boolean'],
'document_template_id' => ['nullable', 'integer', 'exists:document_templates,id'],
'is_active' => ['nullable', 'boolean'],
'connection_type' => ['nullable', 'string', 'max:20'],
'connection_target' => ['nullable', 'string', 'max:255'],
@@ -32,6 +33,7 @@ public function attributes(): array
'is_required' => '필수여부',
'needs_approval' => '승인필요여부',
'needs_inspection' => '검사필요여부',
'document_template_id' => '문서양식',
'is_active' => '사용여부',
'connection_type' => '연결유형',
'connection_target' => '연결대상',