/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\MRP_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_PLANDISPATCH_L') 
 CREATE TABLE T_MRP_PLANDISPATCH_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_COOP_PARAM') 
 CREATE TABLE T_MRP_COOP_PARAM (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(60) 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
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_COOP_PARAMENTRY') 
 CREATE TABLE T_MRP_COOP_PARAMENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FDEMANDORG BIGINT DEFAULT 0 NOT NULL,
FMATERIALATTR NVARCHAR(30) DEFAULT ' ' NOT NULL,
FIS_INNER_COOPERATE CHAR(1) DEFAULT '0' NOT NULL,
FIS_CREATE_ORDER CHAR(1) DEFAULT '0' NOT NULL
);



IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_PLANDISPATCH') 
 CREATE TABLE T_MRP_PLANDISPATCH (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(50) 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,
FFORECASTORGID BIGINT DEFAULT 0 NOT NULL,
FREQPLANNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FREQPLANNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FREQPLANID NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPLANORGID BIGINT DEFAULT 0 NOT NULL,
FPLANGRAMID BIGINT DEFAULT 0 NOT NULL,
FISLLC CHAR(1) DEFAULT '0' NOT NULL,
FISBOMCHECK CHAR(1) DEFAULT '0' NOT NULL,
FISALLOWDATEINPAST CHAR(1) DEFAULT '0' NOT NULL,
FREQPLANLOG BIGINT DEFAULT 0 NOT NULL,
FMRPLOG BIGINT DEFAULT 0 NOT NULL,
FRUNSTATUS CHAR(1) DEFAULT '0' NOT NULL,
FREQPLANRUNSTATUS CHAR(1) DEFAULT '0' NOT NULL,
FFORECASTRUNSTATUS CHAR(1) DEFAULT '0' NOT NULL,
FMRPRUNSTATUS CHAR(1) DEFAULT '0' NOT NULL,
FMRPEXP NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FFORECASTLOG NVARCHAR(255) DEFAULT ' ' NOT NULL,
FISRELEASE CHAR(1) DEFAULT '0' NOT NULL,
FDAYSOFWEEK NVARCHAR(255) DEFAULT ' ' NOT NULL,
FDAYSOFMON NVARCHAR(255) DEFAULT ' ' NOT NULL,
FRUNNINGTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FREPEATTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FLOSEDATE DATETIME,
FPREDTIME BIGINT DEFAULT 0 NOT NULL,
FREPEAT CHAR(1) DEFAULT '0' NOT NULL,
FJOBID NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPLANID NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPLAN NVARCHAR(255) DEFAULT ' ' NOT NULL
);



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