'datetime', ]; /** * 調撥類型常數 */ public const TYPE_W2W = 'warehouse_to_warehouse'; public const TYPE_M2W = 'machine_to_warehouse'; /** * 狀態常數 */ public const STATUS_DRAFT = 'draft'; public const STATUS_PENDING = 'pending'; public const STATUS_IN_TRANSIT = 'in_transit'; public const STATUS_COMPLETED = 'completed'; public const STATUS_CANCELLED = 'cancelled'; /** * 來源倉庫 */ public function fromWarehouse() { return $this->belongsTo(Warehouse::class, 'from_warehouse_id'); } /** * 來源機台(機台退回時) */ public function fromMachine() { return $this->belongsTo(\App\Models\Machine\Machine::class, 'from_machine_id'); } /** * 目標倉庫 */ public function toWarehouse() { return $this->belongsTo(Warehouse::class, 'to_warehouse_id'); } /** * 調撥單明細 */ public function items() { return $this->hasMany(TransferOrderItem::class); } /** * 建立人 */ public function creator() { return $this->belongsTo(\App\Models\System\User::class, 'created_by'); } }