问题: 论坛里有帖子反馈 制造字段映射模型 保存时提示如下错误信息
原因分析:1. 可能是因为客户二开插入的分录键值 刚好占用了标准产品出厂的分录键值 2. 也可能客户自己通过脚本插入的键值,与客户通过PC端 新增分录的键值重复。
可以通过以下办法解决:重置种子表(制造字段映射模型分录表):
1. SQL Server数据库,执行下面SQL:
IF EXISTS (SELECT 1 FROM SYSOBJECTS WHERE NAME = 'Z_MFG_BILLLINKENTRY ')BEGIN DECLARE @StrSql VARCHAR(500) SELECT @StrSql = 'DROP TABLE Z_MFG_BILLLINKENTRY ' EXECUTE(@StrSql)ENDGO
IF NOT EXISTS (SELECT 1 FROM SYSOBJECTS WHERE NAME = 'Z_MFG_BILLLINKENTRY ')BEGIN DECLARE @Id BIGINT, @StrSql VARCHAR(500) SELECT @Id = ISNULL(MAX(FENTRYID),0) + 1 FROM T_MFG_BILLLINKENTRY IF @Id > 100001 SELECT @StrSql = 'CREATE TABLE Z_MFG_BILLLINKENTRY (Id BIGINT IDENTITY(' + CONVERT(VARCHAR(20), @Id) + ',1) NOT NULL, Column1 INT NOT NULL)' ELSE SELECT @StrSql = 'CREATE TABLE Z_MFG_BILLLINKENTRY (Id BIGINT IDENTITY(100001,1) NOT NULL, Column1 INT NOT NULL)'
EXECUTE(@StrSql)ENDGO
EXEC P_ALTERPK 'PZ_MFG_BILLLINKENTRY ', 'Z_MFG_BILLLINKENTRY ', 'Id', '1'GO
2.Oracel数据库,执行下面SQL:
DECLARE
CNT PLS_INTEGER;
MAXID NUMBER(10);
STRSQL VARCHAR(500);
BEGIN
SELECT COUNT(*) INTO CNT FROM USER_OBJECTS T WHERE T.OBJECT_NAME = 'Z_MFG_BILLLINKENTRY';
IF CNT > 0 THEN
SELECT 'DROP SEQUENCE Z_MFG_BILLLINKENTRY ' INTO STRSQL FROM DUAL;
EXECUTE IMMEDIATE STRSQL;
END IF;
SELECT 100001 INTO MAXID FROM DUAL;
SELECT NVL(MAX(FENTRYID),0) + 1000 INTO MAXID FROM T_MFG_BILLLINKENTRY;
IF MAXID > 100001 THEN
SELECT 'CREATE SEQUENCE Z_MFG_BILLLINKENTRY INCREMENT BY 1 START WITH ' || TO_CHAR(MAXID) || ' CACHE 500' INTO STRSQL FROM DUAL;
ELSE
SELECT 'CREATE SEQUENCE Z_MFG_BILLLINKENTRY INCREMENT BY 1 START WITH 100001 CACHE 500' INTO STRSQL FROM DUAL;
END IF;
EXECUTE IMMEDIATE STRSQL;
END;
推荐阅读