开发简单帐表报错
金蝶云社区-云社区用户6ZA50447
云社区用户6ZA50447
1人赞赏了该文章 859次浏览 未经作者许可,禁止转载编辑于2017年04月21日 13:11:51

刚一进入报表就报错

详细错误信息:SELECT TOP 1 * FROM TMP796E9CD1265011E79C12E09467F WHERE (1 <> 1)

Server stack trace:
在 Kingdee.BOS.App.Data.AbstractDatabase.DoLoadDataSet(IDbCommand command, DataSet dataSet, String[] tableNames)
在 Kingdee.BOS.App.Data.AbstractDatabase.LoadDataSet(DbCommand command, DataSet dataSet, String[] tableNames, IEnumerable`1 listParam)
在 Kingdee.BOS.App.Data.AbstractDatabase.LoadDataSet(DbCommand command, DataSet dataSet, String tableName, IEnumerable`1 listParam)
在 Kingdee.BOS.App.Data.AbstractDatabase.ExecuteDataSet(DbCommand command, IEnumerable`1 listParam)
在 Kingdee.BOS.App.Data.DBUtils.ExecuteDataSet(Context ctx, String strSQL, List`1 paramList)
在 Kingdee.BOS.App.Data.DBUtils.ExecuteDataSet(Context ctx, String strSQL)

Exception rethrown at [0]:
在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
在 Kingdee.BOS.Contracts.IDBService.ExecuteDataSet(Context ctx, String strSQL)
在 Kingdee.BOS.Contracts.Report.SysReportBaseService.AnalyzeDspCloumn(IRptParams filter, String tablename)
在 Kingdee.BOS.Core.Report.PlugIn.AbstractSysReportServicePlugIn.CreateTempTable(IRptParams filter, String tablename)
在 Kingdee.BOS.Core.Report.PlugIn.AbstractSysReportServicePlugIn.GetDataForVirtual(IRptParams filter)
在 Kingdee.BOS.Core.Report.PlugIn.AbstractSysReportServicePlugIn.GetData(IRptParams filter)
在 Kingdee.BOS.App.Core.PlugInProxy.SysReportServicePlugInProxy.GetReportData(ReportServiceParameter parameter)
在 Kingdee.BOS.App.Core.SysReportService.GetReportData(ReportServiceParameter parameter)

Exception rethrown at [1]:
在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
在 Kingdee.BOS.Contracts.ISysReportService.GetReportData(ReportServiceParameter parameter)
在 Kingdee.BOS.ServiceHelper.SysReportServiceHelper.GetReportData(ReportServiceParameter parameter)
在 Kingdee.BOS.Model.Report.SysReportModel.GetData(Int32 start, Int32 rows)
在 Kingdee.BOS.Web.Report.SysReportView.GetListData()
在 Kingdee.BOS.Web.Report.SysReportView.<>c__DisplayClass4d.b__49()

具体代码:
public class Class1 : SysReportBaseService
{
public override void Initialize()
{
base.Initialize();
this.ReportProperty.ReportType = ReportType.REPORTTYPE_NORMAL;
this.ReportProperty.ReportName = new LocaleValue("注册证报表", base.Context.UserLocale.LCID);
this.ReportProperty.DetailReportId = "bmw_jdbb";
this.ReportProperty.PrimaryKeyFieldName = "FBILLNO";
this.ReportProperty.IsUIDesignerColumns = false;
this.ReportProperty.IsGroupSummary = true;
this.ReportProperty.SimpleAllCols = false;
this.IsCreateTempTableByPlugin = true;

}
public override string GetTableName()
{
var result = base.GetTableName();
return result;
}
public override void BuilderReportSqlAndTempTable(IRptParams filter, string tableName)
{
base.BuilderReportSqlAndTempTable(filter, tableName);

//获取快捷页签的过滤字段数据
DynamicObject customFil = filter.FilterParameter.CustomFilter;
//拼成过滤条件
string sWhere = string.Empty;
sWhere = string.Format("Where F_bmw_zczname = '{0}' ", customFil["F_bmw_zczname"]);
// 默认排序字段:需要从filter中取用户设置的排序字段
string seqFld = string.Format(base.KSQL_SEQ, " t0.FNUMBER ");

string sql = string.Format(@"/*dialect*/
select
t0.FNUMBER ,
t1.FNAME ,
t1.F_BMW_ENGLISHINAME ,
t0.F_BMW_ZCZ ,
t2.FNAME ,
t0.F_BMW_ZCZDQR
from T_BD_MATERIAL t0
inner join
T_BD_MATERIAL_L t1 on (t0.FMATERIALID = t1.FMATERIALID)
left join
bmw_t_Cust_Entry100003_L t2 on (t0.F_BMW_ZCZLB = t2.FID)
",
seqFld,
tableName);
DBUtils.ExecuteDynamicObject(this.Context, sql);
}

public override ReportHeader GetReportHeaders(IRptParams filter)
{
ReportHeader header = new ReportHeader();

var materialid = header.AddChild("t0.FNUMBER", new LocaleValue("物料编码"));
materialid.ColIndex = 0;
var materialname = header.AddChild("t1.FNAME", new LocaleValue("物料名称"));
materialname.ColIndex = 1;

var materialenglishname = header.AddChild("t1.F_BMW_ENGLISHINAME", new LocaleValue("物料英文名称"));
materialenglishname.ColIndex = 2;
var zczname = header.AddChild("t0.F_BMW_ZCZ", new LocaleValue("注册证名称"), SqlStorageType.SqlDecimal);
zczname.ColIndex = 3;
var zczlb = header.AddChild("t2.FNAME", new LocaleValue("注册证类别"));
zczlb.ColIndex = 4;
var zczdqr = header.AddChild("t0.F_BMW_ZCZDQR", new LocaleValue("注册证到期日"), SqlStorageType.SqlDecimal);
zczdqr.ColIndex = 5;
return header;
}
public override ReportTitles GetReportTitles(IRptParams filter)
{
var result = base.GetReportTitles(filter);
DynamicObject dyFilter = filter.FilterParameter.CustomFilter;
if (dyFilter != null)
{
if (result == null)
{
result = new ReportTitles();
}
result.AddTitle("F_bmw_zczname", Convert.ToString(dyFilter["F_bmw_zczname"]));
}
return result;
}