python版 动态表单 之 表单插件原创
10人赞赏了该文章
991次浏览
编辑于2024年05月04日 13:43:50
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 ButtonClick(e): # 点击查询按钮 an=e.Key.strip().upper() if an == "F_BTNSEARCH": # 获取查询值,文本框的key=bm cxbm=this.View.Model.GetValue("F_bm") #this.View.ShowMessage(cxbm) if cxbm is None: return #this.View.ShowMessage(cxbm) # 通过SQL查询对应的数据,也可以通过接口load数据 strSql = "SELECT FSCHEMEID, FSCHEMENAME,FFORMID FROM T_BAS_FILTERSCHEME with(nolock) WHERE FFORMID='"+cxbm.strip().upper()+"'" #this.View.ShowMessage(strSql) entryData = DBServiceHelper.ExecuteDataSet(this.Context, strSql) if entryData is None or len(entryData.Tables[0].Rows) == 0: return # 绑定单据体数据 for i in range(len(entryData.Tables[0].Rows)): this.View.Model.CreateNewEntryRow("FENTITY") dr = entryData.Tables[0].Rows[i] fid = dr["FSCHEMEID"] or "" this.View.Model.SetValue("FSCHEMEID", fid, i) fname = dr["FSCHEMENAME"] or 0 this.View.Model.SetValue("FSCHEMENAME", fname, i) ffid = dr["FFORMID"] or 0 this.View.Model.SetValue("FFORMID",ffid , i) this.View.UpdateView("FENTITY")
记录下
按钮调用动态表单
clr.AddReference('Kingdee.BOS') clr.AddReference('Kingdee.BOS.Core') from Kingdee.BOS import * from Kingdee.BOS.Core import * from Kingdee.BOS.Util import * def BarItemClick(e): if e.BarItemKey=='lbfz' and this.Context.UserName=='htc': parameteropt =DynamicFormShowParameter(); parameteropt.FormId = "xxx_pur_lst_fa"; #上面bos开发的普通动态表单 #【查询辅助属性启用的物料】动态表单 业务对象标识,此处动态表单、基础资料、单据类型的都可以 parameteropt.CustomParams.Add("F_bm", "PUR_PurchaseOrder"); #parameteropt.ParentPageId = this.View.PageId; this.View.ShowForm(parameteropt);
参考此,使用批量快速赋值
#引入clr运行库 import clr #添加对cloud插件开发的常用组件的引用 clr.AddReference('System') clr.AddReference('System.Data') clr.AddReference('Kingdee.BOS') clr.AddReference('Kingdee.BOS.DataEntity') clr.AddReference('Kingdee.BOS.Core') clr.AddReference('Kingdee.BOS.App') clr.AddReference('Kingdee.BOS.App.Core') clr.AddReference('Kingdee.BOS.ServiceHelper') #导入cloud基础库中的常用实体对象(分命名空间导入,不会递归导入) from Kingdee.BOS import * from Kingdee.BOS.Core import * from Kingdee.BOS.Core.DependencyRules 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 Kingdee.BOS.App.Data import * from System.Collections.Generic import List from Kingdee.BOS.ServiceHelper import * from Kingdee.BOS.Core.DynamicForm import * from Kingdee.BOS.Core.Metadata.EntityElement import * from Kingdee.BOS.Core.Metadata.FieldElement import * from Kingdee.BOS.Orm.DataEntity import * from Kingdee.BOS.Util import * from Kingdee.BOS.Log import * def BarItemClick(e): key=e.BarItemKey.ToUpperInvariant(); if(key=="Button".ToUpperInvariant()): orgId=this.Context.CurrentOrganizationInfo.ID; this.View.Model.DeleteEntryData("FEntity"); sql=("""/*dialect*/EXEC CPZ_QT @orgId={0}""").format(orgId); doc = DBUtils.ExecuteDynamicObject(this.Context, sql); for dr in doc: this.View.Model.CreateNewEntryRow("FEntity"); RowCounts = this.Model.GetEntryRowCount("FEntity"); this.View.Model.SetValue("FPRODUCTID", str(dr["FMATERIALID"]), RowCounts - 1); this.View.InvokeFieldUpdateService("FPRODUCTID", RowCounts - 1); this.View.UpdateView();
赞 10
10人点赞
还没有人点赞,快来当第一个点赞的人吧!
打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!