Files
sam-api/app/Http/Requests/Order/CreateProductionOrderRequest.php
권혁성 adfccc9af0 fix:생산지시 생성 시 다중 담당자(assignee_ids) 저장 누락 수정
- CreateProductionOrderRequest에 assignee_ids 배열 validation 추가
- OrderService::createProductionOrder에 work_order_assignees 저장 로직 추가
- 담당자 유무에 따른 status 분기 (pending/unassigned) 적용

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 15:57:39 +09:00

43 lines
1.4 KiB
PHP

<?php
namespace App\Http\Requests\Order;
use App\Models\Production\WorkOrder;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class CreateProductionOrderRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'process_id' => 'nullable|integer|exists:processes,id',
'process_ids' => 'nullable|array',
'process_ids.*' => 'integer|exists:processes,id',
'priority' => 'nullable|string',
'process_type' => ['nullable', Rule::in(WorkOrder::PROCESS_TYPES)],
'assignee_id' => 'nullable|integer|exists:users,id',
'assignee_ids' => 'nullable|array',
'assignee_ids.*' => 'integer|exists:users,id',
'team_id' => 'nullable|integer|exists:departments,id',
'scheduled_date' => 'nullable|date',
'memo' => 'nullable|string',
];
}
public function messages(): array
{
return [
'process_type.in' => __('validation.in', ['attribute' => '공정 유형']),
'assignee_id.exists' => __('validation.exists', ['attribute' => '담당자']),
'team_id.exists' => __('validation.exists', ['attribute' => '팀']),
'scheduled_date.date' => __('validation.date', ['attribute' => '예정일']),
];
}
}