/**Begin D:\PDM_UPGRADE\PDM1\HDM_table.sql **/
--该表已经不用了,在kd_1.5.142_hdm_transfertable.sql脚本中已经drop该表,但是环境上不知道为什么还是执行出问题了,因此在此处直接注释
--IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_NEWROLEREL')
-- CREATE TABLE T_HDM_NEWROLEREL (
--FENTRYID BIGINT DEFAULT 0 NOT NULL,
--FID BIGINT DEFAULT 0 NOT NULL,
--FBASEDATAID BIGINT DEFAULT 0 NOT NULL,
--FSEQ INT DEFAULT 0 NOT NULL,
--FISCONPOS CHAR(1) DEFAULT '0' NOT NULL
--);

--该表已经不用了,在kd_1.5.142_hdm_transfertable.sql脚本中已经drop该表,但是环境上不知道为什么还是执行出问题了,因此在此处直接注释
--IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_OLDROLEREL')
--CREATE TABLE T_HDM_OLDROLEREL (
--FENTRYID BIGINT DEFAULT 0 NOT NULL,
--FID BIGINT DEFAULT 0 NOT NULL,
--FBASEDATAID BIGINT DEFAULT 0 NOT NULL,
--FSEQ INT DEFAULT 0 NOT NULL
--);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_TRANSFERBILL') 
 CREATE TABLE T_HDM_TRANSFERBILL (
FID BIGINT DEFAULT 0 NOT NULL,
FMID BIGINT DEFAULT 0 NOT NULL,
FBILLNO VARCHAR(60) DEFAULT ' ' NOT NULL,
FRBILLNO VARCHAR(60) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FISEXISTSWORKFLOW CHAR(1) DEFAULT ' ' NOT NULL,
FISSUBMIT CHAR(1) DEFAULT ' ' NOT NULL,
FBARCODE VARCHAR(60) DEFAULT ' ' NOT NULL,
FINPUTDEVICETYPE VARCHAR(100) DEFAULT ' ' NOT NULL,
FEVENTEFFECTDATE DATETIME,
FBILLSTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FAUDITSTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FTRANSFERSTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FTRANSFERINSTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FTRANSFEROUTSTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FHANDOVERSTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FISINTERNATIONALTRANSFER CHAR(1) DEFAULT ' ' NOT NULL,
FWORKFLOWFLAG VARCHAR(2) DEFAULT ' ' NOT NULL,
FTRANSFERTYPE VARCHAR(2) DEFAULT ' ' NOT NULL,
FTRANSFERCLASSIFY VARCHAR(2) DEFAULT ' ' NOT NULL,
FTRANSFERREASONID BIGINT DEFAULT 0 NOT NULL,
FORIGINATOR VARCHAR(2) DEFAULT ' ' NOT NULL,
FTRANSFERSTAGE VARCHAR(2) DEFAULT ' ' NOT NULL,
FEFFECTDATE DATETIME,
FTERMINATIONTYPE VARCHAR(2) DEFAULT ' ' NOT NULL,
FTERMINATIONREASONID BIGINT DEFAULT 0 NOT NULL,
FTERMINATIONPERSONID BIGINT DEFAULT 0 NOT NULL,
FTERMINATIONTIME DATETIME,
FCONFIRMPERSONID BIGINT DEFAULT 0 NOT NULL,
FCONFIRMTIME DATETIME,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FTERMINATIONDESC NVARCHAR(255) DEFAULT ' ' NOT NULL,
FERMANFILEIFID BIGINT DEFAULT 0 NOT NULL,
FAFFRECORDID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_TRANSFERBILL_A') 
 CREATE TABLE T_HDM_TRANSFERBILL_A (
FID BIGINT DEFAULT 0 NOT NULL,
FBCOUNTRYID BIGINT DEFAULT 0 NOT NULL,
FBCOMPANYID BIGINT DEFAULT 0 NOT NULL,
FBCOMPANYHISID BIGINT DEFAULT 0 NOT NULL,
FBORGID BIGINT DEFAULT 0 NOT NULL,
FBORGHISID BIGINT DEFAULT 0 NOT NULL,
FBORGLONGHISID BIGINT DEFAULT 0 NOT NULL,
FBPOSITIONID BIGINT DEFAULT 0 NOT NULL,
FBPOSITIONHISID BIGINT DEFAULT 0 NOT NULL,
FBSTPOSITIONID BIGINT DEFAULT 0 NOT NULL,
FBSTPOSITIONHISID BIGINT DEFAULT 0 NOT NULL,
FBBASELOCATIONID BIGINT DEFAULT 0 NOT NULL,
FAPLANCOUNTRYID BIGINT DEFAULT 0 NOT NULL,
FAPLANCOMPANYID BIGINT DEFAULT 0 NOT NULL,
FAPLANCOMPANYHISID BIGINT DEFAULT 0 NOT NULL,
FAPLANORGID BIGINT DEFAULT 0 NOT NULL,
FAPLANORGHISID BIGINT DEFAULT 0 NOT NULL,
FAPLANORGLONGHISID BIGINT DEFAULT 0 NOT NULL,
FAPLANPOSITIONID BIGINT DEFAULT 0 NOT NULL,
FAPLANPOSITIONHISID BIGINT DEFAULT 0 NOT NULL,
FAPLANSTPOSITIONID BIGINT DEFAULT 0 NOT NULL,
FAPLANSTPOSITIONHISID BIGINT DEFAULT 0 NOT NULL,
FAPLANBASELOCATIONID BIGINT DEFAULT 0 NOT NULL,
FACOUNTRYID BIGINT DEFAULT 0 NOT NULL,
FACOMPANYID BIGINT DEFAULT 0 NOT NULL,
FACOMPANYHISID BIGINT DEFAULT 0 NOT NULL,
FAORGID BIGINT DEFAULT 0 NOT NULL,
FAORGHISID BIGINT DEFAULT 0 NOT NULL,
FAORGLONGHISID BIGINT DEFAULT 0 NOT NULL,
FAPOSITIONID BIGINT DEFAULT 0 NOT NULL,
FAPOSITIONHISID BIGINT DEFAULT 0 NOT NULL,
FASTPOSITIONID BIGINT DEFAULT 0 NOT NULL,
FASTPOSITIONHISID BIGINT DEFAULT 0 NOT NULL,
FABASELOCATIONID BIGINT DEFAULT 0 NOT NULL,
FAREALITYCOUNTRYID BIGINT DEFAULT 0 NOT NULL,
FAREALITYCOMPANYID BIGINT DEFAULT 0 NOT NULL,
FAREALITYCOMPANYHISID BIGINT DEFAULT 0 NOT NULL,
FAREALITYORGID BIGINT DEFAULT 0 NOT NULL,
FAREALITYORGHISID BIGINT DEFAULT 0 NOT NULL,
FAREALITYORGLONGHISID BIGINT DEFAULT 0 NOT NULL,
FAREALITYPOSITIONID BIGINT DEFAULT 0 NOT NULL,
FAREALITYPOSITIONHISID BIGINT DEFAULT 0 NOT NULL,
FAREALITYSTPOSITIONID BIGINT DEFAULT 0 NOT NULL,
FAREALITYSTPOSITIONHISID BIGINT DEFAULT 0 NOT NULL,
FAREALITYBASELOCATIONID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_TRANSFERBILL_B') 
 CREATE TABLE T_HDM_TRANSFERBILL_B (
FID BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FBEMPLOYEEID BIGINT DEFAULT 0 NOT NULL,
FBDEPEMPID BIGINT DEFAULT 0 NOT NULL,
FBMANAGESCOPEID BIGINT DEFAULT 0 NOT NULL,
FBHRBUID BIGINT DEFAULT 0 NOT NULL,
FBEMPGROUPID BIGINT DEFAULT 0 NOT NULL,
FBAFFILIATEORGID BIGINT DEFAULT 0 NOT NULL,
FBAFFILIATEORGHISID BIGINT DEFAULT 0 NOT NULL,
FBAFFILIATEORGLONGHISID BIGINT DEFAULT 0 NOT NULL,
FAEMPLOYEEID BIGINT DEFAULT 0 NOT NULL,
FADEPEMPID BIGINT DEFAULT 0 NOT NULL,
FAMANAGESCOPEID BIGINT DEFAULT 0 NOT NULL,
FAHRBUID BIGINT DEFAULT 0 NOT NULL,
FAEMPGROUPID BIGINT DEFAULT 0 NOT NULL,
FAAFFILIATEORGID BIGINT DEFAULT 0 NOT NULL,
FAAFFILIATEORGHISID BIGINT DEFAULT 0 NOT NULL,
FAAFFILIATEORGLONGHISID BIGINT DEFAULT 0 NOT NULL,
FPLANDATE DATETIME,
FTRANSFERDATE DATETIME,
FREALITYDATE DATETIME,
FTRANSFEROUTLASTDATE DATETIME,
FTRANSFERINREGISTERDATE DATETIME,
FTIMEZONEID BIGINT DEFAULT 0 NOT NULL,
FPOSTYPEID BIGINT DEFAULT 0 NOT NULL,
FPOSSTATUSID BIGINT DEFAULT 0 NOT NULL,
FAFFACTIONID BIGINT DEFAULT 0 NOT NULL,
FLABORRELTYPEID BIGINT DEFAULT 0 NOT NULL,
FLABORRELSTATUS BIGINT DEFAULT 0 NOT NULL,
FBJOBID BIGINT DEFAULT 0 NOT NULL,
FBJOBCOMMITTEID BIGINT DEFAULT 0 NOT NULL,
FAJOBID BIGINT DEFAULT 0 NOT NULL,
FAJOBCOMMITTEEID BIGINT DEFAULT 0 NOT NULL,
FISMANAGECOMMISSION CHAR(1) DEFAULT ' ' NOT NULL,
FCOMMISSIONFILEDATE DATETIME,
FCOMMISSIONFILENUM VARCHAR(100) DEFAULT ' ' NOT NULL,
FISSECURITYKEYPOSITION CHAR(1) DEFAULT ' ' NOT NULL,
FSECURITYKEYPOSITIONID BIGINT DEFAULT 0 NOT NULL,
FAPLANHRID BIGINT DEFAULT 0 NOT NULL,
FAHRID BIGINT DEFAULT 0 NOT NULL,
FAREALITYHRID BIGINT DEFAULT 0 NOT NULL
);


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


--IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_TRANSFERBILL_C')
-- CREATE TABLE T_HDM_TRANSFERBILL_C (
-- FID BIGINT DEFAULT 0 NOT NULL,
-- FBCOMPANYHISNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
-- FBORGHISNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
-- FAPLANCOMPANYHISNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
-- FAPLANORGNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
-- FAREALITYCOMPANYHISNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
-- FAREALITYORGHISNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
-- FACOMPANYHISNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
-- FAORGHISNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
-- FBAFFILIATEORGHISNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
-- FAAFFILIATEORGHISNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
-- FBPOSITIONHISNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
-- FBSTPOSITIONHISNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
-- FAPOSITIONHISNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
-- FASTPOSITIONHISNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
-- FAPLANPOSITIONHISNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
-- FAPLANSTPOSITIONNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
-- FAREALITYPOSITIONHISNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
-- FAREALITYSTPOSITIONHIS VARCHAR(50) DEFAULT ' ' NOT NULL
-- );


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_TRANSFERREASON_L') 
 CREATE TABLE T_HDM_TRANSFERREASON_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_HDM_TRANSFERTERMREASON_L') 
 CREATE TABLE T_HDM_TRANSFERTERMREASON_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_HDM_TRANSREVOKEREASON_L') 
 CREATE TABLE T_HDM_TRANSREVOKEREASON_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_HDM_TRANSFERREASON') 
 CREATE TABLE T_HDM_TRANSFERREASON (
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,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' 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_HDM_TRANSFERTERMREASON') 
 CREATE TABLE T_HDM_TRANSFERTERMREASON (
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,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' 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_HDM_TRANSREVOKEREASON') 
 CREATE TABLE T_HDM_TRANSREVOKEREASON (
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,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' 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
);



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