feat: ItemTypeSeeder에 attributes.source_table 매핑 추가
- common_codes 테이블 item_type 그룹에 source_table 매핑 추가 - FG/PT → products, SM/RM/CS → materials 테이블 매핑 - attributes JSON에 name_en 영문명 추가
This commit is contained in:
@@ -10,18 +10,68 @@ class ItemTypeSeeder extends Seeder
|
||||
/**
|
||||
* Run the database seeds.
|
||||
* common_codes 테이블에 item_type 그룹 데이터 시딩
|
||||
*
|
||||
* attributes.source_table: 실제 저장 테이블 매핑
|
||||
* - FG, PT → products 테이블
|
||||
* - SM, RM, CS → materials 테이블
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$tenantId = 1; // 기본 테넌트
|
||||
|
||||
// code_group = 'item_type' (컬럼명과 동일하게!)
|
||||
// attributes.source_table로 물리 테이블 매핑
|
||||
$itemTypes = [
|
||||
['code_group' => 'item_type', 'code' => 'FG', 'name' => '완제품', 'tenant_id' => $tenantId],
|
||||
['code_group' => 'item_type', 'code' => 'PT', 'name' => '반제품', 'tenant_id' => $tenantId],
|
||||
['code_group' => 'item_type', 'code' => 'SM', 'name' => '부자재', 'tenant_id' => $tenantId],
|
||||
['code_group' => 'item_type', 'code' => 'RM', 'name' => '원자재', 'tenant_id' => $tenantId],
|
||||
['code_group' => 'item_type', 'code' => 'CS', 'name' => '소모품', 'tenant_id' => $tenantId],
|
||||
[
|
||||
'code_group' => 'item_type',
|
||||
'code' => 'FG',
|
||||
'name' => '완제품',
|
||||
'tenant_id' => $tenantId,
|
||||
'attributes' => json_encode([
|
||||
'source_table' => 'products',
|
||||
'name_en' => 'Finished Goods',
|
||||
]),
|
||||
],
|
||||
[
|
||||
'code_group' => 'item_type',
|
||||
'code' => 'PT',
|
||||
'name' => '부품',
|
||||
'tenant_id' => $tenantId,
|
||||
'attributes' => json_encode([
|
||||
'source_table' => 'products',
|
||||
'name_en' => 'Parts',
|
||||
]),
|
||||
],
|
||||
[
|
||||
'code_group' => 'item_type',
|
||||
'code' => 'SM',
|
||||
'name' => '부자재',
|
||||
'tenant_id' => $tenantId,
|
||||
'attributes' => json_encode([
|
||||
'source_table' => 'materials',
|
||||
'name_en' => 'Sub-Materials',
|
||||
]),
|
||||
],
|
||||
[
|
||||
'code_group' => 'item_type',
|
||||
'code' => 'RM',
|
||||
'name' => '원자재',
|
||||
'tenant_id' => $tenantId,
|
||||
'attributes' => json_encode([
|
||||
'source_table' => 'materials',
|
||||
'name_en' => 'Raw Materials',
|
||||
]),
|
||||
],
|
||||
[
|
||||
'code_group' => 'item_type',
|
||||
'code' => 'CS',
|
||||
'name' => '소모품',
|
||||
'tenant_id' => $tenantId,
|
||||
'attributes' => json_encode([
|
||||
'source_table' => 'materials',
|
||||
'name_en' => 'Consumables',
|
||||
]),
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($itemTypes as $index => $item) {
|
||||
|
||||
Reference in New Issue
Block a user