Files
sam-docs/dev/changes/20260126_quote_v2_transform_functions.md
권혁성 db63fcff85 refactor: [docs] 팀별 폴더 구조 재편 (공유/개발/프론트/기획)
- 개발팀 전용 폴더 dev/ 생성 (standards, guides, quickstart, changes, deploys, data, history, dev_plans 이동)
- 프론트엔드 전용 폴더 frontend/ 생성 (api/ → frontend/api-specs/)
- 기획팀 폴더 requests/ 생성
- plans/ → dev/dev_plans/ 이름 변경
- README.md 신규 (사람용 안내), INDEX.md 재작성 (Claude Code용)
- resources.md 신규 (노션 링크용, assets/brochure 이관 예정)
- CURRENT_WORKS.md 삭제, TODO.md → dev/ 이동
- 전체 참조 경로 업데이트

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 16:46:03 +09:00

2.7 KiB

변경 내용 요약

날짜: 2026-01-26 작업자: Claude Code 관련 계획: docs/dev_plans/quote-management-url-migration-plan.md (Step 1.1)

📋 변경 개요

V2 견적 컴포넌트(QuoteRegistrationV2)에서 사용할 데이터 변환 함수 구현

  • transformV2ToApi: V2 폼 데이터 → API 요청 형식
  • transformApiToV2: API 응답 → V2 폼 데이터

📁 수정된 파일

  • react/src/components/quotes/types.ts - V2 타입 정의 및 변환 함수 추가

🔧 상세 변경 사항

1. LocationItem 인터페이스 추가

발주 개소 항목의 데이터 구조 정의

export interface LocationItem {
  id: string;
  floor: string;           // 층
  code: string;            // 부호
  openWidth: number;       // 가로 (오픈사이즈 W)
  openHeight: number;      // 세로 (오픈사이즈 H)
  productCode: string;     // 제품코드
  productName: string;     // 제품명
  quantity: number;        // 수량
  guideRailType: string;   // 가이드레일 설치 유형
  motorPower: string;      // 모터 전원
  controller: string;      // 연동제어기
  wingSize: number;        // 마구리 날개치수
  inspectionFee: number;   // 검사비
  // 계산 결과 (선택)
  unitPrice?: number;
  totalPrice?: number;
  bomResult?: BomCalculationResult;
}

2. QuoteFormDataV2 인터페이스 추가

V2 컴포넌트용 폼 데이터 구조

export interface QuoteFormDataV2 {
  id?: string;
  registrationDate: string;
  writer: string;
  clientId: string;
  clientName: string;
  siteName: string;
  manager: string;
  contact: string;
  dueDate: string;
  remarks: string;
  status: 'draft' | 'temporary' | 'final';
  locations: LocationItem[];  // V1의 items[] 대신 locations[] 사용
}

3. transformV2ToApi 함수 구현

V2 폼 데이터를 API 요청 형식으로 변환

핵심 로직:

  1. locations[]calculation_inputs.items[] (폼 복원용)
  2. BOM 결과가 있으면 자재 상세를 items[]에 포함
  3. 없으면 완제품 기준으로 items[] 생성
  4. status 매핑: finalfinalized, 나머지 → draft

4. transformApiToV2 함수 구현

API 응답을 V2 폼 데이터로 변환

핵심 로직:

  1. calculation_inputs.items[]locations[] 복원
  2. 관련 BOM 자재에서 금액 계산
  3. status 매핑: finalized/convertedfinal, 나머지 → draft

다음 작업 (Phase 1.2~1.4)

  • test-new 페이지 API 연동 (createQuote)
  • test/[id] 상세 페이지 API 연동 (getQuoteById)
  • test/[id] 수정 API 연동 (updateQuote)

🔗 관련 문서

  • 계획 문서: docs/dev_plans/quote-management-url-migration-plan.md
  • V2 컴포넌트: react/src/components/quotes/QuoteRegistrationV2.tsx