--工艺路线分录增加相关字段
--生效时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PDM_ROUTEOPERATION' AND KSQL_COL_NAME ='FVALIDDATE')
ALTER TABLE T_PDM_ROUTEOPERATION ADD (FVALIDDATE DATETIME);

--失效时间
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PDM_ROUTEOPERATION' AND KSQL_COL_NAME ='FINVALIDDATE')
ALTER TABLE T_PDM_ROUTEOPERATION ADD (FINVALIDDATE DATETIME);

--工程变更维护ID
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PDM_ROUTEOPERATION' AND KSQL_COL_NAME ='FENTRYECNID')
ALTER TABLE T_PDM_ROUTEOPERATION ADD (FENTRYECNID BIGINT DEFAULT 0 NOT NULL);

--工程变更单编码
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PDM_ROUTEOPERATION' AND KSQL_COL_NAME ='FENTRYECNNO')
ALTER TABLE T_PDM_ROUTEOPERATION ADD (FENTRYECNNO NVARCHAR(80)   DEFAULT  ' '  NOT NULL);


--原始工艺分录ID
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PDM_ROUTEOPERATION' AND KSQL_COL_NAME ='FSRCOPENTRYID')
ALTER TABLE T_PDM_ROUTEOPERATION ADD (FSRCOPENTRYID BIGINT DEFAULT 0 NOT NULL);


--调整工艺路线名称多语言表的长度
 EXEC P_ALTERCOLUMN 'T_PDM_ROUTE_L', 'FNAME', 'VARCHAR(255)', 'NOT NULL', '0100', ''' ''';

