--外协绩效模板
CREATE TABLE MES_OEM_AND_ABILITY
(
    ID          NUMBER(20,0) NOT NULL,
    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,
    OC_ID       NUMBER(20,0) NOT NULL,
    CA_ID NUMBER(20,0) NOT NULL,
    CHECK (ID IS NOT NULL) ENABLE,
    CHECK (OC_ID IS NOT NULL) ENABLE,
    PRIMARY KEY (ID)
) TABLESPACE jonhon_mes_data;
COMMENT
ON COLUMN MES_OEM_AND_ABILITY.CREATE_USER IS '创建人';
COMMENT
ON COLUMN MES_OEM_AND_ABILITY.CREATE_TIME IS '创建时间';
COMMENT
ON COLUMN MES_OEM_AND_ABILITY.CREATE_DEPT IS '创建部门';
COMMENT
ON COLUMN MES_OEM_AND_ABILITY.UPDATE_USER IS '更新人';
COMMENT
ON COLUMN MES_OEM_AND_ABILITY.UPDATE_TIME IS '更新时间';
COMMENT
ON COLUMN MES_OEM_AND_ABILITY.STATUS IS '状态;1、空闲；2、使用中';
COMMENT
ON COLUMN MES_OEM_AND_ABILITY.IS_DELETED IS '删除标记;1:删除，0:正常';
COMMENT
ON COLUMN MES_OEM_AND_ABILITY.OC_ID IS '外协厂家ID';
COMMENT
ON COLUMN MES_OEM_AND_ABILITY.CA_ID IS '工艺能力ID';
COMMENT
ON TABLE MES_OEM_AND_ABILITY IS '外协绩效模板';

--外协绩效
CREATE TABLE MES_OEM_MERITS
(
    ID                 NUMBER(20,0) NOT NULL,
    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,
    OC_ID              NUMBER(20,0) NOT NULL,
    CA_ID              NUMBER(20,0) NOT NULL,
    JHZS_TARGET        NUMBER(19,2),
    JHZS_REALITY       NUMBER(19,2),
    JHZS_NUM           NUMBER(19,2),
    ZDLJ_TARGET        NUMBER(19,2),
    ZDLJ_REALITY       NUMBER(19,2),
    ZDLJ_NUM           NUMBER(19,2),
    QQX_TARGET         NUMBER(19,2),
    QQX_REALITY        NUMBER(19,2),
    QQX_NUM            NUMBER(19,2),
    PRODUCE_TS_TARGET  NUMBER(19,2),
    PRODUCE_TS_REALITY NUMBER(19,2),
    PRODUCE_TS_NUM     NUMBER(19,2),
    PAY_MERITS         NUMBER(19,2),
    HGX_TARGET         NUMBER(19,2),
    HGX_REALITY        NUMBER(19,2),
    HGX_NUM            NUMBER(19,2),
    DPPM_TARGET        NUMBER(19,2),
    DPPM_REALITY       NUMBER(19,2),
    DPPM_NUM           NUMBER(19,2),
    DJCW_TARGET        NUMBER(19,2),
    DJCW_REALITY       NUMBER(19,2),
    DJCW_NUM           NUMBER(19,2),
    QUALITY_TS_TARGET  NUMBER(19,2),
    QUALITY_TS_REALITY NUMBER(19,2),
    QUALITY_TS_NUM     NUMBER(19,2),
    QUALITY_MERITS     NUMBER(19,2),
    GROW_ABILITY       NUMBER(19,2),
    AJOR_ISSUES        NUMBER(19,2),
    END_SCORE          NUMBER(19,2),
    MERITS_SCORE       VARCHAR2(255 BYTE),
    RANKING            NUMBER(9,0),
    QUALITY_STATUS     NUMBER(5,0),
    PRODUCE_STATUS     NUMBER(5,0),
    OM_STATUS          NUMBER(5,0),
    PCX_TARGET         NUMBER(19,2),
    PCX_REALITY        NUMBER(19,2),
    PCX_NUM            NUMBER(19,2),
    DYW_TARGET         NUMBER(19,2),
    DYW_REALITY        NUMBER(19,2),
    DYW_NUM            NUMBER(19,2),
    QLWT_TARGET        NUMBER(19,2),
    QLWT_REALITY       NUMBER(19,2),
    QLWT_NUM NUMBER(19,2),
    CHECK (ID IS NOT NULL) ENABLE,
    CHECK (OC_ID IS NOT NULL) ENABLE,
    PRIMARY KEY (ID)
) TABLESPACE jonhon_mes_data;
COMMENT
ON COLUMN MES_OEM_MERITS.CREATE_USER IS '创建人';
COMMENT
ON COLUMN MES_OEM_MERITS.CREATE_TIME IS '创建时间';
COMMENT
ON COLUMN MES_OEM_MERITS.CREATE_DEPT IS '创建部门';
COMMENT
ON COLUMN MES_OEM_MERITS.UPDATE_USER IS '更新人';
COMMENT
ON COLUMN MES_OEM_MERITS.UPDATE_TIME IS '更新时间';
COMMENT
ON COLUMN MES_OEM_MERITS.STATUS IS '状态;1、空闲；2、使用中';
COMMENT
ON COLUMN MES_OEM_MERITS.IS_DELETED IS '删除标记;1:删除，0:正常';
COMMENT
ON COLUMN MES_OEM_MERITS.OC_ID IS '外协厂家ID';
COMMENT
ON COLUMN MES_OEM_MERITS.CA_ID IS '工艺能力ID';
COMMENT
ON COLUMN MES_OEM_MERITS.JHZS_TARGET IS '计划准时完成率-目标值';
COMMENT
ON COLUMN MES_OEM_MERITS.JHZS_REALITY IS '计划准时完成率-实际值';
COMMENT
ON COLUMN MES_OEM_MERITS.JHZS_NUM IS '计划准时完成率-绩效得分';
COMMENT
ON COLUMN MES_OEM_MERITS.ZDLJ_TARGET IS '重点零件完成率-目标值';
COMMENT
ON COLUMN MES_OEM_MERITS.ZDLJ_REALITY IS '重点零件完成率-实际值';
COMMENT
ON COLUMN MES_OEM_MERITS.ZDLJ_NUM IS '重点零件完成率-绩效得分';
COMMENT
ON COLUMN MES_OEM_MERITS.QQX_TARGET IS '清欠项-目标值';
COMMENT
ON COLUMN MES_OEM_MERITS.QQX_REALITY IS '清欠项-实际值';
COMMENT
ON COLUMN MES_OEM_MERITS.QQX_NUM IS '清欠项-绩效得分';
COMMENT
ON COLUMN MES_OEM_MERITS.PRODUCE_TS_TARGET IS '生产客户投诉-目标值';
COMMENT
ON COLUMN MES_OEM_MERITS.PRODUCE_TS_REALITY IS '生产客户投诉-实际值';
COMMENT
ON COLUMN MES_OEM_MERITS.PRODUCE_TS_NUM IS '生产客户投诉-绩效得分';
COMMENT
ON COLUMN MES_OEM_MERITS.PAY_MERITS IS '交付绩效';
COMMENT
ON COLUMN MES_OEM_MERITS.HGX_TARGET IS '后工序审理单-目标值';
COMMENT
ON COLUMN MES_OEM_MERITS.HGX_REALITY IS '后工序审理单-实际值';
COMMENT
ON COLUMN MES_OEM_MERITS.HGX_NUM IS '后工序审理单-绩效得分';
COMMENT
ON COLUMN MES_OEM_MERITS.DPPM_TARGET IS 'DPPM-目标值';
COMMENT
ON COLUMN MES_OEM_MERITS.DPPM_REALITY IS 'DPPM-实际值';
COMMENT
ON COLUMN MES_OEM_MERITS.DPPM_NUM IS 'DPPM-绩效得分';
COMMENT
ON COLUMN MES_OEM_MERITS.DJCW_TARGET IS '低级错误-目标值';
COMMENT
ON COLUMN MES_OEM_MERITS.DJCW_REALITY IS '低级错误-实际值';
COMMENT
ON COLUMN MES_OEM_MERITS.DJCW_NUM IS '低级错误-绩效得分';
COMMENT
ON COLUMN MES_OEM_MERITS.QUALITY_TS_TARGET IS '质量客户投诉-目标值';
COMMENT
ON COLUMN MES_OEM_MERITS.QUALITY_TS_REALITY IS '质量客户投诉-实际值';
COMMENT
ON COLUMN MES_OEM_MERITS.QUALITY_TS_NUM IS '质量客户投诉-绩效得分';
COMMENT
ON COLUMN MES_OEM_MERITS.QUALITY_MERITS IS '质量绩效';
COMMENT
ON COLUMN MES_OEM_MERITS.GROW_ABILITY IS '发展能力';
COMMENT
ON COLUMN MES_OEM_MERITS.AJOR_ISSUES IS '重大事项';
COMMENT
ON COLUMN MES_OEM_MERITS.END_SCORE IS '最终得分';
COMMENT
ON COLUMN MES_OEM_MERITS.MERITS_SCORE IS '绩效等级';
COMMENT
ON COLUMN MES_OEM_MERITS.RANKING IS '排名';
COMMENT
ON COLUMN MES_OEM_MERITS.QUALITY_STATUS IS '质量填写填写状态';
COMMENT
ON COLUMN MES_OEM_MERITS.PRODUCE_STATUS IS '生产填写填写状态';
COMMENT
ON COLUMN MES_OEM_MERITS.OM_STATUS IS '状态';
COMMENT
ON COLUMN MES_OEM_MERITS.PCX_TARGET IS '批次性-目标值';
COMMENT
ON COLUMN MES_OEM_MERITS.PCX_REALITY IS '批次性-实际值';
COMMENT
ON COLUMN MES_OEM_MERITS.PCX_NUM IS '批次性-绩效得分';
COMMENT
ON COLUMN MES_OEM_MERITS.DYW_TARGET IS '多余物-目标值';
COMMENT
ON COLUMN MES_OEM_MERITS.DYW_REALITY IS '多余物-实际值';
COMMENT
ON COLUMN MES_OEM_MERITS.DYW_NUM IS '多余物-绩效得分';
COMMENT
ON COLUMN MES_OEM_MERITS.QLWT_TARGET IS '清零问题-目标值';
COMMENT
ON COLUMN MES_OEM_MERITS.QLWT_REALITY IS '清零问题-实际值';
COMMENT
ON COLUMN MES_OEM_MERITS.QLWT_NUM IS '清零问题-绩效得分';
COMMENT
ON TABLE MES_OEM_MERITS IS '外协绩效';


--外协工序
CREATE TABLE MES_OEM_PROCESS
(
    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,
    OEM_PROCESS_CODE NVARCHAR2(255) NOT NULL ENABLE,
    PROCESS_ID       NUMBER(20,0) NOT NULL ENABLE,
    CRAFT_IDS        NVARCHAR2(500) DEFAULT 0 NOT NULL ENABLE,
    MANUAL           CHAR(1) NOT NULL ENABLE,
    CHECK (ID IS NOT NULL) ENABLE,
    PRIMARY KEY (ID)
) TABLESPACE jonhon_mes_data;
COMMENT
ON COLUMN MES_OEM_PROCESS.CREATE_USER IS '创建人';
COMMENT
ON COLUMN MES_OEM_PROCESS.CREATE_TIME IS '创建时间';
COMMENT
ON COLUMN MES_OEM_PROCESS.CREATE_DEPT IS '创建部门';
COMMENT
ON COLUMN MES_OEM_PROCESS.UPDATE_USER IS '更新人';
COMMENT
ON COLUMN MES_OEM_PROCESS.UPDATE_TIME IS '更新时间';
COMMENT
ON COLUMN MES_OEM_PROCESS.STATUS IS '状态;1、空闲；2、使用中';
COMMENT
ON COLUMN MES_OEM_PROCESS.IS_DELETED IS '删除标记;1:删除，0:正常';
COMMENT
ON COLUMN MES_OEM_PROCESS.OEM_PROCESS_CODE IS '编码';
COMMENT
ON COLUMN MES_OEM_PROCESS.PROCESS_ID IS '工序ID';
COMMENT
ON COLUMN MES_OEM_PROCESS.CRAFT_IDS IS '工艺IDS';
COMMENT
ON COLUMN MES_OEM_PROCESS.MANUAL IS '是否手动结算：0否(自动结算)，1是(手动结算)';
COMMENT
ON TABLE MES_OEM_PROCESS IS '外协工序';


--外协特殊过程表
CREATE TABLE MES_OEM_SPECIAL_PRO
(
    ID            NUMBER(20,0) NOT NULL,
    OC_ID         NUMBER(20,0) NOT NULL,
    PRO_ITEM      VARCHAR2(255 BYTE) NOT NULL,
    CONDITION     VARCHAR2(1000 BYTE) NOT NULL,
    CYCLE         NUMBER(10,0),
    LAST_DUE_TIME DATE,
    REM_DAYS      NUMBER(10,0) NOT NULL,
    PRO_MAN       NUMBER(20,0) NOT NULL,
    CREATE_TIME   DATE DEFAULT SYSDATE,
    CREATE_USER   NUMBER(20,0),
    CREATE_DEPT   NUMBER(20,0),
    UPDATE_TIME   DATE DEFAULT SYSDATE,
    UPDATE_USER   NUMBER(20,0),
    REMARKS       VARCHAR2(1000 BYTE),
    STATUS        NUMBER(10,0) DEFAULT 1,
    IS_DELETED NUMBER(10,0) DEFAULT 0,
    CHECK (ID IS NOT NULL) ENABLE,
    CHECK (CONDITION IS NOT NULL) ENABLE,
    CHECK (OC_ID IS NOT NULL) ENABLE,
    CHECK (PRO_MAN IS NOT NULL) ENABLE,
    CHECK (PRO_ITEM IS NOT NULL) ENABLE,
    CHECK (REM_DAYS IS NOT NULL) ENABLE,
    PRIMARY KEY (ID)
) TABLESPACE jonhon_mes_data;
COMMENT
ON COLUMN MES_OEM_SPECIAL_PRO.ID IS '主键ID';
COMMENT
ON COLUMN MES_OEM_SPECIAL_PRO.OC_ID IS '外协厂商（外键）';
COMMENT
ON COLUMN MES_OEM_SPECIAL_PRO.PRO_ITEM IS '过程项';
COMMENT
ON COLUMN MES_OEM_SPECIAL_PRO.CONDITION IS '确认条件';
COMMENT
ON COLUMN MES_OEM_SPECIAL_PRO.CYCLE IS '周期天数';
COMMENT
ON COLUMN MES_OEM_SPECIAL_PRO.LAST_DUE_TIME IS '上次确认日期';
COMMENT
ON COLUMN MES_OEM_SPECIAL_PRO.REM_DAYS IS '提前提醒(天)';
COMMENT
ON COLUMN MES_OEM_SPECIAL_PRO.PRO_MAN IS '工艺员（外键-人员）';
COMMENT
ON COLUMN MES_OEM_SPECIAL_PRO.CREATE_TIME IS '创建时间';
COMMENT
ON COLUMN MES_OEM_SPECIAL_PRO.CREATE_USER IS '创建人';
COMMENT
ON COLUMN MES_OEM_SPECIAL_PRO.CREATE_DEPT IS '创建部门';
COMMENT
ON COLUMN MES_OEM_SPECIAL_PRO.UPDATE_TIME IS '更新时间';
COMMENT
ON COLUMN MES_OEM_SPECIAL_PRO.UPDATE_USER IS '更新人';
COMMENT
ON COLUMN MES_OEM_SPECIAL_PRO.REMARKS IS '备注';
COMMENT
ON COLUMN MES_OEM_SPECIAL_PRO.STATUS IS '状态';
COMMENT
ON TABLE MES_OEM_SPECIAL_PRO IS '外协特殊过程表';


--外协过程任务单
CREATE TABLE MES_OEM_TASK_BILL
(
    ID                NUMBER(20,0) NOT NULL,
    TB_CODE           VARCHAR2(255 BYTE) NOT NULL,
    SP_ID             NUMBER(20,0),
    OC_ID             NUMBER(20,0),
    PRO_ITEM          VARCHAR2(255 BYTE),
    CONFIRM_CONDITION VARCHAR2(1000 BYTE),
    CYCLE             NUMBER(10,0),
    LAST_TIME         DATE,
    REM_DAYS          NUMBER(20,0),
    PRO_MAN           NUMBER(20,0),
    TB_STATUS         NUMBER(10,0) NOT NULL,
    FILL_MEMO         VARCHAR2(1000 BYTE),
    CREATE_TIME       DATE DEFAULT SYSDATE,
    CREATE_USER       NUMBER(20,0),
    CREATE_DEPT       NUMBER(20,0),
    UPDATE_TIME       DATE DEFAULT SYSDATE,
    UPDATE_USER       NUMBER(20,0),
    REMARKS           VARCHAR2(1000 BYTE),
    STATUS            NUMBER(10,0) DEFAULT 1,
    IS_DELETED NUMBER(10,0) DEFAULT 0,
    CHECK (ID IS NOT NULL) ENABLE,
    CHECK (TB_CODE IS NOT NULL) ENABLE,
    CHECK (TB_STATUS IS NOT NULL) ENABLE,
    PRIMARY KEY (ID)
) TABLESPACE jonhon_mes_data;
COMMENT
ON COLUMN MES_OEM_TASK_BILL.ID IS '主键ID';
COMMENT
ON COLUMN MES_OEM_TASK_BILL.TB_CODE IS '任务号';
COMMENT
ON COLUMN MES_OEM_TASK_BILL.SP_ID IS '特殊过程项';
COMMENT
ON COLUMN MES_OEM_TASK_BILL.OC_ID IS '外协厂商（外键）';
COMMENT
ON COLUMN MES_OEM_TASK_BILL.PRO_ITEM IS '过程项';
COMMENT
ON COLUMN MES_OEM_TASK_BILL.CONFIRM_CONDITION IS '确认条件';
COMMENT
ON COLUMN MES_OEM_TASK_BILL.CYCLE IS '周期天数';
COMMENT
ON COLUMN MES_OEM_TASK_BILL.LAST_TIME IS '上次确认时间';
COMMENT
ON COLUMN MES_OEM_TASK_BILL.REM_DAYS IS '提醒天数';
COMMENT
ON COLUMN MES_OEM_TASK_BILL.PRO_MAN IS '工艺员（外键-人员）';
COMMENT
ON COLUMN MES_OEM_TASK_BILL.TB_STATUS IS '处理状态';
COMMENT
ON COLUMN MES_OEM_TASK_BILL.FILL_MEMO IS '填报备注';
COMMENT
ON COLUMN MES_OEM_TASK_BILL.CREATE_TIME IS '创建时间';
COMMENT
ON COLUMN MES_OEM_TASK_BILL.CREATE_USER IS '创建人';
COMMENT
ON COLUMN MES_OEM_TASK_BILL.CREATE_DEPT IS '创建部门';
COMMENT
ON COLUMN MES_OEM_TASK_BILL.UPDATE_TIME IS '更新时间';
COMMENT
ON COLUMN MES_OEM_TASK_BILL.UPDATE_USER IS '更新人';
COMMENT
ON COLUMN MES_OEM_TASK_BILL.REMARKS IS '备注';
COMMENT
ON COLUMN MES_OEM_TASK_BILL.STATUS IS '状态';
COMMENT
ON TABLE MES_OEM_TASK_BILL IS '外协过程任务单';

--外协结算单
CREATE TABLE MES_OEM_STATEMENT
(
    ID              NUMBER(20,0) NOT NULL,
    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,
    WP_ID           NUMBER(20,0) NOT NULL,
    ROS_THICKNESS   NUMBER(19,4),
    UNIT_PRICE      NUMBER(19,4),
    TOTAL_PRICE     NUMBER(19,4),
    UNIT            NVARCHAR2(255),
    QUOTATION       NVARCHAR2(255),
    ROS_STATUS      NUMBER(5,0),
    MEMO            NVARCHAR2(255),
    APPROVAL_STATUS NUMBER(5,0),
    CHECK (ID IS NOT NULL) ENABLE,
    CHECK (WP_ID IS NOT NULL) ENABLE,
    PRIMARY KEY (ID)
) TABLESPACE jonhon_mes_data;
COMMENT
ON COLUMN MES_OEM_STATEMENT.CREATE_USER IS '创建人';
COMMENT
ON COLUMN MES_OEM_STATEMENT.CREATE_TIME IS '创建时间';
COMMENT
ON COLUMN MES_OEM_STATEMENT.CREATE_DEPT IS '创建部门';
COMMENT
ON COLUMN MES_OEM_STATEMENT.UPDATE_USER IS '更新人';
COMMENT
ON COLUMN MES_OEM_STATEMENT.UPDATE_TIME IS '更新时间';
COMMENT
ON COLUMN MES_OEM_STATEMENT.STATUS IS '状态;1、空闲；2、使用中';
COMMENT
ON COLUMN MES_OEM_STATEMENT.IS_DELETED IS '删除标记;1:删除，0:正常';
COMMENT
ON COLUMN MES_OEM_STATEMENT.WP_ID IS '车间作业计划ID';
COMMENT
ON COLUMN MES_OEM_STATEMENT.ROS_THICKNESS IS '镀层厚度';
COMMENT
ON COLUMN MES_OEM_STATEMENT.UNIT_PRICE IS '结算单价';
COMMENT
ON COLUMN MES_OEM_STATEMENT.TOTAL_PRICE IS '结算金额';
COMMENT
ON COLUMN MES_OEM_STATEMENT.UNIT IS '单位';
COMMENT
ON COLUMN MES_OEM_STATEMENT.QUOTATION IS '报价单号';
COMMENT
ON COLUMN MES_OEM_STATEMENT.ROS_STATUS IS '状态';
COMMENT
ON COLUMN MES_OEM_STATEMENT.MEMO IS '备注';
COMMENT
ON COLUMN MES_OEM_STATEMENT.APPROVAL_STATUS IS '审批状态';
COMMENT
ON TABLE MES_OEM_STATEMENT IS '外协结算单';

--外协镀种规则
CREATE TABLE MES_PLATING_TYPE_RULES
(
    ID             NUMBER(20,0) NOT NULL,
    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,
    ORDER_PLAT     NVARCHAR2(255) NOT NULL,
    QUOTATION_PLAT NVARCHAR2(255) NOT NULL,
    CHECK (ID IS NOT NULL) ENABLE,
    CHECK (QUOTATION_PLAT IS NOT NULL) ENABLE,
    CHECK (ORDER_PLAT IS NOT NULL) ENABLE,
    PRIMARY KEY (ID)
)TABLESPACE jonhon_mes_data;
COMMENT
ON COLUMN MES_PLATING_TYPE_RULES.CREATE_USER IS '创建人';
COMMENT
ON COLUMN MES_PLATING_TYPE_RULES.CREATE_TIME IS '创建时间';
COMMENT
ON COLUMN MES_PLATING_TYPE_RULES.CREATE_DEPT IS '创建部门';
COMMENT
ON COLUMN MES_PLATING_TYPE_RULES.UPDATE_USER IS '更新人';
COMMENT
ON COLUMN MES_PLATING_TYPE_RULES.UPDATE_TIME IS '更新时间';
COMMENT
ON COLUMN MES_PLATING_TYPE_RULES.STATUS IS '状态;1、空闲；2、使用中；3、已绑定';
COMMENT
ON COLUMN MES_PLATING_TYPE_RULES.IS_DELETED IS '是否已删除';
COMMENT
ON COLUMN MES_PLATING_TYPE_RULES.ORDER_PLAT IS '订单镀种';
COMMENT
ON COLUMN MES_PLATING_TYPE_RULES.QUOTATION_PLAT IS '报价单镀种';
COMMENT
ON TABLE MES_PLATING_TYPE_RULES IS '外协镀种规则';

--量具计量记录
CREATE TABLE MES_MEASUREMENT_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),
    IS_DELETED    NUMBER(11,0) DEFAULT 0,
    MC_NAME       NVARCHAR2(255),
    NORMS         NVARCHAR2(255),
    MC_CLASS      NVARCHAR2(255),
    LABEL_NO      NVARCHAR2(255),
    STR2          NVARCHAR2(255),
    MC_CODE       NVARCHAR2(255),
    USE_UNIT      NVARCHAR2(255),
    ACCURACY      NVARCHAR2(255),
    OEM_CODE      NVARCHAR2(255),
    MC_OEM        NVARCHAR2(255),
    ENABLE_DATE   DATE,
    WHEN_DCCEPT   NVARCHAR2(255),
    MC_TYPE       NVARCHAR2(255),
    TEST_CYCLE    NUMBER(11,0),
    DUE_DATE      DATE,
    DATE2         DATE,
    BELONG        NVARCHAR2(255),
    WHEN_BUY      DATE,
    TEST_DEPT     NVARCHAR2(255),
    TEST_METHOD   NVARCHAR2(255),
    STR9          NVARCHAR2(255),
    STR10         NVARCHAR2(255),
    ASSETS_NO     NVARCHAR2(255),
    STR6          NVARCHAR2(255),
    PURPOSE_CLASS NVARCHAR2(255),
    IS_OVER_STR   NVARCHAR2(255),
    CM_TYPE       NUMBER(5,0),
    CENSORSHIP    CHAR(1),
    CHECK_STATUS  CHAR(1),
    CHECK_RESULT  CHAR(1),
    CHECK (ID IS NOT NULL) ENABLE,
    PRIMARY KEY (ID)
) TABLESPACE JONHON_MES_DATA;
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.ID IS '主键';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.CREATE_USER IS '创建人';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.CREATE_TIME IS '创建时间';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.CREATE_DEPT IS '创建部门';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.UPDATE_USER IS '更新人';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.UPDATE_TIME IS '更新时间';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.STATUS IS '状态';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.IS_DELETED IS '是否已删除';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.MC_NAME IS '名称(设备名称)';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.NORMS IS '规格';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.MC_CLASS IS '类别(管理类别)';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.LABEL_NO IS '计量类型';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.STR2 IS '计量子类型';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.MC_CODE IS '编号(测量设备编码)';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.USE_UNIT IS '使用单位(试用部门)';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.ACCURACY IS '精度(精度等级)';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.OEM_CODE IS '出厂编号';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.MC_OEM IS '生产厂家(制造厂商)';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.ENABLE_DATE IS '启用日期';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.WHEN_DCCEPT IS '检定日期';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.MC_TYPE IS '型号(型号)';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.TEST_CYCLE IS '检定周期(检定周期)';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.DUE_DATE IS '到期日期(有效日期)';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.DATE2 IS '报废日期';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.BELONG IS '状态';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.WHEN_BUY IS '停用日期';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.TEST_DEPT IS '检定部门';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.TEST_METHOD IS '检定/校验方法(检定校准方法)';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.STR9 IS '备注';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.STR10 IS '备注2';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.ASSETS_NO IS '使用人工号';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.STR6 IS '责任人';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.PURPOSE_CLASS IS '用途分类';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.IS_OVER_STR IS '超期情况';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.CM_TYPE IS '类型1、仪表计量；2、设备计量';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.CENSORSHIP IS '是否送检1:是，0:否';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.CHECK_STATUS IS '检验状态1:在检，0:未检';
COMMENT
ON COLUMN MES_MEASUREMENT_RECORDS.CHECK_RESULT IS '检验结果1:合格，0:不合格';
COMMENT
ON TABLE MES_MEASUREMENT_RECORDS IS '量具计量记录';

--车间订单运行记录表加字段
ALTER TABLE MES_WORK_ORDER_RUN ADD (OEM_STATUS NUMBER(3,0));
COMMENT
ON COLUMN MES_WORK_ORDER_RUN.OEM_STATUS IS '外协状态(1-待外协、2-外协中、3-已完成)';