近期少数客户反馈,在收票单列表进行大批量收票时,收票单偶然会发现两张一样的收票单,打开收票单里面的明细和单据头数据不一样,重新删除收票单后,重新接收票单又是正常的。
因为金蝶云星空接收发票是通过调用金蝶发票云的接口,获取发票数据,依赖于发票云的数据源。为了避免出现上述这种情况,在收票单增加【发票代码+发票号码】唯一性校验,避免收票单出现重复的问题。
步骤1:在数据库中执行脚本
创建表
CREATE TABLE T_BOKE_RECEIVEDIVINFO ( FIVCODE NVARCHAR(100) DEFAULT ' ' NOT NULL, --发票代码 FIVNUMBER NVARCHAR(100) DEFAULT ' ' NOT NULL, --发票号码 FSPDID BIGINT DEFAULT 0 NOT NULL --收票单内码 ); |
创建索引
CREATE UNIQUE INDEX IDX_BOKE_RECEIVEDIVINFO_UNIQUE ON T_BOKE_RECEIVEDIVINFO (FIVCODE, FIVNUMBER);
CREATE INDEX IDX_BOKE_RECEIVEDIVINFO_SPDID ON T_BOKE_RECEIVEDIVINFO (FSPDID); |
步骤2:收票单保存操作上注册python插件
注册的python脚本
import clr clr.AddReference('Kingdee.BOS') clr.AddReference('Kingdee.BOS.Core') clr.AddReference('Kingdee.BOS.App') from Kingdee.BOS import * from Kingdee.BOS.Core import * from Kingdee.BOS.Core.Bill import * from Kingdee.BOS.Core.DynamicForm.PlugIn import * from Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel import * from System import * from Kingdee.BOS.App.Data import * from Kingdee.BOS.Util import *
def EndOperationTransaction(e): for bill in e.DataEntitys: spdId = bill["Id"] ivCode = bill["IVCODE"] ivNumber = bill["IVNUMBER"] if ObjectUtils.IsNullOrEmptyOrWhiteSpace(ivCode) == False and ObjectUtils.IsNullOrEmptyOrWhiteSpace(ivNumber) == False: sql = "IF NOT EXISTS (SELECT 1 FROM T_BOKE_RECEIVEDIVINFO WHERE FSPDID = " + str(spdId) + ") BEGIN INSERT INTO T_BOKE_RECEIVEDIVINFO(FIVCODE, FIVNUMBER, FSPDID) VALUES ('" + ivCode + "', '" + ivNumber + "', " + str(spdId) + ") END" DBUtils.Execute(this.Context, sql) |
步骤3:收票单删除操作上注册python插件
注册Python脚本
import clr |
推荐阅读