- 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>
47 lines
1.8 KiB
PHP
47 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\WorkResult;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class WorkResultStoreRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'work_order_id' => 'required|integer|exists:work_orders,id',
|
|
'work_order_item_id' => 'nullable|integer|exists:work_order_items,id',
|
|
'lot_no' => 'required|string|max:50',
|
|
'work_date' => 'required|date',
|
|
'process_type' => 'nullable|in:screen,slat,bending',
|
|
'product_name' => 'required|string|max:200',
|
|
'specification' => 'nullable|string|max:100',
|
|
'production_qty' => 'required|integer|min:0',
|
|
'good_qty' => 'nullable|integer|min:0',
|
|
'defect_qty' => 'required|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.required' => __('validation.required', ['attribute' => '작업지시']),
|
|
'work_order_id.exists' => __('validation.exists', ['attribute' => '작업지시']),
|
|
'lot_no.required' => __('validation.required', ['attribute' => '로트번호']),
|
|
'work_date.required' => __('validation.required', ['attribute' => '작업일']),
|
|
'product_name.required' => __('validation.required', ['attribute' => '품목명']),
|
|
'production_qty.required' => __('validation.required', ['attribute' => '생산수량']),
|
|
'defect_qty.required' => __('validation.required', ['attribute' => '불량수량']),
|
|
];
|
|
}
|
|
}
|