/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\MAL_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MAL_EAFSERVENTRY') 
 CREATE TABLE T_MAL_EAFSERVENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSKU VARCHAR(50) DEFAULT ' ' NOT NULL,
FGOODSID BIGINT DEFAULT 0 NOT NULL,
FRETURNQTY DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MAL_EAFSERVICE') 
 CREATE TABLE T_MAL_EAFSERVICE (
FID BIGINT DEFAULT 0 NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FENABLE CHAR(1) DEFAULT ' ' NOT NULL,
FAPPLYDATE DATETIME,
FORDERID VARCHAR(50) DEFAULT ' ' NOT NULL,
FRETURNTYPE VARCHAR(10) DEFAULT ' ' NOT NULL,
FPICKWARETYPE VARCHAR(10) DEFAULT ' ' NOT NULL,
FAFSSERVICESTEP VARCHAR(255) DEFAULT ' ' NOT NULL,
FAFSSERVICESTEPDATE DATETIME,
FRETURNCONTACT VARCHAR(50) DEFAULT ' ' NOT NULL,
FRETURNPHONE VARCHAR(50) DEFAULT ' ' NOT NULL,
FRETURNADDRESS VARCHAR(255) DEFAULT ' ' NOT NULL,
FRETURNAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCANCELSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FSOURCE CHAR(1) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MAL_EAFSERVICE_L') 
 CREATE TABLE T_MAL_EAFSERVICE_L (
FPKID VARCHAR(36) 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_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MAL_EAFSERVICE' AND KSQL_COL_NAME ='FMODIFIERID') 
 ALTER TABLE T_MAL_EAFSERVICE ADD (FMODIFIERID BIGINT DEFAULT 0 NOT NULL );





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