feat : 자재관리, 수입관리, 로트관리 모델링 추가
This commit is contained in:
23
app/Models/Lot.php
Normal file
23
app/Models/Lot.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Lot extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
// 자재 마스터
|
||||
public function material()
|
||||
{
|
||||
return $this->belongsTo(Material::class, 'material_id');
|
||||
}
|
||||
|
||||
// 판매 기록
|
||||
public function sales()
|
||||
{
|
||||
return $this->hasMany(LotSale::class, 'lot_id');
|
||||
}
|
||||
}
|
||||
18
app/Models/LotSale.php
Normal file
18
app/Models/LotSale.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class LotSale extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
// 로트 정보
|
||||
public function lot()
|
||||
{
|
||||
return $this->belongsTo(Lot::class, 'lot_id');
|
||||
}
|
||||
}
|
||||
35
app/Models/Material.php
Normal file
35
app/Models/Material.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Material extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
// 자재(품목) 마스터
|
||||
protected $fillable = [
|
||||
'name', // 자재명(품명)
|
||||
'specification', // 규격
|
||||
'material_code', // 자재코드
|
||||
'unit', // 단위
|
||||
'is_inspection', // 검사대상 여부(Y/N)
|
||||
'search_tag', // 검색 태그
|
||||
'remarks', // 비고
|
||||
];
|
||||
|
||||
|
||||
// 자재 입고 내역
|
||||
public function receipts()
|
||||
{
|
||||
return $this->hasMany(MaterialReceipt::class, 'material_id');
|
||||
}
|
||||
|
||||
// 로트 관리
|
||||
public function lots()
|
||||
{
|
||||
return $this->hasMany(Lot::class, 'material_id');
|
||||
}
|
||||
}
|
||||
23
app/Models/MaterialInspection.php
Normal file
23
app/Models/MaterialInspection.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class MaterialInspection extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
// 입고 내역
|
||||
public function receipt()
|
||||
{
|
||||
return $this->belongsTo(MaterialReceipt::class, 'receipt_id');
|
||||
}
|
||||
|
||||
// 검사 항목
|
||||
public function items()
|
||||
{
|
||||
return $this->hasMany(MaterialInspectionItem::class, 'inspection_id');
|
||||
}
|
||||
}
|
||||
17
app/Models/MaterialInspectionItem.php
Normal file
17
app/Models/MaterialInspectionItem.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class MaterialInspectionItem extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
// 검사 내역
|
||||
public function inspection()
|
||||
{
|
||||
return $this->belongsTo(MaterialInspection::class, 'inspection_id');
|
||||
}
|
||||
}
|
||||
29
app/Models/MaterialReceipt.php
Normal file
29
app/Models/MaterialReceipt.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class MaterialReceipt extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'material_id', 'receipt_date', 'lot_number', 'received_qty', 'unit',
|
||||
'supplier_name', 'manufacturer_name', 'purchase_price_excl_vat',
|
||||
'weight_kg', 'status_code', 'is_inspection', 'inspection_date', 'remarks'
|
||||
];
|
||||
|
||||
// 자재 마스터
|
||||
public function material()
|
||||
{
|
||||
return $this->belongsTo(Material::class, 'material_id');
|
||||
}
|
||||
|
||||
// 수입검사 내역
|
||||
public function inspections()
|
||||
{
|
||||
return $this->hasMany(MaterialInspection::class, 'receipt_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user