-- ====================================================================
-- inventory_mgmt_out_master — 불출의뢰 마스터 (Rfw-YYYY-seq)
-- ====================================================================
-- 출처: wace_plm 운영 DB 211.115.91.141:11133/waceplm
-- 추출일: 2026-05-15
-- 자식: inventory_mgmt_out (불출 라인) → inventory_request_master_objid
-- 상태:
--   reception_status='reception' / ''=미접수
--   outstatus='complete' / ''=미완료
-- 채번: inventory_out_no = 'Rfw-' || YYYY || '-' || seq
-- ====================================================================

CREATE TABLE IF NOT EXISTS inventory_mgmt_out_master (
    objid               VARCHAR              NOT NULL,
    parent_objid        VARCHAR,
    inventory_out_no    VARCHAR,
    request_date        VARCHAR,
    request_id          VARCHAR,
    reception_status    VARCHAR,
    reception_id        VARCHAR,
    reception_date      VARCHAR,
    outstatus           VARCHAR,
    writer              VARCHAR,
    regdate             TIMESTAMP,
    remark              VARCHAR,
    contract_mgmt_objid VARCHAR,
    sign                VARCHAR,
    CONSTRAINT inventory_mgmt_out_master_pkey PRIMARY KEY (objid)
);

CREATE INDEX IF NOT EXISTS inventory_mgmt_out_master_no_idx     ON inventory_mgmt_out_master (inventory_out_no);
CREATE INDEX IF NOT EXISTS inventory_mgmt_out_master_status_idx ON inventory_mgmt_out_master (reception_status, outstatus);
