Acumatica 打电话后我能得到发票参考号吗;“准备发票”;来自「;行动“;菜单通过网络API?

Acumatica 打电话后我能得到发票参考号吗;“准备发票”;来自「;行动“;菜单通过网络API?,acumatica,Acumatica,我试图使用web API准备发票,方法是从销售订单屏幕SO301000顶部的“操作”菜单调用“准备发票”,然后在发票SO303000上发布此发票,成功准备发票后,我需要知道发票参考号才能发布此发票,但我无法找到获取此参考号的方法,也无法从退货信息中验证操作是否成功。我的代码如下: SO301000Content SO301000 = context.SO301000GetSchema(); context.SO301000Clear();

我试图使用web API准备发票,方法是从销售订单屏幕SO301000顶部的“操作”菜单调用“准备发票”,然后在发票SO303000上发布此发票,成功准备发票后,我需要知道发票参考号才能发布此发票,但我无法找到获取此参考号的方法,也无法从退货信息中验证操作是否成功。我的代码如下:

            SO301000Content SO301000 = context.SO301000GetSchema();
            context.SO301000Clear();

            SO301000.Actions.PrepareInvoiceAction.Commit = true;

            List<Command> cmds = new List<Command>();

            cmds.Add(new Value { Value = soType, LinkedCommand = SO301000.OrderSummary.OrderType});
            cmds.Add(new Value { Value = soNbr, LinkedCommand = SO301000.OrderSummary.OrderNbr });
            cmds.Add(new Value { Value = customerCD, LinkedCommand = SO301000.OrderSummary.Customer, Commit = true });
            cmds.Add(new Value { Value = customerLocation, LinkedCommand = SO301000.OrderSummary.Location});

            cmds.Add(SO301000.Actions.PrepareInvoiceAction);
            cmds.Add(SO301000.Actions.Save);

            SO301000Content[] SO30100content = context.SO301000Submit(cmds.ToArray());

            //Check whether invoice is successfully prepared and return reference No if it's successful. 
            Thread.Sleep(2000);
            List<InvoiceInfo> InvoiceList = this.GetInvoiceInfoBySO(soNbr);
            if (InvoiceList.Count > 0)
            {
                //successful
            }
            else
            {
                .....//failed
            }
SO301000内容SO301000=context.SO301000GetSchema();
SO301000Clear();
SO301000.Actions.PrepareInvoiceAction.Commit=true;
List cmds=新列表();
Add(新值{Value=soType,LinkedCommand=SO301000.OrderSummary.OrderType});
Add(新值{Value=soNbr,LinkedCommand=SO301000.OrderSummary.OrderNbr});
Add(新值{Value=customerCD,LinkedCommand=SO301000.OrderSummary.Customer,Commit=true});
Add(新值{Value=customerLocation,LinkedCommand=SO301000.OrderSummary.Location});
cmds.Add(SO301000.Actions.PrepareInvoiceAction);
添加(SO301000.Actions.Save);
SO301000Content[]SO30100content=context.SO301000Submit(cmds.ToArray());
//检查发票是否成功准备,如果成功则返回参考号。
《睡眠》(2000年);
List InvoiceList=this.GetInvoiceInfoBySO(soNbr);
如果(InvoiceList.Count>0)
{
//成功的
}
其他的
{
..…//失败了
}
有人知道如何验证该操作是否成功,并且最好以某种方式获得发票参考号吗

现在,我调用了一个通用查询来获取基于订单号的发票参考号,这有点有效-这将是我的另一个问题(只有当我在代码中加入一些睡眠时,它才有效,否则我仍然无法获取新的参考号-似乎有一个bug导致某种延迟),但我会提出另一个问题

谢谢

更新:抱歉,我复制了错误的代码,现在已经更新了。

好的

因此,在提交命令后,可以执行以下操作来检查处理是否已完成

SO301000Content[]SO30100content=context.SO301000Submit(cmds.ToArray())


为了获得准备好的发票号,我所做的是,我尝试取回销售订单文档,并从“装运”选项卡读取发票号。

谢谢!代码运行良好,比“sleep()”好得多。
var status = context.SO301000GetProcessStatus();
                            while (status.Status == ProcessStatus.InProcess)
                            {
                                status = context.SO301000GetProcessStatus();
                            }