单据体Python插件,值更新时触发查询并写值原创
10人赞赏了该文章
526次浏览
编辑于2024年03月21日 15:13:32
场景:
实现单据体字段更新时,进行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)
赞 10
10人点赞
还没有人点赞,快来当第一个点赞的人吧!
打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!