feat: [material] 부적합관리 API Phase 1-A 구현
- Migration: nonconforming_reports, nonconforming_report_items 테이블 - Model: NonconformingReport, NonconformingReportItem (관계, cast, scope) - FormRequest: Store/Update 검증 (items 배열 포함) - Service: CRUD + 채번(NC-YYYYMMDD-NNN) + 비용 자동 계산 + 상태 전이 - Controller: REST 7개 엔드포인트 (목록/통계/상세/등록/수정/삭제/상태변경) - Route: /api/v1/material/nonconforming-reports - i18n: 부적합관리 에러 메시지 (ko)
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Material;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateNonconformingReportRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'nc_type' => 'sometimes|string|in:material,process,construction,other',
|
||||
'occurred_at' => 'sometimes|date',
|
||||
'confirmed_at' => 'nullable|date',
|
||||
'site_name' => 'nullable|string|max:100',
|
||||
'department_id' => 'nullable|integer|exists:departments,id',
|
||||
'order_id' => 'nullable|integer|exists:orders,id',
|
||||
'item_id' => 'nullable|integer|exists:items,id',
|
||||
'defect_quantity' => 'nullable|numeric|min:0',
|
||||
'unit' => 'nullable|string|max:20',
|
||||
'defect_description' => 'nullable|string',
|
||||
'cause_analysis' => 'nullable|string',
|
||||
'corrective_action' => 'nullable|string',
|
||||
'action_completed_at' => 'nullable|date',
|
||||
'action_manager_id' => 'nullable|integer',
|
||||
'related_employee_id' => 'nullable|integer',
|
||||
'material_cost' => 'nullable|integer|min:0',
|
||||
'shipping_cost' => 'nullable|integer|min:0',
|
||||
'construction_cost' => 'nullable|integer|min:0',
|
||||
'other_cost' => 'nullable|integer|min:0',
|
||||
'remarks' => 'nullable|string',
|
||||
'drawing_location' => 'nullable|string|max:255',
|
||||
'status' => 'sometimes|string|in:RECEIVED,ANALYZING,RESOLVED,CLOSED',
|
||||
|
||||
// 자재 상세 내역
|
||||
'items' => 'nullable|array',
|
||||
'items.*.id' => 'nullable|integer',
|
||||
'items.*.item_id' => 'nullable|integer',
|
||||
'items.*.item_name' => 'required_with:items|string|max:100',
|
||||
'items.*.specification' => 'nullable|string|max:100',
|
||||
'items.*.quantity' => 'nullable|numeric|min:0',
|
||||
'items.*.unit_price' => 'nullable|integer|min:0',
|
||||
'items.*.remarks' => 'nullable|string|max:255',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user