Files
sam-api/app/Http/Requests/Material/UpdateNonconformingReportRequest.php

52 lines
2.0 KiB
PHP
Raw Normal View History

<?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',
];
}
}