单据体Python插件,值更新时触发查询并写值
场景:
实现单据体字段更新时,进行sql查询并回填当前行字段
import clr clr.AddReference('System') clr.AddReference('System.Data') clr.AddReference('Kingdee.BOS') clr.AddReference('Kingdee.BOS.Core') clr.AddReference('Kingdee.BOS.App') clr.AddReference('Kingdee.BOS.ServiceHelper') clr.AddReference('Newtonsoft.Json') 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 System.Data import * from System.Net import * from System.Text import * from System.IO import * from Kingdee.BOS.Core.Bill.PlugIn import * from Kingdee.BOS.App.Data import * from System.Collections.Generic import List from Kingdee.BOS.ServiceHelper import * def DataChanged(e): if e.Field.Key == "FQty": cfmid=this.Model.GetValue("FMaterialId",e.Row) if cfmid is None: return fmid=str(cfmid["Id"]) #this.View.Model.SetValue('FNote',fmid); #this.View.ShowMessage(str(fmid)); if len(fmid)<=0: return sqlGetmu=("""select a.fbillno,b.F_xxa from T_SAL_QUOTATION a with(nolock) left join (select FMATERIALID,FID,F_xxa from T_SAL_QUOTATIONENTRY with(nolock))b on b.fid=a.fid where a.fdocumentstatus='C' and b.FMATERIALID='{0}'""").format(fmid); muinfo=DBUtils.ExecuteDynamicObject(this.Context,sqlGetmu); muno=muinfo[0][0] mu=muinfo[0][1] this.Model.SetValue("F_xxa",muno,e.Row) this.Model.SetValue("F_xxb",mu,e.Row)
单据体Python插件,值更新时触发查询并写值
场景:实现单据体字段更新时,进行sql查询并回填当前行字段import clrclr.AddReference('System')clr.AddReference('System.Data')clr.AddR...
点击下载文档
本文2024-09-16 18:27:43发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-22297.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章