55 lines
1.3 KiB
PHP
55 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Modules\IndustrialEngineering\Models;
|
|
|
|
use App\Transaction;
|
|
use App\User;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class ManufacturingWorkOrder extends Model
|
|
{
|
|
use BelongsToBusiness;
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'ie_manufacturing_work_orders';
|
|
|
|
protected $guarded = ['id'];
|
|
|
|
protected $casts = [
|
|
'planned_quantity' => 'decimal:4',
|
|
'completed_quantity' => 'decimal:4',
|
|
'planned_start_date' => 'date',
|
|
'planned_end_date' => 'date',
|
|
'actual_start_date' => 'date',
|
|
'actual_end_date' => 'date',
|
|
'bom_snapshot' => 'array',
|
|
'routing_snapshot' => 'array',
|
|
];
|
|
|
|
public function releasePackage()
|
|
{
|
|
return $this->belongsTo(ReleasePackage::class, 'release_package_id');
|
|
}
|
|
|
|
public function lineRevision()
|
|
{
|
|
return $this->belongsTo(LineRevision::class, 'line_revision_id');
|
|
}
|
|
|
|
public function productionTransaction()
|
|
{
|
|
return $this->belongsTo(Transaction::class, 'production_transaction_id');
|
|
}
|
|
|
|
public function serializedUnits()
|
|
{
|
|
return $this->hasMany(SerializedUnit::class, 'work_order_id');
|
|
}
|
|
|
|
public function assignedTo()
|
|
{
|
|
return $this->belongsTo(User::class, 'assigned_to');
|
|
}
|
|
}
|