feat: [HR/기타] 캘린더/배차/설비/재고 + DB 마이그레이션
- 캘린더 CRUD API, 배차차량 관리 API (CRUD + options) - 배차정보 다중 행 시스템 (shipment_vehicle_dispatches) - 설비 다중점검주기 + 부 담당자 스키마 추가 - TodayIssue 날짜 기반 조회, Stock/Client 날짜 필터 - i18n 메시지 추가 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -134,6 +134,14 @@ public function items(): HasMany
|
||||
return $this->hasMany(ShipmentItem::class)->orderBy('seq');
|
||||
}
|
||||
|
||||
/**
|
||||
* 배차정보 관계
|
||||
*/
|
||||
public function vehicleDispatches(): HasMany
|
||||
{
|
||||
return $this->hasMany(ShipmentVehicleDispatch::class)->orderBy('seq');
|
||||
}
|
||||
|
||||
/**
|
||||
* 거래처 관계
|
||||
*/
|
||||
|
||||
52
app/Models/Tenants/ShipmentVehicleDispatch.php
Normal file
52
app/Models/Tenants/ShipmentVehicleDispatch.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Tenants;
|
||||
|
||||
use App\Traits\Auditable;
|
||||
use App\Traits\BelongsToTenant;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class ShipmentVehicleDispatch extends Model
|
||||
{
|
||||
use Auditable, BelongsToTenant, SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id',
|
||||
'shipment_id',
|
||||
'seq',
|
||||
'logistics_company',
|
||||
'arrival_datetime',
|
||||
'tonnage',
|
||||
'vehicle_no',
|
||||
'driver_contact',
|
||||
'remarks',
|
||||
'options',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'seq' => 'integer',
|
||||
'shipment_id' => 'integer',
|
||||
'arrival_datetime' => 'datetime',
|
||||
'options' => 'array',
|
||||
];
|
||||
|
||||
/**
|
||||
* 출하 관계
|
||||
*/
|
||||
public function shipment(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Shipment::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 다음 순번 가져오기
|
||||
*/
|
||||
public static function getNextSeq(int $shipmentId): int
|
||||
{
|
||||
$maxSeq = static::where('shipment_id', $shipmentId)->max('seq');
|
||||
|
||||
return ($maxSeq ?? 0) + 1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user