金蝶云·星空python插件示例代码(搬运备查)
5人赞赏了该文章
2,016次浏览
编辑于2021年11月29日 14:07:24
值更新后赋值
#引入clr运行库 import clr #添加对cloud插件开发的常用组件的引用 clr.AddReference('Kingdee.BOS') clr.AddReference('Kingdee.BOS.Core') from Kingdee.BOS.Core import * def DataChanged(e): groupNumber = str(this.Model.GetValue("FGroup")['Number']) if (this.Model.GetValue("FGroup") <>None) else "0"; if "G2" in groupNumber: this.Model.SetValue("F_PFIH_Group","101435"); else : this.Model.SetValue("F_PFIH_Group","");
发送get请求
#引入clr运行库 import clr #添加对cloud插件开发的常用组件的引用 clr.AddReference("System") clr.AddReference("System.Web.Extensions") clr.AddReference("Kingdee.BOS") clr.AddReference("Kingdee.BOS.Core") clr.AddReference("Newtonsoft.Json") #导入cloud基础库中的常用实体对象(分命名空间导入,不会递归导入) import sys from System import * from System.Collections.Generic import * from System.Threading import * from System.IO import * from System.Net import * from System.Text import * from System.Security.Cryptography import * from System.Web.Script.Serialization import * from System.Collections.Generic import Dictionary from Newtonsoft.Json.Linq import * def BarItemClick(e) : if e.BarItemKey=="JQH_tbButton" : test = get("https://www.test.com") this.View.ShowMessage(test) def get(url): req = HttpWebRequest.Create(url); req.Method = "GET"; rsp = req.GetResponse(); stream = rsp.GetResponseStream(); reader = StreamReader(stream, Encoding.GetEncoding("utf-8")); result = reader.ReadToEnd(); return result
执行查询和更新sql
import clr clr.AddReference('Kingdee.BOS.App') from Kingdee.BOS.App.Data import * def BarItemClick(e): if e.BarItemKey=="JQH_getSql": # 查询当前登录用户信息 sql = "SELECT FNAME FROM T_SEC_USER WHERE FUSERID="+this.Context.UserId.ToString(); userName = DBUtils.ExecuteScalar(this.Context,sql,None); this.View.ShowMessage(userName); elif e.BarItemKey=="JQH_exeSql": # 修改当前登录用户的描述 sql = "UPDATE T_SEC_USER SET FDESCRIPTION=N'test' WHERE FUSERID="+this.Context.UserId.ToString(); count = DBUtils.Execute(this.Context,sql); this.View.ShowMessage("更新成功,SQL:"+sql+",受影响行数:"+count.ToString());
列表过滤条件,新增菜单发布时的自定义参数
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.Contracts") from Kingdee.BOS import * from Kingdee.BOS.JSON import * from Kingdee.BOS.Core import * from Kingdee.BOS.Core.Const import * from Kingdee.BOS.Core.Bill import * from Kingdee.BOS.Core.List import * from System import * from System.Collections.Generic import * from System.Linq import * def PrepareFilterParameter(e): listType=this.View.OpenParameter.GetCustomParameter("BillTypeID"); if listType: filterString=""; filterString=str.Format(" FBILLTYPEID='"+listType+"'"); e.FilterString+="AND"; e.FilterString+=filterString; #this.View.showMessage(e.FilterString)
本文转载自:CSDN
作者:咚呲哒呲咚呲哒呲
原文链接:https://blog.csdn.net/whatupwoman/article/details/119561680?spm=1001.2014.3001.5501
赞 5
5人点赞
还没有人点赞,快来当第一个点赞的人吧!
打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!