/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\MRP_table.sql **/


 --排程结果表增加订单余量字段
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_PLS_RESULT' AND KSQL_COL_NAME ='FORDERREMAININGQTY') 
 ALTER TABLE T_MRP_PLS_RESULT ADD (FORDERREMAININGQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );

--排程方案增加是否启用班制，班制，考虑计划日期，跨天班次仅安排次日需求字段
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_PLS_SCHEME' AND KSQL_COL_NAME ='FISCLASSSYSTEM') 
 ALTER TABLE T_MRP_PLS_SCHEME ADD (FISCLASSSYSTEM CHAR(1) DEFAULT '0' NOT NULL );
 
  IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_PLS_SCHEME' AND KSQL_COL_NAME ='FCLASSSYSTEMID') 
 ALTER TABLE T_MRP_PLS_SCHEME ADD (FCLASSSYSTEMID BIGINT DEFAULT 0 NOT NULL );
 
   IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_PLS_SCHEME' AND KSQL_COL_NAME ='FCONSIDERPLANDATE1') 
 ALTER TABLE T_MRP_PLS_SCHEME ADD (FCONSIDERPLANDATE1 CHAR(1) DEFAULT '0' NOT NULL );
 
    IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_PLS_SCHEME' AND KSQL_COL_NAME ='FACROSSDAYSHIFT1') 
 ALTER TABLE T_MRP_PLS_SCHEME ADD (FACROSSDAYSHIFT1 CHAR(1) DEFAULT '0' NOT NULL );

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