--任务
alter table UR_TASK add    IS_AUTO_CALC         VARCHAR2(1)                    default '0';
alter table UR_TASK add    CALC_TIME_TYPE       VARCHAR2(1)                    default '0';
alter table UR_TASK add    DAYS_OFFSET          INTEGER                        default 0;
alter table UR_TASK add    CALC_START_TIME      VARCHAR2(8);
alter table UR_TASK add    LAST_CALC_PERD_CODE  VARCHAR2(30);
alter table UR_TASK add    LAST_CALC_STATUS     VARCHAR2(1)                    default '0';
alter table UR_TASK add    CALC_TYPE            VARCHAR2(1)                    default '0';
alter table UR_TASK add    FIRST_PERD_CODE      VARCHAR2(30);

create table UR_TASK_CALC_ERR_LOG  (
   TASK_ID              VARCHAR2(36)                     not null,
   PERD_CODE            VARCHAR2(30)                     not null,
   DW_ID                VARCHAR2(36)                     not null,
   TRUNC_ID             VARCHAR2(36)                     not null,
   PROJ_ID              VARCHAR2(36)                     not null,
   RPT_ID               VARCHAR2(36)                     not null,
   constraint PK_UR_TASK_CALC_ERR_LOG primary key (TASK_ID, PERD_CODE, DW_ID, TRUNC_ID, PROJ_ID, RPT_ID)
);

--电子档案
create table UR_SYS_ARCHIVE  (
   ARCH_ID              VARCHAR2(36)                     not null,
   ARCH_CODE            VARCHAR2(60),
   ARCH_NAME            VARCHAR2(255),
   ARCH_TYPE            VARCHAR2(30),
   ARCH_DATE            VARCHAR2(10),
   END_DATE             VARCHAR2(10),
   COME_DATE            VARCHAR2(10),
   CRT_ARCH_YEAR        VARCHAR2(4),
   SRC_ADDR             VARCHAR2(255),
   DOC_NO               VARCHAR2(120),
   DUTY_MAN             VARCHAR2(60),
   PAGE_COUNT           INTEGER,
   CRT_DOC_DATE         VARCHAR2(10),
   LIMIT_TYPE           VARCHAR2(30),
   KEY_WORDS            VARCHAR2(120),
   ORG                  VARCHAR2(120),
   REASON               VARCHAR2(255),
   ARCH_COUNT           INTEGER,
   SECU_CLASS           VARCHAR2(30),
   IS_PUB_PORTAL        VARCHAR2(1)                    default '0',
   constraint PK_UR_SYS_ARCHIVE primary key (ARCH_ID)
);

create index IDX_UR_SYS_ARCHIVE_LB on UR_SYS_ARCHIVE (
   ARCH_TYPE ASC
);

create index IDX_UR_SYS_ARCHIVE_WORDS on UR_SYS_ARCHIVE (
   KEY_WORDS ASC
);


create table UR_SYS_ARCHIVE_FILE  (
   ARCH_ID              VARCHAR2(36)                     not null,
   FILE_ID              VARCHAR2(36)                     not null,
   SEQ_NO               INTEGER                        default 0,
   constraint PK_UR_SYS_ARCHIVE_FILE primary key (ARCH_ID, FILE_ID)
);

--菜单



--栏目配置
Insert into ur_sys_base_col_set
   (fld_id, inf_type, seq_no, fld_code, idx_code, fld_name, is_ext_fld, data_type, data_len, dict_id, is_not_null, is_valid, is_man_filter)
 Values
   ('A_ARCH_CODE', 'A', 1, 'ARCH_CODE', 'ARCH_CODE', 
    '档案编号', '0', 'C', 60, NULL, 
    '1', '1', '0');
Insert into ur_sys_base_col_set
   (fld_id, inf_type, seq_no, fld_code, idx_code, fld_name, is_ext_fld, data_type, data_len, dict_id, is_not_null, is_valid, is_man_filter)
 Values
   ('A_ARCH_NAME', 'A', 2, 'ARCH_NAME', 'ARCH_NAME', 
    '档案题名', '0', 'C', 255, NULL, 
    '1', '1', '0');
Insert into ur_sys_base_col_set
   (fld_id, inf_type, seq_no, fld_code, idx_code, fld_name, is_ext_fld, data_type, data_len, dict_id, is_not_null, is_valid, is_man_filter)
 Values
   ('A_ARCH_TYPE', 'A', 3, 'ARCH_TYPE', 'ARCH_TYPE', 
    '档案类别', '0', 'E', 30, 'SYS_ARCH_TYPE', 
    '1', '1', '0');
Insert into ur_sys_base_col_set
   (fld_id, inf_type, seq_no, fld_code, idx_code, fld_name, is_ext_fld, data_type, data_len, dict_id, is_not_null, is_valid, is_man_filter)
 Values
   ('A_ARCH_DATE', 'A', 4, 'ARCH_DATE', 'ARCH_DATE', 
    '归档日期', '0', 'D', 10, NULL, 
    '0', '1', '0');
Insert into ur_sys_base_col_set
   (fld_id, inf_type, seq_no, fld_code, idx_code, fld_name, is_ext_fld, data_type, data_len, dict_id, is_not_null, is_valid, is_man_filter)
 Values
   ('A_END_DATE', 'A', 5, 'END_DATE', 'END_DATE', 
    '失效日期', '0', 'D', 10, NULL, 
    '0', '1', '0');
Insert into ur_sys_base_col_set
   (fld_id, inf_type, seq_no, fld_code, idx_code, fld_name, is_ext_fld, data_type, data_len, dict_id, is_not_null, is_valid, is_man_filter)
 Values
   ('A_COME_DATE', 'A', 6, 'COME_DATE', 'COME_DATE', 
    '来文日期', '0', 'D', 10, NULL, 
    '0', '1', '0');
Insert into ur_sys_base_col_set
   (fld_id, inf_type, seq_no, fld_code, idx_code, fld_name, is_ext_fld, data_type, data_len, dict_id, is_not_null, is_valid, is_man_filter)
 Values
   ('A_CRT_ARCH_YEAR', 'A', 7, 'CRT_ARCH_YEAR', 'CRT_ARCH_YEAR', 
    '立卷年度', '0', 'C', 4, NULL, 
    '0', '1', '0');
Insert into ur_sys_base_col_set
   (fld_id, inf_type, seq_no, fld_code, idx_code, fld_name, is_ext_fld, data_type, data_len, dict_id, is_not_null, is_valid, is_man_filter)
 Values
   ('A_SRC_ADDR', 'A', 8, 'SRC_ADDR', 'SRC_ADDR', 
    '原文地址', '0', 'C', 255, NULL, 
    '0', '1', '0');
Insert into ur_sys_base_col_set
   (fld_id, inf_type, seq_no, fld_code, idx_code, fld_name, is_ext_fld, data_type, data_len, dict_id, is_not_null, is_valid, is_man_filter)
 Values
   ('A_DOC_NO', 'A', 9, 'DOC_NO', 'DOC_NO', 
    '文号', '0', 'C', 120, NULL, 
    '0', '1', '0');
Insert into ur_sys_base_col_set
   (fld_id, inf_type, seq_no, fld_code, idx_code, fld_name, is_ext_fld, data_type, data_len, dict_id, is_not_null, is_valid, is_man_filter)
 Values
   ('A_DUTY_MAN', 'A', 10, 'DUTY_MAN', 'DUTY_MAN', 
    '责任人', '0', 'C', 60, NULL, 
    '0', '1', '0');
Insert into ur_sys_base_col_set
   (fld_id, inf_type, seq_no, fld_code, idx_code, fld_name, is_ext_fld, data_type, data_len, dict_id, is_not_null, is_valid, is_man_filter)
 Values
   ('A_PAGE_COUNT', 'A', 11, 'PAGE_COUNT', 'PAGE_COUNT', 
    '页数', '0', 'N', 20, NULL, 
    '0', '1', '0');
Insert into ur_sys_base_col_set
   (fld_id, inf_type, seq_no, fld_code, idx_code, fld_name, is_ext_fld, data_type, data_len, dict_id, is_not_null, is_valid, is_man_filter)
 Values
   ('A_CRT_DOC_DATE', 'A', 12, 'CRT_DOC_DATE', 'CRT_DOC_DATE', 
    '成文时间', '0', 'D', 10, NULL, 
    '0', '1', '0');
Insert into ur_sys_base_col_set
   (fld_id, inf_type, seq_no, fld_code, idx_code, fld_name, is_ext_fld, data_type, data_len, dict_id, is_not_null, is_valid, is_man_filter)
 Values
   ('A_LIMIT_TYPE', 'A', 13, 'LIMIT_TYPE', 'LIMIT_TYPE', 
    '期限', '0', 'C', 30, NULL, 
    '0', '1', '0');
Insert into ur_sys_base_col_set
   (fld_id, inf_type, seq_no, fld_code, idx_code, fld_name, is_ext_fld, data_type, data_len, dict_id, is_not_null, is_valid, is_man_filter)
 Values
   ('A_KEY_WORDS', 'A', 14, 'KEY_WORDS', 'KEY_WORDS', 
    '主题词', '0', 'C', 120, NULL, 
    '0', '1', '0');
Insert into ur_sys_base_col_set
   (fld_id, inf_type, seq_no, fld_code, idx_code, fld_name, is_ext_fld, data_type, data_len, dict_id, is_not_null, is_valid, is_man_filter)
 Values
   ('A_ORG', 'A', 15, 'ORG', 'ORG', 
    '机构', '0', 'C', 120, NULL, 
    '0', '1', '0');
Insert into ur_sys_base_col_set
   (fld_id, inf_type, seq_no, fld_code, idx_code, fld_name, is_ext_fld, data_type, data_len, dict_id, is_not_null, is_valid, is_man_filter)
 Values
   ('A_REASON', 'A', 16, 'REASON', 'REASON', 
    '事由', '0', 'C', 255, NULL, 
    '0', '1', '0');
Insert into ur_sys_base_col_set
   (fld_id, inf_type, seq_no, fld_code, idx_code, fld_name, is_ext_fld, data_type, data_len, dict_id, is_not_null, is_valid, is_man_filter)
 Values
   ('A_ARCH_COUNT', 'A', 17, 'ARCH_COUNT', 'ARCH_COUNT', 
    '份数', '0', 'N', 20, NULL, 
    '0', '1', '0');
Insert into ur_sys_base_col_set
   (fld_id, inf_type, seq_no, fld_code, idx_code, fld_name, is_ext_fld, data_type, data_len, dict_id, is_not_null, is_valid, is_man_filter)
 Values
   ('A_SECU_CLASS', 'A', 18, 'SECU_CLASS', 'SECU_CLASS', 
    '密级', '0', 'E', 30, 'SYS_SECU_CLASS', 
    '0', '1', '0');

--枚举
Insert into ur_sys_dict
   (ver_id, dict_id, dw_id, dict_code, dict_name, code_struct, mark, is_fix_len, is_sel_end, is_sel_multi, can_extend, is_used, is_sys)
 Values
   ('*', 'SYS_ARCH_TYPE', '*', 'SYS_ARCH_TYPE', '档案类别', 
    '2', NULL, '0', '1', '0', 
    '0', '1', '1');
Insert into ur_sys_dict
   (ver_id, dict_id, dw_id, dict_code, dict_name, code_struct, mark, is_fix_len, is_sel_end, is_sel_multi, can_extend, is_used, is_sys)
 Values
   ('*', 'SYS_SECU_CLASS', '*', 'SYS_SECU_CLASS', '密级', 
    '1', NULL, '1', '1', '0', 
    '0', '1', '1');
