IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_DECUMENTS_DATAFIX') 
 CREATE TABLE T_MRP_DECUMENTS_DATAFIX (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FMODIFIERFIELD BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATEFIELD DATETIME,
FMATERIAL BIGINT DEFAULT 0 NOT NULL,
FMATERIALNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FMODELNUM NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSUPPLYORG BIGINT DEFAULT 0 NOT NULL,
FDEMANDMODEL NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOPERATOR BIGINT DEFAULT 0 NOT NULL,
FRELEASESTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FRELEASEUSER BIGINT DEFAULT 0 NOT NULL,
FRELEASETIME DATETIME,
FISCOMMITMENT NVARCHAR(50) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL,
FGOODPRODINVQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDEFPRODINVQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FNONSTANDARDQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTOTALQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FENTRY_MODIFYTIME DATETIME
); 


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_DECUMENTS_DATAS') 
 CREATE TABLE T_MRP_DECUMENTS_DATAS (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(30) 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,
FPLANID NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_DECUMENTS_DATASUB') 
 CREATE TABLE T_MRP_DECUMENTS_DATASUB (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FDETAILID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FSEQUENCE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFIELDKEY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFIELDVALUE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFIELDCAPTION NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_PRODUCTION_DATAFIX') 
 CREATE TABLE T_MRP_PRODUCTION_DATAFIX (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FMODIFIERFIELD BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATEFIELD DATETIME,
FSUPPLYORG BIGINT DEFAULT 0 NOT NULL,
FMANUFACTURE BIGINT DEFAULT 0 NOT NULL,
FOPERATOR BIGINT DEFAULT 0 NOT NULL,
FACQSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FACQUSER BIGINT DEFAULT 0 NOT NULL,
FMODIFIER BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FREMARK NVARCHAR(50) DEFAULT ' ' NOT NULL,
FQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FOFFERINGNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOFFERINGNAME NVARCHAR(250) DEFAULT ' ' NOT NULL,
FOFFERINGID BIGINT DEFAULT 0 NOT NULL,
FACQTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_PRODUCTION_DATAS') 
 CREATE TABLE T_MRP_PRODUCTION_DATAS (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(30) 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,
FPLANID NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_PRODUCTION_DATASUB') 
 CREATE TABLE T_MRP_PRODUCTION_DATASUB (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FDETAILID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FSEQUENCE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFIELDKEY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFIELDVALUE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFIELDCAPTION NVARCHAR(50) DEFAULT ' ' NOT NULL
);
