--资源检查工具，增加相关实体表
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_CHECKRESOURCE') 
CREATE TABLE T_MSPLAN_CHECKRESOURCE (
	FID BIGINT DEFAULT 0 NOT NULL,
	FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
	FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
	FSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FCREATORID BIGINT DEFAULT 0 NOT NULL,
	FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
	FENABLE NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FCREATETIME DATETIME,
	FMODIFYTIME DATETIME,
	FMASTERID BIGINT DEFAULT 0 NOT NULL,
	FAUDITORID BIGINT DEFAULT 0 NOT NULL,
	FDISABLEUSERID BIGINT DEFAULT 0 NOT NULL,
	FENABLEUSERID BIGINT DEFAULT 0 NOT NULL,
	FAUDITTIME DATETIME,
	FDISABLETIME DATETIME,
	FENABLETIME DATETIME,
	FMAINENTITY NVARCHAR(36) DEFAULT ' ' NOT NULL,
	FSRCENTITY NVARCHAR(36) DEFAULT ' ' NOT NULL,
	FCHECKTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FCHECKRANGE NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FOPNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FERRCOUNTLIMIT BIGINT DEFAULT 0 NOT NULL,
	FCHECKLOGSAVEDAYS BIGINT DEFAULT 0 NOT NULL,
	FSQLEXECDB NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FTXTSQL NVARCHAR(255) DEFAULT ' ' NOT NULL,
	FTXTSQL_TAG NCLOB,
	FJAVAPLUGINCLASS NVARCHAR(255) DEFAULT ' ' NOT NULL,
	FJAVAFILTERRULE NVARCHAR(2000) DEFAULT ' ' NOT NULL,
	FJAVAFILTERRULEVALUE NVARCHAR(255) DEFAULT ' ' NOT NULL,
	FJAVAFILTERRULEVALUE_TAG NCLOB,
	FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL,
	FLASTCHECKER BIGINT DEFAULT 0 NOT NULL,
	FLASTCHECKTIME DATETIME,
	FLASTCHECKRESULT NVARCHAR(255) DEFAULT ' ' NOT NULL,
	FLASTCHECKRESULTID BIGINT DEFAULT 0 NOT NULL,
	FRESULTFIELDSETTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FISSYS CHAR(1) DEFAULT '0' NOT NULL,
	FRESULTENTITYNUMBER NVARCHAR(36) DEFAULT ' ' NOT NULL,
	FIDSETFIELDTAG NVARCHAR(80) DEFAULT ' ' NOT NULL,
	FISDEFAULT CHAR(1) DEFAULT '0' NOT NULL,
	FOPNAME NVARCHAR(255) DEFAULT ' ' NOT NULL
);

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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_CHECKFILTERENTRY') 
CREATE TABLE T_MSPLAN_CHECKFILTERENTRY (
	FID BIGINT DEFAULT 0 NOT NULL,
	FENTRYID BIGINT DEFAULT 0 NOT NULL,
	FSEQ BIGINT DEFAULT 0 NOT NULL,
	FFILTERENTITY NVARCHAR(36) DEFAULT ' ' NOT NULL,
	FFILTERRULE NVARCHAR(2000) DEFAULT ' ' NOT NULL,
	FFILTERRULEVALUE NVARCHAR(255) DEFAULT ' ' NOT NULL,
	FFILTERRULEVALUE_TAG NCLOB,
	FENTITYTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_CHECKMATCHENTRY') 
CREATE TABLE T_MSPLAN_CHECKMATCHENTRY (
	FID BIGINT DEFAULT 0 NOT NULL,
	FENTRYID BIGINT DEFAULT 0 NOT NULL,
	FSEQ BIGINT DEFAULT 0 NOT NULL,
	FENTRYTARGETENTITY NVARCHAR(36) DEFAULT ' ' NOT NULL,
	FTARGETFIELDNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
	FTARGETFIELDNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
	FCALCULATETEXT NVARCHAR(1000) DEFAULT ' ' NOT NULL,
	FCALCULATEEXC NVARCHAR(255) DEFAULT ' ' NOT NULL,
	FCALCULATEEXC_TAG NCLOB,
	FCONVERTTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FENTRYSRCENTITY NVARCHAR(36) DEFAULT ' ' NOT NULL,
	FSRCFIELDNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
	FSRCFIELDNAME NVARCHAR(255) DEFAULT ' ' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_CHECKLOGICENTRY') 
CREATE TABLE T_MSPLAN_CHECKLOGICENTRY (
	FID BIGINT DEFAULT 0 NOT NULL,
	FENTRYID BIGINT DEFAULT 0 NOT NULL,
	FSEQ BIGINT DEFAULT 0 NOT NULL,
	FLEFTCHAR NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FENTRYLEFTFIELDNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FENTRYLEFTFIELDNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
	FCONDITION NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FENTRYRIGHTFIELDNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FENTRYRIGHTFIELDNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
	FRIGHTCHAR NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FORAND NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FENTRYLEFTENTITY NVARCHAR(36) DEFAULT ' ' NOT NULL,
	FENTRYRIGHTENTITY NVARCHAR(36) DEFAULT ' ' NOT NULL,
	FENTRYLEFTENTITYTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FENTRYRIGHTENTITYTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_RESULTFIELDENTRY') 
CREATE TABLE T_MSPLAN_RESULTFIELDENTRY (
	FID BIGINT DEFAULT 0 NOT NULL,
	FENTRYID BIGINT DEFAULT 0 NOT NULL,
	FSEQ BIGINT DEFAULT 0 NOT NULL,
	FRESULTENTITYFLAG NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FRESULTFIELDFLAG NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FRESULTFIELDNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
	FRESULTCONVERTTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FRESULTSRCENTITYFLAG NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FRESULTSRCFIELDFLAG NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FRESULTSRCFIELDNAME NVARCHAR(200) DEFAULT ' ' NOT NULL,
	FRESULTCALCULATEEXC NVARCHAR(255) DEFAULT ' ' NOT NULL,
	FRESULTCALCULATEEXC_TAG NCLOB,
	FRESULTCALCULATETEXT NVARCHAR(1000) DEFAULT ' ' NOT NULL,
	FRESULTDATATYPE NVARCHAR(255) DEFAULT ' ' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_CHECKGROUPENTRY') 
CREATE TABLE T_MSPLAN_CHECKGROUPENTRY (
	FID BIGINT DEFAULT 0 NOT NULL,
	FENTRYID BIGINT DEFAULT 0 NOT NULL,
	FSEQ BIGINT DEFAULT 0 NOT NULL,
	FRESOURCECHECKITEMID BIGINT DEFAULT 0 NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_CHECKRESULT') 
CREATE TABLE T_MSPLAN_CHECKRESULT (
	FID BIGINT DEFAULT 0 NOT NULL,
	FBILLNO NVARCHAR(30) DEFAULT ' ' NOT NULL,
	FBILLSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FCREATORID BIGINT DEFAULT 0 NOT NULL,
	FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
	FAUDITORID BIGINT DEFAULT 0 NOT NULL,
	FAUDITDATE DATETIME,
	FMODIFYTIME DATETIME,
	FCREATETIME DATETIME,
	FRESOURCECHECK BIGINT DEFAULT 0 NOT NULL,
	FCOST DECIMAL(23,10) DEFAULT 0 NOT NULL, 
	FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL,
	FTAGID BIGINT DEFAULT 0 NOT NULL,
	FCHECKSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FEXECDATAS NVARCHAR(255) DEFAULT ' ' NOT NULL,
	FEXECDATAS_TAG NCLOB,
	FERRORMSG NVARCHAR(255) DEFAULT ' ' NOT NULL,
	FERRORMSG_TAG NCLOB,
	FERRORCOUNT BIGINT DEFAULT 0 NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_CHECKRESULTENTRY') 
CREATE TABLE T_MSPLAN_CHECKRESULTENTRY (
	FID BIGINT DEFAULT 0 NOT NULL,
	FENTRYID BIGINT DEFAULT 0 NOT NULL,
	FSEQ BIGINT DEFAULT 0 NOT NULL,
	FMODIFIERFIELD BIGINT DEFAULT 0 NOT NULL,
	FMODIFYDATEFIELD DATETIME,
	FBILLID BIGINT DEFAULT 0 NOT NULL,
	FBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
	FBIZBILLNO NVARCHAR(200) DEFAULT ' ' NOT NULL,
	FBIZORGID BIGINT DEFAULT 0 NOT NULL,
	FBIZMATERIALID BIGINT DEFAULT 0 NOT NULL,
	FBIZOTHERINFO NVARCHAR(2000) DEFAULT ' ' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_RESULTSUMENTRY') 
CREATE TABLE T_MSPLAN_RESULTSUMENTRY (
	FID BIGINT DEFAULT 0 NOT NULL,
	FENTRYID BIGINT DEFAULT 0 NOT NULL,
	FSEQ BIGINT DEFAULT 0 NOT NULL,
	FMODIFIERFIELD1 BIGINT DEFAULT 0 NOT NULL,
	FMODIFYDATEFIELD1 DATETIME,
	FDETIALITEMID BIGINT DEFAULT 0 NOT NULL,
	FDETIALITEMERRCOUNT BIGINT DEFAULT 0 NOT NULL,
	FDETIALITEMREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_SQLPARAM') 
CREATE TABLE T_MSPLAN_SQLPARAM (
	FID BIGINT DEFAULT 0 NOT NULL,
	FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL,
	FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
	FSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FCREATORID BIGINT DEFAULT 0 NOT NULL,
	FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
	FENABLE NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FCREATETIME DATETIME,
	FMODIFYTIME DATETIME,
	FMASTERID BIGINT DEFAULT 0 NOT NULL,
	FISSYS CHAR(1) DEFAULT '0' NOT NULL,
	FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL,
	FTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FPLUGINCLASS NVARCHAR(255) DEFAULT ' ' NOT NULL,
	FPARAMVALUE NVARCHAR(2000) DEFAULT ' ' NOT NULL
);

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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_RCPARAMSET')
CREATE TABLE T_MSPLAN_RCPARAMSET (
	FID BIGINT DEFAULT 0 NOT NULL,
	FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL,
	FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
	FSTATUS NVARCHAR(255) DEFAULT ' ' NOT NULL,
	FCREATORID BIGINT DEFAULT 0 NOT NULL,
	FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
	FENABLE NVARCHAR(255) DEFAULT ' ' NOT NULL,
	FCREATETIME DATETIME,
	FMODIFYTIME DATETIME,
	FMASTERID BIGINT DEFAULT 0 NOT NULL,
	FISBATCHCOMPUTE CHAR(1) DEFAULT '0' NOT NULL,
	FEXECQUEUE NVARCHAR(255) DEFAULT ' ' NOT NULL
	
);
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_RCPARAMSET_L')
CREATE TABLE T_MSPLAN_RCPARAMSET_L (
	FPKID NVARCHAR(36) DEFAULT ' ' NOT NULL,
	FID BIGINT DEFAULT 0 NOT NULL,
	FLOCALEID NVARCHAR(10) DEFAULT ' ' NOT NULL,
	FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL
	
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_BIZBILLRESULT')
CREATE TABLE T_MSPLAN_BIZBILLRESULT (
	FID BIGINT DEFAULT 0 NOT NULL,
	FBILLNO NVARCHAR(30) DEFAULT ' ' NOT NULL,
	FBILLSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FCREATORID BIGINT DEFAULT 0 NOT NULL,
	FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
	FAUDITORID BIGINT DEFAULT 0 NOT NULL,
	FAUDITDATE DATETIME,
	FMODIFYTIME DATETIME,
	FCREATETIME DATETIME,
	FBIZBILLID BIGINT DEFAULT 0 NOT NULL,
	FBIZIDTAG NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FBIZENTITY NVARCHAR(36) DEFAULT ' ' NOT NULL,
	FTAGID BIGINT DEFAULT 0 NOT NULL,
	FCHECKRESULT NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FBIZBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
	FBIZORGID BIGINT DEFAULT 0 NOT NULL,
	FBIZMATERIALID BIGINT DEFAULT 0 NOT NULL,
	FCHECKREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
	
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_BIZBILLCHKENTRY')
CREATE TABLE T_MSPLAN_BIZBILLCHKENTRY (
	FID BIGINT DEFAULT 0 NOT NULL,
	FENTRYID BIGINT DEFAULT 0 NOT NULL,
	FSEQ BIGINT DEFAULT 0 NOT NULL,
	FMODIFIERFIELD BIGINT DEFAULT 0 NOT NULL,
	FMODIFYDATEFIELD DATETIME,
	FENTRYRESOURCECHECKID BIGINT DEFAULT 0 NOT NULL,
	FENTRYCHECKRESULT NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FENTRYRESULTBILLID BIGINT DEFAULT 0 NOT NULL,
	FENTRYRESULTBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL
);

