Added columns in model files of Item and line and production plan and production quantity #348

Merged
jothi merged 1 commits from ranjith-dev into master 2026-02-19 06:00:20 +00:00
4 changed files with 44 additions and 17 deletions

View File

@@ -12,6 +12,7 @@ class Item extends Model
protected $fillable = [
'plant_id',
'line_id',
'category',
'code',
'description',
@@ -19,11 +20,16 @@ class Item extends Model
'uom',
];
public function plant(): BelongsTo
public function plant()
{
return $this->belongsTo(Plant::class);
}
public function item()
{
return $this->belongsTo(Item::class, 'item_id', 'id');
}
public function stickerMasters()
{
return $this->hasMany(StickerMaster::class, 'item_id', 'id');

View File

@@ -3,30 +3,32 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
class Line extends Model
{
use SoftDeletes;
protected $fillable = [
"plant_id",
"name",
"type",
"group_work_center",
"no_of_operation",
"work_group1_id",
"work_group2_id",
"work_group3_id",
"work_group4_id",
"work_group5_id",
"work_group6_id",
"work_group7_id",
"work_group8_id",
"work_group9_id",
"work_group10_id",
'plant_id',
'block_id',
'name',
'type',
'line_capacity',
'group_work_center',
'no_of_operation',
'work_group1_id',
'work_group2_id',
'work_group3_id',
'work_group4_id',
'work_group5_id',
'work_group6_id',
'work_group7_id',
'work_group8_id',
'work_group9_id',
'work_group10_id',
];
public function plant(): BelongsTo
@@ -34,6 +36,11 @@ class Line extends Model
return $this->belongsTo(Plant::class);
}
public function block(): BelongsTo
{
return $this->belongsTo(Block::class);
}
public function testingPanelReadings()
{
return $this->hasMany(TestingPanelReading::class);

View File

@@ -16,9 +16,12 @@ class ProductionPlan extends Model
protected $fillable = [
'plant_id',
'shift_id',
'item_id',
'line_id',
'plan_quantity',
'production_quantity',
'working_days',
'leave_dates',
'operator_id',
'created_at',
'updated_at',
@@ -39,6 +42,11 @@ class ProductionPlan extends Model
return $this->belongsTo(Line::class);
}
public function item(): BelongsTo
{
return $this->belongsTo(Item::class);
}
public function prunable(): Builder
{
return static::where('created_at', '<=', now()->subMonthsNoOverflow(6));

View File

@@ -22,6 +22,7 @@ class ProductionQuantity extends Model
'shift_id',
'line_id',
'item_id',
'machine_id',
'serial_number',
'production_order',
'operator_id',
@@ -53,6 +54,11 @@ class ProductionQuantity extends Model
return $this->belongsTo(Item::class);
}
public function machine(): BelongsTo
{
return $this->belongsTo(Machine::class);
}
protected static function booted()
{
static::created(function ($productionQuantity) {