Files
sam-docs/system/database/products.md

88 lines
2.6 KiB
Markdown
Raw Permalink Normal View History

# 제품 / 품목 / 설계 도메인
> **모델 수**: Products 6 + ItemMaster 8 + Items 3 + Design 4 = 21
> **핵심**: 제품 정의, BOM 구조, 품목 마스터, 설계 모델
---
## 주요 테이블
### 제품 (Products)
| 테이블 | 모델 | 역할 |
|--------|------|------|
| products | Product | 제품 마스터 (code, name, product_type) |
| product_components | ProductComponent | BOM 구성 (parent-child 관계) |
| parts | Part | 부품 정의 |
| prices | Price | 가격 정보 |
| common_codes | CommonCode | 공통 코드 |
### 품목 마스터 (ItemMaster)
| 테이블 | 모델 | 역할 |
|--------|------|------|
| item_fields | ItemField | 품목 필드 정의 |
| item_pages | ItemPage | 품목 페이지 구성 |
| item_bom_items | ItemBomItem | 품목 BOM 항목 |
| custom_tabs | CustomTab | 커스텀 탭 |
| unit_options | UnitOption | 단위 옵션 |
### 품목 (Items)
| 테이블 | 모델 | 역할 |
|--------|------|------|
| items | Item | 품목 마스터 |
| item_details | ItemDetail | 품목 상세 |
| item_receipts | ItemReceipt | 품목 입고 |
### 설계 (Design)
| 테이블 | 모델 | 역할 |
|--------|------|------|
| design_models | DesignModel | 설계 모델 마스터 |
| model_versions | ModelVersion | 모델 버전 |
| bom_templates | BomTemplate | BOM 템플릿 |
| bom_template_items | BomTemplateItem | BOM 템플릿 항목 (수량, 로스율) |
---
## 관계 구조
```
Product
├─ belongsTo Category (계층 분류)
├─ hasMany ProductComponent (BOM)
│ └─ child_product_id → Product (자기 참조)
├─ hasMany Part
├─ hasMany Price
└─ morphMany File
Item
├─ hasMany ItemDetail
├─ hasMany ItemReceipt
└─ options JSON: { lot_managed, consumption_method, production_source, input_tracking }
DesignModel → ModelVersion → BomTemplate → BomTemplateItem
```
---
## 품목 options 체계
items.options JSON으로 품목별 관리 방식 정의:
| 속성 | 타입 | 설명 |
|------|------|------|
| lot_managed | bool | LOT 추적 여부 |
| consumption_method | auto/manual/none | 소진 방식 |
| production_source | purchased/self_produced/both | 조달 구분 |
| input_tracking | bool | 원자재 투입 추적 여부 |
### 유형별 조합
| 유형 | 예시 | lot | consumption | source |
|------|------|-----|------------|--------|
| 구매 소모품 (LOT) | 내화실 | true | manual | purchased |
| 구매 소모품 (비LOT) | 장갑, 테이프 | false | manual | purchased |
| 일반 자체생산 | 슬랫, 절곡물 | true | auto | self_produced |
| 잔재 활용 생산 | 조인트바 | true | auto | self_produced |