/**Begin D:\k3Cloud\PDM_UPGRADE\PDM1\MDS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MDS_STOCK_CABIN') 
 CREATE TABLE T_MDS_STOCK_CABIN (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


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


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


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MDS_STOCKRANEENTITY') 
 CREATE TABLE T_MDS_STOCKRANEENTITY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FISUSE CHAR(1) DEFAULT '0' NOT NULL,
FMRTYPE BIGINT DEFAULT 0 NOT NULL,
FENTRYCREATOR BIGINT DEFAULT 0 NOT NULL,
FENTRYMODIFIER BIGINT DEFAULT 0 NOT NULL,
FENTRYCREATETIME DATETIME,
FENTRYMODIFYTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MDS_STOCKRANGEDEF') 
 CREATE TABLE T_MDS_STOCKRANGEDEF (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENABLE VARCHAR(5) DEFAULT '0' NOT NULL,
FSTATUS VARCHAR(5) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FCTRLSTRATEGY VARCHAR(50) DEFAULT ' ' NOT NULL,
FPROVISIONMODE VARCHAR(5) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCREATEORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSOURCEDATAID BIGINT DEFAULT 0 NOT NULL,
FBITINDEX BIGINT DEFAULT 0 NOT NULL,
FSOURCEBITINDEX BIGINT DEFAULT 0 NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MDS_STOCKRANGEDEF_L') 
 CREATE TABLE T_MDS_STOCKRANGEDEF_L (
FPKID VARCHAR(36) 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_MDS_STOCKSTATUS') 
 CREATE TABLE T_MDS_STOCKSTATUS (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(80) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(5) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(5) DEFAULT '0' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL,
FISPRESET CHAR(1) DEFAULT '0' NOT NULL,
FCTRLSTRATEGY VARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATEORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSOURCEDATAID BIGINT DEFAULT 0 NOT NULL,
FBITINDEX BIGINT DEFAULT 0 NOT NULL,
FSOURCEBITINDEX BIGINT DEFAULT 0 NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL
);


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



/**End D:\k3Cloud\PDM_UPGRADE\PDM1\MDS_table.sql **/
