-- 新增多语言表
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_PURCHASEBILLENTRY_L')
 CREATE TABLE T_FA_PURCHASEBILLENTRY_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(300) DEFAULT ' ' NOT NULL
);

-- 避免客户二开了多语言表导致资产名称无法升级，这里再次升级该字段
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_PURCHASEBILLENTRY_L' AND KSQL_COL_NAME IN ('FNAME'))
ALTER TABLE T_FA_PURCHASEBILLENTRY_L ADD (FNAME NVARCHAR(300) DEFAULT ' ' NOT NULL);

EXEC P_ALTERPK 'PK_T_FA_PURCHASEBILLENTRY_L', 'T_FA_PURCHASEBILLENTRY_L', 'FPKID', '1';

-- 采购转固单主信息行
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_PURCHASEBILLENTRY' AND KSQL_COL_NAME IN ('FISMAINLINE'))
ALTER TABLE T_FA_PURCHASEBILLENTRY ADD (FISMAINLINE CHAR(1) DEFAULT '0' NOT NULL );