/**BEGIN D:\K3CLOUD\PDM_UPGRADE\PDM1\MDS_TABLE.SQL **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_ORNEEDPLAN') 
 CREATE TABLE T_MSPLAN_ORNEEDPLAN (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO VARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLSTATUS VARCHAR(5) 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,
FORGID BIGINT DEFAULT 0 NOT NULL,
FBILLTYPE BIGINT DEFAULT 0 NOT NULL,
FMODEL BIGINT DEFAULT 0 NOT NULL,
FCHECKTYPE BIGINT DEFAULT 0 NOT NULL,
FPROJECT BIGINT DEFAULT 0 NOT NULL,
FCUSTOMER BIGINT DEFAULT 0 NOT NULL,
FWORKCENTER BIGINT DEFAULT 0 NOT NULL,
FWORKSTATUS VARCHAR(5) DEFAULT ' ' NOT NULL,
FCLOSEDATE DATETIME,
FCLOSEOR BIGINT DEFAULT 0 NOT NULL,
FDATASOURCE VARCHAR(5) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_ORNEEDPLANENTRY') 
 CREATE TABLE T_MSPLAN_ORNEEDPLANENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSTART NVARCHAR(100) DEFAULT ' ' NOT NULL,
FEND NVARCHAR(100) DEFAULT ' ' NOT NULL,
FRESOURCE BIGINT DEFAULT 0 NOT NULL,
FSTIME DATETIME,
FFTIME DATETIME,
FQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNIT BIGINT DEFAULT 0 NOT NULL,
FKEY CHAR(1) DEFAULT '0' NOT NULL,
FCHOOSE CHAR(1) DEFAULT '0' NOT NULL,
FSTARTTASKID BIGINT DEFAULT 0 NOT NULL,
FENDTASKID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_EQXNEEDPLAN') 
 CREATE TABLE T_MSPLAN_EQXNEEDPLAN (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO VARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLSTATUS VARCHAR(5) 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,
FORGID BIGINT DEFAULT 0 NOT NULL,
FBILLTYPE BIGINT DEFAULT 0 NOT NULL,
FMODEL BIGINT DEFAULT 0 NOT NULL,
FCHECKTYPE BIGINT DEFAULT 0 NOT NULL,
FPROJECT BIGINT DEFAULT 0 NOT NULL,
FCUSTOMER BIGINT DEFAULT 0 NOT NULL,
FWORKCENTER BIGINT DEFAULT 0 NOT NULL,
FWORKSTATUS VARCHAR(5) DEFAULT ' ' NOT NULL,
FCLOSEDATE DATETIME,
FCLOSEOR BIGINT DEFAULT 0 NOT NULL,
FDATASOURCE VARCHAR(5) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_EQXNEEDPLANENTRY') 
 CREATE TABLE T_MSPLAN_EQXNEEDPLANENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSTART NVARCHAR(100) DEFAULT ' ' NOT NULL,
FEND NVARCHAR(100) DEFAULT ' ' NOT NULL,
FRESOURCE BIGINT DEFAULT 0 NOT NULL,
FSTIME DATETIME,
FFTIME DATETIME,
FQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNIT BIGINT DEFAULT 0 NOT NULL,
FKEY CHAR(1) DEFAULT '0' NOT NULL,
FCHOOSE CHAR(1) DEFAULT '0' NOT NULL,
FSTARTTASKID BIGINT DEFAULT 0 NOT NULL,
FENDTASKID BIGINT DEFAULT 0 NOT NULL,
FSRCBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
FSRCBILLID BIGINT DEFAULT 0 NOT NULL,
FSOURCEBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSOURCEBILLNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FSOURCEENTRYSEQ BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_TLNEEDPLAN') 
 CREATE TABLE T_MSPLAN_TLNEEDPLAN (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO VARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLSTATUS VARCHAR(5) 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,
FORGID BIGINT DEFAULT 0 NOT NULL,
FBILLTYPE BIGINT DEFAULT 0 NOT NULL,
FMODEL BIGINT DEFAULT 0 NOT NULL,
FCHECKTYPE BIGINT DEFAULT 0 NOT NULL,
FPROJECT BIGINT DEFAULT 0 NOT NULL,
FCUSTOMER BIGINT DEFAULT 0 NOT NULL,
FWORKCENTER BIGINT DEFAULT 0 NOT NULL,
FWORKSTATUS VARCHAR(5) DEFAULT ' ' NOT NULL,
FCLOSEDATE DATETIME,
FCLOSEOR BIGINT DEFAULT 0 NOT NULL,
FDATASOURCE VARCHAR(5) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_TLNEEDPLANENTRY') 
 CREATE TABLE T_MSPLAN_TLNEEDPLANENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSTART NVARCHAR(100) DEFAULT ' ' NOT NULL,
FEND NVARCHAR(100) DEFAULT ' ' NOT NULL,
FRESOURCE BIGINT DEFAULT 0 NOT NULL,
FSTIME DATETIME,
FFTIME DATETIME,
FQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNIT BIGINT DEFAULT 0 NOT NULL,
FKEY CHAR(1) DEFAULT '0' NOT NULL,
FCHOOSE CHAR(1) DEFAULT '0' NOT NULL,
FCARDNO BIGINT DEFAULT 0 NOT NULL,
FTOOLTYPE BIGINT DEFAULT 0 NOT NULL,
FSUPPLYMODE VARCHAR(50) DEFAULT ' ' NOT NULL,
FREPLACEGROUP NVARCHAR(100) DEFAULT ' ' NOT NULL,
FREPLACEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSHORTQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FRESULT VARCHAR(5) DEFAULT ' ' NOT NULL,
FSUPPYID BIGINT DEFAULT 0 NOT NULL,
FSUPPYIDTYPE VARCHAR(5) DEFAULT ' ' NOT NULL,
FSTARTTASKID BIGINT DEFAULT 0 NOT NULL,
FENDTASKID BIGINT DEFAULT 0 NOT NULL
);



/**END D:\K3CLOUD\PDM_UPGRADE\PDM1\MDS_TABLE.SQL **/
