/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\MDS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MDS_SAFESTK_ENTITY') 
 CREATE TABLE T_MDS_SAFESTK_ENTITY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FQTYS DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDATENODE NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MDS_SAFETYSTOCK') 
 CREATE TABLE T_MDS_SAFETYSTOCK (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL,
FSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FCREATEORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FCTRLSTRATEGY NVARCHAR(30) DEFAULT ' ' NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FUNIT BIGINT DEFAULT 0 NOT NULL,
FSAFTYTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSAFETYRATS DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSAFETYSOURCE BIGINT DEFAULT 0 NOT NULL,
FMON0 DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMON1 DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMON2 DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMON3 DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMON4 DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMON5 DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMON6 DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMON7 DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMON8 DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMON9 DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMON10 DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMON11 DECIMAL(23,10) DEFAULT 0 NOT NULL
);


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


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


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



/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\MDS_table.sql **/
