【问题标题】:Acumatica - Linking report on Customer ScreenAcumatica - 客户屏幕上的链接报告
【发布时间】:2018-11-22 00:47:17
【问题描述】:

我创建了一个报告,其中唯一的参数是 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。

【问题讨论】:

  • 您是否尝试过使用客户“CD”值与“ID”值?您可能需要传入字符串 CD 显示值与 INT ID 值。看看有没有帮助。
  • 我已经更新了上面的代码以使用 CurrentCustomer 视图而不是 BAccount 视图。我已经尝试过 CustomerID 以及跳过 var ccust 并直接转到 BAccountID 和 AcctCD。所有方式仍然产生相同的错误。我不确定这是否是超时问题?
  • 什么版本的 Acumatica?另外,我假设您的报告参数的名称是带有大写字母的“CustomerID”(可能需要完全匹配)。您可以在报告中看到这一点。
  • 如果您查看客户图表,您可以看到他们使用 AcctCD 调用报告。不确定您为什么在示例中选择销售订单。您已经拥有当前客户。此外,您还有一个 IN 前缀报告。我认为这是正确的,但只是确认。

标签: c# acumatica


【解决方案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();
}

确保在您的自定义报告示例中以下内容正确:

  • 客户 ID 的报告参数名称必须与报告中存在的相同。确保“Cu​​stomerID”是正确的值,而不是“Customer_ID”之类的值
  • 确认报告 IN642501 可以从站点地图/url 无错误地访问。如果无法访问,那么您对报告的重定向将不起作用。
  • 尝试使用 Base.BAccountAccessor.Current 作为客户记录的来源,如示例所示。

【讨论】:

  • 我已经尝试了上述方法,但仍然遇到相同的错误。该报告是不同的客户历史报告,而不是 Acumatica 中的库存报告,因此它是自定义报告。我已经添加了上面报告参数的屏幕截图。您可以访问该报告并正常运行它。它只是从客户屏幕传递客户 ID 并转到报告。
  • 什么版本的 Acumatica?您可以更新适合建议的问题吗?您可以在问题中包含报告 xml 吗?
  • 我已经编辑了上面的代码,除了报告 xml 之外,我提供了所有内容,因为我不确定如何提供。
  • 要确认它不是错误,请尝试最新的 6.1 版本,所有 Acumatica 报告都只是 xml 文件。在文本编辑器中打开报告文件进行查看(如果需要,保存到文件)
  • 遗憾的是,我无法更新到最新版本,因为这是针对当前客户的。我确实得到了 xml,但是如果这有帮助的话。此外,我的系统上没有自定义视图之间的关系连接。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-09-06
  • 2015-05-27
  • 2020-08-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多