【问题标题】:Optimization cannot be performed error when trying to get sales price for specific item in acumatica尝试获取 acumatica 中特定商品的销售价格时无法执行优化错误
【发布时间】:2019-02-27 08:32:34
【问题描述】:

我正在尝试获取 acumatica 中特定商品的销售价格。

我通过邮递员向这个 URL 发送了 GET 请求:

https://my-acumarica-url/entity/Default/17.200.001/SalesPricesInquiry/?$filter=InventoryID eq '1000004'

我收到以下错误:

{
"message": "An error has occurred.",
"exceptionMessage": "Optimization cannot be performed.The following fields cause the error:\r\nEffectiveAsOf: View Filter has BQL delegate\r\nPriceWorkgroupIsMine: View Filter has BQL delegate\r\nInventoryID: View Filter has BQL delegate\r\nItemClassID: View Filter has BQL delegate\r\nPriceClass: View Filter has BQL delegate\r\nPriceCode: View Filter has BQL delegate\r\nPriceManager: View Filter has BQL delegate\r\nPriceManagerIsMe: View Filter has BQL delegate\r\nPriceType: View Filter has BQL delegate\r\nPriceWorkgroup: View Filter has BQL delegate\r\n",
"exceptionType": "PX.Api.ContractBased.OptimizedExport.CannotOptimizeException",
"stackTrace": "   at PX.Api.ContractBased.OptimizedExport.NotWorkingOptimizedExportProvider.get_CanOptimize()\r\n   at PX.Api.ContractBased.EntityService.GetList(ISystemContract systemContract, String version, String name, EntityImpl entity, Boolean returnFullEntities, CbOperationContext operationContext, Boolean ignoreValueFields, PXGraph graph)\r\n   at PX.Api.ContractBased.Soap.SoapFacadeBase.GetListImpl(Entity entity, Boolean returnFullEntities)\r\n   at PX.Api.ContractBased.SystemContracts.V2.RestController.GetList(String objectName, String select, String filter, String expand, String custom, Nullable`1 skip, Nullable`1 top)\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(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__0.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__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.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>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.<ExecuteActionFilterAsyncCore>d__0.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__2.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__2.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__0.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__0.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__1.MoveNext()"
}

【问题讨论】:

    标签: rest api acumatica endpoint


    【解决方案1】:

    SalesPricesInquiry 是一个查询,应通过PUT 访问,如documentation says

    【讨论】:

    • 谢谢!您的链接会打开文档的首页,而不是显示 SalesPricesInquiry 信息的页面。 “Web 服务端点”有一些文档,但还不够(比如应该使用 PUT/GET)。详细说明所有查询及其选项/参数的网站链接会很有帮助。
    【解决方案2】:

    根据默认/17.200.001/swagger.json

    "/InventorySummaryInquiry": {
     "put": {
        "tags": [
          "InventorySummaryInquiry"
        ],
        "summary": "Creates a record or updates an existing record.",
        "operationId": "InventorySummaryInquiry_PutEntity",
        "consumes": [
          "application/json",
          "text/json"
        ],
        "produces": [
          "application/json",
          "text/json"
        ],
    

    “PUT”将导致创建库存条目。

    当我“PUT”默认/17.200.001/InventorySummaryInquiry

     {"WarehouseID" : {"Value":"MSE01"}}
    

    我得到回应

    {
      "id": "497b52a8-8a81-4345-bcaa-9b607231886b",
      "rowNumber": 1,
      "note": null,
      "ExpandByLotSerialNbr": {},
      "InventoryID": {},
      "LocationID": {},
      "WarehouseID": {},
      "custom": {},
      "files": []
    }
    

    这对我来说没有意义。我在“MSE01”仓库中有 2000 多件物品。

    每次我尝试这个时都会得到一个新的“id”,这可能意味着正在创建一个新条目,这就是返回的内容?

    【讨论】:

    • Swagger 文档不正确。由于这是 Acumatica 上的查询表单,因此通过 API 使用它需要一个 PUT,因为这是 Acumatica 在内部获取数据的方式。在我的 Acumatica 查询中,ProductID 是必需的,所以我不能只将其留空并希望获得所有项目的列表。 - 要获得真正的库存清单,我必须创建一个通用查询并弄清楚如何使其 REST API 可访问。
    猜你喜欢
    • 1970-01-01
    • 2017-07-09
    • 2019-08-27
    • 1970-01-01
    • 1970-01-01
    • 2019-09-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多