/**Begin D:\PDM_UPGRADE\PDM1\POM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_MDC_SHDIFSHAREDETAIL') 
 CREATE TABLE T_IM_MDC_SHDIFSHAREDETAIL (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSHORDERNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSHORDERENTRYID BIGINT DEFAULT 0 NOT NULL,
FSHMATERIAL BIGINT DEFAULT 0 NOT NULL,
FSHQTYTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSHAUXPTY BIGINT DEFAULT 0 NOT NULL,
FSHISBACKFLUSH NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSHWAREHOUSE BIGINT DEFAULT 0 NOT NULL,
FSHLOCATION2 BIGINT DEFAULT 0 NOT NULL,
FSHMVERSION BIGINT DEFAULT 0 NOT NULL,
FSHLOTNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSHINVTYPE BIGINT DEFAULT 0 NOT NULL,
FSHINVSTATUS BIGINT DEFAULT 0 NOT NULL,
FSHOWNERTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSHOWNER BIGINT DEFAULT 0 NOT NULL,
FSHPRODUCEDATE DATETIME,
FSHEXPIRYDATE DATETIME,
FSHKEEPERTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSHKEEPER BIGINT DEFAULT 0 NOT NULL,
FSHBASEUNIT BIGINT DEFAULT 0 NOT NULL,
FPICKBASENUM DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMADEBASENUM DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSHAREBASENUM DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINVUNIT BIGINT DEFAULT 0 NOT NULL,
FSHARENUM DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTSHAREBASENUM DECIMAL(23,10) DEFAULT 0 NOT NULL,
FASSIGNNUM DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTSHARENUM DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSHDIFFSHAREID BIGINT DEFAULT 0 NOT NULL,
FDIFFSHAREREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL,
FDIFFSHAREREMARK_TAG NCLOB,
FASSIGNREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL,
FASSIGNREMARK_TAG NCLOB,
FSTOCKID BIGINT DEFAULT 0 NOT NULL,
FSTOCKENTRYID BIGINT DEFAULT 0 NOT NULL,
FSHSTOCKNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSHDIFFSHARENO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FASSIGNSTAUTS NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_MDC_MFTBACKDIFSHARE') 
 CREATE TABLE T_IM_MDC_MFTBACKDIFSHARE (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FORDMATERIAL BIGINT DEFAULT 0 NOT NULL,
FORDERUNIT BIGINT DEFAULT 0 NOT NULL,
FORDERNUM DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBASENUM DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINBASENUM DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTEXTFIELD NVARCHAR(50) DEFAULT ' ' NOT NULL,
FORDERENTRYID BIGINT DEFAULT 0 NOT NULL,
FORDERBASEUNIT BIGINT DEFAULT 0 NOT NULL,
FDIFSHARE1 CHAR(1) DEFAULT '0' NOT NULL,
FORDERNO NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_MDC_INVBACKDIFSHARE') 
 CREATE TABLE T_IM_MDC_INVBACKDIFSHARE (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FQTYFIELD5 DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCANSENDQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FACTISSUEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FLOTNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FLOCATIONID BIGINT DEFAULT 0 NOT NULL,
FMVERSION BIGINT DEFAULT 0 NOT NULL,
FOUTINVSTATUSID BIGINT DEFAULT 0 NOT NULL,
FOUTOWNERTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOUTOWNERID BIGINT DEFAULT 0 NOT NULL,
FOUTKEEPERTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOUTKEEPERID BIGINT DEFAULT 0 NOT NULL,
FEXPIRYDATE DATETIME,
FPRODUCEDATE DATETIME,
FINVDATENUM DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNITFIELD BIGINT DEFAULT 0 NOT NULL,
FINVENTORY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FINVACCNUM DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDIFNUM DECIMAL(23,10) DEFAULT 0 NOT NULL,
FWAITSHARENUM DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDIFSHARE CHAR(1) DEFAULT '0' NOT NULL,
FWAREHOUSE BIGINT DEFAULT 0 NOT NULL,
FINVTYPE BIGINT DEFAULT 0 NOT NULL,
FINVSTATUSID BIGINT DEFAULT 0 NOT NULL,
FOWNERTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOWNERID BIGINT DEFAULT 0 NOT NULL,
FKEEPERTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FKEEPERID BIGINT DEFAULT 0 NOT NULL,
FAUXPTYID BIGINT DEFAULT 0 NOT NULL,
FISADD CHAR(1) DEFAULT '0' NOT NULL,
FISCHANGE CHAR(1) DEFAULT '0' NOT NULL,
FMATERIELMASTERID BIGINT DEFAULT 0 NOT NULL,
FASSIGNNUM DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSHARESTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FASSIGNSTAUTS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FMATERIAL BIGINT DEFAULT 0 NOT NULL,
FLOCATION2 BIGINT DEFAULT 0 NOT NULL,
FINVSTATUS BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_MDC_DIFSHARELOGENTRY') 
 CREATE TABLE T_IM_MDC_DIFSHARELOGENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FDIFFSHAREF7 BIGINT DEFAULT 0 NOT NULL,
FSHAREDETAIL NVARCHAR(50) DEFAULT ' ' NOT NULL,
FASSIGNDETAIL NVARCHAR(50) DEFAULT ' ' NOT NULL
);


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


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_MDC_BACKDIFSHARE') 
 CREATE TABLE T_IM_MDC_BACKDIFSHARE (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(50) 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,
FORGID BIGINT DEFAULT 0 NOT NULL,
FINVORG BIGINT DEFAULT 0 NOT NULL,
FMFTDEPT BIGINT DEFAULT 0 NOT NULL,
FBASEDATAFIELD BIGINT DEFAULT 0 NOT NULL,
FINDATESTART DATETIME,
FINDATEEND DATETIME,
FINVDATE DATETIME,
FREMARK NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPRODUCEDEPT BIGINT DEFAULT 0 NOT NULL,
FEMATERIAL BIGINT DEFAULT 0 NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FISSHARE CHAR(1) DEFAULT '0' NOT NULL,
FISASSAGIN CHAR(1) DEFAULT '0' NOT NULL
);



/**End D:\PDM_UPGRADE\PDM1\POM_table.sql **/
