59 lines
2.2 KiB
PHP
59 lines
2.2 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Requests\Material;
|
||
|
|
|
||
|
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
|
||
|
|
class StoreNonconformingReportRequest extends FormRequest
|
||
|
|
{
|
||
|
|
public function authorize(): bool
|
||
|
|
{
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function rules(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'nc_type' => 'required|string|in:material,process,construction,other',
|
||
|
|
'occurred_at' => 'required|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',
|
||
|
|
|
||
|
|
// 자재 상세 내역
|
||
|
|
'items' => 'nullable|array',
|
||
|
|
'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',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function messages(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'nc_type.required' => __('error.nonconforming.nc_type_required'),
|
||
|
|
'nc_type.in' => __('error.nonconforming.nc_type_invalid'),
|
||
|
|
'occurred_at.required' => __('error.nonconforming.occurred_at_required'),
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|