
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_MULTIORGSUPDEM') 
 CREATE TABLE T_MRP_MULTIORGSUPDEM (
FID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' 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,
FSOURCEDATAID BIGINT DEFAULT 0 NOT NULL,
FBITINDEX INT DEFAULT 0 NOT NULL,
FSOURCEBITINDEX INT DEFAULT 0 NOT NULL
);


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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_NODEDETAILS') 
 CREATE TABLE T_MRP_NODEDETAILS (
FID BIGINT DEFAULT 0 NOT NULL,
FDEMANDORGID BIGINT DEFAULT 0 NOT NULL,
FSTOCKDEMANDORG BIGINT DEFAULT 0 NOT NULL,
FNODENUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSUPPLYORGGROUPTEXT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSUPPLYORGGROUPTEXT_TAG NCLOB,
FPARENTDNYID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENABLE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBODTIME INT DEFAULT 0 NOT NULL,
FSTOCKSETUP NVARCHAR(30) DEFAULT ' ' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_DEFAULTSUPPLY') 
 CREATE TABLE T_MRP_DEFAULTSUPPLY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FSUPPLYORGID BIGINT DEFAULT 0 NOT NULL,
FSUPPLYRATIO DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSUPPLYRULE NVARCHAR(30) DEFAULT ' ' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_SHOWENTITY') 
 CREATE TABLE T_MRP_SHOWENTITY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FSTORAGEORG BIGINT DEFAULT 0 NOT NULL,
FSTOCKSCALE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPRIORITY INT DEFAULT 0 NOT NULL,
FSTOCKNUMBER BIGINT DEFAULT 0 NOT NULL,
FSTOCKINDEX BIGINT DEFAULT 0 NOT NULL,
FSUPPLYPRIORITY INT DEFAULT 0 NOT NULL,
FWASTEWAREHOUSE CHAR(1) DEFAULT '0' NOT NULL,
FORGSETID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSTOCKSETUPENTRYENTITYID NVARCHAR(50) DEFAULT ' ' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_INVSTOCKTYPE') 
 CREATE TABLE T_MRP_INVSTOCKTYPE (
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_MRP_INVSTOCKSTATUS') 
 CREATE TABLE T_MRP_INVSTOCKSTATUS (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);
