分享一段Python写的简单账表
主要步骤:
1、创建个过滤框,拉了两个字段,用来放select后面的查询字段和from后面的整段
2、创建简单账表,注册服务插件
用Python写的一段简单账表的语句
import clr clr.AddReference("System") clr.AddReference("Kingdee.BOS") clr.AddReference("Kingdee.BOS.Core") clr.AddReference("Kingdee.BOS.DataEntity") clr.AddReference("Kingdee.BOS.App") clr.AddReference("Kingdee.BOS.Contracts") clr.AddReference("Kingdee.BOS.ServiceHelper") from Kingdee.BOS import* from Kingdee.BOS.Contracts import* from Kingdee.BOS.Contracts.Report import* from Kingdee.BOS.Core import * from Kingdee.BOS.Core.Metadata import * from Kingdee.BOS.Core.Report import* from Kingdee.BOS.Core.SqlBuilder import* from Kingdee.BOS.App.Data import* from Kingdee.BOS.Orm.DataEntity import* from System import* from System.ComponentModel import* from System.Collections.Generic import* from System.Text import* from System.Threading.Tasks import* from Kingdee.BOS.ServiceHelper import * #初始化 def Initialize(): this.ReportProperty.ReportType=ReportType.REPORTTYPE_NORMAL; this.IsCreateTempTableByPlugin=True; this.ReportProperty.IsGroupSummary=True; #设置标题 def GetReportTitles(Filter): reportTitles=ReportTitles(); #customFiler=Filter.FilterParameter.CustomFilter; return reportTitles; #设置单据列 def GetReportHeaders(Filter): header=ReportHeader(); localEid=this.Context.UserLocale.LCID; #处理sql语句 custFilter=Filter.FilterParameter.CustomFilter; SQL=custFilter['F_PLYA_SQL'] if SQL<>'': text =SQL.split(',') for i in text: name = i.split(' ')[-1].strip() header.AddChild(name,LocaleValue(name,localEid)); # header.AddChild("FBILLNO",LocaleValue("员工编号",localEid)); # header.AddChild("FID",LocaleValue("员工ID",localEid)); return header; #创建临时报表 def BuilderReportSqlAndTempTable(rptfilter,tableName): custFilter = rptfilter.FilterParameter.CustomFilter; sql=("""/*dialect*/ SELECT FIDENTITYID=row_NUMBer() over(order by t1.{3} ASC),t1.* ---构建主键 INTO {0} FROM ( select {1} from {2} --修改这段代码 ) t1 """).format(tableName,custFilter['F_PLYA_SQL'],custFilter['F_PLYA_FROM'],custFilter['F_PLYA_SQL'].split(',')[0].strip()); DBServiceHelper.Execute(this.Context,sql); #关闭清空临时表 def CloseReport(): this.DropTempTable();
我想知道有人可以成功使用吗?
分享一段Python写的简单账表
主要步骤:1、创建个过滤框,拉了两个字段,用来放select后面的查询字段和from后面的整段2、创建简单账表,注册服务插件用Python写的一段简...
点击下载文档
上一篇:使用BulkInserts批量写数据到临时表下一篇:我的回合,抽卡!
本文2024-09-16 17:14:55发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-14487.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章