/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\POM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_MROSWS') 
 CREATE TABLE T_POM_MROSWS (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(30) 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,
FBILLTYPE BIGINT DEFAULT 0 NOT NULL,
FDATEFIELD DATETIME,
FREMARK NVARCHAR(512) DEFAULT ' ' NOT NULL,
FSORDERNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPROJECT BIGINT DEFAULT 0 NOT NULL,
FMATERIELMTC BIGINT DEFAULT 0 NOT NULL,
FWORKCARD BIGINT DEFAULT 0 NOT NULL,
FPRINTFORMAT NVARCHAR(50) DEFAULT ' ' NOT NULL,
FWORKHOURUNIT BIGINT DEFAULT 0 NOT NULL,
FPLANHOURS DECIMAL(23,10) DEFAULT 0 NOT NULL,
FATTACHMENTCOUNT BIGINT DEFAULT 0 NOT NULL,
FPRINTCOUNT BIGINT DEFAULT 0 NOT NULL,
FCARDUSER BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_PARTREPLACERECORD') 
 CREATE TABLE T_POM_PARTREPLACERECORD (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO VARCHAR(30) DEFAULT ' ' NOT NULL,
FBILLSTATUS VARCHAR(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,
FORDERNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FCUSTOMER BIGINT DEFAULT 0 NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_PARTREPLECEENTRY') 
 CREATE TABLE T_POM_PARTREPLECEENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FMODIFIERFIELD BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATEFIELD DATETIME,
FREPLEMATERALID BIGINT DEFAULT 0 NOT NULL,
FPARTDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPARTLOCATION VARCHAR(255) DEFAULT ' ' NOT NULL,
FREPLEACEDATE DATETIME,
FREPLESEQ VARCHAR(50) DEFAULT ' ' NOT NULL,
FUSESEQ VARCHAR(50) DEFAULT ' ' NOT NULL,
FREQMATERIALNUM VARCHAR(80) DEFAULT ' ' NOT NULL,
FPROMATERIALENTRYID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_PARTREPLECEENTRY_L') 
 CREATE TABLE T_POM_PARTREPLECEENTRY_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FPARTDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_MROSWSENTRY') 
 CREATE TABLE T_POM_MROSWSENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FMODIFIERFIELD BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATEFIELD DATETIME,
FORDERNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPROGROUP BIGINT DEFAULT 0 NOT NULL,
FPROFESSIONA BIGINT DEFAULT 0 NOT NULL,
FWORKDESC NVARCHAR(512) DEFAULT ' ' NOT NULL,
FREFMANUAL NVARCHAR(50) DEFAULT ' ' NOT NULL,
FMANUALCODE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FMANUALVERSION NVARCHAR(50) DEFAULT ' ' NOT NULL,
FWORKHOURS DECIMAL(23,10) DEFAULT 0 NOT NULL,
FENWORKHOURUNIT BIGINT DEFAULT 0 NOT NULL,
FRECHECK CHAR(1) DEFAULT '0' NOT NULL,
FISHELP CHAR(1) DEFAULT '0' NOT NULL,
FHELPUSER BIGINT DEFAULT 0 NOT NULL,
FHELPMANUAL NVARCHAR(50) DEFAULT ' ' NOT NULL,
FHELPHOURS DECIMAL(23,10) DEFAULT 0 NOT NULL,
FISEXISTORDER CHAR(1) DEFAULT '0' NOT NULL
);



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