生产订单二开字段,如何在生产报表中展示,下面例子以生产订单执行明细表举例,展示如何进行报表的二开开发,步骤如下:
1、生产订单新增文本字段,注意字段的标识名和字段名:
2、生产订单执行明细报表新增字段,注意字段的标识名:
3、生产订单执行明细报表过滤框的显示隐藏列添加过滤字段,注意字段的标识名:
4、二开报表插件,继承生产订单执行明细报表的报表插件MOExecuteDetailRpt
using Kingdee.K3.MFG.PRD.App.ReportPlugIn.MOExecute;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Kingdee.BOS.Util;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.Contracts;
using Kingdee.BOS.App.Data;
namespace Kingdee.EK.K3.MFG.PRD.App.ReportPlugIn
{
[DisplayName("报表二次开发字段")]
[Description("生产订单执行明细表二开字段")]
public class ReportService : MOExecuteDetailRpt
{
private string[] customRptTempTableNames;
public override void BuilderReportSqlAndTempTable(Kingdee.BOS.Core.Report.IRptParams filter, string tableName)
{
base.BuilderReportSqlAndTempTable(filter, tableName);
IDBService dbservice = Kingdee.BOS.App.ServiceHelper.GetService
customRptTempTableNames = dbservice.CreateTemporaryTableName(this.Context, 1);
string strTable = customRptTempTableNames[0];
//调用基类的方法,获取初步的查询结果到临时表
base.BuilderReportSqlAndTempTable(filter, strTable);
//初步结果处理,然后回写积累的数据到临时表
StringBuilder sb = new StringBuilder();
sb.AppendLine("SELECT T1.*,MOE.FTEXT");
sb.AppendFormat(" into {0} ", tableName);
sb.AppendFormat(" FROM {0} T1", strTable);
sb.AppendFormat(" LEFT JOIN T_PRD_MOENTRY MOE ON T1.FMOENTRYID=MOE.FENTRYID");
DBUtils.Execute(this.Context, "DROP TABLE " + tableName);
DBUtils.Execute(this.Context, sb.ToString());
}
public override void CloseReport()
{
if (customRptTempTableNames.IsNullOrEmptyOrWhiteSpace())
return;
IDBService dbservice = Kingdee.BOS.App.ServiceHelper.GetService
dbservice.DeleteTemporaryTableName(this.Context, customRptTempTableNames);
base.CloseReport();
}
}
}
5、最终报表结果展示如下: