CREATE TABLE "MES_OUTSOURCE_PROCESS"
(
    "ID"           NUMBER(20, 0) PRIMARY KEY,
    "PROCESS_ID"   NUMBER(20, 0),
    "PROCESS_NAME" NVARCHAR2(255),
    "DAYS"         NUMBER(10, 0),
    "REMARKS"      NVARCHAR2(255),
    "CREATE_USER"  NUMBER(20, 0),
    "CREATE_DEPT"  NUMBER(20, 0),
    "CREATE_TIME"  DATE,
    "UPDATE_USER"  NUMBER(20, 0),
    "UPDATE_TIME"  DATE,
    "STATUS"       NUMBER(11, 0) DEFAULT 1,
    "IS_DELETED"   NUMBER(11, 0) DEFAULT 0
);

-- 添加表注释
COMMENT ON TABLE mes_outsource_process IS '外协工序表';

-- 添加字段注释
COMMENT ON COLUMN mes_outsource_process.id IS 'ID';
COMMENT ON COLUMN mes_outsource_process.process_id IS '工序id';
COMMENT ON COLUMN mes_outsource_process.process_name IS '工序名称';
COMMENT ON COLUMN mes_outsource_process.days IS '时间';
COMMENT ON COLUMN mes_outsource_process.remarks IS '备注';
COMMENT ON COLUMN mes_outsource_process.create_user IS '创建人';
COMMENT ON COLUMN mes_outsource_process.create_dept IS '创建部门';
COMMENT ON COLUMN mes_outsource_process.create_time IS '创建时间';
COMMENT ON COLUMN mes_outsource_process.update_user IS '更新人';
COMMENT ON COLUMN mes_outsource_process.update_time IS '更新时间';
COMMENT ON COLUMN mes_outsource_process.status IS '业务状态';
COMMENT ON COLUMN mes_outsource_process.is_deleted IS '是否已删除';

DROP TABLE MES_RACK_SET;
CREATE TABLE "MES_RACK_SET"
(
    "ID"          NUMBER(20, 0)           NOT NULL ENABLE,
    "TENANT_ID"   NVARCHAR2(12),
    "CREATE_USER" NUMBER(20, 0),
    "CREATE_TIME" DATE,
    "CREATE_DEPT" NUMBER(20, 0),
    "UPDATE_USER" NUMBER(20, 0),
    "UPDATE_TIME" DATE,
    "STATUS"      NUMBER(11, 0) DEFAULT 1,
    "IS_DELETED"  NUMBER(11, 0) DEFAULT 0,
    "RS_CODE"     NVARCHAR2(255)          NOT NULL ENABLE,
    "RS_TYPE"     NVARCHAR2(255)          NOT NULL ENABLE,
    "BIND_QTY"    NUMBER        DEFAULT 0 NOT NULL ENABLE,
    PRIMARY KEY ("ID")
) SEGMENT CREATION IMMEDIATE TABLESPACE "JONHON_MES_DATA";

COMMENT ON TABLE mes_rack_set IS '挂具设置';
COMMENT ON COLUMN mes_rack_set.rs_code IS '编码';
COMMENT ON COLUMN mes_rack_set.rs_type IS '类型';
COMMENT ON COLUMN mes_rack_set.create_user IS '创建人';
COMMENT ON COLUMN mes_rack_set.create_dept IS '创建部门';
COMMENT ON COLUMN mes_rack_set.create_time IS '创建时间';
COMMENT ON COLUMN mes_rack_set.update_user IS '更新人';
COMMENT ON COLUMN mes_rack_set.update_time IS '更新时间';
COMMENT ON COLUMN mes_rack_set.status IS '状态;1、空闲；2、使用中；3、已绑定';
COMMENT ON COLUMN mes_rack_set.is_deleted IS '是否已删除';

-- MES_FEI_BA_SET definition
DROP TABLE MES_FEI_BA_SET;
CREATE TABLE "MES_FEI_BA_SET"
(
    "ID"          NUMBER(20, 0)           NOT NULL ENABLE,
    "TENANT_ID"   NVARCHAR2(12),
    "CREATE_USER" NUMBER(20, 0),
    "CREATE_TIME" DATE,
    "CREATE_DEPT" NUMBER(20, 0),
    "UPDATE_USER" NUMBER(20, 0),
    "UPDATE_TIME" DATE,
    "STATUS"      NUMBER(11, 0) DEFAULT 1,
    "IS_DELETED"  NUMBER(11, 0) DEFAULT 0,
    "FS_CODE"     NVARCHAR2(255)          NOT NULL ENABLE,
    "FS_TYPE"     NVARCHAR2(255)          NOT NULL ENABLE,
    "BIND_QTY"    NUMBER        DEFAULT 0 NOT NULL ENABLE,
    PRIMARY KEY ("ID")
) SEGMENT CREATION IMMEDIATE TABLESPACE "JONHON_MES_DATA";

COMMENT ON TABLE mes_fei_ba_set IS '飞跋设置';
COMMENT ON COLUMN mes_fei_ba_set.fs_code IS '编码';
COMMENT ON COLUMN mes_fei_ba_set.fs_type IS '类型';
COMMENT ON COLUMN mes_fei_ba_set.create_user IS '创建人';
COMMENT ON COLUMN mes_fei_ba_set.create_dept IS '创建部门';
COMMENT ON COLUMN mes_fei_ba_set.create_time IS '创建时间';
COMMENT ON COLUMN mes_fei_ba_set.update_user IS '更新人';
COMMENT ON COLUMN mes_fei_ba_set.update_time IS '更新时间';
COMMENT ON COLUMN mes_fei_ba_set.status IS '状态;1、空闲；2、使用中';
COMMENT ON COLUMN mes_fei_ba_set.is_deleted IS '删除标记;1:删除，0:正常';

DROP TABLE MES_RECORDER_TYPE;
CREATE TABLE "MES_RECORDER_TYPE"
(
    "ID"          NUMBER(20, 0)  NOT NULL ENABLE,
    "TENANT_ID"   NVARCHAR2(12),
    "CREATE_USER" NUMBER(20, 0),
    "CREATE_TIME" DATE,
    "CREATE_DEPT" NUMBER(20, 0),
    "UPDATE_USER" NUMBER(20, 0),
    "UPDATE_TIME" DATE,
    "STATUS"      NUMBER(11, 0) DEFAULT 1,
    "IS_DELETED"  NUMBER(11, 0) DEFAULT 0,
    "CRT_CODE"    NVARCHAR2(255) NOT NULL ENABLE,
    "MEMO"        NVARCHAR2(900),
    PRIMARY KEY ("ID")
) SEGMENT CREATION IMMEDIATE TABLESPACE "JONHON_MES_DATA";

COMMENT ON TABLE mes_recorder_type IS '记录仪分类';
COMMENT ON COLUMN mes_recorder_type.id IS '流水号';
COMMENT ON COLUMN mes_recorder_type.crt_code IS '编码';
COMMENT ON COLUMN mes_recorder_type.memo IS '备注';
COMMENT ON COLUMN mes_recorder_type.create_user IS '创建人';
COMMENT ON COLUMN mes_recorder_type.create_dept IS '创建部门';
COMMENT ON COLUMN mes_recorder_type.create_time IS '创建时间';
COMMENT ON COLUMN mes_recorder_type.update_user IS '更新人';
COMMENT ON COLUMN mes_recorder_type.update_time IS '更新时间';
COMMENT ON COLUMN mes_recorder_type.status IS '状态;';
COMMENT ON COLUMN mes_recorder_type.is_deleted IS '删除标记;1:删除，0:正常';

-- MES_RECORDER_COMPARE definition
DROP TABLE MES_RECORDER_COMPARE;
CREATE TABLE "MES_RECORDER_COMPARE"
(
    "ID"          NUMBER(20, 0)  NOT NULL ENABLE,
    "TENANT_ID"   NVARCHAR2(12),
    "CREATE_USER" NUMBER(20, 0),
    "CREATE_TIME" DATE,
    "CREATE_DEPT" NUMBER(20, 0),
    "UPDATE_USER" NUMBER(20, 0),
    "UPDATE_TIME" DATE,
    "STATUS"      NUMBER(11, 0) DEFAULT 1,
    "IS_DELETED"  NUMBER(11, 0) DEFAULT 0,
    "CODE"        NVARCHAR2(255) NOT NULL ENABLE,
    "NAME"        NVARCHAR2(255) NOT NULL ENABLE,
    "SHOW_NAME"   NVARCHAR2(255),
    "SHOW_GRAPH"  CHAR(1),
    "CRC_X"       NUMBER(*, 0),
    "CRC_Y"       NUMBER(20, 10),
    PRIMARY KEY ("ID")
) SEGMENT CREATION IMMEDIATE TABLESPACE "JONHON_MES_DATA";

COMMENT ON TABLE mes_recorder_compare IS '记录仪曲线设置';
COMMENT ON COLUMN mes_recorder_compare.id IS '流水号';
COMMENT ON COLUMN mes_recorder_compare.code IS '设备编号';
COMMENT ON COLUMN mes_recorder_compare.name IS '参数名称';
COMMENT ON COLUMN mes_recorder_compare.show_name IS '参数显示名称';
COMMENT ON COLUMN mes_recorder_compare.show_graph IS '是否显示曲线图';
COMMENT ON COLUMN mes_recorder_compare.crc_x IS '曲线X间隔';
COMMENT ON COLUMN mes_recorder_compare.crc_y IS '曲线Y比例尺';
COMMENT ON COLUMN mes_recorder_compare.create_user IS '创建人';
COMMENT ON COLUMN mes_recorder_compare.create_dept IS '创建部门';
COMMENT ON COLUMN mes_recorder_compare.create_time IS '创建时间';
COMMENT ON COLUMN mes_recorder_compare.update_user IS '更新人';
COMMENT ON COLUMN mes_recorder_compare.update_time IS '更新时间';
COMMENT ON COLUMN mes_recorder_compare.status IS '状态;';
COMMENT ON COLUMN mes_recorder_compare.is_deleted IS '删除标记;1:删除，0:正常';

DROP TABLE MES_MEA_TOOL;
CREATE TABLE "MES_MEA_TOOL"
(
    "ID"          NUMBER(20, 0) NOT NULL ENABLE,
    "TENANT_ID"   NVARCHAR2(12),
    "CREATE_USER" NUMBER(20, 0),
    "CREATE_TIME" DATE,
    "CREATE_DEPT" NUMBER(20, 0),
    "UPDATE_USER" NUMBER(20, 0),
    "UPDATE_TIME" DATE,
    "STATUS"      NUMBER(11, 0) DEFAULT 1,
    "IS_DELETED"  NUMBER(11, 0) DEFAULT 0,
    "MT_SIZE"     NVARCHAR2(255),
    "MT_NAME"     NVARCHAR2(255),
    "ORDERS"      NVARCHAR2(255),
    PRIMARY KEY ("ID")
) SEGMENT CREATION IMMEDIATE TABLESPACE "JONHON_MES_DATA";

COMMENT ON TABLE mes_mea_tool IS '量具信息';
COMMENT ON COLUMN mes_mea_tool.id IS '流水号';
COMMENT ON COLUMN mes_mea_tool.mt_size IS '尺寸';
COMMENT ON COLUMN mes_mea_tool.mt_name IS '量具';
COMMENT ON COLUMN mes_mea_tool.orders IS '序号';
COMMENT ON COLUMN mes_mea_tool.create_user IS '创建人';
COMMENT ON COLUMN mes_mea_tool.create_dept IS '创建部门';
COMMENT ON COLUMN mes_mea_tool.create_time IS '创建时间';
COMMENT ON COLUMN mes_mea_tool.update_user IS '更新人';
COMMENT ON COLUMN mes_mea_tool.update_time IS '更新时间';
COMMENT ON COLUMN mes_mea_tool.status IS '状态;1、空闲；2、使用中';
COMMENT ON COLUMN mes_mea_tool.is_deleted IS '删除标记;1:删除，0:正常';

DROP TABLE MES_UPKEEP_RECORDS;
CREATE TABLE "MES_UPKEEP_RECORDS"
(
    "ID"            NUMBER(20, 0) NOT NULL ENABLE,
    "TENANT_ID"     NVARCHAR2(12),
    "CREATE_USER"   NUMBER(20, 0),
    "CREATE_TIME"   DATE,
    "CREATE_DEPT"   NUMBER(20, 0),
    "UPDATE_USER"   NUMBER(20, 0),
    "UPDATE_TIME"   DATE,
    "STATUS"        NUMBER(11, 0) DEFAULT 1,
    "IS_DELETED"    NUMBER(11, 0) DEFAULT 0,
    "DEVICE"        NVARCHAR2(255),
    "DEVICE_CODE"   NVARCHAR2(255),
    "FAULT_DATE"    DATE,
    "FAULT_MEMO"    NVARCHAR2(255),
    "UPKEEP_DATE"   DATE,
    "UPKEEP_RESULT" NVARCHAR2(255),
    "MEMO"          NVARCHAR2(255),
    "UPKEEP_MAN"    NVARCHAR2(255),
    PRIMARY KEY ("ID")
) SEGMENT CREATION IMMEDIATE TABLESPACE "JONHON_MES_DATA";

COMMENT ON TABLE mes_upkeep_records IS '设备维修记录';
COMMENT ON COLUMN mes_upkeep_records.id IS '流水号';
COMMENT ON COLUMN mes_upkeep_records.device IS '设备';
COMMENT ON COLUMN mes_upkeep_records.device_code IS '设备编号';
COMMENT ON COLUMN mes_upkeep_records.fault_date IS '故障日期';
COMMENT ON COLUMN mes_upkeep_records.fault_memo IS '故障描述';
COMMENT ON COLUMN mes_upkeep_records.upkeep_date IS '维修日期';
COMMENT ON COLUMN mes_upkeep_records.upkeep_result IS '维修结果';
COMMENT ON COLUMN mes_upkeep_records.memo IS '备注';
COMMENT ON COLUMN mes_upkeep_records.upkeep_man IS '维修人';
COMMENT ON COLUMN mes_upkeep_records.create_user IS '创建人';
COMMENT ON COLUMN mes_upkeep_records.create_dept IS '创建部门';
COMMENT ON COLUMN mes_upkeep_records.create_time IS '创建时间';
COMMENT ON COLUMN mes_upkeep_records.update_user IS '更新人';
COMMENT ON COLUMN mes_upkeep_records.update_time IS '更新时间';
COMMENT ON COLUMN mes_upkeep_records.status IS '状态;';
COMMENT ON COLUMN mes_upkeep_records.is_deleted IS '删除标记;1:删除，0:正常';

-- MES_MEASURING_upkeep definition
DROP TABLE MES_MEASURING_UPKEEP;
CREATE TABLE "MES_MEASURING_UPKEEP"
(
    "ID"              NUMBER(20, 0)            NOT NULL ENABLE,
    "TENANT_ID"       NVARCHAR2(12),
    "CREATE_USER"     NUMBER(20, 0),
    "CREATE_TIME"     DATE,
    "CREATE_DEPT"     NUMBER(20, 0),
    "UPDATE_USER"     NUMBER(20, 0),
    "UPDATE_TIME"     DATE,
    "STATUS"          NUMBER(11, 0) DEFAULT 1,
    "IS_DELETED"      NUMBER(11, 0) DEFAULT 0,
    "MM_CODE"         NVARCHAR2(255)           NOT NULL ENABLE,
    "MI_ID"           NUMBER(18, 0),
    "MEMO"            NVARCHAR2(900),
    "CREATE_MAN"      NUMBER(18, 0)            NOT NULL ENABLE,
    "APPROVAL_STATUS" NUMBER        DEFAULT -1 NOT NULL ENABLE,
    "RLS_ID"          NUMBER(18, 0),
    PRIMARY KEY ("ID")
) SEGMENT CREATION IMMEDIATE TABLESPACE "JONHON_MES_DATA";

COMMENT ON TABLE mes_measuring_upkeep IS '量具保养';
COMMENT ON COLUMN mes_measuring_upkeep.id IS '流水号';
COMMENT ON COLUMN mes_measuring_upkeep.mm_code IS '保养单号';
COMMENT ON COLUMN mes_measuring_upkeep.mi_id IS '库存物料;外键（库存物料）';
COMMENT ON COLUMN mes_measuring_upkeep.memo IS '备注';
COMMENT ON COLUMN mes_measuring_upkeep.approval_status IS '审批状态;-1';
COMMENT ON COLUMN mes_measuring_upkeep.rls_id IS '库存物料';
COMMENT ON COLUMN mes_measuring_upkeep.create_user IS '创建人';
COMMENT ON COLUMN mes_measuring_upkeep.create_dept IS '创建部门';
COMMENT ON COLUMN mes_measuring_upkeep.create_time IS '创建时间';
COMMENT ON COLUMN mes_measuring_upkeep.update_user IS '更新人';
COMMENT ON COLUMN mes_measuring_upkeep.update_time IS '更新时间';
COMMENT ON COLUMN mes_measuring_upkeep.status IS '状态;0：待保养；1：已保养；21：作废';
COMMENT ON COLUMN mes_measuring_upkeep.is_deleted IS '删除标记;1:删除，0:正常';
