
 

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FSINGLEQTY') 
 ALTER TABLE T_POM_DISTRIBPLANX ADD (FSINGLEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FBACKFLUSH') 
 ALTER TABLE T_POM_DISTRIBPLANX ADD (FBACKFLUSH VARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FRECEIVEDQTY') 
 ALTER TABLE T_POM_DISTRIBPLANX ADD (FRECEIVEDQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FMTFDELIVERYQTY') 
 ALTER TABLE T_POM_DISTRIBPLANX ADD (FMTFDELIVERYQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FBILLTYPE') 
 ALTER TABLE T_POM_DISTRIBPLANX ADD (FBILLTYPE BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FADJUSTATY') 
 ALTER TABLE T_POM_DISTRIBPLANX ADD (FADJUSTATY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FFOODCONVEYER') 
 ALTER TABLE T_POM_DISTRIBPLANX ADD (FFOODCONVEYER BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FSENDEDOUTQTY') 
 ALTER TABLE T_POM_DISTRIBPLANX ADD (FSENDEDOUTQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FDISTRTYPE') 
 ALTER TABLE T_POM_DISTRIBPLANX ADD (FDISTRTYPE BIGINT DEFAULT 0 NOT NULL );
 

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANXENT' AND KSQL_COL_NAME ='FRTIME') 
 ALTER TABLE T_POM_DISTRIBPLANXENT ADD (FRTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANXENT' AND KSQL_COL_NAME ='FENTRYRECEIVEDQTY') 
 ALTER TABLE T_POM_DISTRIBPLANXENT ADD (FENTRYRECEIVEDQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANXENT' AND KSQL_COL_NAME ='FENTRYMTFDELIVERYQTY') 
 ALTER TABLE T_POM_DISTRIBPLANXENT ADD (FENTRYMTFDELIVERYQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANXENT' AND KSQL_COL_NAME ='FSCHEDULESORTID') 
 ALTER TABLE T_POM_DISTRIBPLANXENT ADD (FSCHEDULESORTID NVARCHAR(80) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANXENT' AND KSQL_COL_NAME ='FSOURCEBILLTYPE') 
 ALTER TABLE T_POM_DISTRIBPLANXENT ADD (FSOURCEBILLTYPE BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANXENT' AND KSQL_COL_NAME ='FENTRYSENDEDOUTQTY') 
 ALTER TABLE T_POM_DISTRIBPLANXENT ADD (FENTRYSENDEDOUTQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );



--上线顺序号、 fonorderbillno
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FONORDERBILLNO')
 ALTER TABLE T_POM_DISTRIBPLANX ADD (FONORDERBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL );
--调出库存组织、 fcalloutorg
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FCALLOUTORG')
  ALTER TABLE T_POM_DISTRIBPLANX ADD (FCALLOUTORG BIGINT DEFAULT 0 NOT NULL );

--调出仓库、fcalloutwarehouse
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FCALLOUTWAREHOUSE')
  ALTER TABLE T_POM_DISTRIBPLANX ADD (FCALLOUTWAREHOUSE BIGINT DEFAULT 0 NOT NULL );

--调出仓位、 fcalloutstocklocat
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FCALLOUTSTOCKLOCAT')
    ALTER TABLE T_POM_DISTRIBPLANX ADD (FCALLOUTSTOCKLOCAT BIGINT DEFAULT 0 NOT NULL );

--生产事务类型  ftransactiontypeid
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FTRANSACTIONTYPEID')
    ALTER TABLE T_POM_DISTRIBPLANX ADD (FTRANSACTIONTYPEID BIGINT DEFAULT 0 NOT NULL );

--生产工单数量、fmftorderqty
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FMFTORDERQTY')
 ALTER TABLE T_POM_DISTRIBPLANX ADD (FMFTORDERQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );

 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANXENT' AND KSQL_COL_NAME ='FMFTSTOCKID')
  ALTER TABLE T_POM_DISTRIBPLANXENT ADD (FMFTSTOCKID NVARCHAR(80) DEFAULT ' ' NOT NULL );
 --组件清单分录ID
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANXENT' AND KSQL_COL_NAME ='FMFTSTOCKENTRYID')
  ALTER TABLE T_POM_DISTRIBPLANXENT ADD (FMFTSTOCKENTRYID NVARCHAR(80) DEFAULT ' ' NOT NULL );


 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FCONFIGID')
 ALTER TABLE T_POM_DISTRIBPLANX ADD (FCONFIGID  BIGINT DEFAULT 0 NOT NULL  );

  IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANXENT' AND KSQL_COL_NAME ='FENTRYCONFIGID')
  ALTER  TABLE T_POM_DISTRIBPLANXENT ADD (FENTRYCONFIGID  BIGINT DEFAULT 0 NOT NULL  );

    IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FLOGID')

    ALTER TABLE T_POM_DISTRIBPLANX ADD (FLOGID BIGINT DEFAULT 0 NOT NULL );


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FREMARK')
 ALTER TABLE T_POM_DISTRIBPLANX ADD (FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL);




--     FAUXPTY            BIGINT,
-- 	FLOT               BIGINT,
--     FSENDTIME          TIMESTAMP,
--     FDELIVERYCYCLE     BIGINT,
--     FBATCHNO           VARCHAR(50)     DEFAULT ' '::CHARACTER VARYING NOT NULL,
--     FSUPPLYOWNERTYPE   VARCHAR(50)     DEFAULT ' '::CHARACTER VARYING NOT NULL,
--     FSUPPLYOWNER       BIGINT,
--     FBUSINESSSTATUS    VARCHAR(50)     DEFAULT ' '::CHARACTER VARYING NOT NULL,
--     FBUSINESSMSG       VARCHAR(255)    DEFAULT ' '::CHARACTER VARYING NOT NULL


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FAUXPTY')
 ALTER TABLE T_POM_DISTRIBPLANX ADD (FAUXPTY BIGINT DEFAULT 0 NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FLOT')
 ALTER TABLE T_POM_DISTRIBPLANX ADD (FLOT BIGINT DEFAULT 0 NOT NULL );

 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FSENDTIME')
  ALTER TABLE T_POM_DISTRIBPLANX ADD (FSENDTIME DATETIME );

 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FDELIVERYCYCLE')
  ALTER TABLE T_POM_DISTRIBPLANX ADD (FDELIVERYCYCLE BIGINT DEFAULT 0 NOT NULL );

 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FBATCHNO')
  ALTER TABLE T_POM_DISTRIBPLANX ADD (FBATCHNO NVARCHAR(50) DEFAULT ' ' NOT NULL );

  IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FSUPPLYOWNERTYPE')
   ALTER TABLE T_POM_DISTRIBPLANX ADD (FSUPPLYOWNERTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL );

 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FSUPPLYOWNER')
  ALTER TABLE T_POM_DISTRIBPLANX ADD (FSUPPLYOWNER BIGINT DEFAULT 0 NOT NULL );

   IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FBUSINESSSTATUS')
    ALTER TABLE T_POM_DISTRIBPLANX ADD (FBUSINESSSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL );

  IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANX' AND KSQL_COL_NAME ='FBUSINESSMSG')
   ALTER TABLE T_POM_DISTRIBPLANX ADD (FBUSINESSMSG NVARCHAR(255) DEFAULT ' ' NOT NULL );


--	    FENTRYAUXPTY         BIGINT,
--    FENTRYSENDTIME       TIMESTAMP,
--    FENTRYDELIVERYCYCLE  BIGINT,
--    FENTRYOWNERTYPE      VARCHAR(50)     DEFAULT ' '::CHARACTER VARYING NOT NULL,
--    FENTRYOWNER          BIGINT
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANXENT' AND KSQL_COL_NAME ='FENTRYAUXPTY')
 ALTER TABLE T_POM_DISTRIBPLANXENT ADD (FENTRYAUXPTY BIGINT DEFAULT 0 NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANXENT' AND KSQL_COL_NAME ='FENTRYSENDTIME')
 ALTER TABLE T_POM_DISTRIBPLANXENT ADD (FENTRYSENDTIME DATETIME );

 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANXENT' AND KSQL_COL_NAME ='FENTRYDELIVERYCYCLE')
  ALTER TABLE T_POM_DISTRIBPLANXENT ADD (FENTRYDELIVERYCYCLE BIGINT DEFAULT 0 NOT NULL );

   IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANXENT' AND KSQL_COL_NAME ='FENTRYOWNERTYPE')
    ALTER TABLE T_POM_DISTRIBPLANXENT ADD (FENTRYOWNERTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL );

  IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_DISTRIBPLANXENT' AND KSQL_COL_NAME ='FENTRYOWNER')
   ALTER TABLE T_POM_DISTRIBPLANXENT ADD (FENTRYOWNER BIGINT DEFAULT 0 NOT NULL );




