IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_MROORDERENTRY_S') 
CREATE TABLE T_POM_MROORDERENTRY_S (
	FID BIGINT DEFAULT 0 NOT NULL,
	FENTRYID BIGINT DEFAULT 0 NOT NULL,
	FPARENTENTRYID BIGINT DEFAULT 0 NOT NULL,
	FPLANDEPTCONTROLNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FPARTNO BIGINT DEFAULT 0 NOT NULL,
	FPARTQTY DECIMAL(23,10) DEFAULT 0 NOT NULL ,
	FPARTNOUNIT BIGINT DEFAULT 0 NOT NULL,
	FCUSTOMERORDERNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FORDERDATE DATETIME NULL,
	FCOMPLETEDATE DATETIME NULL,
	FWORKDEPT BIGINT DEFAULT 0 NOT NULL,
	FNEEDTIME DECIMAL(23,10) DEFAULT 0 NOT NULL ,
	FUNITFIELD BIGINT DEFAULT 0 NOT NULL,
	FJOBREQUIREMENT NVARCHAR(50) DEFAULT ' ' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_MROORDER_S_E') 
CREATE TABLE T_POM_MROORDER_S_E (
	FID BIGINT DEFAULT 0 NOT NULL,
	FENTRYID BIGINT DEFAULT 0 NOT NULL,
	FSEQ  BIGINT DEFAULT 0 NOT NULL,
	FWORKMEASURES NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FWORKER BIGINT DEFAULT 0 NOT NULL,
	FDATE DATETIME NULL,
	FPAGE BIGINT DEFAULT 0 NOT NULL,
	FPAGETOTAL BIGINT DEFAULT 0 NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_MROORDERENTRY_P') 
CREATE TABLE T_POM_MROORDERENTRY_P (
	FID BIGINT DEFAULT 0 NOT NULL,
	FENTRYID BIGINT DEFAULT 0 NOT NULL,
	FPARENTENTRYID BIGINT DEFAULT 0 NOT NULL,
	FPLANDEPTCONTROLNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FPARTNO BIGINT DEFAULT 0 NOT NULL,
	FPARTQTY DECIMAL(23,10) DEFAULT 0 NOT NULL ,
	FPARTNOUNIT BIGINT DEFAULT 0 NOT NULL,
	FCUSTOMERORDERNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FORDERDATE DATETIME NULL,
	FCOMPLETEDATE DATETIME NULL,
	FWORKDEPT BIGINT DEFAULT 0 NOT NULL,
	FNEEDTIME DECIMAL(23,10) DEFAULT 0 NOT NULL ,
	FUNITFIELD BIGINT DEFAULT 0 NOT NULL,
	FJOBREQUIREMENT NVARCHAR(50) DEFAULT ' ' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_MROORDER_P_E') 
CREATE TABLE T_POM_MROORDER_P_E (
	FID BIGINT DEFAULT 0 NOT NULL,
	FENTRYID BIGINT DEFAULT 0 NOT NULL,
	FSEQ  BIGINT DEFAULT 0 NOT NULL,
	FWORKMEASURES NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FWORKER BIGINT DEFAULT 0 NOT NULL,
	FDATE DATETIME NULL,
	FPAGE BIGINT DEFAULT 0 NOT NULL,
	FPAGETOTAL BIGINT DEFAULT 0 NOT NULL
);
