-- 计划
CREATE TABLE "BLADE_PLAN"
(
    "ID"                 BIGINT NOT NULL,
    "NAME"               VARCHAR(32),
    "DESCRIPTION"        VARCHAR(255),
    "TYPE_ID"            BIGINT,
    "CODE"               VARCHAR(128),
    "INDENT_CODE"        VARCHAR(100),
    "CATEGORY"           INT,
    "PRODUCT_ID"         BIGINT,
    "PRODUCT_CODE"       VARCHAR(50),
    "PRODUCT_NAME"       VARCHAR(50),
    "PLAN_NUM"           INT DEFAULT 0,
    "UNASSIGNED_NUM"     INT DEFAULT 0,
    "REPORT_NUM"         INT DEFAULT 0,
    "QUALIFY_NUM"        INT DEFAULT 0,
    "SCRAPPED_NUM"       INT DEFAULT 0,
    "CRAFT_ID"           BIGINT,
    "CRAFT_NAME"         VARCHAR(50),
    "CRAFT_VERSION"      BIGINT,
    "CRAFT_VERSION_NAME" VARCHAR(50),
    "PLAN_START_TIME"    TIMESTAMP(0),
    "PLAN_END_TIME"      TIMESTAMP(0),
    "START_TIME"         TIMESTAMP(0),
    "END_TIME"           TIMESTAMP(0),
    "STANDARD_MODEL"     VARCHAR(128),
    "PLAN_STATUS_BEFORE" INT,
    "PLAN_STATUS"        INT,
    "BOM_ID"             BIGINT,
    "BOM_VERSION"        VARCHAR(50),
    "CUSTOMER_ID"        BIGINT,
    "CUSTOMER_NAME"      VARCHAR(50),
    "EXTEND_FIELD" CLOB,
    "CREATE_USER"        BIGINT,
    "CREATE_DEPT"        BIGINT,
    "CREATE_TIME"        TIMESTAMP(0),
    "UPDATE_USER"        BIGINT,
    "UPDATE_TIME"        TIMESTAMP(0),
    "STATUS"             INT,
    "IS_DELETED"         BIGINT,
    "SOURCE_PLAN_ID"     BIGINT,
    NOT CLUSTER PRIMARY KEY ("ID"),
    CONSTRAINT "IDX_TYPEID_PLANSTATUS_CODE" UNIQUE ("TYPE_ID", "PLAN_STATUS", "CODE"),
    CHECK ("IS_DELETED" >= 0)
) STORAGE(ON "MAIN", CLUSTERBTR);

COMMENT
ON COLUMN "BLADE_PLAN"."BOM_ID" IS '产品bom主键';
COMMENT
ON COLUMN "BLADE_PLAN"."BOM_VERSION" IS '所属bom版本名称';
COMMENT
ON COLUMN "BLADE_PLAN"."CATEGORY" IS '计划类别：1 产品计划 2 来料计划';
COMMENT
ON COLUMN "BLADE_PLAN"."CODE" IS '计划编号';
COMMENT
ON COLUMN "BLADE_PLAN"."CRAFT_ID" IS '所属产品工艺id';
COMMENT
ON COLUMN "BLADE_PLAN"."CRAFT_NAME" IS '所属产品工艺名称';
COMMENT
ON COLUMN "BLADE_PLAN"."CRAFT_VERSION" IS '所属工艺版本id';
COMMENT
ON COLUMN "BLADE_PLAN"."CRAFT_VERSION_NAME" IS '所属工艺版本名称';
COMMENT
ON COLUMN "BLADE_PLAN"."CREATE_DEPT" IS '创建部门';
COMMENT
ON COLUMN "BLADE_PLAN"."CREATE_TIME" IS '创建时间';
COMMENT
ON COLUMN "BLADE_PLAN"."CREATE_USER" IS '创建人';
COMMENT
ON COLUMN "BLADE_PLAN"."CUSTOMER_ID" IS '客户id';
COMMENT
ON COLUMN "BLADE_PLAN"."CUSTOMER_NAME" IS '客户名称';
COMMENT
ON COLUMN "BLADE_PLAN"."DESCRIPTION" IS '描述';
COMMENT
ON COLUMN "BLADE_PLAN"."END_TIME" IS '实际结束时间';
COMMENT
ON COLUMN "BLADE_PLAN"."EXTEND_FIELD" IS '扩展字段';
COMMENT
ON COLUMN "BLADE_PLAN"."INDENT_CODE" IS '订单编号';
COMMENT
ON COLUMN "BLADE_PLAN"."NAME" IS '计划类型名称';
COMMENT
ON COLUMN "BLADE_PLAN"."PLAN_END_TIME" IS '计划结束时间';
COMMENT
ON COLUMN "BLADE_PLAN"."PLAN_NUM" IS '计划数量';
COMMENT
ON COLUMN "BLADE_PLAN"."PLAN_START_TIME" IS '计划开始时间';
COMMENT
ON COLUMN "BLADE_PLAN"."PLAN_STATUS" IS '计划状态(1:待派发 2.待加工 3.加工中 4.暂停 5.关闭 6.完工)';
COMMENT
ON COLUMN "BLADE_PLAN"."PLAN_STATUS_BEFORE" IS '暂停前的状态';
COMMENT
ON COLUMN "BLADE_PLAN"."PRODUCT_CODE" IS '所属产品编码';
COMMENT
ON COLUMN "BLADE_PLAN"."PRODUCT_ID" IS '所属产品id';
COMMENT
ON COLUMN "BLADE_PLAN"."PRODUCT_NAME" IS '所属产品名称';
COMMENT
ON COLUMN "BLADE_PLAN"."QUALIFY_NUM" IS '合格数量';
COMMENT
ON COLUMN "BLADE_PLAN"."REPORT_NUM" IS '报工数量';
COMMENT
ON COLUMN "BLADE_PLAN"."SCRAPPED_NUM" IS '报废数量';
COMMENT
ON COLUMN "BLADE_PLAN"."SOURCE_PLAN_ID" IS '源计划';
COMMENT
ON COLUMN "BLADE_PLAN"."STANDARD_MODEL" IS '规格型号';
COMMENT
ON COLUMN "BLADE_PLAN"."START_TIME" IS '实际开始时间';
COMMENT
ON COLUMN "BLADE_PLAN"."STATUS" IS '状态';
COMMENT
ON COLUMN "BLADE_PLAN"."TYPE_ID" IS '所属计划类型';
COMMENT
ON COLUMN "BLADE_PLAN"."UNASSIGNED_NUM" IS '待派发数量';
COMMENT
ON COLUMN "BLADE_PLAN"."UPDATE_TIME" IS '修改时间';
COMMENT
ON COLUMN "BLADE_PLAN"."UPDATE_USER" IS '修改人';

-- 计划工序
CREATE TABLE "BLADE_PLAN_PROCESS"
(
    "ID"               BIGINT NOT NULL,
    "TENANT_ID"        BIGINT,
    "TYPE_NAME"        VARCHAR(32),
    "DESCRIPTION"      VARCHAR(255),
    "PLAN_ID"          BIGINT,
    "MAIN_SEQUENCE_ID" BIGINT,
    "SORT"             INT,
    "CODE"             VARCHAR(50),
    "NAME"             VARCHAR(255),
    "PROGRAM_ID"       BIGINT,
    "PROGRAM_NAME"     VARCHAR(128),
    "STANDARD_TIME"    INT,
    "WORKSTATION_ID"   VARCHAR(500),
    "WORKSTATION_NAME" VARCHAR(500),
    "ART_BAG_ID"       BIGINT,
    "ART_BAG_NAME"     VARCHAR(50),
    "PREPARE_TIME"     INT,
    "DISASSEMBLY_TIME" INT,
    "TRANSPORT_TIME"   INT,
    "WHETHER_TEST"     INT DEFAULT 0,
    "WHETHER_PARALLEL" INT,
    "ASSIGN_STATUS"    INT DEFAULT 0,
    "CREATE_USER"      BIGINT,
    "CREATE_DEPT"      BIGINT,
    "CREATE_TIME"      TIMESTAMP(0),
    "UPDATE_USER"      BIGINT,
    "UPDATE_TIME"      TIMESTAMP(0),
    "STATUS"           INT,
    "IS_DELETED"       INT,
    NOT CLUSTER PRIMARY KEY ("ID")
) STORAGE(ON "MAIN", CLUSTERBTR);

COMMENT
ON TABLE "BLADE_PLAN_PROCESS" IS '计划工序';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."ART_BAG_ID" IS '工艺包id';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."ART_BAG_NAME" IS '工艺包名称';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."ASSIGN_STATUS" IS '工序派发状态 默认 0未派发 1已派发';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."CODE" IS '工序编号';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."CREATE_DEPT" IS '创建部门';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."CREATE_TIME" IS '创建时间';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."CREATE_USER" IS '创建人';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."DESCRIPTION" IS '描述';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."DISASSEMBLY_TIME" IS '拆卸工时';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."MAIN_SEQUENCE_ID" IS '主序id（当主序id不为空时，代表工序是子序）';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."NAME" IS '工序名称';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."PLAN_ID" IS '所属计划id';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."PREPARE_TIME" IS '准备工时';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."PROGRAM_ID" IS '程序id';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."PROGRAM_NAME" IS '程序名称';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."SORT" IS '工序顺序';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."STANDARD_TIME" IS '标准工时';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."STATUS" IS '状态';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."TENANT_ID" IS '租户id';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."TRANSPORT_TIME" IS '运输工时';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."TYPE_NAME" IS '计划类型名称';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."UPDATE_TIME" IS '修改时间';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."UPDATE_USER" IS '修改人';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."WHETHER_PARALLEL" IS '是否并行 默认 0否 1是';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."WHETHER_TEST" IS '是否质检 默认 0否 1是';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."WORKSTATION_ID" IS '多工位id，用逗号隔开';
COMMENT
ON COLUMN "BLADE_PLAN_PROCESS"."WORKSTATION_NAME" IS '多工位id，用逗号隔开';


CREATE
    INDEX "PLAN_PROCESS_INDEX" ON "BLADE_PLAN_PROCESS" ("PLAN_ID" ASC) STORAGE(ON "MAIN", CLUSTERBTR);

-- 工单
CREATE TABLE "BLADE_ORDER"
(
    "ID"                  BIGINT NOT NULL,
    "STATUS"              INT,
    "IS_DELETED"          DECIMAL(20, 0) DEFAULT 0,
    "CREATE_USER"         BIGINT,
    "CREATE_DEPT"         BIGINT,
    "CREATE_TIME"         TIMESTAMP(0),
    "UPDATE_USER"         BIGINT,
    "UPDATE_TIME"         TIMESTAMP(0),
    "TENANT_ID"           VARCHAR(12),
    "ORDER_CODE"          VARCHAR(128),
    "ASSIGN_NUM"          INT            DEFAULT 0,
    "SCRAPPED_NUM"        INT            DEFAULT 0,
    "QUALIFY_NUM"         INT            DEFAULT 0,
    "ORDER_STATUS"        INT            DEFAULT 1,
    "PLAN_ID"             BIGINT,
    "ORDER_STATUS_BEFORE" INT,
    "START_TIME"          TIMESTAMP(0),
    "END_TIME"            TIMESTAMP(0),
    "DESCRIPTION"         VARCHAR(255),
    NOT CLUSTER PRIMARY KEY ("ID"),
    CHECK ("STATUS" >= 0),
    CHECK ("IS_DELETED" >= 0)
) STORAGE(ON "MAIN", CLUSTERBTR);

COMMENT
ON TABLE "BLADE_ORDER" IS '计划工单';
COMMENT
ON COLUMN "BLADE_ORDER"."ASSIGN_NUM" IS '投产数量';
COMMENT
ON COLUMN "BLADE_ORDER"."CREATE_DEPT" IS '创建部门';
COMMENT
ON COLUMN "BLADE_ORDER"."CREATE_TIME" IS '创建时间';
COMMENT
ON COLUMN "BLADE_ORDER"."CREATE_USER" IS '创建人';
COMMENT
ON COLUMN "BLADE_ORDER"."DESCRIPTION" IS '描述';
COMMENT
ON COLUMN "BLADE_ORDER"."END_TIME" IS '结束时间';
COMMENT
ON COLUMN "BLADE_ORDER"."ID" IS '主键';
COMMENT
ON COLUMN "BLADE_ORDER"."IS_DELETED" IS '删除状态：0-未删除，1-已删除';
COMMENT
ON COLUMN "BLADE_ORDER"."ORDER_CODE" IS '工单号';
COMMENT
ON COLUMN "BLADE_ORDER"."ORDER_STATUS" IS '工单状态(1：待加工，2：加工中，3：暂停，4：关闭,5:完工)';
COMMENT
ON COLUMN "BLADE_ORDER"."ORDER_STATUS_BEFORE" IS '变更前工单状态';
COMMENT
ON COLUMN "BLADE_ORDER"."PLAN_ID" IS '计划ID，cpc生成的ID';
COMMENT
ON COLUMN "BLADE_ORDER"."QUALIFY_NUM" IS '合格数量';
COMMENT
ON COLUMN "BLADE_ORDER"."SCRAPPED_NUM" IS '报废数量';
COMMENT
ON COLUMN "BLADE_ORDER"."START_TIME" IS '开始时间';
COMMENT
ON COLUMN "BLADE_ORDER"."STATUS" IS '状态';
COMMENT
ON COLUMN "BLADE_ORDER"."TENANT_ID" IS '所属租户';
COMMENT
ON COLUMN "BLADE_ORDER"."UPDATE_TIME" IS '更新时间';
COMMENT
ON COLUMN "BLADE_ORDER"."UPDATE_USER" IS '更新人';


CREATE
    INDEX "ORDER_INDEX" ON "BLADE_ORDER" ("PLAN_ID" ASC, "ORDER_STATUS" ASC) STORAGE(ON "MAIN", CLUSTERBTR);

-- 工单工序
CREATE TABLE "BLADE_ORDER_PROCESS"
(
    "ID"                    BIGINT NOT NULL,
    "TENANT_ID"             VARCHAR(12),
    "CREATE_USER"           BIGINT,
    "CREATE_TIME"           TIMESTAMP(0),
    "UPDATE_USER"           BIGINT,
    "UPDATE_TIME"           TIMESTAMP(0),
    "REMARK"                VARCHAR(255),
    "STATUS"                TINYINT,
    "IS_DELETED"            BIGINT,
    "CREATE_DEPT"           BIGINT,
    "PLAN_ID"               BIGINT,
    "ORDER_ID"              BIGINT,
    "SORT"                  INT,
    "PROCESS_SEQUENCE"      VARCHAR(50),
    "PROCESS_CODE"          VARCHAR(50),
    "PROCESS_NAME"          VARCHAR(50),
    "PROGRAM_ID"            BIGINT,
    "PROGRAM_NAME"          VARCHAR(128),
    "PROCESS_STATUS_BEFORE" INT,
    "PROCESS_STATUS"        INT,
    "INPUT_NUM"             INT DEFAULT 0,
    "QUALIFY_NUM"           INT DEFAULT 0,
    "SCRAPPED_NUM"          INT DEFAULT 0,
    "STANDARD_TIME"         INT,
    "START_TIME"            TIMESTAMP(0),
    "END_TIME"              TIMESTAMP(0),
    "WORKSTATION_ID"        VARCHAR(500),
    "WORKSTATION_NAME"      VARCHAR(500),
    "ART_BAG_ID"            BIGINT,
    "ART_BAG_NAME"          VARCHAR(128),
    "PREPARE_TIME"          INT,
    "DISASSEMBLY_TIME"      INT,
    "TRANSPORT_TIME"        INT,
    "WHETHER_TEST"          INT DEFAULT 0,
    "WHETHER_PARALLEL"      INT DEFAULT 0,
    "MAIN_SEQUENCE_ID"      BIGINT,
    NOT CLUSTER PRIMARY KEY ("ID")
) STORAGE(ON "MAIN", CLUSTERBTR);

COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."ART_BAG_ID" IS '工艺包id';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."ART_BAG_NAME" IS '工艺包名称';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."CREATE_DEPT" IS '创建部门';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."CREATE_TIME" IS '创建时间';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."CREATE_USER" IS '创建人';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."DISASSEMBLY_TIME" IS '拆卸工时（单位：s）';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."END_TIME" IS '结束时间';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."ID" IS '主键';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."INPUT_NUM" IS '投产数量';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."IS_DELETED" IS '删除标识';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."MAIN_SEQUENCE_ID" IS '主序id（当主序id不为空时，代表工序是子序）';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."ORDER_ID" IS '工单id';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."PLAN_ID" IS '计划id';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."PREPARE_TIME" IS '准备工时（单位：s）';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."PROCESS_CODE" IS '工序编号';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."PROCESS_NAME" IS '工序名称';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."PROCESS_SEQUENCE" IS '工序序号';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."PROCESS_STATUS" IS '工序状态(1.待加工 2.加工中 3.暂停 4.关闭 5.完工)';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."PROCESS_STATUS_BEFORE" IS '暂停前状态';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."PROGRAM_ID" IS '程序id';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."PROGRAM_NAME" IS '程序名称';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."QUALIFY_NUM" IS '工序合格数量';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."REMARK" IS '备注';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."SCRAPPED_NUM" IS '工序报废数量';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."SORT" IS '工序顺序';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."STANDARD_TIME" IS '标准工时（单位：s）';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."START_TIME" IS '开始时间';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."STATUS" IS '状态';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."TENANT_ID" IS '租户ID';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."TRANSPORT_TIME" IS '运输工时（单位：s）';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."UPDATE_TIME" IS '更新时间';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."UPDATE_USER" IS '更新人';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."WHETHER_PARALLEL" IS '是否并行： 0 否 1 是';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."WHETHER_TEST" IS '是否质检： 0 否 1 是';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."WORKSTATION_ID" IS '多工位id，用逗号隔开';
COMMENT
ON COLUMN "BLADE_ORDER_PROCESS"."WORKSTATION_NAME" IS '多工位名称，用逗号隔开';


CREATE
    INDEX "PLAN_ORDER" ON "BLADE_ORDER_PROCESS" ("PLAN_ID" ASC, "ORDER_ID" ASC) STORAGE(ON "MAIN", CLUSTERBTR);

-- 工单工位
CREATE TABLE "BLADE_ORDER_WORKSTATION"
(
    "ID"                 BIGINT NOT NULL,
    "TENANT_ID"          VARCHAR(12),
    "CREATE_USER"        BIGINT,
    "CREATE_TIME"        TIMESTAMP(0),
    "UPDATE_USER"        BIGINT,
    "UPDATE_TIME"        TIMESTAMP(0),
    "REMARK"             VARCHAR(255),
    "STATUS"             TINYINT,
    "IS_DELETED"         BIGINT,
    "CREATE_DEPT"        BIGINT,
    "PLAN_ID"            BIGINT,
    "ORDER_ID"           BIGINT,
    "PROCESS_ID"         BIGINT,
    "WORKSTATION_ID"     BIGINT,
    "WORKSTATION_NAME"   VARCHAR(32),
    "PRODUCER_ID"        BIGINT,
    "PRODUCER_CODE"      VARCHAR(32),
    "PRODUCER_NAME"      VARCHAR(128),
    "QUALIFY_NUM"        INT DEFAULT 0,
    "SCRAPPED_NUM"       INT DEFAULT 0,
    "WORKSTATION_STATUS" INT DEFAULT 1,
    "CURRENT_RECORD_ID"  BIGINT,
    NOT CLUSTER PRIMARY KEY ("ID")
) STORAGE(ON "MAIN", CLUSTERBTR);

COMMENT
ON COLUMN "BLADE_ORDER_WORKSTATION"."CREATE_DEPT" IS '创建部门';
COMMENT
ON COLUMN "BLADE_ORDER_WORKSTATION"."CREATE_TIME" IS '创建时间';
COMMENT
ON COLUMN "BLADE_ORDER_WORKSTATION"."CREATE_USER" IS '创建人';
COMMENT
ON COLUMN "BLADE_ORDER_WORKSTATION"."CURRENT_RECORD_ID" IS '当前报工记录的id';
COMMENT
ON COLUMN "BLADE_ORDER_WORKSTATION"."ID" IS '主键';
COMMENT
ON COLUMN "BLADE_ORDER_WORKSTATION"."IS_DELETED" IS '删除标识';
COMMENT
ON COLUMN "BLADE_ORDER_WORKSTATION"."ORDER_ID" IS '工单id';
COMMENT
ON COLUMN "BLADE_ORDER_WORKSTATION"."PLAN_ID" IS '计划id';
COMMENT
ON COLUMN "BLADE_ORDER_WORKSTATION"."PROCESS_ID" IS '工单工序id';
COMMENT
ON COLUMN "BLADE_ORDER_WORKSTATION"."PRODUCER_CODE" IS '当前生产人员编号';
COMMENT
ON COLUMN "BLADE_ORDER_WORKSTATION"."PRODUCER_ID" IS '当前生产人员id';
COMMENT
ON COLUMN "BLADE_ORDER_WORKSTATION"."PRODUCER_NAME" IS '当前生产人员名称';
COMMENT
ON COLUMN "BLADE_ORDER_WORKSTATION"."QUALIFY_NUM" IS '报工合格数量';
COMMENT
ON COLUMN "BLADE_ORDER_WORKSTATION"."REMARK" IS '备注';
COMMENT
ON COLUMN "BLADE_ORDER_WORKSTATION"."SCRAPPED_NUM" IS '报工报废数量';
COMMENT
ON COLUMN "BLADE_ORDER_WORKSTATION"."STATUS" IS '状态';
COMMENT
ON COLUMN "BLADE_ORDER_WORKSTATION"."TENANT_ID" IS '租户ID';
COMMENT
ON COLUMN "BLADE_ORDER_WORKSTATION"."UPDATE_TIME" IS '更新时间';
COMMENT
ON COLUMN "BLADE_ORDER_WORKSTATION"."UPDATE_USER" IS '更新人';
COMMENT
ON COLUMN "BLADE_ORDER_WORKSTATION"."WORKSTATION_ID" IS '加工工位id';
COMMENT
ON COLUMN "BLADE_ORDER_WORKSTATION"."WORKSTATION_NAME" IS '加工工位名称';
COMMENT
ON COLUMN "BLADE_ORDER_WORKSTATION"."WORKSTATION_STATUS" IS '状态：1.未开工 2.已开工';


CREATE
    INDEX "PLAN_ORDER_PROCESS_WORKSTATION" ON "BLADE_ORDER_WORKSTATION" ("ORDER_ID" ASC, "PROCESS_ID" ASC, "WORKSTATION_ID" ASC) STORAGE(ON "MAIN", CLUSTERBTR);

-- 开报工记录
CREATE TABLE "BLADE_ORDER_REPORT_RECORD"
(
    "ID"                 BIGINT NOT NULL,
    "TENANT_ID"          VARCHAR(12),
    "CREATE_USER"        BIGINT,
    "CREATE_TIME"        TIMESTAMP(0),
    "UPDATE_USER"        BIGINT,
    "UPDATE_TIME"        TIMESTAMP(0),
    "REMARK"             VARCHAR(255),
    "STATUS"             TINYINT,
    "IS_DELETED"         BIGINT,
    "CREATE_DEPT"        BIGINT,
    "PLAN_ID"            BIGINT,
    "ORDER_ID"           BIGINT,
    "PROCESS_ID"         BIGINT,
    "WORKSTATION_ID"     BIGINT,
    "WORKSTATION_NAME"   VARCHAR(32),
    "PRODUCER_USER_ID"   BIGINT,
    "PRODUCER_USER_CODE" VARCHAR(50),
    "PRODUCER_USER_NAME" VARCHAR(50),
    "START_TIME"         TIMESTAMP(0),
    "WORKSHOP_TIME"      TIMESTAMP(0),
    "QUALITY_TIME"       TIMESTAMP(0),
    "WORKSHOP_USER_ID"   BIGINT,
    "WORKSHOP_USER_CODE" VARCHAR(50),
    "WORKSHOP_USER_NAME" VARCHAR(50),
    "QUALITY_USER_ID"    BIGINT,
    "QUALITY_USER_CODE"  VARCHAR(50),
    "QUALITY_USER_NAME"  VARCHAR(50),
    "QUALIFY_NUM"        INT DEFAULT 0,
    "SCRAPPED_NUM"       INT DEFAULT 0,
    "RECORD_STATUS"      INT DEFAULT 0,
    "MAIN_SEQUENCE_ID"   BIGINT,
    "OPEN_SEQUENCE_ID"   BIGINT,
    "VERSION"            INT DEFAULT 0,
    "SYSTEM_OR_ORDINARY" INT DEFAULT 0,
    NOT CLUSTER PRIMARY KEY ("ID")
) STORAGE(ON "MAIN", CLUSTERBTR);

COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."CREATE_DEPT" IS '创建部门';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."CREATE_TIME" IS '创建时间';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."CREATE_USER" IS '创建人';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."ID" IS '主键';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."IS_DELETED" IS '删除标识';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."MAIN_SEQUENCE_ID" IS '主序id（当主序id不为空时，代表工序是子序）';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."OPEN_SEQUENCE_ID" IS '并序报工记录id（并序开工时子序的开工记录中）';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."ORDER_ID" IS '工单id';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."PLAN_ID" IS '计划id';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."PROCESS_ID" IS '工单工序id';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."PRODUCER_USER_CODE" IS '开工人员编码';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."PRODUCER_USER_ID" IS '开工人员id';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."PRODUCER_USER_NAME" IS '开工人员名称';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."QUALIFY_NUM" IS '报工合格数量';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."QUALITY_TIME" IS '质检报工时间';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."QUALITY_USER_CODE" IS '质检报工人员编码';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."QUALITY_USER_ID" IS '质检报工人员id';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."QUALITY_USER_NAME" IS '质检报工人员名称';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."RECORD_STATUS" IS '记录状态：0 开工 1 完工';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."REMARK" IS '备注';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."SCRAPPED_NUM" IS '报工报废数量';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."START_TIME" IS '开工时间';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."STATUS" IS '状态';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."TENANT_ID" IS '租户ID';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."UPDATE_TIME" IS '更新时间';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."UPDATE_USER" IS '更新人';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."WORKSHOP_TIME" IS '报工时间';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."WORKSHOP_USER_CODE" IS '报工人员编码';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."WORKSHOP_USER_ID" IS '报工人员id';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."WORKSHOP_USER_NAME" IS '报工人员名称';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."WORKSTATION_ID" IS '加工工位id';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."WORKSTATION_NAME" IS '加工工位名称';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."VERSION" IS '乐观锁';
COMMENT
ON COLUMN "BLADE_ORDER_REPORT_RECORD"."SYSTEM_OR_ORDINARY" IS '0:普通报工 1:系统报工';

CREATE
    INDEX "RECORD_INDEX" ON "BLADE_ORDER_REPORT_RECORD" ("PROCESS_ID" ASC, "WORKSTATION_ID" ASC, "RECORD_STATUS" ASC) STORAGE(ON "MAIN", CLUSTERBTR);

-- 计划工单菜单
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
                        is_deleted, belong_application, keep_alive)
VALUES (1594520271959724033, 0, 'job', '计划工单', 'job', '/job', 'iconfont saber-jihuagongdan', 12, 0, 0, 1, '', 0, 'CPS',
        1);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
                        is_deleted, belong_application, keep_alive)
VALUES (1594521413162733569, 1594520271959724033, 'job_plan', '计划', 'menu', '/job/plan/index', '', 1, 1, 0, 1, '', 0,
        'CPS', 1);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
                        is_deleted, belong_application, keep_alive)
VALUES (1594524229658841089, 1594520271959724033, 'job_order', '工单1', 'job_order', '/job/order/index', '', 2, 1, 0, 1,
        '', 0, 'CPS', 1);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
                        is_deleted, belong_application, keep_alive)
VALUES (1599717577688829954, 1594524229658841089, 'job_work_start', '开工', 'job_work_start', '', '', 1, 2, 0, 1, '', 0,
        'CPS', 1);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
                        is_deleted, belong_application, keep_alive)
VALUES (1599717707783557122, 1594524229658841089, 'job_work_report', '报工', 'job_work_report', '', '', 2, 2, 0, 1, '', 0,
        'CPS', 1);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
                        is_deleted, belong_application, keep_alive)
VALUES (1599717873215295489, 1594524229658841089, 'job_work_complete', '完工', 'job_work_complete', '', '', 3, 2, 0, 1,
        '', 0, 'CPS', 1);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
                        is_deleted, belong_application, keep_alive)
VALUES (1599718446291443713, 1594524229658841089, 'job_work_assigned', '工位指派', 'job_work_assigned', '', '', 4, 2, 0, 1,
        '', 0, 'CPS', 1);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
                        is_deleted, belong_application, keep_alive)
VALUES (1599725934163382273, 1594524229658841089, 'report_history_edit', '报工记录编辑', 'report_history_edit', '', '', 5, 2,
        0, 1, '', 0, 'CPS', 1);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
                        is_deleted, belong_application, keep_alive)
VALUES (1599726500805464065, 1594524229658841089, 'report_history_delete', '报工记录删除', 'report_history_delete', '', '', 6,
        2, 0, 1, '', 0, 'CPS', 1);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
                        is_deleted, belong_application, keep_alive)
VALUES (1599727121952526337, 1594524229658841089, 'report_history', '报工记录列表', 'report_history', '', '', 7, 2, 0, 1, '',
        0, 'CPS', 1);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
                        is_deleted, belong_application, keep_alive)
VALUES (1599948830497501186, 1594521413162733569, 'job_plan_create', '计划新增', 'button', '', '', 1, 2, 0, 1, '', 0, 'CPS',
        1);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
                        is_deleted, belong_application, keep_alive)
VALUES (1599948991642660865, 1594521413162733569, 'job_plan_edit', '计划编辑', 'button', '', '', 2, 2, 0, 1, '', 0, 'CPS',
        1);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
                        is_deleted, belong_application, keep_alive)
VALUES (1599949079353946114, 1594521413162733569, 'job_plan_import', '计划导入', 'button', '', '', 3, 2, 0, 1, '', 0, 'CPS',
        1);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
                        is_deleted, belong_application, keep_alive)
VALUES (1599949217078112257, 1594521413162733569, 'job_plan_export', '计划导出', 'button', '', '', 4, 2, 0, 1, '', 0, 'CPS',
        1);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
                        is_deleted, belong_application, keep_alive)
VALUES (1599949426399047681, 1594521413162733569, 'job_plan_distributed', '计划派工', 'button', '', '', 5, 2, 0, 1, '', 0,
        'CPS', 1);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
                        is_deleted, belong_application, keep_alive)
VALUES (1599949565360533506, 1594521413162733569, 'job_plan_additional', '计划追加', 'button', '', '', 6, 2, 0, 1, '', 0,
        'CPS', 1);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
                        is_deleted, belong_application, keep_alive)
VALUES (1599949740036517889, 1594521413162733569, 'job_plan_suspended', '计划暂停', 'button', '', '', 7, 2, 0, 1, '', 0,
        'CPS', 1);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
                        is_deleted, belong_application, keep_alive)
VALUES (1599949969905348609, 1594521413162733569, 'job_plan_close', '计划关闭', 'button', '', '', 8, 2, 0, 1, '', 0, 'CPS',
        1);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
                        is_deleted, belong_application, keep_alive)
VALUES (1599950097730957313, 1594521413162733569, 'job_plan_delete', '计划删除', 'button', '', '', 9, 2, 0, 1, '', 0, 'CPS',
        1);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
                        is_deleted, belong_application, keep_alive)
VALUES (1599967268410040322, 1594524229658841089, 'report_history_export', '报工记录导出', 'report_history_export', '', '', 8,
        2, 0, 1, '', 0, 'CPS', 1);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category,
                        action, is_open, remark, is_deleted, belong_application, keep_alive)
VALUES (1600664450734919681, 1594524229658841089, 'job_work_delete', '删除', 'job_work_delete', '', '', 9, 2, 0, 1, '', 0,
        'CPS', 1);

INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
                        is_deleted, belong_application, keep_alive)
VALUES (1599950099730957311, 1594521413162733569, 'job_plan_list', '计划列表', 'button', '', '', 10, 2, 0, 1, '', 0, 'CPS',
        1);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
                        is_deleted, belong_application, keep_alive)
VALUES (1599950099730957312, 1594521413162733569, 'job_plan_reboot', '计划重启', 'button', '', '', 11, 2, 0, 1, '', 0,
        'CPS', 1);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
                        is_deleted, belong_application, keep_alive)
VALUES (1599950099730957313, 1594521413162733569, 'job_plan_finish', '计划完工', 'button', '', '', 12, 2, 0, 1, '', 0,
        'CPS',
        1);

-- 工单编码规则
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, is_deleted)
VALUES (1595651058122289153, 1531087267316621313, 'code_rule_for_biz_objects', 'Order', '工单', 1, '', 0, 0);
INSERT INTO blade_meta_object_type (f_id, name, model_type_id, subsys_id, table_name, ref_code, ref_name, primary_key,
                                    rule_field, rule_dict_code, code)
VALUES ('Order', '工单', NULL, 'CoProduction', 'blade_order', 'id', 'plan_id', 'id', NULL, NULL, 'order_code');
INSERT INTO blade_meta_object_type_field (id, object_id, f_code, f_name, field, element_type, enum_type, seq)
VALUES (1595653060172640257, 'Order', 'plan_id', '计划', 'planId', '5', NULL, 0);
INSERT INTO blade_bas_coderule (id, name, remark, bill_form_id, system_default, auto_billno, repair_billno,
                                const_length, create_user, create_dept, create_time, update_user, update_time, status,
                                is_deleted, rule_field_dict_key, preview)
VALUES (1595657697210212353, '工单', '工单', 'Order', 1, 0, 0, NULL, 1123598821738675201, 1123598813738675201,
        '2022-11-24 13:56:56', 1123598821738675201, '2022-11-28 16:22:16', 1, 0, NULL, '-001');
INSERT INTO blade_bas_coderule_entry (id, rule_id, seq, element_type, element_source, source_property, length, format,
                                      element_value, seed, increment_step, separator_char, re_char, add_char, cut_style,
                                      add_style, code_only_by, code_element)
VALUES (1595657697231183873, 1595657697210212353, 1, 5, 'plan_id', 1, 0, '', '', 1, 1, '', '', '', 1, 0, 0, 1);
INSERT INTO blade_bas_coderule_entry (id, rule_id, seq, element_type, element_source, source_property, length, format,
                                      element_value, seed, increment_step, separator_char, re_char, add_char, cut_style,
                                      add_style, code_only_by, code_element)
VALUES (1595657697235378178, 1595657697210212353, 3, 0, '', NULL, 3, '', '', 1, 1, '', '', '0', 1, 0, 0, 1);
INSERT INTO blade_bas_coderule_entry (id, rule_id, seq, element_type, element_source, source_property, length, format,
                                      element_value, seed, increment_step, separator_char, re_char, add_char, cut_style,
                                      add_style, code_only_by, code_element)
VALUES (1595658353455210498, 1595657697210212353, 2, 1, '', NULL, 1, '', '-', 1, 1, '', '', '', 1, 0, 0, 1);
INSERT INTO blade_meta_ref_object_type (object_type_id, ref_object_type_id, field_name, id)
VALUES ('Order', 'CoPlan', 'plan_id', 1595657548199174145);

-- 计划编号编码规则
INSERT INTO blade_bas_coderule(id, name, remark, bill_form_id, system_default, auto_billno, repair_billno, const_length,
                               create_user, create_dept, create_time, update_user, update_time, status, is_deleted,
                               rule_field_dict_key, preview)
VALUES (1598203747095384066, '计划', '计划编码', 'CoPlan', 1, 0, 0, NULL, 1123598821738675201, 1123598813738675201,
        '2022-12-01 14:34:01', 1123598821738675201, '2022-12-01 14:34:03', 1, 0, NULL, '20221201-RS5-R-001');
INSERT INTO blade_bas_coderule_entry(id, rule_id, seq, element_type, element_source, source_property, length, format,
                                     element_value, seed, increment_step, separator_char, re_char, add_char, cut_style,
                                     add_style, code_only_by, code_element)
VALUES (1598203747158298626, 1598203747095384066, 1, 2, 'create_time', NULL, 8, 'yyyyMMdd', '', 1, 1, '-', '', '', 1, 0,
        0, 1);
INSERT INTO blade_bas_coderule_entry(id, rule_id, seq, element_type, element_source, source_property, length, format,
                                     element_value, seed, increment_step, separator_char, re_char, add_char, cut_style,
                                     add_style, code_only_by, code_element)
VALUES (1598203747162492929, 1598203747095384066, 2, 1, '', NULL, 3, '', 'RS5', 1, 1, '-', '', '', 1, 0, 0, 1);
INSERT INTO blade_bas_coderule_entry(id, rule_id, seq, element_type, element_source, source_property, length, format,
                                     element_value, seed, increment_step, separator_char, re_char, add_char, cut_style,
                                     add_style, code_only_by, code_element)
VALUES (1598203747166687234, 1598203747095384066, 3, 1, '', NULL, 1, '', 'R', 1, 1, '-', '', '', 1, 0, 0, 1);
INSERT INTO blade_bas_coderule_entry(id, rule_id, seq, element_type, element_source, source_property, length, format,
                                     element_value, seed, increment_step, separator_char, re_char, add_char, cut_style,
                                     add_style, code_only_by, code_element)
VALUES (1598203747166687235, 1598203747095384066, 4, 0, '', NULL, 3, '', '', 1, 1, '', '', '0', 1, 0, 0, 1);
INSERT INTO blade_meta_object_type_field(id, object_id, f_code, f_name, field, element_type, enum_type, seq)
VALUES (1598203200812453890, 'CoPlan', 'create_time', '创建时间', 'createTime', '2', NULL, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, is_deleted)
VALUES (1531090589473823540, 1531087267316621313, 'code_rule_for_biz_objects', 'CoPlan', '计划', 0, '', 0, 0);
INSERT INTO blade_meta_object_type(f_id, name, model_type_id, subsys_id, table_name, ref_code, ref_name, primary_key,
                                   rule_field, rule_dict_code, code)
VALUES ('CoPlan', '计划', NULL, 'CoProduction', 'blade_plan', 'id', 'code', 'id', NULL, NULL, 'code');
-- 数据权限
-- 计划

INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599960953099784192, 1599950099730957311, 'coproduction_plan.detail', '计划查看详情',
        '/blade-coproduction/plan/get/*', NULL, NULL, 'GET', 1123598821738675201, 1123598813738675201,
        '2022-12-06 11:09:10', 1123598821738675201, '2022-12-06 11:09:10', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599960953099784193, 1599950099730957311, 'coproduction_plan.page', '计划列表分页', '/blade-coproduction/plan/page',
        NULL, NULL, 'POST', 1123598821738675201, 1123598813738675201, '2022-12-06 11:09:10', 1123598821738675201,
        '2022-12-06 11:09:10', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599960953099784194, 1599948830497501186, 'coproduction_plan.save', '计划新增', '/blade-coproduction/plan/save',
        NULL, NULL, 'POST', 1123598821738675201, 1123598813738675201, '2022-12-06 11:09:10', 1123598821738675201,
        '2022-12-06 11:09:10', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599960953099784195, 1599948991642660865, 'coproduction_plan.modify', '计划修改', '/blade-coproduction/plan/modify',
        NULL, NULL, 'PUT', 1123598821738675201, 1123598813738675201, '2022-12-06 11:09:10', 1123598821738675201,
        '2022-12-06 11:09:10', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599960953099784196, 1599950097730957313, 'coproduction_plan.remove', '计划删除', '/blade-coproduction/plan/remove',
        NULL, NULL, 'DELETE', 1123598821738675201, 1123598813738675201, '2022-12-06 11:09:10', 1123598821738675201,
        '2022-12-06 11:09:10', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599960953099784197, 1599949565360533506, 'coproduction_plan.append', '计划追加', '/blade-coproduction/plan/append',
        NULL, NULL, 'POST', 1123598821738675201, 1123598813738675201, '2022-12-06 11:09:10', 1123598821738675201,
        '2022-12-06 11:09:10', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599960953099784198, 1599949740036517889, 'coproduction_plan.pause', '计划暂停', '/blade-coproduction/plan/pause',
        NULL, NULL, 'POST', 1123598821738675201, 1123598813738675201, '2022-12-06 11:09:10', 1123598821738675201,
        '2022-12-06 11:09:10', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599960953099784199, 1599950099730957312, 'coproduction_plan.reboot', '计划重启', '/blade-coproduction/plan/reboot',
        NULL, NULL, 'POST', 1123598821738675201, 1123598813738675201, '2022-12-06 11:09:10', 1123598821738675201,
        '2022-12-06 11:09:10', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599960953099784200, 1599949079353946114, 'coproduction_plan.template', '计划导入模板下载',
        '/blade-coproduction/plan/template', NULL, NULL, 'GET', 1123598821738675201, 1123598813738675201,
        '2022-12-06 11:09:10', 1123598821738675201, '2022-12-06 11:09:10', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599960953099784201, 1599949079353946114, 'coproduction_plan.import', '计划导入', '/blade-coproduction/plan/import',
        NULL, NULL, 'POST', 1123598821738675201, 1123598813738675201, '2022-12-06 11:09:10', 1123598821738675201,
        '2022-12-06 11:09:10', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599960953099784202, 1599949217078112257, 'coproduction_plan.export', '计划导出', '/blade-coproduction/plan/export',
        NULL, NULL, 'POST', 1123598821738675201, 1123598813738675201, '2022-12-06 11:09:10', 1123598821738675201,
        '2022-12-06 11:09:10', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599960953099784203, 1599950099730957313, 'coproduction_plan.finish', '计划完工', '/blade-coproduction/plan/finish',
        NULL, NULL, 'POST', 1123598821738675201, 1123598813738675201, '2022-12-06 11:09:10', 1123598821738675201,
        '2022-12-06 11:09:10', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599960953099784204, 1599949969905348609, 'coproduction_plan.close', '计划关闭', '/blade-coproduction/plan/close',
        NULL, NULL, 'POST', 1123598821738675201, 1123598813738675201, '2022-12-06 11:09:10', 1123598821738675201,
        '2022-12-06 11:09:10', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599960953099784205, 1599717873215295489, 'coproduction_plan.editWorkstation', '编辑工位',
        '/blade-coproduction/plan/editWorkstation', NULL, NULL, 'POST', 1123598821738675201, 1123598813738675201,
        '2022-12-06 11:09:10', 1123598821738675201, '2022-12-06 11:09:10', 1, 0);
-- 工单
insert into "blade_scope_api" ("id", "menu_id", "resource_code", "scope_name", "scope_path", "scope_type", "remark",
                               "http_method", "create_user", "create_dept", "create_time", "update_user", "update_time",
                               "status", "is_deleted")
values (1599960953099784222, 1522823470509395969, 'coproduction_plan.statusCount', '计划页上方状态数量总览',
        '/blade-coproduction/plan/statusCount', null, null, 'GET', 1123598821738675201, 1123598813738675201,
        '2022-12-06 11:09:10', 1123598821738675201, '2022-12-06 11:09:10', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599961117681328130, 1599949426399047681, 'order.assign', '工单派发', '/blade-coproduction/order/assign', NULL,
        NULL, 'POST', 1123598821738675201, 1123598813738675201, '2022-12-06 10:57:11', 1123598821738675201,
        '2022-12-06 10:57:11', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599961227261714434, 1594521413162733569, 'plan_process.list_by_plan_id', '计划工序列表',
        '/blade-coproduction/plan-process/list-by-plan-id', NULL, NULL, 'GET', 1123598821738675201, 1123598813738675201,
        '2022-12-06 10:57:37', 1123598821738675201, '2022-12-06 10:57:37', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599961446795780098, 1594521413162733569, 'order_process.tree_workstation', '获取指派的工位组以及工位',
        '/blade-coproduction/order-process/tree-workstation', NULL, NULL, 'GET', 1123598821738675201,
        1123598813738675201, '2022-12-06 10:58:29', 1123598821738675201, '2022-12-06 10:58:29', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599961674936557570, 1594521413162733569, 'order.plan_order_list', '计划工单列表',
        '/blade-coproduction/order/plan-order-list', NULL, NULL, 'POST', 1123598821738675201, 1123598813738675201,
        '2022-12-06 10:59:24', 1123598821738675201, '2022-12-06 10:59:24', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599962064025362434, 1594521413162733569, 'plan.detail', 'blade_plan详情', '/blade-coproduction/plan/get/*', NULL,
        NULL, 'GET', 1123598821738675201, 1123598813738675201, '2022-12-06 11:00:57', 1123598821738675201,
        '2022-12-06 11:00:57', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599962305147510786, 1594524229658841089, 'order.list', '工单主页列表', '/blade-coproduction/order/list', NULL, NULL,
        'POST', 1123598821738675201, 1123598813738675201, '2022-12-06 11:01:54', 1123598821738675201,
        '2022-12-06 11:01:54', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599962398688878593, 1594524229658841089, 'order_process.detail', '工单工序详情',
        '/blade-coproduction/order-process/detail', NULL, NULL, 'GET', 1123598821738675201, 1123598813738675201,
        '2022-12-06 11:02:16', 1123598821738675201, '2022-12-06 11:02:16', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599962692835418114, 1594524229658841089, 'order_process.tree_workstation', '获取指派的工位组以及工位',
        '/blade-coproduction/order-process/tree-workstation', NULL, NULL, 'GET', 1123598821738675201,
        1123598813738675201, '2022-12-06 11:03:26', 1123598821738675201, '2022-12-06 11:03:26', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599962774611763201, 1594524229658841089, 'order_process.get_relation', '获取刀具、夹具信息',
        '/blade-coproduction/order-process/get-relation', NULL, NULL, 'POST', 1123598821738675201, 1123598813738675201,
        '2022-12-06 11:03:46', 1123598821738675201, '2022-12-06 11:03:46', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599966795124776961, 1599727121952526337, 'order_report_record.page_query', '分页查询工单报工记录',
        '/blade-coproduction/order-report-record/page-query', NULL, NULL, 'POST', 1123598821738675201,
        1123598813738675201, '2022-12-06 11:19:45', 1123598821738675201, '2022-12-06 11:19:45', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599967401986039809, 1599967268410040322, 'order_report_record.record_export', '导出报工记录',
        '/blade-coproduction/order-report-record/record-export', NULL, NULL, 'POST', 1123598821738675201,
        1123598813738675201, '2022-12-06 11:22:09', 1123598821738675201, '2022-12-06 11:22:09', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599969158061432833, 1599727121952526337, 'order_report_record.query_child_record', '查询主序下子序相关信息',
        '/blade-coproduction/order-report-record/query-child-record', NULL, NULL, 'GET', 1123598821738675201,
        1123598813738675201, '2022-12-06 11:29:08', 1123598821738675201, '2022-12-06 11:29:08', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599970340100567042, 1599717707783557122, 'order_process.report_parallel', '报工(并行序)',
        '/blade-coproduction/order-process/report-parallel', NULL, NULL, 'POST', 1123598821738675201,
        1123598813738675201, '2022-12-06 11:33:50', 1123598821738675201, '2022-12-06 11:33:50', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599970340104761345, 1599717707783557122, 'order_process.report_work', '报工(非并行序)',
        '/blade-coproduction/order-process/report-work', NULL, NULL, 'POST', 1123598821738675201, 1123598813738675201,
        '2022-12-06 11:33:50', 1123598821738675201, '2022-12-06 11:33:50', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599970386216939521, 1599717577688829954, 'order_process.start_detail_general', '开工页面详情(非并行序)',
        '/blade-coproduction/order-process/start-detail-general', NULL, NULL, 'GET', 1123598821738675201,
        1123598813738675201, '2022-12-06 11:34:01', 1123598821738675201, '2022-12-06 11:34:01', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599970386216939522, 1599717577688829954, 'order_process.start_detail_parallel', '开工页面详情(并行序)',
        '/blade-coproduction/order-process/start-detail-parallel', NULL, NULL, 'GET', 1123598821738675201,
        1123598813738675201, '2022-12-06 11:34:01', 1123598821738675201, '2022-12-06 11:34:01', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599970386221133825, 1599717577688829954, 'order_process.start_general', '开工(非并行序)',
        '/blade-coproduction/order-process/start-general', NULL, NULL, 'POST', 1123598821738675201, 1123598813738675201,
        '2022-12-06 11:34:01', 1123598821738675201, '2022-12-06 11:34:01', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599970386221133826, 1599717577688829954, 'order_process.start_parallel', '开工(并行序)',
        '/blade-coproduction/order-process/start-parallel', NULL, NULL, 'POST', 1123598821738675201,
        1123598813738675201, '2022-12-06 11:34:01', 1123598821738675201, '2022-12-06 11:34:01', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599970399634518017, 1599725934163382273, 'order_report_record.edit_order_parallel_record', '编辑并行序报工记录',
        '/blade-coproduction/order-report-record/edit-parallel-record', NULL, NULL, 'POST', 1123598821738675201,
        1123598813738675201, '2022-12-06 11:34:04', 1123598821738675201, '2022-12-06 11:34:04', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599970399638712321, 1599725934163382273, 'order_report_record.edit_order_record', '编辑非行序报工记录',
        '/blade-coproduction/order-report-record/edit-common-record', NULL, NULL, 'POST', 1123598821738675201,
        1123598813738675201, '2022-12-06 11:34:04', 1123598821738675201, '2022-12-06 11:34:04', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599970433344139265, 1599726500805464065, 'order_report_record.remove_report_record', '删除报工记录id',
        '/blade-coproduction/order-report-record/remove-report-record', NULL, NULL, 'GET', 1123598821738675201,
        1123598813738675201, '2022-12-06 11:34:12', 1123598821738675201, '2022-12-06 11:34:12', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark, http_method,
                             create_user, create_dept, create_time, update_user, update_time, status, is_deleted)
VALUES (1599970533021773826, 1599717577688829954, 'order_workstation.get_workstation_can_start', '获得可开工的工位)',
        '/blade-coproduction/order-workstation/get-workstation-can-start', NULL, NULL, 'GET', 1123598821738675201,
        1123598813738675201, '2022-12-06 11:34:36', 1123598821738675201, '2022-12-06 11:34:36', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type,
                             remark, http_method, create_user, create_dept, create_time,
                             update_user, update_time, status, is_deleted)
VALUES (1601031782210977794, 1600664450734919681, 'order.remove', '计划工单删除', '/blade-coproduction/order/remove', NULL,
        NULL, 'DELETE', 1123598821738675201, 1123598813738675201, '2022-12-09 09:51:37', 1123598821738675201,
        '2022-12-09 09:51:37', 1, 0);
INSERT INTO blade_scope_api (id, menu_id, resource_code, scope_name, scope_path, scope_type, remark,
                             http_method, create_user, create_dept, create_time, update_user, update_time,
                             status, is_deleted)
VALUES (1602122216145076226, 1599725934163382273, 'order_report_record.report_records_detail', '编辑报工记录展开详情',
        '/blade-coproduction/order-report-record/report-record-detail', NULL, NULL, 'GET', 1123598821738675201,
        1123598813738675201, '2022-12-12 10:04:37', 1123598821738675201, '2022-12-12 10:04:37', 1, 0);
