feat: G-2 작업실적 관리 API 구현

- WorkResult 모델 생성 (Production 네임스페이스)
- WorkResultService 서비스 구현 (CRUD + 통계 + 토글)
- WorkResultController 컨트롤러 생성 (8개 엔드포인트)
- FormRequest 검증 클래스 (Store/Update)
- Swagger 문서 작성 (WorkResultApi.php)
- 라우트 추가 (/api/v1/work-results)
- i18n 메시지 추가 (work_result 키)

API Endpoints:
- GET /work-results - 목록 조회 (페이징, 필터링)
- GET /work-results/stats - 통계 조회
- GET /work-results/{id} - 상세 조회
- POST /work-results - 등록
- PUT /work-results/{id} - 수정
- DELETE /work-results/{id} - 삭제
- PATCH /work-results/{id}/inspection - 검사 상태 토글
- PATCH /work-results/{id}/packaging - 포장 상태 토글

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-26 15:18:08 +09:00
parent dd0f79b947
commit 84cce6742e
9 changed files with 1154 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Http\Requests\WorkResult;
use Illuminate\Foundation\Http\FormRequest;
class WorkResultUpdateRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'work_order_id' => 'sometimes|integer|exists:work_orders,id',
'work_order_item_id' => 'nullable|integer|exists:work_order_items,id',
'lot_no' => 'sometimes|string|max:50',
'work_date' => 'sometimes|date',
'process_type' => 'sometimes|in:screen,slat,bending',
'product_name' => 'sometimes|string|max:200',
'specification' => 'nullable|string|max:100',
'production_qty' => 'sometimes|integer|min:0',
'good_qty' => 'nullable|integer|min:0',
'defect_qty' => 'sometimes|integer|min:0',
'is_inspected' => 'nullable|boolean',
'is_packaged' => 'nullable|boolean',
'worker_id' => 'nullable|integer|exists:users,id',
'memo' => 'nullable|string|max:2000',
];
}
public function messages(): array
{
return [
'work_order_id.exists' => __('validation.exists', ['attribute' => '작업지시']),
'lot_no.max' => __('validation.max.string', ['attribute' => '로트번호', 'max' => 50]),
'work_date.date' => __('validation.date', ['attribute' => '작업일']),
'product_name.max' => __('validation.max.string', ['attribute' => '품목명', 'max' => 200]),
];
}
}