
--计划表：主表
CREATE TABLE "Z_RESOURCE_INSPECT_PLAN"(
    HANDLE			   NVARCHAR2(412) NOT NULL,
    SITE               NVARCHAR2(6  ) NOT NULL,
    PLAN_NO            NVARCHAR2(128) ,
    REVISION           NVARCHAR2(6  ) ,
    CURRENT_REVISION   NVARCHAR2(5  ) ,
    PLAN_TASK_COUNT    NUMBER(38,0)   ,
    DESCRIPTION        NVARCHAR2(500) ,
    STATUS             NVARCHAR2(10 ) ,
    CATEGORY           NVARCHAR2(10 ) ,
    SCHEDULE_TYPE      NVARCHAR2(10 ) ,
    FREQUENCY          NUMBER(38,2)   ,
    FREQUENCY_UNIT     NVARCHAR2(10)  ,
    BEFORE_TOLERANCE   NUMBER(38,0)   ,
    AFTER_TOLERANCE    NUMBER(38,0)   ,
    INDATE_START       DATE           ,
    INDATE_END         DATE           ,
    INSPECTION_ITEM_BO NVARCHAR2(412) ,
    CREATE_USER        NVARCHAR2(30)  NOT NULL,
    CREATED_DATE_TIME  DATE           NOT NULL,
    MODIFY_USER        NVARCHAR2(30)  ,
    MODIFIED_DATE_TIME DATE           ,
    PRIMARY KEY ("HANDLE")
);
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_PLAN"."HANDLE"						 IS '主键';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_PLAN"."SITE"               IS '站点';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_PLAN"."PLAN_NO"            IS '设备检验计划编号';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_PLAN"."REVISION"           IS '版本';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_PLAN"."CURRENT_REVISION"   IS '是否当前版本(true/false)';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_PLAN"."PLAN_TASK_COUNT"    IS '任务数量';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_PLAN"."DESCRIPTION"        IS '设备检验计划描述';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_PLAN"."STATUS"             IS '检验计划状态(新建、启动、禁用)';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_PLAN"."CATEGORY"           IS '保养类别(日常保养/一级保养/二级保养/日点检/周点检/月点检/年点检)';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_PLAN"."SCHEDULE_TYPE"      IS '排程方式（周期/执行间隔时间）';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_PLAN"."FREQUENCY"          IS '频率';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_PLAN"."FREQUENCY_UNIT"     IS '频率单位(M月W周D日H时F分S秒)';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_PLAN"."BEFORE_TOLERANCE"   IS '前容差时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_PLAN"."AFTER_TOLERANCE"    IS '后容差时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_PLAN"."INDATE_START"       IS '检验计划有效期(开始时间)';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_PLAN"."INDATE_END"         IS '检验计划有效期(结束时间)';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_PLAN"."INSPECTION_ITEM_BO" IS '检验项目清单HANDLE';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_PLAN"."CREATE_USER"        IS '创建人';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_PLAN"."CREATED_DATE_TIME"  IS '创建时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_PLAN"."MODIFY_USER"        IS '修改人';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_PLAN"."MODIFIED_DATE_TIME" IS '修改时间';
COMMENT ON TABLE  "WIP"."Z_RESOURCE_INSPECT_PLAN"                      IS '设备检验计划表';
commit;

--计划设备表：关联表，计划HANDLE-设备HANDLE
CREATE TABLE "Z_RESOURCE_INSPECT_RESOURCE"(
    HANDLE						NVARCHAR2(412) NOT NULL,
    RESOURCE_INSPECT_PLAN_BO    NVARCHAR2(412) ,
    RESOURCE_BO                 NVARCHAR2(412) ,
    STATUS                      NVARCHAR2(10 ) ,
    TASK_CREATE_DATE            DATE           ,
    CREATE_USER                 NVARCHAR2(30)  NOT NULL,
    CREATED_DATE_TIME           DATE           NOT NULL,
    MODIFY_USER                 NVARCHAR2(30)  ,
    MODIFIED_DATE_TIME          DATE     			 ,
    PRIMARY KEY ("HANDLE")
);

COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_RESOURCE"."HANDLE"                   IS '主键';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_RESOURCE"."RESOURCE_INSPECT_PLAN_BO" IS '设备检验计划HANDLE';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_RESOURCE"."RESOURCE_BO"              IS '设备编号';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_RESOURCE"."STATUS"                   IS '任务状态(启用/禁用)';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_RESOURCE"."TASK_CREATE_DATE"         IS '任务生成时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_RESOURCE"."CREATE_USER"              IS '创建人';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_RESOURCE"."CREATED_DATE_TIME"        IS '创建时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_RESOURCE"."MODIFY_USER"              IS '修改人';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_RESOURCE"."MODIFIED_DATE_TIME"       IS '修改时间';
COMMENT ON TABLE  "WIP"."Z_RESOURCE_INSPECT_RESOURCE"                            IS '设备检验计划从表';
COMMIT;

--检验任务表：主表
CREATE TABLE "Z_RESOURCE_INSPECT_TASK"(
    HANDLE                   NVARCHAR2(412) NOT NULL,
    SITE                     NVARCHAR2(6  ) NOT NULL,
    TASK_NO                  NVARCHAR2(128) ,
    CATEGORY                 NVARCHAR2(10 ) ,
    DESCRIPTION              NVARCHAR2(500) ,
    STATUS                   NVARCHAR2(10 ) ,
    RESOURCE_INSPECT_PLAN_BO NVARCHAR2(412) ,
    INSPECTION_ITEM_BO       NVARCHAR2(412) ,
    RESOURCE_BO              NVARCHAR2(128) ,
    RESULT                   NVARCHAR2(500) ,
    TASK_CREATE_DATE         DATE           ,
    PLAN_START_DATE          DATE           ,
    PLAN_COMPLETE_DATE       DATE           ,
    ACTUAL_START_DATE        DATE           ,
    ACTUAL_COMPLETE_DATE     DATE           ,
    EXECUTOR                 NVARCHAR2(128) ,
    REMARK                   NVARCHAR2(500) ,
    CREATE_USER              NVARCHAR2(30 ) NOT NULL,
    CREATED_DATE_TIME        DATE           NOT NULL,
    MODIFY_USER              NVARCHAR2(30)  ,
    MODIFIED_DATE_TIME       DATE           ,
    PRIMARY KEY ("HANDLE")
);

COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK"."HANDLE"                   IS  '主键';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK"."SITE"                     IS  '站点';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK"."TASK_NO"                  IS  '任务编号';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK"."CATEGORY"                 IS  '类型(自动AUTO/手动)';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK"."DESCRIPTION"              IS  '任务描述';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK"."STATUS"                   IS  '任务状态(新建/处理中/完成/关闭)';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK"."RESOURCE_INSPECT_PLAN_BO" IS  '设备检验计划HANDLE';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK"."INSPECTION_ITEM_BO"       IS  '检验项目清单HANDLE';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK"."RESOURCE_BO"              IS  '设备HANDLE';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK"."RESULT"                   IS  '检验结果';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK"."TASK_CREATE_DATE"         IS  '任务创建时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK"."PLAN_START_DATE"          IS  '计划开始时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK"."PLAN_COMPLETE_DATE"       IS  '计划完成时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK"."ACTUAL_START_DATE"        IS  '实际开始时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK"."ACTUAL_COMPLETE_DATE"     IS  '实际完成时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK"."EXECUTOR"                 IS  '执行人';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK"."REMARK"                   IS  '备注';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK"."CREATE_USER"              IS  '创建人';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK"."CREATED_DATE_TIME"        IS  '创建时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK"."MODIFY_USER"              IS  '修改人';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK"."MODIFIED_DATE_TIME"       IS  '修改时间';
COMMENT ON TABLE  "WIP"."Z_RESOURCE_INSPECT_TASK"                            IS  '设备检验任务表';
COMMIT;

--任务检验项明细表：从表
CREATE TABLE "Z_RESOURCE_INSPECT_TASK_PARAM"(
    HANDLE                        NVARCHAR2(412) NOT NULL,
    RESOURCE_INSPECT_TASK_BO      NVARCHAR2(412) NOT NULL,
    INSPECT_NO                    NVARCHAR2(10 ) ,
    DESCRIPTION                   NVARCHAR2(128) ,
    INSPECT_METHOD                NVARCHAR2(10 ) ,
    INSPECT_DATA_TYPE             NVARCHAR2(4  ) ,
    PARAM_UNIT                    NVARCHAR2(10 ) ,
    REQUIRED                      NVARCHAR2(5  ) ,
    MIN_VALUE                     NUMBER(38,2)   ,
    MAX_VALUE                     NUMBER(38,2)   ,
    STANDARD_VALUE                NVARCHAR2(500) ,
    RESULT_VALUE                  NVARCHAR2(500) ,
    RESULT                        NVARCHAR2(10 ) ,
    REMARK                        NVARCHAR2(500) ,
    CREATE_USER                   NVARCHAR2(30 ) NOT NULL,
    CREATED_DATE_TIME             DATE           NOT NULL,
    MODIFY_USER                   NVARCHAR2(30)  ,
    MODIFIED_DATE_TIME            DATE           ,
    PRIMARY KEY ("HANDLE")
);

COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_PARAM"."HANDLE"                   IS  '主键';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_PARAM"."RESOURCE_INSPECT_TASK_BO" IS  '任务HANDLE';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_PARAM"."INSPECT_NO"               IS  '检验项目编号';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_PARAM"."DESCRIPTION"              IS  '检验项目编号';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_PARAM"."INSPECT_METHOD"           IS  '检验方式/方法';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_PARAM"."INSPECT_DATA_TYPE"        IS  '检验数据类型（文本T、数字N、布尔值B）';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_PARAM"."PARAM_UNIT"               IS  '参数单位';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_PARAM"."REQUIRED"                 IS  '是否必填【Y必填，N非必填】';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_PARAM"."MIN_VALUE"                IS  '最小值';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_PARAM"."MAX_VALUE"                IS  '最大值';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_PARAM"."STANDARD_VALUE"           IS  '标准值';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_PARAM"."RESULT_VALUE"             IS  '结果值';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_PARAM"."RESULT"                   IS  '结果【Y/N】';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_PARAM"."REMARK"                   IS  '备注';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_PARAM"."CREATE_USER"              IS  '创建人';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_PARAM"."CREATED_DATE_TIME"        IS  '创建时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_PARAM"."MODIFY_USER"              IS  '修改人';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_PARAM"."MODIFIED_DATE_TIME"       IS  '修改时间';
COMMENT ON TABLE  "WIP"."Z_RESOURCE_INSPECT_TASK_PARAM"                            IS  '设备检验任务从表';
COMMIT;

--任务耗用备品表：关联表，任务HANDLE-物料HANDLE
CREATE TABLE "Z_RESOURCE_INSPECT_TASK_SPARE"(
    HANDLE                     NVARCHAR2(412)  NOT NULL,
    RESOURCE_INSPECT_TASK_BO   NVARCHAR2(412)  NOT NULL,
    SPARE_BO				   NVARCHAR2(412)  ,
    SPARE_NO                   NVARCHAR2(24)   ,
    DESCRIPTION                 NVARCHAR2(128)  ,
    QTY                        NUMBER(38,2)    ,
    UNIT                       NVARCHAR2(10)   ,
    REMARK                     NVARCHAR2(500)  ,
    CREATE_USER                NVARCHAR2(30 ) NOT NULL,
    CREATED_DATE_TIME          DATE           NOT NULL,
    MODIFY_USER                NVARCHAR2(30)  ,
    MODIFIED_DATE_TIME         DATE           ,
    PRIMARY KEY ("HANDLE")
);

COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_SPARE"."HANDLE"                     IS  '主键';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_SPARE"."RESOURCE_INSPECT_TASK_BO"   IS  '任务HANDLE';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_SPARE"."SPARE_BO"                   IS  '备品HANDLE';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_SPARE"."SPARE_NO"                   IS  '备品编号';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_SPARE"."DESCRIPTION"                 IS  '备品描述';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_SPARE"."QTY"                        IS  '数量';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_SPARE"."UNIT"                       IS  '单位';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_SPARE"."REMARK"                     IS  '备注';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_SPARE"."CREATE_USER"                IS  '创建人';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_SPARE"."CREATED_DATE_TIME"          IS  '创建时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_SPARE"."MODIFY_USER"                IS  '修改人';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_INSPECT_TASK_SPARE"."MODIFIED_DATE_TIME"         IS  '修改时间';
COMMENT ON TABLE  "WIP"."Z_RESOURCE_INSPECT_TASK_SPARE"                              IS  '设备检验任务-备品表';
COMMIT;

--检验计划用户组表：关联表，计划HANDLE-用户组HANDLE
CREATE TABLE "Z_INSPECT_PLAN_USER_GROUP"(
    HANDLE						NVARCHAR2(412) NOT NULL,
    USER_GROUP_BO               NVARCHAR2(412) ,
    RESOURCE_INSPECT_PLAN_BO    NVARCHAR2(412) ,
    CREATE_USER                 NVARCHAR2(30)  NOT NULL,
    CREATED_DATE_TIME           DATE           NOT NULL,
    MODIFY_USER                 NVARCHAR2(30)  ,
    MODIFIED_DATE_TIME          DATE     			 ,
    PRIMARY KEY ("HANDLE")
);

COMMENT ON COLUMN "WIP"."Z_INSPECT_PLAN_USER_GROUP"."HANDLE"                   IS '主键';
COMMENT ON COLUMN "WIP"."Z_INSPECT_PLAN_USER_GROUP"."USER_GROUP_BO"            IS '用户组HANDLE';
COMMENT ON COLUMN "WIP"."Z_INSPECT_PLAN_USER_GROUP"."RESOURCE_INSPECT_PLAN_BO" IS '检验计划HANDLE';
COMMENT ON COLUMN "WIP"."Z_INSPECT_PLAN_USER_GROUP"."CREATE_USER"              IS '创建人';
COMMENT ON COLUMN "WIP"."Z_INSPECT_PLAN_USER_GROUP"."CREATED_DATE_TIME"        IS '创建时间';
COMMENT ON COLUMN "WIP"."Z_INSPECT_PLAN_USER_GROUP"."MODIFY_USER"              IS '修改人';
COMMENT ON COLUMN "WIP"."Z_INSPECT_PLAN_USER_GROUP"."MODIFIED_DATE_TIME"       IS '修改时间';
COMMENT ON TABLE  "WIP"."Z_INSPECT_PLAN_USER_GROUP"                            IS '设备检验计划从表';
COMMIT;

--报修表：
--主表
CREATE TABLE "Z_RESOURCE_REPAIR_TASK"(
    HANDLE                           NVARCHAR2(412) NOT NULL,           --'主键';
    SITE                             NVARCHAR2(6)   NOT NULL,           --'站点';
    REPAIR_NO                        NVARCHAR2(128) ,                   --'维修编号';
    DESCRIPTION                      NVARCHAR2(128) ,                   --'描述';
    STATUS                           NVARCHAR2(16)  ,                   --'状态';
    RESOURCE_NO                      NVARCHAR2(412) ,                   --'设备编号';
    REPORT_USER                      NVARCHAR2(30) ,                    --'提报人';
    NC_CODE_NO                       NVARCHAR2(412) ,                   --'不良代码';
    REPAIR_TYPE                      NVARCHAR2(16)  ,                   --'维修类型';
    STOP_MACHINE                     NVARCHAR2(412) ,                   --'是否停机';
    BREAK_DOWN_DESCRIPTION           NVARCHAR2(500) ,                   --'故障描述补充';
    FIND_LINK                        NVARCHAR2(16)  ,                   --'发现环节';
    REPORT_SOURCE                    NVARCHAR2(16)  ,                   --'上报来源';
    OBJECT_BO                        NVARCHAR2(412) ,                   --'关联来源-异常转维修';
    PLAN_START_DATE                  DATE           ,                   --'建议开始维修时间';
    PLAN_COMPLETE_DATE               DATE           ,                   --'建议完成时间';
    ACTUAL_START_DATE                DATE           ,                   --'实际开始维修时间';
    ACTUAL_COMPLETE_DATE             DATE           ,                   --'实际完成时间';
    REPAIR_USERS                     NVARCHAR2(256) ,                   --'维修用户';
    CANCEL_CODE                      NVARCHAR2(412) ,                   --'取消代码';
    CANCEL_DATE                      DATE           ,                   --'取消时间';
    CANCEL_DESCRIPTION               NVARCHAR2(500) ,                   --'取消描述';
    CANCEL_USER                      NVARCHAR2(30)  ,                   --'取消用户';
    DEAL_WAY                         NVARCHAR2(16)  ,                   --'处理方式';
    PRELIMINARY_REASON               NVARCHAR2(500) ,                   --'初步原因';
    DEAL_WAY_DESCRIPTION             NVARCHAR2(500) ,                   --'处理方式描述';
    WAIT_TIME                        NUMBER(38,2)   ,                   --'等待时间';
    WAIT_START_DATE                  DATE           ,                   --'等待开始时间';
    WAIT_END_DATE                    DATE           ,                   --'等待结束时间';
    WAIT_DESCRIPTION                 NVARCHAR2(500) ,                   --'等待描述';
    PRIMARY_REASON									 NVARCHAR2(16)  ,                   --'根本原因';
    PRIMARY_REASON_DESCRIPTION       NVARCHAR2(500) ,                   --'根本原因描述';
    PRECAUTION_MEASURE_DESCRIPTION   NVARCHAR2(500) ,                   --'预防措施描述';
    REMARK                           NVARCHAR2(500) ,                   --'备注';
    OTHER                            NVARCHAR2(16)  ,                   --'预留字段1';
    ANOTHER                          NVARCHAR2(32)  ,                   --'预留字段2';
    CREATE_USER                      NVARCHAR2(30)  NOT NULL,           --'创建人';
    CREATED_DATE_TIME                DATE           NOT NULL,           --'创建时间';
    MODIFY_USER                      NVARCHAR2(30)  ,                   --'修改人';
    MODIFIED_DATE_TIME               DATE     			,                   --'修改时间';
    PRIMARY KEY ("HANDLE")
);

COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."HANDLE"                          IS '主键';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."SITE"                            IS '站点';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."REPAIR_NO"                       IS '维修编号';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."DESCRIPTION"                     IS '描述';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."STATUS"                          IS '状态';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."RESOURCE_NO"                     IS '设备编号';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."REPORT_USER"                     IS '提报人';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."NC_CODE_NO"                      IS '不良代码HANDLE';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."REPAIR_TYPE"                     IS '维修类型';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."STOP_MACHINE"                    IS '是否停机';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."BREAK_DOWN_DESCRIPTION"          IS '故障描述补充';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."FIND_LINK"                       IS '发现环节';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."REPORT_SOURCE"                   IS '上报来源';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."OBJECT_BO"                       IS '关联来源-异常转维修';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."PLAN_START_DATE"                 IS '建议维修时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."PLAN_COMPLETE_DATE"              IS '建议完成时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."ACTUAL_START_DATE"               IS '实际维修时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."ACTUAL_COMPLETE_DATE"            IS '实际完成时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."REPAIR_USER"                     IS '维修用户';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."CANCEL_CODE"                     IS '取消代码';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."CANCEL_DATE"                     IS '取消时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."CANCEL_DESCRIPTION"              IS '取消描述';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."CANCEL_USER"                     IS '取消用户';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."DEAL_WAY"                        IS '处理方式';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."PRELIMINARY_REASON"              IS '初步原因';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."DEAL_WAY_DESCRIPTION"            IS '处理方式描述';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."WAIT_TIME"                       IS '等待时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."WAIT_START_DATE"                 IS '等待开始时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."WAIT_END_DATE"                   IS '等待结束时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."WAIT_DESCRIPTION"                IS '等待描述';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."PRIMARY_REASON"                  IS '根本原因';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."PRIMARY_REASON_DESCRIPTION"      IS '根本原因描述';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."PRECAUTION_MEASURE_DESCRIPTION"  IS '预防措施描述';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."REMARK"                          IS '备注';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."OTHER"                           IS '预留字段1';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."ANOTHER"                         IS '预留字段2';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."CREATE_USER"                     IS '创建人';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."CREATED_DATE_TIME"               IS '创建时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."MODIFY_USER"                     IS '修改人';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_REPAIR_TASK"."MODIFIED_DATE_TIME"              IS '修改时间';
COMMENT ON TABLE  "WIP"."Z_RESOURCE_REPAIR_TASK"                                   IS '设备报修/维修表';
COMMIT;

--设备状态接口
CREATE TABLE "Z_RESOURCE_STATUS_RECEIVE"(
    HANDLE                  NVARCHAR2(412) NOT NULL,
    SITE                    NVARCHAR2(6)  ,
    RESRCE                  NVARCHAR2(36) ,
    STATUS                  NVARCHAR2(8)  ,
    DATE_TIME               DATE          ,
    CHANGE_STATUS           NVARCHAR2(8)  ,
    CHANGE_DATE_TIME        DATE          ,
    INTERVAL_TIME           NUMBER(38,2)  ,
    CREATE_USER             NVARCHAR2(30)  NOT NULL,
    CREATED_DATE_TIME       DATE           NOT NULL,
    MODIFY_USER             NVARCHAR2(30)  ,
    MODIFIED_DATE_TIME      DATE     		 	 ,
    PRIMARY KEY ("HANDLE")
);

COMMENT ON COLUMN "WIP"."Z_RESOURCE_STATUS_RECEIVE"."HANDLE"                          IS '主键';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_STATUS_RECEIVE"."SITE"                            IS '站点';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_STATUS_RECEIVE"."RESRCE"                          IS '设备编号';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_STATUS_RECEIVE"."STATUS"                          IS '当前状态';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_STATUS_RECEIVE"."DATE_TIME"                       IS '当前状态获取时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_STATUS_RECEIVE"."CHANGE_STATUS"                   IS '接收的状态';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_STATUS_RECEIVE"."CHANGE_DATE_TIME"                IS '接收时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_STATUS_RECEIVE"."INTERVAL_TIME"                   IS '间隔时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_STATUS_RECEIVE"."CREATE_USER"                     IS '创建人';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_STATUS_RECEIVE"."CREATED_DATE_TIME"               IS '创建时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_STATUS_RECEIVE"."MODIFY_USER"                     IS '修改人';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_STATUS_RECEIVE"."MODIFIED_DATE_TIME"              IS '修改时间';
COMMENT ON TABLE  "WIP"."Z_RESOURCE_STATUS_RECEIVE"                                   IS '设备状态表-接口';
COMMIT;

--设备故障接口
CREATE TABLE "Z_RESOURCE_FAULT_RECEIVE"(
    HANDLE                    NVARCHAR2(412) NOT NULL,
    SITE                      NVARCHAR2(6)  ,
    RESRCE                    NVARCHAR2(36) ,
    FAULT_CODE                NVARCHAR2(36) ,
    FAULT_DATE                DATE          ,
    CREATE_USER               NVARCHAR2(30)  NOT NULL,
    CREATED_DATE_TIME         DATE           NOT NULL,
    MODIFY_USER               NVARCHAR2(30)  ,
    MODIFIED_DATE_TIME        DATE     			 ,
    PRIMARY KEY ("HANDLE")
);

COMMENT ON COLUMN "WIP"."Z_RESOURCE_FAULT_RECEIVE"."HANDLE"                          IS '主键';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_FAULT_RECEIVE"."SITE"                            IS '站点';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_FAULT_RECEIVE"."RESRCE"                          IS '设备编号';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_FAULT_RECEIVE"."FAULT_CODE"                      IS '设备故障编码';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_FAULT_RECEIVE"."FAULT_DATE"                      IS '故障接收时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_FAULT_RECEIVE"."CREATE_USER"                     IS '创建人';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_FAULT_RECEIVE"."CREATED_DATE_TIME"               IS '创建时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_FAULT_RECEIVE"."MODIFY_USER"                     IS '修改人';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_FAULT_RECEIVE"."MODIFIED_DATE_TIME"              IS '修改时间';
COMMENT ON TABLE  "WIP"."Z_RESOURCE_FAULT_RECEIVE"                                   IS '设备故障信息接收表-接口';
COMMIT;

--设备数据收集接口
CREATE TABLE "Z_EDC_DATA_RESOURCE_NO"(
    HANDLE                        NVARCHAR2(412) NOT NULL,
    SITE                          NVARCHAR2(6)   ,
    RESRCE                        NVARCHAR2(36)  ,
    SEND_DATE                     DATE           ,

    S1                            NVARCHAR2(128) ,
    N1                            NUMBER(38,2)   ,
    D1                            DATE           ,

    PARAM                         NVARCHAR2(128) ,
    PARAM_VALUE                   NVARCHAR2(500) ,
    PARAM_DATE                    DATE           ,

    CREATE_USER                   NVARCHAR2(30)  NOT NULL,
    CREATED_DATE_TIME             DATE           NOT NULL,
    MODIFY_USER                   NVARCHAR2(30)  ,
    MODIFIED_DATE_TIME            DATE     			 ,
    PRIMARY KEY ("HANDLE")
);

COMMENT ON COLUMN "WIP"."Z_RESOURCE_PARAM_RECEIVE"."HANDLE"                 IS '主键';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_PARAM_RECEIVE"."SITE"                   IS '备注';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_PARAM_RECEIVE"."RESRCE"                 IS '设备编号';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_PARAM_RECEIVE"."RARAM_NODE"             IS '数据接收时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_PARAM_RECEIVE"."PARAM"                  IS '参数名称';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_PARAM_RECEIVE"."PARAM_VALUE"            IS '参数值';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_PARAM_RECEIVE"."PARAM_DATE"             IS '参数时间';

COMMENT ON COLUMN "WIP"."Z_RESOURCE_PARAM_RECEIVE"."CREATE_USER"            IS '创建人';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_PARAM_RECEIVE"."CREATED_DATE_TIME"      IS '创建时间';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_PARAM_RECEIVE"."MODIFY_USER"            IS '修改人';
COMMENT ON COLUMN "WIP"."Z_RESOURCE_PARAM_RECEIVE"."MODIFIED_DATE_TIME"     IS '修改时间';
COMMENT ON TABLE  "WIP"."Z_RESOURCE_PARAM_RECEIVE"                          IS '设备参数接收表-接口';
COMMIT;

CREATE TABLE "WIP"."Z_EDC_DATA_RESOURCE_NO"
(
"HANDLE"               NVARCHAR2(412) NOT NULL,
"SITE"                 NVARCHAR2(6)    ,
"RESRCE"               NVARCHAR2(412)  ,
"DC_GROUP_BO"          NVARCHAR2(412)  ,
"DATE_TIME"            DATE            ,
"CREATED_DATE_TIME"    DATE            ,
"CREATE_USER"          NVARCHAR2(30)   ,
"S1"                   NVARCHAR2(100),
"S2"                   NVARCHAR2(100),
"S3"                   NVARCHAR2(100),
"S4"                   NVARCHAR2(100),
"S5"                   NVARCHAR2(100),
"S6"                   NVARCHAR2(100),
"S7"                   NVARCHAR2(100),
"S8"                   NVARCHAR2(100),
"S9"                   NVARCHAR2(100),
"S10"                  NVARCHAR2(100),
"S11"                  NVARCHAR2(100),
"S12"                  NVARCHAR2(100),
"S13"                  NVARCHAR2(100),
"S14"                  NVARCHAR2(100),
"S15"                  NVARCHAR2(100),
"S16"                  NVARCHAR2(100),
"S17"                  NVARCHAR2(100),
"S18"                  NVARCHAR2(100),
"S19"                  NVARCHAR2(100),
"S20"                  NVARCHAR2(100),
"S21"                  NVARCHAR2(100),
"S22"                  NVARCHAR2(100),
"S23"                  NVARCHAR2(100),
"S24"                  NVARCHAR2(100),
"S25"                  NVARCHAR2(100),
"S26"                  NVARCHAR2(100),
"S27"                  NVARCHAR2(100),
"S28"                  NVARCHAR2(100),
"S29"                  NVARCHAR2(100),
"S30"                  NVARCHAR2(100),
"N1"                   NUMBER(38,6),
"N2"                   NUMBER(38,6),
"N3"                   NUMBER(38,6),
"N4"                   NUMBER(38,6),
"N5"                   NUMBER(38,6),
"N6"                   NUMBER(38,6),
"N7"                   NUMBER(38,6),
"N8"                   NUMBER(38,6),
"N9"                   NUMBER(38,6),
"N10"                  NUMBER(38,6),
"N11"                  NUMBER(38,6),
"N12"                  NUMBER(38,6),
"N13"                  NUMBER(38,6),
"N14"                  NUMBER(38,6),
"N15"                  NUMBER(38,6),
"N16"                  NUMBER(38,6),
"N17"                  NUMBER(38,6),
"N18"                  NUMBER(38,6),
"N19"                  NUMBER(38,6),
"N20"                  NUMBER(38,6),
"N21"                  NUMBER(38,6),
"N22"                  NUMBER(38,6),
"N23"                  NUMBER(38,6),
"N24"                  NUMBER(38,6),
"N25"                  NUMBER(38,6),
"N26"                  NUMBER(38,6),
"N27"                  NUMBER(38,6),
"N28"                  NUMBER(38,6),
"N29"                  NUMBER(38,6),
"N30"                  NUMBER(38,6),
PRIMARY KEY ("HANDLE")
);

--刀具维护
CREATE TABLE "Z_TOOL" (
    HANDLE                    NVARCHAR2(412) NOT NULL,
    SITE                      NVARCHAR2(6)  ,
    TOOL                      NVARCHAR2(36) ,
    DESCRIPTION               NVARCHAR2(36) ,
    STATUS                    NVARCHAR2(16) ,
    TOOL_TYPE                 NVARCHAR2(36) ,
    SPECIFICATION             NVARCHAR2(36) ,
    BRAND                     NVARCHAR2(128) ,
    REMARK                    NVARCHAR2(500) ,
    CREATE_USER               NVARCHAR2(30)  NOT NULL,
    CREATED_DATE_TIME         DATE           NOT NULL,
    MODIFY_USER               NVARCHAR2(30)  ,
    MODIFIED_DATE_TIME        DATE     			 ,
    PRIMARY KEY ("HANDLE")
);

COMMENT ON COLUMN "WIP"."Z_TOOL"."HANDLE"                 IS '主键';
COMMENT ON COLUMN "WIP"."Z_TOOL"."SITE"                   IS '站点';
COMMENT ON COLUMN "WIP"."Z_TOOL"."TOOL"                   IS '工具具编号';
COMMENT ON COLUMN "WIP"."Z_TOOL"."DESCRIPTION"            IS '描述';
COMMENT ON COLUMN "WIP"."Z_TOOL"."STATUS"                 IS '状态';
COMMENT ON COLUMN "WIP"."Z_TOOL"."TOOL_TYPE"              IS '类型';
COMMENT ON COLUMN "WIP"."Z_TOOL"."SPECIFICATION"          IS '规格';
COMMENT ON COLUMN "WIP"."Z_TOOL"."BRAND"                  IS '品牌';
COMMENT ON COLUMN "WIP"."Z_TOOL"."REMARK"                 IS '备注';
COMMENT ON COLUMN "WIP"."Z_TOOL"."CREATE_USER"            IS '创建人';
COMMENT ON COLUMN "WIP"."Z_TOOL"."CREATED_DATE_TIME"      IS '创建时间';
COMMENT ON COLUMN "WIP"."Z_TOOL"."MODIFY_USER"            IS '修改人';
COMMENT ON COLUMN "WIP"."Z_TOOL"."MODIFIED_DATE_TIME"     IS '修改时间';
COMMENT ON TABLE  "WIP"."Z_TOOL"                          IS '工具表';
COMMIT;


