Files
sam-docs/system/database/sales.md
권혁성 d4e5f62413 docs: [종합정비] Phase 1 시스템 현황 문서 14개 작성
- system/overview.md: 전체 아키텍처 개요
- system/api-structure.md: API 구조 (220 모델, 1027 엔드포인트, 18 라우트 도메인)
- system/react-structure.md: React 구조 (249 페이지, 612 컴포넌트)
- system/mng-structure.md: MNG 구조 (171 컨트롤러, 436 Blade 뷰)
- system/docker-setup.md: Docker 7 컨테이너 구성
- system/database/README.md + 9개 도메인 스키마 (270+ 테이블)
  - core, hr, sales, production, finance, boards, files, system, erp-analysis

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 18:03:13 +09:00

98 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 영업 / 수주 / 견적 도메인
> **모델 수**: Orders 8 + Quote 8 + Estimate 2 = 18
> **핵심**: 견적 → 수주 → 생산 변환 흐름
---
## 주요 테이블
### 수주 (Orders)
| 테이블 | 모델 | 역할 |
|--------|------|------|
| orders | Order | 수주 마스터 (status: DRAFT→CONFIRMED→IN_PRODUCTION) |
| order_items | OrderItem | 수주 항목 (options JSON 포함) |
| order_nodes | OrderNode | 설계 분해 구조 |
| order_item_components | OrderItemComponent | 수주 항목 구성요소 |
| order_histories | OrderHistory | 수주 변경 이력 |
| clients | Client | 거래처 마스터 |
| client_groups | ClientGroup | 거래처 그룹 |
| site_briefings | SiteBriefing | 현장 브리핑 |
### 견적 (Quote)
| 테이블 | 모델 | 역할 |
|--------|------|------|
| quotes | Quote | 견적 마스터 |
| quote_items | QuoteItem | 견적 항목 |
| quote_formulas | QuoteFormula | 견적 공식 |
| quote_formula_categories | QuoteFormulaCategory | 공식 카테고리 |
| quote_revisions | QuoteRevision | 견적 버전 이력 |
### 견적서 (Estimate)
| 테이블 | 모델 | 역할 |
|--------|------|------|
| estimates | Estimate | 견적서 마스터 |
| estimate_items | EstimateItem | 견적서 항목 |
---
## 관계 구조
```
Quote (견적)
├─ belongsTo Client
├─ belongsTo SiteBriefing
├─ belongsTo Item
├─ hasMany QuoteItem
├─ hasMany QuoteRevision
└─ → Order 변환 (OrderService)
Order (수주)
├─ belongsTo Quote
├─ belongsTo Client
├─ hasMany OrderItem
│ ├─ belongsTo Item
│ ├─ hasMany OrderItemComponent
│ └─ options: JSON { floor, code, width, height, cutting_info, slat_info, bending_info }
├─ hasMany OrderNode
├─ hasMany OrderHistory
└─ hasMany WorkOrder (생산으로 변환)
```
---
## 비즈니스 흐름
```
견적(Quote) → 수주(Order) → 작업지시(WorkOrder) → 작업실적(WorkResult)
│ │ │
QuoteItem OrderItem WorkOrderItem
```
### 상태 흐름 (Order)
```
DRAFT → CONFIRMED → IN_PRODUCTION → COMPLETED → SHIPPED
```
---
## OrderItem options JSON 구조
```json
{
"floor": "1F",
"code": "SL-001",
"width": 1200,
"height": 800,
"cutting_info": { ... },
"slat_info": { "joint_bar": 2, "glass_qty": 10 },
"bending_info": { ... },
"wip_info": { ... }
}
```
- 견적 → 수주 변환 시 `extractSlatInfoFromBom()`으로 slat_info 자동 계산
- 조인트바 수량 공식: `(2 + floor((제작가로 - 500) / 1000)) × 셔터수량`