错误:“发票和备忘”屏幕上的Acumatica SOAP API发布发票AR301000

问题描述

我正在尝试使用基于I210基于合同的Web服务指南中所述的SOAP API从“发票和备忘”屏幕(AR301000)发布特定电子发票。

调试我的代码,当我发布电子发票时,出现此错误

System.ServiceModel.FaultException: 'PX.Data.PXInvalidOperationException: Operation Failed ---> System.Data.sqlClient.sqlException: The multi-part identifier "LocationExtAddress.LocationBAccountID" Could not be bound.
The multi-part identifier "LocationExtAddress.LocationCD" Could not be bound.
   at System.Data.sqlClient.sqlConnection.OnError(sqlException exception,Boolean breakConnection,Action`1 wrapCloseInAction)
   at System.Data.sqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj,Boolean callerHasConnectionLock,Boolean asyncclose)
   at System.Data.sqlClient.TdsParser.TryRun(RunBehavior runBehavior,sqlCommand cmdHandler,sqlDataReader dataStream,BulkcopySimpleResultSet bulkcopyHandler,TdsParserStateObject stateObj,Boolean& dataReady)... and more error code

这是我的代码

//successful login

//Invoice data
string invoiceType = "Invoice";
string invoiceNbr = "SS-00000009";

//Find the invoice to be released
ARInvoice invoicetoFind = new ARInvoice
{
    Type = new StringSearch { Value = invoiceType },ReferenceNbr = new StringSearch { Value = invoiceNbr },Hold = new BooleanValue { Value = false }
};
ARInvoice invoice = (ARInvoice) client.Get(invoicetoFind);

//Release invoice
InvokeResult invokeResult = client.Invoke(invoice,new Release());

//Monitor the status of the process
ProcessResult processResult = LongRunProcessor.GetProcessResult(client,invokeResult);

//Get the confirmed shipment
invoice = (ARInvoice)client.Get(new ARInvoice { ID = processResult.EntityId });

//display the summary of the invoice
txtType.Text = invoice.Type.Value;
txtNumber.Text = invoice.ReferenceNbr.Value;
txtStatus.Text = invoice.Status.Value;

client.logout();

错误发生在调用行。

解决方法

首先需要确保发票未保留-如果已保留,则Get返回的实体将为空。那可能是个问题。

还可以在调用中尝试使用ReleaseInvoice()代替Release()吗?

InvokeResult invokeResult = client.Invoke(发票,新的ReleaseInvoice());

过去对我有用。