如何使用Acumatica Contract API更改库存项目ID

问题描述 投票:0回答:1

我想使用合同API更改商品的库存ID。看来我应该能够做到这一点,但是我想我还是缺少将新的InventoryID发送给调用的方法的方法。

我正在使用Web Service端点并添加了ChangeID方法。在参数下,我添加了一个名为key的参数并映射到CD(这是对话框中调用该字段的方式,以及在更改项目订单示例中如何使用该字段),但是我不清楚如何通过映射的对象。

我有此代码:

       Dim strItemCode As String = "18r1"

        Dim TheItem As StockItem = soapClient.Get(New StockItem With {
                .InventoryID = New StringSearch With {.Value = strItemCode},
                .WarehouseDetails = New StockItemWarehouseDetail() {New StockItemWarehouseDetail With {.ReturnBehavior = ReturnBehavior.All}}})

        Dim TheInvokedResult As InvokeResult = soapClient.Invoke(TheItem, New ChangeID With {.key = New StringValue With {.Value = "18r1TJK"}})

它的工作程度实际上是确实加载了项目,但是当我尝试调用结果时,我得到了一个错误。该错误似乎使我可能传递了错误的参数,这当然是有道理的,但是文档对此确实有一些诱人的帮助,因此我认为我会稍作尝试。预先感谢。

System.ServiceModel.FaultException
  HResult=0x80131501
  Message=System.ArgumentNullException: Value cannot be null.
Parameter name: key
   at PX.Api.ContractBased.Soap.WebApiSoapController.Post(ISoapSystemContract systemContract, XmlReader requestReader, String serviceNamespace, String internalNamespace, MethodInfo method, Func`1 serviceFactory, IEdmModel edmModel)
   at PX.Api.ContractBased.Soap.WebApiSoapController.<Post>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at PX.Api.ContractBased.Soap.WebApiSoapController.<Login>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Threading.Tasks.TaskHelpersExtensions.<CastToObject>d__3`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()
  Source=mscorlib
  StackTrace:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at InventoryEditor.ServiceReference1.DefaultSoap.Invoke(Entity entity, Action action)
   at InventoryEditor.ServiceReference1.DefaultSoapClient.Invoke(Entity entity, Action action) in C:\Data Files\InventoryEditor\InventoryEditor\InventoryEditor\Connected Services\ServiceReference1\Reference.vb:line 65002
   at InventoryEditor.Form1.Button1_Click(Object sender, EventArgs e) in C:\Data Files\InventoryEditor\InventoryEditor\InventoryEditor\Form1.vb:line 24
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
   at InventoryEditor.My.MyApplication.Main(String[] Args) in :line 81
acumatica
1个回答
0
投票

嗯,原来在这里发帖是寻找答案所需的灵感。诀窍是在创建WSE扩展名时使用“填充”。然后,您可以搜索对话框,它将适当的结果填充到参数和动臂中,重命名项目代码。

© www.soinside.com 2019 - 2024. All rights reserved.