-- ====================================================================
-- inventory_mgmt_out — 불출 라인 (의뢰 + 실제 불출)
-- ====================================================================
-- 출처: wace_plm 운영 DB 211.115.91.141:11133/waceplm
-- 추출일: 2026-05-15
-- 부모: inventory_mgmt.objid → parent_objid (자재 마스터)
-- 부모2: inventory_mgmt_out_master.objid → inventory_request_master_objid
-- 흐름: REQUEST_QTY 먼저 입력 (의뢰) → OUT_QTY/OUT_DATE/ACQ_USER/SIGN 입력 (불출)
-- ====================================================================

CREATE TABLE IF NOT EXISTS inventory_mgmt_out (
    objid                          VARCHAR              NOT NULL,
    parent_objid                   VARCHAR,
    request_qty                    VARCHAR,
    out_qty                        VARCHAR,
    out_date                       VARCHAR,
    writer                         VARCHAR,
    acq_user                       VARCHAR,
    regdate                        TIMESTAMP,
    inventory_request_master_objid VARCHAR,
    sign                           VARCHAR,
    contract_mgmt_objid            VARCHAR,
    unit                           VARCHAR,
    CONSTRAINT inventory_mgmt_out_pkey PRIMARY KEY (objid)
);

CREATE INDEX IF NOT EXISTS inventory_mgmt_out_parent_objid_idx ON inventory_mgmt_out (parent_objid);
CREATE INDEX IF NOT EXISTS inventory_mgmt_out_master_objid_idx ON inventory_mgmt_out (inventory_request_master_objid);
