C# Acumatica-客户屏幕上的链接报告

C# Acumatica-客户屏幕上的链接报告,c#,acumatica,C#,Acumatica,我创建了一个报告,其中唯一的参数是SOOrder表中的CustomerID。CustomerID参数的工作方式与原始客户历史记录报告相同,只是它使用SOOrder.CustomerID而不是ARPayment.CustomerID作为链接字段。我创建此自定义项是为了将链接添加到报告: public override void Initialize() { Base.report.AddMenuAction(NewCustHistory); } public PXAction<Cu

我创建了一个报告,其中唯一的参数是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();
}
以下是报告的XML:


更新1:我已经更新了代码,以复制下面提供的答案。错误仍然存在。我的Acumatica版本是6.10.0755。

使用客户页面上的客户历史记录报告示例,您可以看到它使用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();
}
公共PXAction客户历史记录;
[PXUIField(DisplayName=AR.Messages.CustomerHistory,MapEnableRights=PXCacheRights.Select,MapViewRights=PXCacheRights.Select)]
[PXButton(ImageKey=PX.Web.UI.Sprite.Main.Report)]
公共虚拟IEnumerable CustomerHistory(PXAdapter)
{
客户=this.BAccountAccessor.Current;
if(customer!=null&&customer.BAccountID>0L)
{
字典参数=新字典();
参数[“CustomerID”]=customer.AcctCD;
抛出新的PXReportRequiredException(参数“AR652000”、AR.Messages.CustomerHistory);
}
返回适配器Get();
}
确保自定义报告示例中的以下内容正确无误:

  • 客户id的报告参数名称必须匹配,因为它存在于报告中。确保“CustomerID”是正确的值,而不是类似“Customer\u ID”的值
  • 确认642501中的报告可以从站点地图/url访问,没有错误。如果不可访问,则重定向到报告将不起作用
  • 尝试使用Base.BAccountAccessor.Current作为客户记录的源,如示例所示

您是否尝试使用客户“CD”值与“ID”值“价值?您可能需要传入字符串CD显示值与INT ID值。看看这是否有帮助。我已经更新了上面的代码,使用CurrentCustomer视图而不是BAccount视图。我尝试了CustomerID和跳过var ccust,直接转到BAccountID和AcctCD。所有方法仍然会产生相同的错误。我不确定这是不是超时问题?什么版本的针灸?另外,我假设您的报表参数的名称是“CustomerID”,带有大写和all(可能需要精确匹配)。您可以在报告中看到这一点。如果您查看客户图,您可以看到他们使用AcctCD调用报告。不确定您在示例中选择销售订单的原因。您已经拥有当前客户。此外,您还有一个IN前缀报告。我认为这是正确的,但只是确认一下。我已经尝试了上述方法,但仍然会遇到同样的错误。该报告是一个不同的客户历史报告,而不是Acumatica中的库存报告,因此它是一个自定义报告。我已经添加了上述报告参数的屏幕截图。您可以访问报告并运行它,不会出现错误。它只是将customerID从客户屏幕传递到报告。Acumatica的哪个版本?你能根据建议更新这个问题吗?你能在问题中包含报告xml吗?我已经编辑了上面的代码,除了报告xml之外,我提供了一切,因为我不知道如何提供。为了确认这不是错误,请尝试最新的6.1版本,所有Acumatica报告都只是xml文件。在文本编辑器中打开报告文件以查看(如果需要,保存到文件中)。很遗憾,我无法更新到最新版本,因为这是针对当前客户的。不过,如果有帮助的话,我确实得到了xml。此外,系统上没有的自定义视图之间存在连接关系。
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) 
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();
}