-- 创建正式库表
CREATE TABLE production_scheduling
(
    id BIGSERIAL PRIMARY KEY,  -- BIGSERIAL 对应 int8
    production_id int8 NOT NULL DEFAULT 0,
    coal_id                 BIGINT         NOT NULL DEFAULT 0, -- 煤种ID
    scheduling_num numeric(10,2),
    type int8,
    status int8,
    unit varchar(50),
    process varchar(50) NOT NULL,
    work_hours numeric(10,2) NOT NULL,
    scheduling_date date,
    scheduling_user_id int8,
    scheduling_user_name varchar(50),
    deleted int4 NOT NULL DEFAULT 0,
    create_by varchar(255) COLLATE "pg_catalog"."default",
    create_time timestamp(6),
    update_by varchar(255) COLLATE "pg_catalog"."default",
    success_num int8 DEFAULT 0,
    update_time timestamp(6)
);

COMMENT ON COLUMN "production_scheduling"."id" IS '主键ID';

COMMENT ON COLUMN "production_scheduling"."production_id" IS '生产明细id';
COMMENT ON COLUMN production_scheduling.coal_id IS '煤种ID';

COMMENT ON COLUMN "production_scheduling"."scheduling_num" IS '排产数量';

COMMENT ON COLUMN "production_scheduling"."unit" IS '单位';

COMMENT ON COLUMN "production_scheduling"."process" IS '工序（字典）';

COMMENT ON COLUMN "production_scheduling"."work_hours" IS '工时定额';

COMMENT ON COLUMN "production_scheduling"."scheduling_date" IS '排产日期';

COMMENT ON COLUMN "production_scheduling"."scheduling_user_id" IS '排产人id';

COMMENT ON COLUMN "production_scheduling"."scheduling_user_name" IS '排产人名称';


COMMENT ON COLUMN "production_scheduling"."deleted" IS '软删除标志，0=未删除，1=已删除';

COMMENT ON COLUMN "production_scheduling"."create_by" IS '创建该记录的用户';

COMMENT ON COLUMN "production_scheduling"."create_time" IS '记录创建时间';
COMMENT ON COLUMN "production_scheduling"."production_scheduling"."update_by" IS '最后修改该记录的用户';

COMMENT ON COLUMN "production_scheduling"."production_scheduling"."update_time" IS '记录最后更新时间';

COMMENT ON COLUMN "production_scheduling"."production_scheduling"."type" IS '煤料类型（1-成品 2-原料）';

COMMENT ON COLUMN "production_scheduling"."production_scheduling"."status" IS '状态（1-待生产 2-生产中 3-已报工）';
COMMENT ON COLUMN "production_scheduling"."production_scheduling"."success_num" IS '入库数量';


COMMENT ON TABLE "public"."production_scheduling" IS '生产报工表';