通过API的ReleasePayment导致PX.Data.PXActionDisabledException

问题描述

当尝试通过Web服务端点〜/ entity / Default / 18.200.001 / Payment / ReleasePayment释放客户退款(AR302000)时,我收到以下异常消息:

{
    "message": "An error has occurred.","exceptionMessage": "Operation Failed","exceptionType": "PX.Data.PXInvalidOperationException","stackTrace": "   at PX.Api.ContractBased.EntityService.Invoke(ISystemContract systemContract,String version,String name,EntityImpl entity,ActionImpl action,CbOperationContext operationContext,Boolean throwOnError)\r\n   at PX.Api.ContractBased.soap.soapFacadeBase.InvokeImpl(EntityImpl entity,Boolean throwOnError)\r\n   at PX.Api.ContractBased.SystemContracts.V2.soapFacade.PX.Api.ContractBased.IRestGate.Invoke(EntityImpl entity,String objectName,HttpRequestMessage request)\r\n   at PX.Api.ContractBased.SystemContracts.V2.RestController.InvokeAction(String objectName,String actionName,ActionInvocation invocation)\r\n   at lambda_method(Closure,Object,Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__displayClass6_1.<GetExecutor>b__3(Object instance,Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext,IDictionary`2 arguments,CancellationToken cancellationToken)\r\n--- End of stack trace from prevIoUs location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()\r\n--- End of stack trace from prevIoUs location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterattribute.<CallOnActionExecutedAsync>d__6.MoveNext()\r\n--- End of stack trace from prevIoUs location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()\r\n   at System.Web.Http.Filters.ActionFilterattribute.<CallOnActionExecutedAsync>d__6.MoveNext()\r\n--- End of stack trace from prevIoUs location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterattribute.<ExecuteActionFilterasyncCore>d__5.MoveNext()\r\n--- End of stack trace from prevIoUs location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterattribute.<CallOnActionExecutedAsync>d__6.MoveNext()\r\n--- End of stack trace from prevIoUs location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()\r\n   at System.Web.Http.Filters.ActionFilterattribute.<CallOnActionExecutedAsync>d__6.MoveNext()\r\n--- End of stack trace from prevIoUs location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.ActionFilterattribute.<ExecuteActionFilterasyncCore>d__5.MoveNext()\r\n--- End of stack trace from prevIoUs location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()\r\n--- End of stack trace from prevIoUs location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Filters.AuthorizationFilterattribute.<ExecuteAuthorizationFilterasyncCore>d__3.MoveNext()\r\n--- End of stack trace from prevIoUs location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()\r\n--- End of stack trace from prevIoUs location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()\r\n   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()\r\n--- End of stack trace from prevIoUs location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.dispatcher.HttpControllerdispatcher.<SendAsync>d__15.MoveNext()","innerException": {
        "message": "An error has occurred.","exceptionMessage": "The Release button is disabled.","exceptionType": "PX.Data.PXActiondisabledException","stackTrace": "   at PX.Data.PXAction`1.<Press>d__28.MoveNext()\r\n   at PX.Api.SyImportProcessor.SyStep.a(Object A_0,PXFilterRow[] A_1,PXFilterRow[] A_2)\r\n   at PX.Api.SyImportProcessor.ExportTableHelper.ExportTable()"
    }
}

请求正文如下:

{
   "entity": {
      "ReferenceNbr": {
        "value": "FTNHQ-RP0205826"
      }
   }
}

在查看付款单据时,我已经检查了释放按钮的启用:

Customer Refund

从2019R1(19.100.0122)升级到2020R1(20.108.0019)之后,此端点以及/ Invoice / ReleaseInvoice上的错误开始发生。请注意,我可以做其他的创建,读取和更新工作-似乎只是动作引起问题,例如我要在此发布的客户退款是通过API创建的。

起初,我认为这可能与2019R2中推出的控制帐户限制的新功能有关,但我确保在科目表列表中设置子分类账设置。

我还使用事件探查器检查了跟踪请求,但无法从列表中解密可操作的任何内容,请参见下文。

Trace for ~/entity/default/18.200.001/payment/releasepayment

PS。我仍然可以在生产服务器上(通过Web服务API)运行上述发行操作,而不会出现任何问题(因为它仍在版本2019R1中)。

我还试图通过Web上的常规UI释放客户退款,并且这种方式行之有效,所以这肯定有点让人头疼。

我们将不胜感激任何帮助/想法。

上面的屏幕快照中的长跟踪消息:

LINQ fallback! Consider rewriting your query.    at Remotion.Linq.Clauses.StreamedData.StreamedSequenceInfo.ExecuteQueryModel(QueryModel queryModel,IQueryExecutor executor)
   at Remotion.Linq.QueryProviderBase.System.Linq.IQueryProvider.Execute[TResult](Expression expression)
   at Remotion.Linq.QueryableBase`1.GetEnumerator()
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.<distinctIterator>d__64`1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at PX.Objects.GL.FinPeriodIDAttribute.ValidateRelatedToMainFinPeriods(PXCache cache,Object oldRow,Object newRow,Boolean externalCall,Nullable`1 newMainCalendarOrgID,Nullable`1 oldMainCalendarOrgID,FinPeriod newMainorgFinPeriod)
   at PX.Objects.GL.FinPeriodIDAttribute.ValidatePeriodAndSourcesImpl(PXCache cache,Boolean externalCall)
   at PX.Objects.GL.OrganizationDependedPeriodIDAttribute.RowPersisting(PXCache sender,PXRowPersistingEventArgs e)
   at PX.Objects.GL.OpenPeriodAttribute.RowPersisting(PXCache sender,PXRowPersistingEventArgs e)
   at PX.Data.PXRowPersisting.Invoke(PXCache sender,PXRowPersistingEventArgs e)
   at PX.Data.PXCache.OnRowPersisting(Object item,PXDBOperation operation)
   at PX.Data.PXCache`1.PersistInserted(Object row,Boolean bypassInterceptor)
   at PX.Data.PXCache`1.Persist(PXDBOperation operation)
   at PX.Data.PXGraph.Persist(Type cacheType,PXDBOperation operation)
   at PX.Data.PXGraph.Persist()
   at PX.Objects.AR.ARPaymentEntry.Persist()
   at PX.Data.PXSave`1.<Handler>d__2.MoveNext()
   at PX.Data.PXAction`1.<Press>d__28.MoveNext()
   at PX.Api.SyImportProcessor.SyStep.a(Object A_0,PXFilterRow[] A_2)
   at PX.Api.SyImportProcessor.ExportTableHelper.ExportTable()
   at PX.Api.ContractBased.EntityService.Invoke(ISystemContract systemContract,Boolean throwOnError)
   at PX.Api.ContractBased.soap.soapFacadeBase.InvokeImpl(EntityImpl entity,Boolean throwOnError)
   at PX.Api.ContractBased.SystemContracts.V2.soapFacade.PX.Api.ContractBased.IRestGate.Invoke(EntityImpl entity,HttpRequestMessage request)
   at PX.Api.ContractBased.SystemContracts.V2.RestController.InvokeAction(String objectName,ActionInvocation invocation)
   at lambda_method(Closure,Object[] )
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__displayClass6_1.<GetExecutor>b__3(Object instance,Object[] methodParameters)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext,CancellationToken cancellationToken)
   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at System.Web.Http.Controllers.ApiControllerActionInvoker.InvokeActionAsyncCore(HttpActionContext actionContext,CancellationToken cancellationToken)
   at System.Web.Http.Controllers.ApiControllerActionInvoker.InvokeActionAsync(HttpActionContext actionContext,CancellationToken cancellationToken)
   at System.Web.Http.Controllers.ActionFilterResult.<>c.<ExecuteAsync>b__5_0(ActionInvoker innerInvoker)
   at System.Web.Http.Controllers.ActionFilterResult.<>c__displayClass7_0`1.<InvokeActionWithActionFilters>b__0()
   at System.Web.Http.Filters.ActionFilterattribute.<CallOnActionExecutedAsync>d__6.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at System.Web.Http.Filters.ActionFilterattribute.CallOnActionExecutedAsync(HttpActionContext actionContext,CancellationToken cancellationToken,Func`1 continuation)
   at System.Web.Http.Filters.ActionFilterattribute.<ExecuteActionFilterasyncCore>d__5.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at System.Web.Http.Filters.ActionFilterattribute.ExecuteActionFilterasyncCore(HttpActionContext actionContext,Func`1 continuation)
   at System.Web.Http.Filters.ActionFilterattribute.System.Web.Http.Filters.IActionFilter.ExecuteActionFilterasync(HttpActionContext actionContext,Func`1 continuation)
   at System.Web.Http.Filters.ActionFilterattribute.<CallOnActionExecutedAsync>d__6.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at System.Web.Http.Filters.ActionFilterattribute.CallOnActionExecutedAsync(HttpActionContext actionContext,Func`1 continuation)
   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at System.Web.Http.Controllers.ActionFilterResult.ExecuteAsync(CancellationToken cancellationToken)
   at System.Web.Http.Filters.AuthorizationFilterattribute.<ExecuteAuthorizationFilterasyncCore>d__3.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at System.Web.Http.Filters.AuthorizationFilterattribute.ExecuteAuthorizationFilterasyncCore(HttpActionContext actionContext,Func`1 continuation)
   at System.Web.Http.Filters.AuthorizationFilterattribute.System.Web.Http.Filters.IAuthorizationFilter.ExecuteAuthorizationFilterasync(HttpActionContext actionContext,Func`1 continuation)
   at System.Web.Http.Controllers.AuthorizationFilterResult.ExecuteAsync(CancellationToken cancellationToken)
   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at System.Web.Http.Controllers.ExceptionFilterResult.ExecuteAsync(CancellationToken cancellationToken)
   at System.Web.Http.ApiController.ExecuteAsync(HttpControllerContext controllerContext,CancellationToken cancellationToken)
   at System.Web.Http.dispatcher.HttpControllerdispatcher.<SendAsync>d__15.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at System.Web.Http.dispatcher.HttpControllerdispatcher.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)
   at System.Net.Http.HttpMessageInvoker.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)
   at System.Web.Http.dispatcher.HttpRoutingdispatcher.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)
   at System.Net.Http.DelegatingHandler.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)
   at Autofac.Integration.WebApi.Owin.DependencyScopeHandler.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)
   at System.Web.Http.HttpServer.<SendAsync>d__24.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at System.Web.Http.HttpServer.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)
   at System.Web.Http.Owin.HttpMessageHandlerAdapter.<InvokeCore>d__20.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at System.Web.Http.Owin.HttpMessageHandlerAdapter.InvokeCore(IOwinContext context,IOwinRequest owinRequest,IOwinResponse owinResponse)
   at System.Web.Http.Owin.HttpMessageHandlerAdapter.<InvokeCore>d__20.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at System.Web.Http.Owin.HttpMessageHandlerAdapter.InvokeCore(IOwinContext context,IOwinResponse owinResponse)
   at PX.Owin.Startup.<<ConfigurationImpl>b__10_5>d.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at PX.Owin.Startup.<ConfigurationImpl>b__10_5(IOwinContext ctx,Func`1 next)
   at PX.Logging.Enrichers.OwinExtensions.<>c.<<disableAspNetCallbackEnricher>b__0_0>d.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at PX.Logging.Enrichers.OwinExtensions.<>c.<disableAspNetCallbackEnricher>b__0_0(IOwinContext ctx,Func`1 next)
   at Microsoft.Owin.Mapping.MapWhenMiddleware.<Invoke>d__3.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.Owin.Mapping.MapWhenMiddleware.Invoke(IDictionary`2 environment)
   at Microsoft.Owin.Mapping.MapWhenMiddleware.<Invoke>d__3.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.Owin.Mapping.MapWhenMiddleware.Invoke(IDictionary`2 environment)
   at Microsoft.Owin.Mapping.MapWhenMiddleware.<Invoke>d__3.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.Owin.Mapping.MapWhenMiddleware.Invoke(IDictionary`2 environment)
   at Microsoft.Owin.Mapping.MapWhenMiddleware.<Invoke>d__3.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.Owin.Mapping.MapWhenMiddleware.Invoke(IDictionary`2 environment)
   at Microsoft.Owin.Mapping.MapWhenMiddleware.<Invoke>d__3.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.Owin.Mapping.MapWhenMiddleware.Invoke(IDictionary`2 environment)
   at Microsoft.Owin.Mapping.MapWhenMiddleware.<Invoke>d__3.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.Owin.Mapping.MapWhenMiddleware.Invoke(IDictionary`2 environment)
   at Microsoft.Owin.Mapping.MapWhenMiddleware.<Invoke>d__3.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.Owin.Mapping.MapWhenMiddleware.Invoke(IDictionary`2 environment)
   at Microsoft.Owin.Mapping.MapWhenMiddleware.<Invoke>d__3.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.Owin.Mapping.MapWhenMiddleware.Invoke(IDictionary`2 environment)
   at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.<RunApp>d__7.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.RunApp(Func`2 entryPoint,IDictionary`2 environment,taskcompletionsource`1 tcs,StageAsyncResult result)
   at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContextStage.BeginEvent(Object sender,EventArgs e,AsyncCallback cb,Object exTradata)
   at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean& completedSynchronously)
   at System.Web.HttpApplication.PipelinestepManager.ResumeSteps(Exception error)
   at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context,AsyncCallback cb)
   at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr,HttpContext context)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedobjectsPointer,IntPtr nativeRequestContext,IntPtr moduleData,Int32 flags)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedobjectsPointer,Int32 flags)
   at System.Web.Hosting.UnsafeIISMethods.MgdindicateCompletion(IntPtr pHandler,RequestNotificationStatus& notificationStatus)
   at System.Web.Hosting.UnsafeIISMethods.MgdindicateCompletion(IntPtr pHandler,RequestNotificationStatus& notificationStatus)
   at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedobjectsPointer,Int32 flags)

解决方法

发生此错误是因为您缺少付款类型-因为它是关键字段之一,因此需要在您的请求正文中进行设置。如果它是标准付款(类型为“付款”),那么在没有“类型”的情况下可能会起作用,因为这是屏幕上的默认设置,但在您的情况下,这是“客户退款”。

我在本地进行了测试,并且在对Entity / Default / 18.200.001 / Payment / ReleasePayment进行HTTP POST时运行良好:

{
   "entity": {
      "Type": {
        "value": "Customer Refund"
      },"ReferenceNbr": {
        "value": "FTNHQ-RP0205826"
      }
   }
}