Masters and Transaction changes

This commit is contained in:
dhanabalan
2025-03-24 17:23:01 +05:30
parent 04ee0cadd5
commit c631f1f2c0
123 changed files with 6935 additions and 32 deletions

33
app/Models/Block.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
class Block extends Model
{
use SoftDeletes;
protected $fillable = [
'name',
'plant_id',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function shifts(): HasMany
{
return $this->hasMany(Shift::class);
}
public function lines(): HasMany
{
return $this->hasMany(Line::class);
}
}

17
app/Models/Item.php Normal file
View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Item extends Model
{
use SoftDeletes;
protected $fillable = [
'code',
'description',
'hourly_quantity',
];
}

42
app/Models/Line.php Normal file
View File

@@ -0,0 +1,42 @@
<?php
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;
class Line extends Model
{
use SoftDeletes;
protected $fillable = [
"plant_id",
"block_id",
"shift_id",
"name",
"type",
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function block(): BelongsTo
{
return $this->belongsTo(Block::class);
}
public function shift(): BelongsTo
{
return $this->belongsTo(Shift::class);
}
public function line_stops(): HasMany
{
return $this->hasMany(LineStop::class);
}
}

36
app/Models/LineStop.php Normal file
View File

@@ -0,0 +1,36 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class LineStop extends Model
{
use SoftDeletes;
protected $fillable = [
"plant_id",
"block_id",
"shift_id",
"code",
"reason",
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function block(): BelongsTo
{
return $this->belongsTo(Block::class);
}
public function shift(): BelongsTo
{
return $this->belongsTo(Shift::class);
}
}

View File

@@ -4,6 +4,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
class Plant extends Model
@@ -21,4 +22,9 @@ class Plant extends Model
{
return $this->belongsTo(Company::class);
}
public function blocks(): HasMany
{
return $this->hasMany(Block::class);
}
}

View File

@@ -0,0 +1,50 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class ProductionLineStop extends Model
{
use SoftDeletes;
protected $fillable = [
"plant_id",
"block_id",
"shift_id",
"line_id",
"code_id",
"reason",
"from_datetime",
"to_datetime",
"stop_hour",
"stop_min",
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function block(): BelongsTo
{
return $this->belongsTo(Block::class);
}
public function shift(): BelongsTo
{
return $this->belongsTo(Shift::class);
}
public function line(): BelongsTo
{
return $this->belongsTo(Line::class);
}
public function linestop(): BelongsTo
{
return $this->belongsTo(LineStop::class);
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class ProductionPlan extends Model
{
use SoftDeletes;
protected $fillable = [
"plant_id",
"shift_id",
"line_id",
"plan_quantity",
"production_quantity",
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function shift(): BelongsTo
{
return $this->belongsTo(Shift::class);
}
public function line(): BelongsTo
{
return $this->belongsTo(Line::class);
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class ProductionQuantity extends Model
{
use SoftDeletes;
protected $fillable = [
"plant_id",
"block_id",
"shift_id",
"line_id",
"plan_quantity",
"hourly_quantity",
"item_code",
"serial_number",
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function block(): BelongsTo
{
return $this->belongsTo(Block::class);
}
public function shift(): BelongsTo
{
return $this->belongsTo(Shift::class);
}
public function line(): BelongsTo
{
return $this->belongsTo(Line::class);
}
}

36
app/Models/Shift.php Normal file
View File

@@ -0,0 +1,36 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class Shift extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'block_id',
'name',
'start_time',
'duration',
'end_time',
];
// public function plant(): BelongsTo
// {
// return $this->belongsTo(Plant::class);
// }
public function block(): BelongsTo
{
return $this->belongsTo(Block::class);
}
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
}

View File

@@ -6,11 +6,12 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Spatie\Permission\Traits\HasRoles;
class User extends Authenticatable
{
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory, Notifiable;
use HasFactory, HasRoles, Notifiable;
/**
* The attributes that are mass assignable.