feat: 계좌관리 추가
This commit is contained in:
BIN
app/Models/ApiKey.php:Zone.Identifier
Normal file
BIN
app/Models/ApiKey.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/ApiRequestLog.php:Zone.Identifier
Normal file
BIN
app/Models/ApiRequestLog.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Audit/AuditLog.php:Zone.Identifier
Normal file
BIN
app/Models/Audit/AuditLog.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/BadDebts/BadDebt.php:Zone.Identifier
Normal file
BIN
app/Models/BadDebts/BadDebt.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/BadDebts/BadDebtDocument.php:Zone.Identifier
Normal file
BIN
app/Models/BadDebts/BadDebtDocument.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/BadDebts/BadDebtMemo.php:Zone.Identifier
Normal file
BIN
app/Models/BadDebts/BadDebtMemo.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Boards/Board.php:Zone.Identifier
Normal file
BIN
app/Models/Boards/Board.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Boards/BoardComment.php:Zone.Identifier
Normal file
BIN
app/Models/Boards/BoardComment.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Boards/BoardSetting.php:Zone.Identifier
Normal file
BIN
app/Models/Boards/BoardSetting.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Boards/Post.php:Zone.Identifier
Normal file
BIN
app/Models/Boards/Post.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Boards/PostCustomFieldValue.php:Zone.Identifier
Normal file
BIN
app/Models/Boards/PostCustomFieldValue.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Calculation/CalculationConfig.php:Zone.Identifier
Normal file
BIN
app/Models/Calculation/CalculationConfig.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/CategoryGroup.php:Zone.Identifier
Normal file
BIN
app/Models/CategoryGroup.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Commons/Category.php:Zone.Identifier
Normal file
BIN
app/Models/Commons/Category.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Commons/CategoryField.php:Zone.Identifier
Normal file
BIN
app/Models/Commons/CategoryField.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Commons/CategoryLog.php:Zone.Identifier
Normal file
BIN
app/Models/Commons/CategoryLog.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Commons/CategoryTemplate.php:Zone.Identifier
Normal file
BIN
app/Models/Commons/CategoryTemplate.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Commons/Classification.php:Zone.Identifier
Normal file
BIN
app/Models/Commons/Classification.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Commons/File.php:Zone.Identifier
Normal file
BIN
app/Models/Commons/File.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Commons/GlobalMenu.php:Zone.Identifier
Normal file
BIN
app/Models/Commons/GlobalMenu.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Commons/Menu.php:Zone.Identifier
Normal file
BIN
app/Models/Commons/Menu.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Commons/Tag.php:Zone.Identifier
Normal file
BIN
app/Models/Commons/Tag.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/CompanyRequest.php:Zone.Identifier
Normal file
BIN
app/Models/CompanyRequest.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Construction/Contract.php:Zone.Identifier
Normal file
BIN
app/Models/Construction/Contract.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Design/BomTemplate.php:Zone.Identifier
Normal file
BIN
app/Models/Design/BomTemplate.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Design/BomTemplateItem.php:Zone.Identifier
Normal file
BIN
app/Models/Design/BomTemplateItem.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Design/DesignModel.php:Zone.Identifier
Normal file
BIN
app/Models/Design/DesignModel.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Design/ModelVersion.php:Zone.Identifier
Normal file
BIN
app/Models/Design/ModelVersion.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Estimate/Estimate.php:Zone.Identifier
Normal file
BIN
app/Models/Estimate/Estimate.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Estimate/EstimateItem.php:Zone.Identifier
Normal file
BIN
app/Models/Estimate/EstimateItem.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Estimates/MainRequestEstimate.php:Zone.Identifier
Normal file
BIN
app/Models/Estimates/MainRequestEstimate.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/FcmSendLog.php:Zone.Identifier
Normal file
BIN
app/Models/FcmSendLog.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/FileShareLink.php:Zone.Identifier
Normal file
BIN
app/Models/FileShareLink.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Folder.php:Zone.Identifier
Normal file
BIN
app/Models/Folder.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/ItemMaster/CustomTab.php:Zone.Identifier
Normal file
BIN
app/Models/ItemMaster/CustomTab.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/ItemMaster/EntityRelationship.php:Zone.Identifier
Normal file
BIN
app/Models/ItemMaster/EntityRelationship.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/ItemMaster/ItemBomItem.php:Zone.Identifier
Normal file
BIN
app/Models/ItemMaster/ItemBomItem.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/ItemMaster/ItemField.php:Zone.Identifier
Normal file
BIN
app/Models/ItemMaster/ItemField.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/ItemMaster/ItemPage.php:Zone.Identifier
Normal file
BIN
app/Models/ItemMaster/ItemPage.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/ItemMaster/ItemSection.php:Zone.Identifier
Normal file
BIN
app/Models/ItemMaster/ItemSection.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/ItemMaster/TabColumn.php:Zone.Identifier
Normal file
BIN
app/Models/ItemMaster/TabColumn.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/ItemMaster/UnitOption.php:Zone.Identifier
Normal file
BIN
app/Models/ItemMaster/UnitOption.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Items/Item.php:Zone.Identifier
Normal file
BIN
app/Models/Items/Item.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Items/ItemDetail.php:Zone.Identifier
Normal file
BIN
app/Models/Items/ItemDetail.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Items/ItemReceipt.php:Zone.Identifier
Normal file
BIN
app/Models/Items/ItemReceipt.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/LoginToken.php:Zone.Identifier
Normal file
BIN
app/Models/LoginToken.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/MainRequest.php:Zone.Identifier
Normal file
BIN
app/Models/MainRequest.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/MainRequestFlow.php:Zone.Identifier
Normal file
BIN
app/Models/MainRequestFlow.php:Zone.Identifier
Normal file
Binary file not shown.
79
app/Models/Materials/Material.php
Normal file
79
app/Models/Materials/Material.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Materials;
|
||||
|
||||
use App\Models\Commons\Category;
|
||||
use App\Models\Commons\File;
|
||||
use App\Models\Commons\Tag;
|
||||
use App\Models\Qualitys\Lot;
|
||||
use App\Traits\BelongsToTenant;
|
||||
use App\Traits\ModelTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* @mixin IdeHelperMaterial
|
||||
*/
|
||||
class Material extends Model
|
||||
{
|
||||
use BelongsToTenant, ModelTrait, SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id',
|
||||
'category_id',
|
||||
'name',
|
||||
'item_name',
|
||||
'specification',
|
||||
'material_code',
|
||||
'material_type',
|
||||
'unit',
|
||||
'is_inspection',
|
||||
'search_tag',
|
||||
'remarks',
|
||||
'attributes',
|
||||
'options',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'attributes' => 'array',
|
||||
'options' => 'array',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
// 카테고리
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(Category::class);
|
||||
}
|
||||
|
||||
// 자재 입고 내역
|
||||
public function receipts()
|
||||
{
|
||||
return $this->hasMany(MaterialReceipt::class, 'material_id');
|
||||
}
|
||||
|
||||
// 로트 관리
|
||||
public function lots()
|
||||
{
|
||||
return $this->hasMany(Lot::class, 'material_id');
|
||||
}
|
||||
|
||||
// 파일 목록 (N:M, 폴리모픽)
|
||||
public function files()
|
||||
{
|
||||
return $this->morphMany(File::class, 'fileable');
|
||||
}
|
||||
|
||||
// 태그 목록 (N:M, 폴리모픽)
|
||||
public function tags()
|
||||
{
|
||||
return $this->morphToMany(Tag::class, 'taggable');
|
||||
}
|
||||
}
|
||||
BIN
app/Models/Materials/Material.php:Zone.Identifier
Normal file
BIN
app/Models/Materials/Material.php:Zone.Identifier
Normal file
Binary file not shown.
26
app/Models/Materials/MaterialInspection.php
Normal file
26
app/Models/Materials/MaterialInspection.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Materials;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* @mixin IdeHelperMaterialInspection
|
||||
*/
|
||||
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');
|
||||
}
|
||||
}
|
||||
BIN
app/Models/Materials/MaterialInspection.php:Zone.Identifier
Normal file
BIN
app/Models/Materials/MaterialInspection.php:Zone.Identifier
Normal file
Binary file not shown.
20
app/Models/Materials/MaterialInspectionItem.php
Normal file
20
app/Models/Materials/MaterialInspectionItem.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Materials;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* @mixin IdeHelperMaterialInspectionItem
|
||||
*/
|
||||
class MaterialInspectionItem extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
// 검사 내역
|
||||
public function inspection()
|
||||
{
|
||||
return $this->belongsTo(MaterialInspection::class, 'inspection_id');
|
||||
}
|
||||
}
|
||||
BIN
app/Models/Materials/MaterialInspectionItem.php:Zone.Identifier
Normal file
BIN
app/Models/Materials/MaterialInspectionItem.php:Zone.Identifier
Normal file
Binary file not shown.
32
app/Models/Materials/MaterialReceipt.php
Normal file
32
app/Models/Materials/MaterialReceipt.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Materials;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* @mixin IdeHelperMaterialReceipt
|
||||
*/
|
||||
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');
|
||||
}
|
||||
}
|
||||
BIN
app/Models/Materials/MaterialReceipt.php:Zone.Identifier
Normal file
BIN
app/Models/Materials/MaterialReceipt.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Members/User.php:Zone.Identifier
Normal file
BIN
app/Models/Members/User.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Members/UserMenuPermission.php:Zone.Identifier
Normal file
BIN
app/Models/Members/UserMenuPermission.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Members/UserRole.php:Zone.Identifier
Normal file
BIN
app/Models/Members/UserRole.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Members/UserTenant.php:Zone.Identifier
Normal file
BIN
app/Models/Members/UserTenant.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/NotificationSetting.php:Zone.Identifier
Normal file
BIN
app/Models/NotificationSetting.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/NotificationSettingGroup.php:Zone.Identifier
Normal file
BIN
app/Models/NotificationSettingGroup.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/NotificationSettingGroupItem.php:Zone.Identifier
Normal file
BIN
app/Models/NotificationSettingGroupItem.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/NotificationSettingGroupState.php:Zone.Identifier
Normal file
BIN
app/Models/NotificationSettingGroupState.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Orders/Client.php:Zone.Identifier
Normal file
BIN
app/Models/Orders/Client.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Orders/ClientGroup.php:Zone.Identifier
Normal file
BIN
app/Models/Orders/ClientGroup.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Orders/Order.php:Zone.Identifier
Normal file
BIN
app/Models/Orders/Order.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Orders/OrderHistory.php:Zone.Identifier
Normal file
BIN
app/Models/Orders/OrderHistory.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Orders/OrderItem.php:Zone.Identifier
Normal file
BIN
app/Models/Orders/OrderItem.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Orders/OrderItemComponent.php:Zone.Identifier
Normal file
BIN
app/Models/Orders/OrderItemComponent.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Orders/OrderVersion.php:Zone.Identifier
Normal file
BIN
app/Models/Orders/OrderVersion.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Permissions/Permission.php:Zone.Identifier
Normal file
BIN
app/Models/Permissions/Permission.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Permissions/PermissionOverride.php:Zone.Identifier
Normal file
BIN
app/Models/Permissions/PermissionOverride.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Permissions/Role.php:Zone.Identifier
Normal file
BIN
app/Models/Permissions/Role.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Permissions/RoleMenuPermission.php:Zone.Identifier
Normal file
BIN
app/Models/Permissions/RoleMenuPermission.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Popups/Popup.php:Zone.Identifier
Normal file
BIN
app/Models/Popups/Popup.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Process.php:Zone.Identifier
Normal file
BIN
app/Models/Process.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/ProcessClassificationRule.php:Zone.Identifier
Normal file
BIN
app/Models/ProcessClassificationRule.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/ProcessItem.php:Zone.Identifier
Normal file
BIN
app/Models/ProcessItem.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Production/WorkOrder.php:Zone.Identifier
Normal file
BIN
app/Models/Production/WorkOrder.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Production/WorkOrderAssignee.php:Zone.Identifier
Normal file
BIN
app/Models/Production/WorkOrderAssignee.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Production/WorkOrderBendingDetail.php:Zone.Identifier
Normal file
BIN
app/Models/Production/WorkOrderBendingDetail.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Production/WorkOrderIssue.php:Zone.Identifier
Normal file
BIN
app/Models/Production/WorkOrderIssue.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Production/WorkOrderItem.php:Zone.Identifier
Normal file
BIN
app/Models/Production/WorkOrderItem.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Production/WorkResult.php:Zone.Identifier
Normal file
BIN
app/Models/Production/WorkResult.php:Zone.Identifier
Normal file
Binary file not shown.
47
app/Models/Products/CommonCode.php
Normal file
47
app/Models/Products/CommonCode.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Products;
|
||||
|
||||
use App\Traits\BelongsToTenant;
|
||||
use App\Traits\ModelTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* @mixin IdeHelperCommonCode
|
||||
*/
|
||||
class CommonCode extends Model
|
||||
{
|
||||
use BelongsToTenant, ModelTrait, SoftDeletes;
|
||||
|
||||
protected $table = 'common_codes';
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id',
|
||||
'code_group',
|
||||
'code',
|
||||
'name',
|
||||
'parent_id',
|
||||
'attributes',
|
||||
'description',
|
||||
'is_active',
|
||||
'sort_order',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'attributes' => 'array',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
|
||||
// 관계: 상위 코드
|
||||
public function parent()
|
||||
{
|
||||
return $this->belongsTo(self::class, 'parent_id');
|
||||
}
|
||||
|
||||
// 관계: 하위 코드들
|
||||
public function children()
|
||||
{
|
||||
return $this->hasMany(self::class, 'parent_id');
|
||||
}
|
||||
}
|
||||
BIN
app/Models/Products/CommonCode.php:Zone.Identifier
Normal file
BIN
app/Models/Products/CommonCode.php:Zone.Identifier
Normal file
Binary file not shown.
33
app/Models/Products/Part.php
Normal file
33
app/Models/Products/Part.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Products;
|
||||
|
||||
use App\Models\Commons\Tag;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* @mixin IdeHelperPart
|
||||
*/
|
||||
class Part extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = ['tenant_id', 'code', 'name', 'category_id', 'part_type_id', 'unit', 'attributes', 'description', 'is_active'];
|
||||
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(CommonCode::class, 'category_id');
|
||||
}
|
||||
|
||||
public function partType()
|
||||
{
|
||||
return $this->belongsTo(CommonCode::class, 'part_type_id');
|
||||
}
|
||||
|
||||
// 태그 목록 (N:M, 폴리모픽)
|
||||
public function tags()
|
||||
{
|
||||
return $this->morphToMany(Tag::class, 'taggable');
|
||||
}
|
||||
}
|
||||
BIN
app/Models/Products/Part.php:Zone.Identifier
Normal file
BIN
app/Models/Products/Part.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Products/Price.php:Zone.Identifier
Normal file
BIN
app/Models/Products/Price.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Products/PriceRevision.php:Zone.Identifier
Normal file
BIN
app/Models/Products/PriceRevision.php:Zone.Identifier
Normal file
Binary file not shown.
118
app/Models/Products/Product.php
Normal file
118
app/Models/Products/Product.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Products;
|
||||
|
||||
use App\Models\Commons\Category;
|
||||
use App\Models\Commons\File;
|
||||
use App\Models\Commons\Tag;
|
||||
use App\Traits\BelongsToTenant;
|
||||
use App\Traits\ModelTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Product extends Model
|
||||
{
|
||||
use BelongsToTenant, ModelTrait, SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id', 'code', 'name', 'unit', 'category_id',
|
||||
'product_type', // 라벨/분류용
|
||||
'attributes', 'attributes_archive', 'options', 'bom', 'description',
|
||||
'is_sellable', 'is_purchasable', 'is_producible',
|
||||
// 하이브리드 구조: 최소 고정 필드
|
||||
'safety_stock', 'lead_time', 'is_variable_size',
|
||||
'product_category', 'part_type',
|
||||
// 파일 필드
|
||||
'bending_diagram', 'bending_details',
|
||||
'specification_file', 'specification_file_name',
|
||||
'certification_file', 'certification_file_name',
|
||||
'certification_number', 'certification_start_date', 'certification_end_date',
|
||||
'created_by', 'updated_by', 'is_active',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'attributes' => 'array',
|
||||
'attributes_archive' => 'array',
|
||||
'options' => 'array',
|
||||
'bom' => 'array',
|
||||
'bending_details' => 'array',
|
||||
'certification_start_date' => 'date',
|
||||
'certification_end_date' => 'date',
|
||||
'is_sellable' => 'boolean',
|
||||
'is_purchasable' => 'boolean',
|
||||
'is_producible' => 'boolean',
|
||||
'is_variable_size' => 'boolean',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
// 분류
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(Category::class, 'category_id');
|
||||
}
|
||||
|
||||
// BOM (자기참조) — 라인 모델 경유
|
||||
public function componentLines()
|
||||
{
|
||||
return $this->hasMany(ProductComponent::class, 'parent_product_id')->orderBy('sort_order');
|
||||
}
|
||||
|
||||
// 라인들
|
||||
public function parentLines()
|
||||
{
|
||||
return $this->hasMany(ProductComponent::class, 'child_product_id');
|
||||
} // 나를 쓰는 상위 라인들
|
||||
|
||||
// 편의: 직접 children/parents 제품에 접근
|
||||
public function children()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
self::class, 'product_components', 'parent_product_id', 'child_product_id'
|
||||
)->withPivot(['quantity', 'sort_order', 'is_default'])
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function parents()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
self::class, 'product_components', 'child_product_id', 'parent_product_id'
|
||||
)->withPivot(['quantity', 'sort_order', 'is_default'])
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
// 파일 / 태그 (폴리모픽)
|
||||
public function files()
|
||||
{
|
||||
return $this->morphMany(File::class, 'fileable');
|
||||
}
|
||||
|
||||
public function tags()
|
||||
{
|
||||
return $this->morphToMany(Tag::class, 'taggable');
|
||||
}
|
||||
|
||||
// 스코프
|
||||
public function scopeType($q, string $type)
|
||||
{
|
||||
return $q->where('product_type', $type);
|
||||
}
|
||||
|
||||
public function scopeSellable($q)
|
||||
{
|
||||
return $q->where('is_sellable', 1);
|
||||
}
|
||||
|
||||
public function scopePurchasable($q)
|
||||
{
|
||||
return $q->where('is_purchasable', 1);
|
||||
}
|
||||
|
||||
public function scopeProducible($q)
|
||||
{
|
||||
return $q->where('is_producible', 1);
|
||||
}
|
||||
}
|
||||
BIN
app/Models/Products/Product.php:Zone.Identifier
Normal file
BIN
app/Models/Products/Product.php:Zone.Identifier
Normal file
Binary file not shown.
115
app/Models/Products/ProductComponent.php
Normal file
115
app/Models/Products/ProductComponent.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Products;
|
||||
|
||||
use App\Models\Materials\Material;
|
||||
use App\Traits\BelongsToTenant;
|
||||
use App\Traits\ModelTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class ProductComponent extends Model
|
||||
{
|
||||
use BelongsToTenant, ModelTrait, SoftDeletes;
|
||||
|
||||
protected $table = 'product_components';
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id',
|
||||
'parent_product_id',
|
||||
'category_id',
|
||||
'category_name',
|
||||
'ref_type',
|
||||
'ref_id',
|
||||
'quantity',
|
||||
'sort_order',
|
||||
// 하이브리드 구조: 고정 필드 (범용 BOM 계산)
|
||||
'quantity_formula',
|
||||
'condition',
|
||||
// 동적 필드 (테넌트별 커스텀)
|
||||
'attributes',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'quantity' => 'decimal:6',
|
||||
'attributes' => 'array',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
'deleted_at' => 'datetime',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
/**
|
||||
* 상위 제품 (모델/제품)
|
||||
*/
|
||||
public function parentProduct()
|
||||
{
|
||||
return $this->belongsTo(Product::class, 'parent_product_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 참조된 제품 또는 자재를 동적으로 가져오기
|
||||
* ref_type에 따라 Product 또는 Material을 반환
|
||||
*/
|
||||
public function referencedItem()
|
||||
{
|
||||
if ($this->ref_type === 'PRODUCT') {
|
||||
return $this->belongsTo(Product::class, 'ref_id');
|
||||
} elseif ($this->ref_type === 'MATERIAL') {
|
||||
return $this->belongsTo(Material::class, 'ref_id');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 하위 제품 (ref_type = PRODUCT일 때만)
|
||||
*/
|
||||
public function product()
|
||||
{
|
||||
return $this->belongsTo(Product::class, 'ref_id')
|
||||
->where('ref_type', 'PRODUCT');
|
||||
}
|
||||
|
||||
/**
|
||||
* 하위 자재 (ref_type = MATERIAL일 때만)
|
||||
*/
|
||||
public function material()
|
||||
{
|
||||
return $this->belongsTo(Material::class, 'ref_id')
|
||||
->where('ref_type', 'MATERIAL');
|
||||
}
|
||||
|
||||
// ---------------------------------------------------
|
||||
// 🔎 Query Scopes
|
||||
// ---------------------------------------------------
|
||||
|
||||
/**
|
||||
* 제품 BOM 아이템만
|
||||
*/
|
||||
public function scopeProducts($query)
|
||||
{
|
||||
return $query->where('ref_type', 'PRODUCT');
|
||||
}
|
||||
|
||||
/**
|
||||
* 자재 BOM 아이템만
|
||||
*/
|
||||
public function scopeMaterials($query)
|
||||
{
|
||||
return $query->where('ref_type', 'MATERIAL');
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정 상위 제품의 BOM
|
||||
*/
|
||||
public function scopeForParent($query, int $parentProductId)
|
||||
{
|
||||
return $query->where('parent_product_id', $parentProductId);
|
||||
}
|
||||
}
|
||||
BIN
app/Models/Products/ProductComponent.php:Zone.Identifier
Normal file
BIN
app/Models/Products/ProductComponent.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/PushDeviceToken.php:Zone.Identifier
Normal file
BIN
app/Models/PushDeviceToken.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/PushNotificationSetting.php:Zone.Identifier
Normal file
BIN
app/Models/PushNotificationSetting.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Qualitys/Inspection.php:Zone.Identifier
Normal file
BIN
app/Models/Qualitys/Inspection.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Qualitys/Lot.php:Zone.Identifier
Normal file
BIN
app/Models/Qualitys/Lot.php:Zone.Identifier
Normal file
Binary file not shown.
BIN
app/Models/Qualitys/LotSale.php:Zone.Identifier
Normal file
BIN
app/Models/Qualitys/LotSale.php:Zone.Identifier
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user