【发布时间】:2021-10-26 20:19:23
【问题描述】:
(以下都是我通过 Postman 直接向 Acumatica 发送请求)
在将文件附加到购买收据之前,我可以根据需要更新任何购买收据。在 Acumatica 中将文件附加到购买收据后,我似乎无法在此之后更新购买收据并开始收到“序列不包含匹配元素”错误。将文件附加到购买收据是否会改变我不知道的事情?提前感谢您的帮助!
这是一个发送到 Acumatica 以将收据数量更新为 33 的示例 PUT 请求正文(如果没有附加文件,则确认可以工作,附加文件后不工作):
{
"id": "d5c53b1c-0b06-ed11-8312-0a72f5e849b2",
"rowNumber": 1,
"note": {
"value": ""
},
"BaseCurrencyID": {
"value": "CAD"
},
"BillDate": {
"value": "2021-08-25T00:00:00+00:00"
},
"Branch": {
"value": "BOE"
},
"ControlQty": {
"value": 2.000000
},
"CreateBill": {
"value": false
},
"CurrencyEffectiveDate": {
"value": "2020-12-29T00:00:00+00:00"
},
"CurrencyID": {
"value": "CAD"
},
"CurrencyRate": {
"value": 1.00000000
},
"CurrencyRateTypeID": {},
"CurrencyReciprocalRate": {
"value": 1.00000000
},
"Date": {
"value": "2021-08-25T00:00:00+00:00"
},
"Details": [
{
"id": "d5c53b1c-0b06-ed11-8312-0a72f5e849b2",
"rowNumber": 1,
"note": {
"value": ""
},
"Account": {
"value": "5000"
},
"AccrualAccount": {
"value": "2000"
},
"AccrualSubaccount": {
"value": "000"
},
"Branch": {
"value": "BOE"
},
"Description": {
"value": "Cost of Purchase"
},
"EditableUnitCost": {
"value": true
},
"EstimatedINExtendedCost": {
"value": 312.0000
},
"ExtendedCost": {
"value": 312.0000
},
"FinalINExtendedCost": {},
"InventoryID": {
"value": "E10003"
},
"LineNbr": {
"value": 1
},
"LineType": {
"value": "Non-Stock"
},
"OpenQty": {
"value": 0.0
},
"OrderedQty": {
"value": 1.000000
},
"POLineNbr": {
"value": 1
},
"POOrderNbr": {
"value": "000003"
},
"POOrderType": {
"value": "Normal"
},
"POReceiptLineNbr": {},
"POReceiptNbr": {},
"ReceiptQty": {
"value": 33.000000
},
"Subaccount": {
"value": "000"
},
"TransactionDescription": {
"value": "Ladder - 24' Aluminum Extension Ladder"
},
"TransferOrderLineNbr": {},
"TransferOrderNbr": {},
"TransferOrderType": {},
"TransferShipmentNbr": {},
"UnitCost": {
"value": 22.0000
},
"UOM": {
"value": "EA"
},
"custom": {}
}
],
"Hold": {
"value": true
},
"Location": {
"value": "MAIN"
},
"PostPeriod": {
"value": "082021"
},
"ProcessReturnWithOriginalCost": {
"value": false
},
"ReceiptNbr": {
"value": "000138"
},
"Status": {
"value": "On Hold"
},
"TotalCost": {
"value": 213.0000
},
"TotalQty": {
"value": 2.000000
},
"Type": {
"value": "Receipt"
},
"UnbilledQuantity": {
"value": 2.000000
},
"VendorID": {
"value": "GROPWA"
},
"VendorRef": {},
"custom": {},
"files": [
{
"id": "6f621043-a8z4-4a89-b34f-910d399e31c0",
"filename": "Purchase Receipts (RT, 000138)\\Sample.txt",
"href": "/entity/Purchasing/20.200.001/files/6f621043-a8z4-4a89-b34f-910d399e31c0"
}
]
}
以下是尝试更新后收到的错误响应:
{
"message": "An error has occurred.",
"exceptionMessage": "Sequence contains no matching element",
"exceptionType": "System.InvalidOperationException",
"stackTrace": " at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)\r\n at PX.Api.ContractBased.EntityExportContextBuilder.ExtractFieldMappingKeyForDetail(String mappingKey, EntityField field, EntityMappingProjection[] entityFields, IMetadataProvider metadataProvider, IEntityMappingKeyService entityMappingKeyService, String endpointName, String version)\r\n at PX.Api.ContractBased.EntityExportContextBuilder.EntityFieldsOrderComparer.Compare(EntityField x, EntityField y)\r\n at System.Linq.EnumerableSorter`2.CompareKeys(Int32 index1, Int32 index2)\r\n at System.Linq.EnumerableSorter`1.QuickSort(Int32[] map, Int32 left, Int32 right)\r\n at System.Linq.EnumerableSorter`1.Sort(TElement[] elements, Int32 count)\r\n at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__1.MoveNext()\r\n at PX.Api.ContractBased.EntityExportContextBuilder.BuildPutCommands(EntityImpl entity, String mappingKey, Boolean newEntity, EntityMappingProjectionWrapper[] orderedMappedFields, ISet`1 preProcessedFields, Boolean isDetail)\r\n at PX.Api.ContractBased.EntityExportContextBuilder.BuildContextForPutOrInvoke(EntityDescriptor descriptor, Boolean isNewEntity, Action`2 appendActionsDelegate)\r\n at PX.Api.ContractBased.EntityService.Put(ISystemContract systemContract, String version, String name, EntityImpl entity, CbOperationContext operationContext, Boolean throwOnError)\r\n at PX.Api.ContractBased.Soap.SoapFacadeBase.PutImpl(EntityImpl entity, Boolean throwOnValidationError)\r\n at PX.Api.ContractBased.SystemContracts.V2.RestController.PutEntity(EntityImpl entity, String select, String filter, String expand, String custom)\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.<GetExecutor>b__2(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()"
}
【问题讨论】:
-
您应该使用单独的
PUT请求来附加文件。 help-2021r1.acumatica.com/…