refactor: [shipment] 배차 정보를 shipment_vehicle_dispatches로 일원화

- 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>
This commit is contained in:
2026-03-18 23:15:47 +09:00
parent 5e52293454
commit 6563d977ee
8 changed files with 87 additions and 73 deletions

View File

@@ -16,7 +16,7 @@ public function index(array $params): LengthAwarePaginator
$query = ShipmentVehicleDispatch::query()
->where('tenant_id', $tenantId)
->with('shipment');
->with(['shipment.order.client', 'shipment.order.writer', 'shipment.creator']);
// 검색어 필터
if (! empty($params['search'])) {
@@ -98,7 +98,7 @@ public function show(int $id): ShipmentVehicleDispatch
return ShipmentVehicleDispatch::query()
->where('tenant_id', $tenantId)
->with('shipment')
->with(['shipment.order.client', 'shipment.order.writer', 'shipment.creator'])
->findOrFail($id);
}
@@ -114,7 +114,7 @@ public function update(int $id, array $data): ShipmentVehicleDispatch
->findOrFail($id);
// options에 저장할 필드 분리
$optionFields = ['freight_cost_type', 'supply_amount', 'vat', 'total_amount', 'status'];
$optionFields = ['freight_cost_type', 'supply_amount', 'vat', 'total_amount'];
$directFields = ['logistics_company', 'arrival_datetime', 'tonnage', 'vehicle_no', 'driver_contact', 'remarks'];
// 기존 options 유지하면서 업데이트