/**Begin D:\PDM_UPGRADE\PDM1\HAOS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_ADMINSTRUCT_L') 
 CREATE TABLE T_HAOS_ADMINSTRUCT_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FFULLNAME NVARCHAR(1000) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_GROUP_L') 
 CREATE TABLE T_HAOS_GROUP_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FGROUPVISION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FGROUPLEADER NVARCHAR(100) DEFAULT ' ' NOT NULL,
FGROUPMISSION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_DEPARTMENT_L') 
 CREATE TABLE T_HAOS_DEPARTMENT_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FDEPTFUNCTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_COMPANY_L') 
 CREATE TABLE T_HAOS_COMPANY_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FCOMPANYNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FADDRESS NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBUSINESSSCOPE NVARCHAR(100) DEFAULT ' ' NOT NULL,
FLEGALPERSON NVARCHAR(100) DEFAULT ' ' NOT NULL,
FREGISTEREDADDRESS NVARCHAR(255) DEFAULT ' ' NOT NULL,
FREGISTEREDCAPITAL NVARCHAR(100) DEFAULT ' ' NOT NULL,
FREGISTEROFFICE NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_ADMINORG_L') 
 CREATE TABLE T_HAOS_ADMINORG_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FBUSINESSADDRESS NVARCHAR(255) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPOSITIONING NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FMAINDUTY NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FSAFEDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_ADMINORG_A') 
 CREATE TABLE T_HAOS_ADMINORG_A (
FID BIGINT DEFAULT 0 NOT NULL,
FWORKPLACEID BIGINT DEFAULT 0 NOT NULL,
FTOBEDISABLEFLAG VARCHAR(2) DEFAULT ' ' NOT NULL,
FTOBEDISABLEDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_ADMINORG') 
 CREATE TABLE T_HAOS_ADMINORG (
FID BIGINT DEFAULT 0 NOT NULL,
FSTRUCTNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FADMINORGTYPEID BIGINT DEFAULT 0 NOT NULL,
FADMINORGLAYERID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FESTABLISHMENTDATE DATETIME,
FCITYID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FENABLE VARCHAR(2) DEFAULT '10' NOT NULL,
FINDEX INT DEFAULT 999 NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FPARENTID BIGINT DEFAULT 0 NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FCOMPANYID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FBUSINESSADDRESS NVARCHAR(255) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBOID BIGINT DEFAULT 0 NOT NULL,
FISCURRENTVERSION VARCHAR(1) DEFAULT ' ' NOT NULL,
FBSED DATETIME,
FBSLED DATETIME,
FBRED DATETIME,
FBRLED DATETIME,
FDATASTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FSOURCEVID BIGINT DEFAULT 0 NOT NULL,
FISMODIFY VARCHAR(1) DEFAULT ' ' NOT NULL,
FFIRSTBSED DATETIME,
FCHANGEBSED DATETIME,
FADMINORGCLASSIFYID BIGINT DEFAULT 0 NOT NULL,
FADMINORGFUNCTIONID BIGINT DEFAULT 0 NOT NULL,
FPOSITIONING NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FMAINDUTY NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FSAFELEVELID BIGINT DEFAULT 0 NOT NULL,
FSAFETYPEID BIGINT DEFAULT 0 NOT NULL,
FDEPARTMENTID BIGINT DEFAULT 0 NOT NULL,
FSAFEDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCORPORATEORGID BIGINT DEFAULT 0 NOT NULL,
FCOMPANYAREAID BIGINT DEFAULT 0 NOT NULL,
FBRFD DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_DEPARTMENT') 
 CREATE TABLE T_HAOS_DEPARTMENT (
FID BIGINT DEFAULT 0 NOT NULL,
FADMINORGID BIGINT DEFAULT 0 NOT NULL,
FDEPARTMENTTYPEID BIGINT DEFAULT 0 NOT NULL,
FCOSTCENTERCODE VARCHAR(60) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FDEPTFUNCTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET VARCHAR(1) DEFAULT ' ' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FBOID BIGINT DEFAULT 0 NOT NULL,
FISCURRENTVERSION VARCHAR(1) DEFAULT ' ' NOT NULL,
FBSED DATETIME,
FBSLED DATETIME,
FBRED DATETIME,
FBRLED DATETIME,
FDATASTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FSOURCEVID BIGINT DEFAULT 0 NOT NULL,
FISMODIFY VARCHAR(1) DEFAULT ' ' NOT NULL,
FFIRSTBSED DATETIME,
FCHANGEBSED DATETIME,
FBRFD DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_GROUP') 
 CREATE TABLE T_HAOS_GROUP (
FID BIGINT DEFAULT 0 NOT NULL,
FADMINORGID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FGROUPVISION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FGROUPLEADER NVARCHAR(100) DEFAULT ' ' NOT NULL,
FGROUPMISSION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET VARCHAR(1) DEFAULT ' ' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FBOID BIGINT DEFAULT 0 NOT NULL,
FISCURRENTVERSION VARCHAR(1) DEFAULT ' ' NOT NULL,
FBSED DATETIME,
FBSLED DATETIME,
FBRED DATETIME,
FBRLED DATETIME,
FDATASTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FSOURCEVID BIGINT DEFAULT 0 NOT NULL,
FISMODIFY VARCHAR(1) DEFAULT ' ' NOT NULL,
FFIRSTBSED DATETIME,
FCHANGEBSED DATETIME,
FBRFD DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_COMPANY') 
 CREATE TABLE T_HAOS_COMPANY (
FID BIGINT DEFAULT 0 NOT NULL,
FADMINORGID BIGINT DEFAULT 0 NOT NULL,
FORGANIZATIONCODE VARCHAR(100) DEFAULT ' ' NOT NULL,
FISINCORPORATEDCOMPANY CHAR(1) DEFAULT ' ' NOT NULL,
FTAXREGNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FUNIFORMSOCIALCREDITCODE VARCHAR(100) DEFAULT ' ' NOT NULL,
FCONTACTPHONE VARCHAR(100) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FCOMPANYNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FADDRESS NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBUSINESSSCOPE NVARCHAR(100) DEFAULT ' ' NOT NULL,
FLEGALPERSON NVARCHAR(100) DEFAULT ' ' NOT NULL,
FREGISTEREDADDRESS NVARCHAR(255) DEFAULT ' ' NOT NULL,
FREGISTEREDCAPITAL NVARCHAR(100) DEFAULT ' ' NOT NULL,
FREGISTEROFFICE NVARCHAR(100) DEFAULT ' ' NOT NULL,
FINDUSTRYTYPEID BIGINT DEFAULT 0 NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET VARCHAR(1) DEFAULT ' ' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FBOID BIGINT DEFAULT 0 NOT NULL,
FISCURRENTVERSION VARCHAR(1) DEFAULT ' ' NOT NULL,
FBSED DATETIME,
FBSLED DATETIME,
FBRED DATETIME,
FBRLED DATETIME,
FDATASTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FSOURCEVID BIGINT DEFAULT 0 NOT NULL,
FISMODIFY VARCHAR(1) DEFAULT ' ' NOT NULL,
FFIRSTBSED DATETIME,
FCHANGEBSED DATETIME,
FCOMPANYTYPEID BIGINT DEFAULT 0 NOT NULL,
FBRFD DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_ADMINSTRUCT') 
 CREATE TABLE T_HAOS_ADMINSTRUCT (
FID BIGINT DEFAULT 0 NOT NULL,
FADMINORGID BIGINT DEFAULT 0 NOT NULL,
FPARENTID BIGINT DEFAULT 0 NOT NULL,
FSTRUCTLONGNUMBER VARCHAR(500) DEFAULT ' ' NOT NULL,
FLONGNUMBER VARCHAR(500) DEFAULT ' ' NOT NULL,
FISLEAF CHAR(1) DEFAULT '1' NOT NULL,
FLEVEL INT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FFULLNAME NVARCHAR(1000) DEFAULT ' ' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET VARCHAR(1) DEFAULT ' ' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FBOID BIGINT DEFAULT 0 NOT NULL,
FISCURRENTVERSION VARCHAR(1) DEFAULT ' ' NOT NULL,
FBSED DATETIME,
FBSLED DATETIME,
FBRED DATETIME,
FBRLED DATETIME,
FDATASTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FSOURCEVID BIGINT DEFAULT 0 NOT NULL,
FISMODIFY VARCHAR(1) DEFAULT ' ' NOT NULL,
FFIRSTBSED DATETIME,
FCHANGEBSED DATETIME,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT ' C' NOT NULL,
FBRFD DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_ADMINORGTYPE') 
 CREATE TABLE T_HAOS_ADMINORGTYPE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FADMINORGTYPESTDID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FORGPATTERNID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_ADMINORGTYPE_L') 
 CREATE TABLE T_HAOS_ADMINORGTYPE_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_ADMINORGTYPESTD') 
 CREATE TABLE T_HAOS_ADMINORGTYPESTD (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_ADMINORGTYPESTD_L') 
 CREATE TABLE T_HAOS_ADMINORGTYPESTD_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_SAFELEVEL') 
 CREATE TABLE T_HAOS_SAFELEVEL (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(10) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET VARCHAR(1) DEFAULT ' ' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_SAFELEVEL_L') 
 CREATE TABLE T_HAOS_SAFELEVEL_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_SAFETYPE') 
 CREATE TABLE T_HAOS_SAFETYPE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(10) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET VARCHAR(1) DEFAULT ' ' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_SAFETYPE_L') 
 CREATE TABLE T_HAOS_SAFETYPE_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_COMPANYTYPE') 
 CREATE TABLE T_HAOS_COMPANYTYPE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FINDEX BIGINT DEFAULT 0 NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_COMPANYTYPE_L') 
 CREATE TABLE T_HAOS_COMPANYTYPE_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_INDUSTRYTYPE') 
 CREATE TABLE T_HAOS_INDUSTRYTYPE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FINDEX BIGINT DEFAULT 0 NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_INDUSTRYTYPE_L') 
 CREATE TABLE T_HAOS_INDUSTRYTYPE_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_DEPARTMENTTYPE') 
 CREATE TABLE T_HAOS_DEPARTMENTTYPE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSYSDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_DEPARTMENTTYPE_L') 
 CREATE TABLE T_HAOS_DEPARTMENTTYPE_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSYSDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_ADMINORGCLASSIFY') 
 CREATE TABLE T_HAOS_ADMINORGCLASSIFY (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_ADMINORGCLASSIFY_L') 
 CREATE TABLE T_HAOS_ADMINORGCLASSIFY_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_ADMINORGFUNCTION') 
 CREATE TABLE T_HAOS_ADMINORGFUNCTION (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_ADMINORGFUNCTION_L') 
 CREATE TABLE T_HAOS_ADMINORGFUNCTION_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_ORGSORTCODE') 
 CREATE TABLE T_HAOS_ORGSORTCODE (
FID BIGINT DEFAULT 0 NOT NULL,
FADMINORGID BIGINT DEFAULT 0 NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FSORTCODE VARCHAR(500) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT ' C' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FISSYSPRESET VARCHAR(1) DEFAULT ' ' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FBOID BIGINT DEFAULT 0 NOT NULL,
FISCURRENTVERSION VARCHAR(1) DEFAULT ' ' NOT NULL,
FBSED DATETIME,
FBSLED DATETIME,
FBRED DATETIME,
FBRLED DATETIME,
FDATASTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FSOURCEVID BIGINT DEFAULT 0 NOT NULL,
FISMODIFY VARCHAR(1) DEFAULT ' ' NOT NULL,
FFIRSTBSED DATETIME,
FCHANGEBSED DATETIME,
FBRFD DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_ADMINORGLAYER') 
 CREATE TABLE T_HAOS_ADMINORGLAYER (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_ADMINORGLAYER_L') 
 CREATE TABLE T_HAOS_ADMINORGLAYER_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_BASEDATALIST') 
 CREATE TABLE T_HAOS_BASEDATALIST (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(10) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET VARCHAR(1) DEFAULT ' ' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FPAGEKEY VARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_BASEDATALIST_L') 
 CREATE TABLE T_HAOS_BASEDATALIST_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_ORGBUSINESSFILE') 
 CREATE TABLE T_HAOS_ORGBUSINESSFILE (
FID BIGINT DEFAULT 0 NOT NULL,
FADMINORGID BIGINT DEFAULT 0 NOT NULL,
FBUSSINESSFIELDID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET VARCHAR(1) DEFAULT ' ' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FBOID BIGINT DEFAULT 0 NOT NULL,
FISCURRENTVERSION VARCHAR(1) DEFAULT ' ' NOT NULL,
FBSED DATETIME,
FBSLED DATETIME,
FBRED DATETIME,
FBRLED DATETIME,
FDATASTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FSOURCEVID BIGINT DEFAULT 0 NOT NULL,
FISMODIFY VARCHAR(1) DEFAULT ' ' NOT NULL,
FFIRSTBSED DATETIME,
FCHANGEBSED DATETIME,
FBRFD DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_PROJTEAMSTRUCT_L') 
 CREATE TABLE T_HAOS_PROJTEAMSTRUCT_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FFULLNAME NVARCHAR(1000) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_PROJTEAMSTRUCT') 
 CREATE TABLE T_HAOS_PROJTEAMSTRUCT (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FLONGNUMBER VARCHAR(500) DEFAULT ' ' NOT NULL,
FLEVEL INT DEFAULT 0 NOT NULL,
FSORTCODE VARCHAR(500) DEFAULT ' ' NOT NULL,
FPARENTID BIGINT DEFAULT 0 NOT NULL,
FPROJTEAMID BIGINT DEFAULT 0 NOT NULL,
FISLEAF CHAR(1) DEFAULT '1' NOT NULL,
FCREATEORGID BIGINT DEFAULT 0 NOT NULL,
FSTRUCTLONGNUMBER VARCHAR(500) DEFAULT ' ' NOT NULL,
FFULLNAME NVARCHAR(1000) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FENABLE VARCHAR(2) DEFAULT '2' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FBOID BIGINT DEFAULT 0 NOT NULL,
FISCURRENTVERSION VARCHAR(1) DEFAULT ' ' NOT NULL,
FBSED DATETIME,
FBSLED DATETIME,
FDATASTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FSOURCEVID BIGINT DEFAULT 0 NOT NULL,
FFIRSTBSED DATETIME,
FCHANGEBSED DATETIME,
FISMODIFY VARCHAR(1) DEFAULT ' ' NOT NULL,
FBRED DATETIME,
FBRLED DATETIME,
FBRFD DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_PROJTEAMBASE_L') 
 CREATE TABLE T_HAOS_PROJTEAMBASE_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FDISCARDCOURSE NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_PROJTEAMBASE') 
 CREATE TABLE T_HAOS_PROJTEAMBASE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(2) DEFAULT '2' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FPROJECTNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FBOID BIGINT DEFAULT 0 NOT NULL,
FISCURRENTVERSION VARCHAR(1) DEFAULT ' ' NOT NULL,
FBSED DATETIME,
FBSLED DATETIME,
FDATASTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FSOURCEVID BIGINT DEFAULT 0 NOT NULL,
FFIRSTBSED DATETIME,
FCHANGEBSED DATETIME,
FISMODIFY VARCHAR(1) DEFAULT ' ' NOT NULL,
FBRED DATETIME,
FBRLED DATETIME,
FBRFD DATETIME,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FESTABLISHMENTDATE DATETIME,
FSTARTDATE DATETIME,
FCITYID BIGINT DEFAULT 0 NOT NULL,
FCOUNTRYID BIGINT DEFAULT 0 NOT NULL,
FDISBANDDATE DATETIME,
FSTRUCTNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FBELONGADMINORGID BIGINT DEFAULT 0 NOT NULL,
FDISCARDCOURSE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FWORKPLACEID BIGINT DEFAULT 0 NOT NULL,
FPARENTID BIGINT DEFAULT 0 NOT NULL,
FISROOT VARCHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_PROJSORTCODE') 
 CREATE TABLE T_HAOS_PROJSORTCODE (
FID BIGINT DEFAULT 0 NOT NULL,
FBOID BIGINT DEFAULT 0 NOT NULL,
FPROJTEAMID BIGINT DEFAULT 0 NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FSORTCODE VARCHAR(500) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FBSED DATETIME,
FBSLED DATETIME,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FENABLE VARCHAR(2) DEFAULT '2' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FISCURRENTVERSION VARCHAR(1) DEFAULT ' ' NOT NULL,
FDATASTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FSOURCEVID BIGINT DEFAULT 0 NOT NULL,
FFIRSTBSED DATETIME,
FCHANGEBSED DATETIME,
FISMODIFY VARCHAR(1) DEFAULT ' ' NOT NULL,
FBRED DATETIME,
FBRLED DATETIME,
FBRFD DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_ORGTEAM') 
 CREATE TABLE T_HAOS_ORGTEAM (
FID BIGINT DEFAULT 0 NOT NULL,
FTEAMTYPEID BIGINT DEFAULT 0 NOT NULL,
FORGTYPEID BIGINT DEFAULT 0 NOT NULL,
FOTCLASSIFY BIGINT DEFAULT 0 NOT NULL,
FSTRUCTNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FNUMBER VARCHAR(70) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET VARCHAR(1) DEFAULT ' ' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FBOID BIGINT DEFAULT 0 NOT NULL,
FISCURRENTVERSION VARCHAR(1) DEFAULT ' ' NOT NULL,
FBSED DATETIME,
FBSLED DATETIME,
FBRED DATETIME,
FBRLED DATETIME,
FDATASTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FSOURCEVID BIGINT DEFAULT 0 NOT NULL,
FISMODIFY VARCHAR(1) DEFAULT ' ' NOT NULL,
FFIRSTBSED DATETIME,
FCHANGEBSED DATETIME,
FBRFD DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_ORGTEAM_L') 
 CREATE TABLE T_HAOS_ORGTEAM_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_ORGTEAMSTRUCT') 
 CREATE TABLE T_HAOS_ORGTEAMSTRUCT (
FID BIGINT DEFAULT 0 NOT NULL,
FORGTEAMID BIGINT DEFAULT 0 NOT NULL,
FPARENTID BIGINT DEFAULT 0 NOT NULL,
FLEVEL INT DEFAULT 0 NOT NULL,
FISLEAF CHAR(1) DEFAULT '0' NOT NULL,
FSTRUCTLONGNUMBER VARCHAR(500) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FLONGNUMBER VARCHAR(500) DEFAULT ' ' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET VARCHAR(1) DEFAULT ' ' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FBOID BIGINT DEFAULT 0 NOT NULL,
FISCURRENTVERSION VARCHAR(1) DEFAULT ' ' NOT NULL,
FBSED DATETIME,
FBSLED DATETIME,
FBRED DATETIME,
FBRLED DATETIME,
FDATASTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FSOURCEVID BIGINT DEFAULT 0 NOT NULL,
FISMODIFY VARCHAR(1) DEFAULT ' ' NOT NULL,
FFIRSTBSED DATETIME,
FCHANGEBSED DATETIME,
FBRFD DATETIME,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT ' C' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_TEAMCOOPREL') 
 CREATE TABLE T_HAOS_TEAMCOOPREL (
FID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(2) DEFAULT '2' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FORGTYPE VARCHAR(2) DEFAULT '0' NOT NULL,
FCOOPRELTYPEID BIGINT DEFAULT 0 NOT NULL,
FCOOPORGTEAMID BIGINT DEFAULT 0 NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET VARCHAR(1) DEFAULT ' ' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FBOID BIGINT DEFAULT 0 NOT NULL,
FISCURRENTVERSION VARCHAR(1) DEFAULT ' ' NOT NULL,
FBSED DATETIME,
FBSLED DATETIME,
FBRED DATETIME,
FBRLED DATETIME,
FDATASTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FSOURCEVID BIGINT DEFAULT 0 NOT NULL,
FISMODIFY VARCHAR(1) DEFAULT ' ' NOT NULL,
FFIRSTBSED DATETIME,
FCHANGEBSED DATETIME,
FBRFD DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_OTEVENT') 
 CREATE TABLE T_HAOS_OTEVENT (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FEVENTTYPE VARCHAR(2) DEFAULT ' ' NOT NULL,
FEXECUTEWAY VARCHAR(2) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FEVENTBATCHTYPE VARCHAR(2) DEFAULT ' ' NOT NULL,
FCANCELEDEVENTID BIGINT DEFAULT 0 NOT NULL,
FOPERATEUSERID BIGINT DEFAULT 0 NOT NULL,
FOPERATEDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_OTBUSIEVENTREL') 
 CREATE TABLE T_HAOS_OTBUSIEVENTREL (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FOPERATEUSERID BIGINT DEFAULT 0 NOT NULL,
FOPERATEDATE DATETIME,
FSOURCEENTITY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBOID BIGINT DEFAULT 0 NOT NULL,
FISBUSINESSEVENTBO CHAR(1) DEFAULT ' ' NOT NULL,
FEVENTID BIGINT DEFAULT 0 NOT NULL,
FSTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FCANCELEDEVENTID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_OTEVENTRELHIS') 
 CREATE TABLE T_HAOS_OTEVENTRELHIS (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FVID BIGINT DEFAULT 0 NOT NULL,
FBUSIEVENTID BIGINT DEFAULT 0 NOT NULL,
FPRESTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FPREBSED DATETIME,
FPREBSLED DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_ORGCHANGETYPE') 
 CREATE TABLE T_HAOS_ORGCHANGETYPE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FOTCLASSIFY BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_ORGCHANGETYPE_L') 
 CREATE TABLE T_HAOS_ORGCHANGETYPE_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_ORGCHANGEREASON') 
 CREATE TABLE T_HAOS_ORGCHANGEREASON (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FOTCLASSIFY BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_ORGCHANGEREASON_L') 
 CREATE TABLE T_HAOS_ORGCHANGEREASON_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_OTCLASSIFY') 
 CREATE TABLE T_HAOS_OTCLASSIFY (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FTEAMTYPEID BIGINT DEFAULT 0 NOT NULL,
FORGTYPEID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_OTCLASSIFY_L') 
 CREATE TABLE T_HAOS_OTCLASSIFY_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_TEAMCOOPRELTYPE_L') 
 CREATE TABLE T_HAOS_TEAMCOOPRELTYPE_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_TEAMCOOPRELTYPE') 
 CREATE TABLE T_HAOS_TEAMCOOPRELTYPE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_COOPOTCLASSIFY') 
 CREATE TABLE T_HAOS_COOPOTCLASSIFY (
FPKID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_COMMBASEDATALIST') 
 CREATE TABLE T_HAOS_COMMBASEDATALIST (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(10) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET VARCHAR(1) DEFAULT ' ' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FPAGEKEY VARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_COMMBASEDATALIST_L') 
 CREATE TABLE T_HAOS_COMMBASEDATALIST_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);

-- 标识表
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_DELTAG') 
CREATE TABLE T_HAOS_DELTAG (
FID BIGINT DEFAULT 0 NOT NULL
);

/**End D:\PDM_UPGRADE\PDM1\HAOS_table.sql **/
