-- 创建待入库表
CREATE TABLE pending_inventory
(
    id                        BIGSERIAL PRIMARY KEY,                  -- 主键ID
    supplier_name             VARCHAR(255)   NOT NULL,                -- 供货商名称
    coal                      VARCHAR(50)    NOT NULL,                -- 煤种
    unit                      VARCHAR(50)    NOT NULL,                -- 单位
    inventory_quantity        NUMERIC(10, 2) NOT NULL,                -- 库存数量
    price_including_tax       NUMERIC(10, 2) NOT NULL,                -- 单价（含税）
    total_price_including_tax NUMERIC(10, 2) NOT NULL,                -- 总价（含税）
    registrant                VARCHAR(50),                            -- 登记人
    registration_time         TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP, -- 登记时间
    price_excluding_tax       VARCHAR(255),                           -- 单价（不含税）
    total_price_excluding_tax VARCHAR(255),                           -- 总价（不含税）
    registrant_id             BIGINT,                                 -- 登记人ID
    registration_date         DATE,                                   -- 登记日期
    supplier_id               BIGINT,                                 -- 供货商ID
    coal_id                   BIGINT,                                 -- 煤种ID
    master_id                 BIGINT,                                 -- 生产加工id
    purchase_id               BIGINT,                                 -- 采购id
    coal_plan_id               BIGINT,                                 -- 煤质方案id

    deleted                   INTEGER      DEFAULT 0,                 -- 软删除标志，0=未删除，1=已删除
    create_by                 VARCHAR(255),                           -- 创建该记录的用户
    create_time               TIMESTAMP(6),                           -- 记录创建时间
    update_by                 VARCHAR(255),                           -- 最后修改该记录的用户
    update_time               TIMESTAMP(6)                            -- 记录最后更新时间

);

COMMENT ON TABLE pending_inventory IS '待入库表';

-- 字段注释
COMMENT ON COLUMN pending_inventory.id IS '主键ID';
COMMENT ON COLUMN pending_inventory.supplier_name IS '供货商名称';
COMMENT ON COLUMN pending_inventory.coal IS '煤种';
COMMENT ON COLUMN pending_inventory.unit IS '单位';
COMMENT ON COLUMN pending_inventory.inventory_quantity IS '库存数量';
COMMENT ON COLUMN pending_inventory.price_including_tax IS '单价（含税）';
COMMENT ON COLUMN pending_inventory.total_price_including_tax IS '总价（含税）';
COMMENT ON COLUMN pending_inventory.registrant IS '登记人';
COMMENT ON COLUMN pending_inventory.registration_time IS '登记时间';
COMMENT ON COLUMN pending_inventory.price_excluding_tax IS '单价（不含税）';
COMMENT ON COLUMN pending_inventory.total_price_excluding_tax IS '总价（不含税）';
COMMENT ON COLUMN pending_inventory.registrant_id IS '登记人ID';
COMMENT ON COLUMN pending_inventory.registration_date IS '登记日期';
COMMENT ON COLUMN pending_inventory.supplier_id IS '供货商ID';
COMMENT ON COLUMN pending_inventory.coal_id IS '煤种ID';
COMMENT ON COLUMN pending_inventory.master_id IS '生产加工id';
COMMENT ON COLUMN pending_inventory.purchase_id IS '采购id';
COMMENT ON COLUMN pending_inventory.coal_plan_id IS '煤质方案id';

COMMENT ON COLUMN pending_inventory.deleted IS '软删除标志，0=未删除，1=已删除';
COMMENT ON COLUMN pending_inventory.create_by IS '创建该记录的用户';
COMMENT ON COLUMN pending_inventory.create_time IS '记录创建时间';
COMMENT ON COLUMN pending_inventory.update_by IS '最后修改该记录的用户';
COMMENT ON COLUMN pending_inventory.update_time IS '记录最后更新时间';

