-- 新增入库库存状态表
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_INVSTATUSENTRY') 
 CREATE TABLE T_IM_INVSTATUSENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FINVSTATUSID BIGINT DEFAULT 0 NOT NULL,
FISDEFAULT CHAR(1) DEFAULT '0' NOT NULL,
FINVSTATUSISPRESET CHAR(1) DEFAULT '0' NOT NULL
);

-- 新增出库库存状态表
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_OUTINVSTATUSENTRY') 
 CREATE TABLE T_IM_OUTINVSTATUSENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FOUTINVSTATUSID BIGINT DEFAULT 0 NOT NULL,
FISDEFAULT CHAR(1) DEFAULT '0' NOT NULL,
FOUTINVSTATUSISPRESET CHAR(1) DEFAULT '0' NOT NULL
);

-- 入库库存类型添加是否系统预设字段
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVTYPEENTRY' AND KSQL_COL_NAME ='FINVTYPEISPRESET') 
 ALTER TABLE T_IM_INVTYPEENTRY ADD (FINVTYPEISPRESET CHAR(1) DEFAULT '0' NOT NULL );
 
 -- 出库库存类型添加是否系统预设字段 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_OUTINVTYPEENTRY' AND KSQL_COL_NAME ='FOUTINVTYPEISPRESET') 
 ALTER TABLE T_IM_OUTINVTYPEENTRY ADD (FOUTINVTYPEISPRESET CHAR(1) DEFAULT '0' NOT NULL );
 
-- 业务类型添加是否系统预设字段
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_BIZTYPEENTRY' AND KSQL_COL_NAME ='FBIZTYPEISPRESET') 
 ALTER TABLE T_IM_BIZTYPEENTRY ADD (FBIZTYPEISPRESET CHAR(1) DEFAULT '0' NOT NULL );
