-- ====================================================================
-- inventory_mgmt_in — 자재 입고/이동 히스토리 라인
-- ====================================================================
-- 출처: wace_plm 운영 DB 211.115.91.141:11133/waceplm
-- 추출일: 2026-05-15
-- 부모: inventory_mgmt.objid → parent_objid
-- 외부키: out_objid (콤마분리 inventory_mgmt_out.objid 누적)
-- ====================================================================

CREATE TABLE IF NOT EXISTS inventory_mgmt_in (
    objid                       VARCHAR              NOT NULL,
    parent_objid                VARCHAR,
    receipt_qty                 VARCHAR,
    location                    VARCHAR,
    sub_location                VARCHAR,
    writer                      VARCHAR,
    regdate                     TIMESTAMP,
    contract_mgmt_objid         VARCHAR,
    purchase_order_master_objid VARCHAR,
    purchase_order_sub_objid    VARCHAR,
    out_objid                   VARCHAR,
    out_qty                     VARCHAR,
    move_objid                  VARCHAR,
    move_qty                    VARCHAR,
    move_date                   VARCHAR,
    move_user                   VARCHAR,
    request_qty                 VARCHAR,
    receipt_date                VARCHAR,
    CONSTRAINT inventory_mgmt_in_pkey PRIMARY KEY (objid)
);

CREATE INDEX IF NOT EXISTS inventory_mgmt_in_parent_objid_idx        ON inventory_mgmt_in (parent_objid);
CREATE INDEX IF NOT EXISTS inventory_mgmt_in_contract_mgmt_objid_idx ON inventory_mgmt_in (contract_mgmt_objid);
