Python实现报表联查单据原创
61人赞赏了该文章
3,428次浏览
编辑于2020年12月08日 08:51:11
一、【使用场景】: 二开一张简单账表,双击明细行,通过python脚本实现联查单据
二、【代码示例】:
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 System import * from System.Collections.Generic import * from System.ComponentModel import * from Kingdee.BOS.Core.Bill import * from Kingdee.BOS.Core.DynamicForm import * from Kingdee.BOS.Core.DynamicForm.PlugIn.Args import * from Kingdee.BOS.Core.Metadata import * from Kingdee.BOS.Core.Metadata.FormElement import * from Kingdee.BOS.Core.Permission import * from Kingdee.BOS.Core.Report import * from Kingdee.BOS.Core.Report.PlugIn import * from Kingdee.BOS.Core.Report.PlugIn.Args import * from Kingdee.BOS.Core.SqlBuilder import * from Kingdee.BOS.Orm.DataEntity import * from Kingdee.BOS.ServiceHelper import * from Kingdee.BOS.Resource import * def CellDbClick(e): fbillNo = str(this.View.GetCurrentRowValue("FBILLNO")) formId = str(this.View.GetCurrentRowValue("FFORMID")) fm = MetaDataServiceHelper.GetFormMetaData(this.View.Context, formId) form = fm.BusinessInfo.GetForm() param = QueryBuilderParemeter() param.FormId = formId param.FilterClauseWihtKey = "FBILLNO = '" + fbillNo + "'" # 获取到单据内码 param.BusinessInfo = fm.BusinessInfo tolist = List[SelectorItemInfo]() tolist.Add(SelectorItemInfo(form.PkFieldName)) param.SelectItems = tolist dynObjs = QueryServiceHelper.GetDynamicObjectCollection(this.View.Context, param) # 联查单据展示 para = BillShowParameter() para.OpenStyle.ShowType = ShowType.MainNewTabPage para.FormId = formId para.Status = OperationStatus.VIEW para.PKey = str(dynObjs[0]["FID"]) this.View.ShowForm(para)
二、【实现效果】:
以上分析及处理方案是一些个人的理解,如有不对之处,还请指正。
赞 61
61人点赞
还没有人点赞,快来当第一个点赞的人吧!
打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!
推荐阅读