--外协绩效模板
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
) 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)
) 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,
    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,
    PROCESS_ID       NUMBER(20,0) NOT NULL,
    CRAFT_IDS        NVARCHAR2(500) DEFAULT 0 NOT NULL
) 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 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
) 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
) 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 '外协过程任务单';