我创建了一个报告,唯一的参数是来自SOOrder表的CustomerID。 CustomerID的参数与原始客户历史报告的工作方式相同,只是它使用SOOrder.CustomerID而不是ARPayment.CustomerID作为链接字段。我已创建此自定义以将链接添加到报告中:
public override void Initialize()
{
Base.report.AddMenuAction(NewCustHistory);
}
public PXAction<Customer> NewCustHistory;
[PXUIField(DisplayName = "New Customer History", MapEnableRights = PXCacheRights.Select)]
[PXButton(ImageKey = PX.Web.UI.Sprite.Main.Report)]
public virtual IEnumerable newCustHistory(PXAdapter adapter)
{
Customer customer = Base.BAccountAccessor.Current;
if (customer != null)
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["CustomerID"] = customer.AcctCD;
throw new PXReportRequiredException(parameters, "IN642501", "New Customer History");
}
return adapter.Get();
}
当我在选择客户后尝试运行报告时,它编译得很好我在跟踪中得到了这两个错误:
Object reference not set to an instance of an object.
at PX.Data.Reports.BqlSoapCommand.a(PXGraph A_0, StringBuilder A_1, List`1 A_2)
at PX.Data.Reports.BqlSoapCommand.Parse(PXGraph graph, List`1 pars, List`1 tables, List`1 fields, List`1 sortColumns, StringBuilder text, Selection selection)
at PX.Data.BqlCommand.a(PXGraph A_0, PXView A_1)
at PX.Data.BqlCommand.GetText(PXGraph graph, PXView view)
at PX.Data.PXDatabaseProviderBase.Select(PXGraph graph, BqlCommand command, Int64 topCount, PXView view, PXDataValue[] pars)
at PX.Data.PXDatabaseProvider.Select(PXGraph graph, BqlCommand command, Int64 topCount, PXDataValue[] pars)
at PX.Data.PXDatabase.Select(PXGraph graph, BqlCommand command, Int64 topCount, PXDataValue[] pars)
at PX.Data.Reports.SoapNavigator.b()
at PX.Data.Reports.SoapNavigator.c()
at PX.Data.Reports.SoapNavigator.Reset()
at PX.Reports.Data.ReportNode.ProcessItem()
at PX.Reports.Data.ItemNode.Process(Object dataItem)
at PX.Reports.Data.ItemNode.Process()
at PX.Reports.Data.ReportNode.Process()
at PX.Reports.Data.ReportProcessor.ProcessReport(Report definition)
at PX.Data.PXLongOperation.<>c__DisplayClass65_0`1.b__0()
at PX.Data.PXLongOperation.<>c__DisplayClass18_0.b__0()
以及这一个:
Object reference not set to an instance of an object.
at PX.Common.Async.Process[Result](String uniqueKey, Method`1 method, Int64 waitTimeout)
at PX.Reports.Web.WebReport.Render(HttpResponse response, String format, Int32 pageNumber, Boolean refresh, Boolean isAttacment, String locale)
at PX.Reports.Web.PageOperation.PerformOperation(NameValueCollection urlQuery, HttpResponse response)
at PX.Reports.Web.HttpHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
以下是报告的XML:Report XML
更新1:我已更新代码以复制下面提供的答案。错误仍然存在。我的Acumatica版本是6.10.0755。
答案 0 :(得分:1)
使用客户页面上的客户历史记录报告示例,您可以看到它使用AcctCD作为客户ID的报告参数
public PXAction<Customer> customerHistory;
[PXUIField(DisplayName = AR.Messages.CustomerHistory, MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
[PXButton(ImageKey = PX.Web.UI.Sprite.Main.Report)]
public virtual IEnumerable CustomerHistory(PXAdapter adapter)
{
Customer customer = this.BAccountAccessor.Current;
if (customer != null && customer.BAccountID > 0L)
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["CustomerID"] = customer.AcctCD;
throw new PXReportRequiredException(parameters, "AR652000", AR.Messages.CustomerHistory);
}
return adapter.Get();
}
请确保您的自定义报告示例中的以下内容正确无误: