- shipments 테이블에서 배차 관련 컬럼 8개 삭제 (vehicle_no, driver_name 등) - shipping 전환 시 배차 정보를 vehicle_dispatches에 저장 - delivery_method ENUM → VARCHAR 변경 (common_codes 기반) - VehicleDispatchService에 수주/작성자 관계 로딩 추가 - Swagger delivery_method enum 제약 제거 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
80 lines
3.2 KiB
PHP
80 lines
3.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Shipment;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class ShipmentStoreRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
// 기본 정보
|
|
'shipment_no' => 'nullable|string|max:50',
|
|
'lot_no' => 'nullable|string|max:50',
|
|
'order_id' => 'nullable|integer|exists:orders,id',
|
|
'scheduled_date' => 'required|date',
|
|
'status' => 'nullable|in:scheduled,ready,shipping,completed',
|
|
'priority' => 'nullable|in:urgent,normal,low',
|
|
'delivery_method' => 'nullable|in:pickup,direct,logistics,direct_dispatch,loading,kyungdong_delivery,daesin_delivery,kyungdong_freight,daesin_freight,self_pickup',
|
|
|
|
// 발주처/배송 정보
|
|
'client_id' => 'nullable|integer|exists:clients,id',
|
|
'customer_name' => 'nullable|string|max:100',
|
|
'site_name' => 'nullable|string|max:100',
|
|
'delivery_address' => 'nullable|string|max:255',
|
|
'receiver' => 'nullable|string|max:50',
|
|
'receiver_contact' => 'nullable|string|max:50',
|
|
|
|
// 상태 플래그
|
|
'can_ship' => 'nullable|boolean',
|
|
'deposit_confirmed' => 'nullable|boolean',
|
|
'invoice_issued' => 'nullable|boolean',
|
|
'customer_grade' => 'nullable|string|max:20',
|
|
|
|
// 상차 정보
|
|
'loading_manager' => 'nullable|string|max:50',
|
|
'loading_time' => 'nullable|date',
|
|
|
|
// 기타
|
|
'remarks' => 'nullable|string',
|
|
|
|
// 배차정보
|
|
'vehicle_dispatches' => 'nullable|array',
|
|
'vehicle_dispatches.*.seq' => 'nullable|integer|min:1',
|
|
'vehicle_dispatches.*.logistics_company' => 'nullable|string|max:100',
|
|
'vehicle_dispatches.*.arrival_datetime' => 'nullable|date',
|
|
'vehicle_dispatches.*.tonnage' => 'nullable|string|max:20',
|
|
'vehicle_dispatches.*.vehicle_no' => 'nullable|string|max:20',
|
|
'vehicle_dispatches.*.driver_contact' => 'nullable|string|max:50',
|
|
'vehicle_dispatches.*.remarks' => 'nullable|string',
|
|
|
|
// 출하 품목
|
|
'items' => 'nullable|array',
|
|
'items.*.seq' => 'nullable|integer|min:1',
|
|
'items.*.item_code' => 'nullable|string|max:50',
|
|
'items.*.item_name' => 'required|string|max:100',
|
|
'items.*.floor_unit' => 'nullable|string|max:50',
|
|
'items.*.specification' => 'nullable|string|max:100',
|
|
'items.*.quantity' => 'nullable|numeric|min:0',
|
|
'items.*.unit' => 'nullable|string|max:20',
|
|
'items.*.lot_no' => 'nullable|string|max:50',
|
|
'items.*.stock_lot_id' => 'nullable|integer|exists:stock_lots,id',
|
|
'items.*.remarks' => 'nullable|string',
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'scheduled_date.required' => __('validation.required', ['attribute' => '출고예정일']),
|
|
'items.*.item_name.required' => __('validation.required', ['attribute' => '품목명']),
|
|
];
|
|
}
|
|
}
|