Files
wace_rps/docs/migration/sales/ddl-extracted/100_create_estimate_template.sql
T
hjjeong 1760045634 영업관리 4개 메뉴(견적/주문/판매/매출) 1차 이식 + 마스터 매핑
- wace_plm contract_mgmt/contract_item/contract_item_serial/contract_mgmt_option/estimate_template/estimate_template_item/mail_log/sales_registration/shipment_log 9개 테이블 DDL을 vexplor_rps에 적재, 운영 데이터 복사
- 거래처: Wehago/Amaranth ERP api16S11 INBOUND 동기화 결과(customer_code) 기준 LEFT JOIN으로 변경, 25/25 매칭
- 품목: wace part_mng 8,179건을 item_info(varchar id)에 wace objid 그대로 INSERT, contract_item 72/72 매칭
- 공통코드: wace comm_code 847건 복제 + backend SQL에 5종 LEFT JOIN
- DataGrid에 formatMoney(천단위콤마+소수점2자리) / formatNumber 자동 우측정렬 분리
- adminService.getUserMenuList company_code 분기 제거(RPS 단독), useMenu.buildMenuTree root 식별 보강

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 15:39:03 +09:00

79 lines
4.2 KiB
SQL

-- ====================================================================
-- estimate_template / estimate_template_item
-- ====================================================================
-- 출처: wace_plm 운영 DB 211.115.91.141:11133/waceplm (PG 16.8)
-- 추출일: 2026-05-07
-- 견적관리(estimateList_new)의 메인 테이블 — 신규 견적의 헤더+라인을 담당.
-- contract_objid 로 contract_mgmt에 묶여 1 contract → N templates (template_type별).
-- ====================================================================
CREATE TABLE IF NOT EXISTS estimate_template (
objid VARCHAR(50) PRIMARY KEY,
contract_objid VARCHAR(50) NOT NULL, -- → contract_mgmt(objid)
template_type VARCHAR(10) NOT NULL, -- '1'=일반, '2'=장비
executor VARCHAR(200), -- 발주자
recipient VARCHAR(200), -- 수신자
estimate_no VARCHAR(100), -- 견적번호
contact_person VARCHAR(100), -- 담당자
greeting_text TEXT, -- 인사말
model_name VARCHAR(200),
model_code VARCHAR(100),
executor_date VARCHAR(50),
note1 VARCHAR(500),
note2 VARCHAR(500),
note3 VARCHAR(500),
note4 VARCHAR(500),
categories_json TEXT, -- 그룹/소그룹 구조 JSON
writer VARCHAR(50),
regdate TIMESTAMP DEFAULT now(),
chg_user_id VARCHAR(50),
chgdate TIMESTAMP DEFAULT now(),
notes_content TEXT, -- 본문 비고
validity_period VARCHAR(50), -- 유효기간
total_amount VARCHAR(50),
total_amount_krw VARCHAR(50),
manager_name VARCHAR(100), -- 담당자 이름
manager_contact VARCHAR(100), -- 담당자 연락처
note_remarks TEXT, -- 테이블 내 비고 (품목 하단)
show_total_row VARCHAR(1) DEFAULT 'Y', -- 계 행 표시 여부 (Y/N)
group1_subtotal VARCHAR(50),
part_name VARCHAR(200),
part_objid VARCHAR(50) -- → item_info(legacy mapping)
);
CREATE INDEX IF NOT EXISTS idx_estimate_contract ON estimate_template(contract_objid);
CREATE INDEX IF NOT EXISTS idx_estimate_type ON estimate_template(template_type);
COMMENT ON TABLE estimate_template IS '견적 템플릿 (estimateList_new의 메인)';
COMMENT ON COLUMN estimate_template.manager_name IS '담당자 이름';
COMMENT ON COLUMN estimate_template.manager_contact IS '담당자 연락처';
COMMENT ON COLUMN estimate_template.note_remarks IS '테이블 내 비고 (품목 하단)';
COMMENT ON COLUMN estimate_template.show_total_row IS '계 행 표시 여부 (Y: 표시, N: 숨김)';
-- --------------------------------------------------------------------
CREATE SEQUENCE IF NOT EXISTS estimate_template_item_objid_seq;
CREATE TABLE IF NOT EXISTS estimate_template_item (
objid INTEGER PRIMARY KEY DEFAULT nextval('estimate_template_item_objid_seq'),
template_objid VARCHAR(50) NOT NULL, -- → estimate_template(objid)
seq INTEGER NOT NULL,
category VARCHAR(100), -- 그룹명
description VARCHAR(500), -- 품명
specification TEXT, -- 규격
quantity VARCHAR(50),
unit VARCHAR(50),
unit_price VARCHAR(50),
amount VARCHAR(50),
note VARCHAR(500),
remark VARCHAR(500),
part_objid VARCHAR
);
ALTER SEQUENCE estimate_template_item_objid_seq OWNED BY estimate_template_item.objid;
CREATE INDEX IF NOT EXISTS idx_item_template ON estimate_template_item(template_objid);
CREATE INDEX IF NOT EXISTS idx_item_seq ON estimate_template_item(template_objid, seq);
COMMENT ON TABLE estimate_template_item IS '견적 템플릿 라인';