k3cloud使用python插件执行sql原创
金蝶云社区-温侯
温侯
9人赞赏了该文章 4,026次浏览 未经作者许可,禁止转载编辑于2020年03月28日 22:08:11

import clr

clr.AddReference("System")

clr.AddReference("System.Core")

clr.AddReference("Kingdee.BOS")

clr.AddReference("Kingdee.BOS.Core")

clr.AddReference("Kingdee.BOS.DataEntity")

clr.AddReference("Kingdee.BOS.ServiceHelper")

from Kingdee.BOS.Core.Log import *

from Kingdee.BOS.Core import *

from Kingdee.BOS.Core.DynamicForm import *

from Kingdee.BOS.KDThread import *

from Kingdee.BOS.DataEntity import *

from Kingdee.BOS.Orm.DataEntity import *

from Kingdee.BOS.ServiceHelper import *

from Kingdee.BOS.Core.Metadata import SelectorItemInfo ##字段选择实体类

from Kingdee.BOS.Core.SqlBuilder import QueryBuilderParemeter ##查询参数实体类

from Kingdee.BOS.App.Data import *  

from Kingdee.BOS.Core.Bill.PlugIn import *

from Kingdee.BOS.Core.Bill.PlugIn.Args import *

from Kingdee.BOS.Core.DynamicForm.PlugIn.Args import *

def DataChanged(e):

    if e.Key=="FMaterialId" and e.NewValue<>"":

        #Materialid=this.Model.GetValue("FMaterialId",e.Row)

        #sql="/*dialect*/select b.FDESCRIPTION from T_BD_MATERIAL a join T_BD_MATERIAL_L b on a.FMATERIALID=b.FMATERIALID where FNumber like '"+Materialid['Number']+"'"

        #result = DBServiceHelper.ExecuteDynamicObject(this.Context, sql)

        #this.View.ShowMessage(result[0][0]);

        

        #DBUtils.Execute(this.Context,"DELETE FROM TableA");

        sql="insert into tableA(id,AA)values(99,99)"

        DBUtils.Execute(this.Context, str(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");


图标赞 9
9人点赞
还没有人点赞,快来当第一个点赞的人吧!
图标打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!