已解决,需要重写表头
public override ReportHeader GetReportHeaders(IRptParams filter)
{
ReportHeader head = base.GetReportHeaders(filter);
head.AddChild("F_CPXH", new LocaleValue("产品型号", this.Context.UserLocale.LCID));
head.AddChild("F_CPYS", new LocaleValue("产品颜色", this.Context.UserLocale.LCID));
return head;
}
------------------------------------------------------------------------------------------------------------------------------
参考这个贴子https://vip.kingdee.com/article/285118202751868703,在存货收发汇总表加物料基础属性的自定义字段,加一个字段的话没问题,只有加两个或两个以上的时候,会这样。请问怎么能解决?
谢谢!
[code]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Kingdee.BOS;
using Kingdee.BOS.App;
using Kingdee.BOS.Contracts;
using Kingdee.BOS.Core;
using Kingdee.K3.FIN.App.Core;
using Kingdee.K3.FIN.HS.App.Report;
using Kingdee.BOS.App.Data;
using Kingdee.BOS.Core.Report;
using Kingdee.BOS.Util;
namespace ClassLibrary7
{
public class InOutStockSummaryService2:InOutStockSummaryService
{
private string[] InOutStockNames;
public override void BuilderReportSqlAndTempTable(IRptParams filter, string tableName)
{
//创建临时表,用于存放自己的数据
IDBService dbservice = Kingdee.BOS.App.ServiceHelper.GetService
InOutStockNames = dbservice.CreateTemporaryTableName(this.Context, 1);
string strTable = InOutStockNames[0];
//调用基类的方法,获取初步的查询结果到临时表
base.BuilderReportSqlAndTempTable(filter, strTable);
//对初步的查询结果进行处理,然后写回基类默认的存放查询结果的临时表
StringBuilder sb = new StringBuilder();
string strSql = " /*dialect*/SELECT t1.*,t2.F_TEXT_PCD,t2.F_TEXT_NBBM "
+ "into {0} from {1} t1 left join T_BD_MATERIAL t2 on replace(t1.FMATERIALID,'-总计','')=convert(nvarchar(255),t2.FNUMBER) ";
sb.AppendFormat(strSql, tableName, strTable);
DBUtils.Execute(this.Context, sb.ToString());
}
public override void CloseReport()
{//删除临时表
if(InOutStockNames.IsNullOrEmptyOrWhiteSpace())
{return;}
IDBService dbService = Kingdee.BOS.App.ServiceHelper.GetService
dbService.DeleteTemporaryTableName(this.Context,InOutStockNames);
base.CloseReport();
}
}
}