#引入clr运行库
import clr
clr.AddReference("Kingdee.BOS.Core")
clr.AddReference("Kingdee.BOS.App")
clr.AddReference("Kingdee.BOS")
#添加对cloud插件开发的常用组件的引用
from Kingdee.BOS.Core.Bill.PlugIn import *
from Kingdee.BOS.Core.Bill.PlugIn.Args import *
from Kingdee.BOS.Core.DynamicForm.PlugIn.Args import *
from Kingdee.BOS.App.Data import *
def AfterBarItemClick(e):
#判断是否点击了审核按钮(菜单和列表一样)
if (e.BarItemKey=="tbSplitApprove" or e.BarItemKey=="tbApprove"):
#执行MSSQL语句
# DBUtils.Execute,加了参数:,None,False,错误提示不会显示sql脚本
DBUtils.Execute(this.Context, "/*dialect*/update a set a.AA=b.AA from (select id,AA from TableA)a,(select id,AA from TableB)b where a.id=b.id",None,False);
#执行MSSQL存储过程
#DBUtils.Execute(this.Context, "/*dialect*/exec 存储过程名字",None,False);
this.View.ShowMessage("操作成功!");
#读取数据库;strSql是读取数据库的脚本
doc = DBUtils.ExecuteDynamicObject(this.Context, strSql);
data = doc[0]["FSTARTDATE"].ToString();