不能使用Acumatica中的Web服务通过特定账单进行预付款的抵销流程

时间:2017-04-21 07:34:48

标签: web-services acumatica

我在使用特定帐单文件的预付款文件的处理过程中遇到了问题。它仅适用于1个供应商,因为该供应商提供了大量预付款文件(它有超过6000条记录)。

以下是我的代码。

sCon.getLoginSettlementVoucher(context);
                        AP301000Content billSchema2 = context.AP301000GetSchema();
                        List<Command> cmds = new List<Command>();
                        billSchema2.DocumentSummary.Type.Commit = false;
                        billSchema2.DocumentSummary.Type.LinkedCommand = null;

                        var command2 = new Command[]
                        {
                            new Value { Value = docTypeSV, 
                                        LinkedCommand = billSchema2.DocumentSummary.Type},
                            new Value { Value = refNbrSV, 
                                        LinkedCommand = billSchema2.DocumentSummary.ReferenceNbr},
                            billSchema2.Applications.DocTypeDisplayDocType,
                            billSchema2.Applications.ReferenceNbrDisplayRefNbr,
                            billSchema2.Applications.Balance,
                            billSchema2.Applications.AmountPaid
                        };

                        try
                        {
                            var applications = context.AP301000Export(command2, null, 0, false, true);
                            int rowApp = applications.Count(); int ind = 0;
                            foreach (var data in applications)
                            {
                                string docTypeApp = data[0].ToString();
                                string refNbrApp = data[1].ToString();
                                string balanceApp = data[2].ToString();
                                decimal balApp = Convert.ToDecimal(balanceApp);
                                string amountPaid = data[3].ToString();
                                string index = ind.ToString();

                                if (refNbrApp == AcuRefNbr)
                                {
                                    billSchema2.DocumentSummary.Type.Commit = false;
                                    billSchema2.DocumentSummary.Type.LinkedCommand = null;
                                    billSchema2.Applications.ReferenceNbrDisplayRefNbr.LinkedCommand = null;

                                    cmds.Add(new Value { LinkedCommand = billSchema2.DocumentSummary.Type, Value = "Bill" });
                                    cmds.Add(new Value { LinkedCommand = billSchema2.DocumentSummary.ReferenceNbr, Value = refNbrSV });
                                    cmds.Add(new Value { LinkedCommand = billSchema2.DocumentSummary.Vendor, Value = vVendCode });
                                    cmds.Add(new Key
                                    {
                                        ObjectName = billSchema2.Applications.DocTypeDisplayDocType.ObjectName,
                                        FieldName = billSchema2.Applications.DocTypeDisplayDocType.FieldName,
                                        Value = docTypeApp
                                    });
                                    cmds.Add(new Key
                                    {
                                        ObjectName = billSchema2.Applications.ReferenceNbrDisplayRefNbr.ObjectName,
                                        FieldName = billSchema2.Applications.ReferenceNbrDisplayRefNbr.FieldName,
                                        Value = refNbrApp
                                    });

                                    cmds.Add(new Value { LinkedCommand = billSchema2.Applications.ServiceCommands.RowNumber, Value = index });

                                    if (docAmtSV == balApp)
                                        cmds.Add(new Value { LinkedCommand = billSchema2.Applications.AmountPaid, Value = docAmountSV });


                                    else if (docAmtSV < balApp)
                                        cmds.Add(new Value { LinkedCommand = billSchema2.Applications.AmountPaid, Value = docAmountSV });
                                    else if (docAmtSV > balApp)
                                        cmds.Add(new Value { LinkedCommand = billSchema2.Applications.AmountPaid, Value = balanceApp });

                                    cmds.Add(billSchema2.Actions.Save);
                                    var result2 = context.AP301000Submit(cmds.ToArray());

                                }
                                else
                                {
                                    continue;
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            continue;
                        } 

然后我在提交过程中收到了如下所示的异常消息。

 Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'.

 The request failed with the error message:

--

<!DOCTYPE html>

<html>

<head>

    <title>Request timed out.</title>

    <meta name="viewport" content="width=device-width" />

    <style>

     body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} 

     p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}

     b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}

     H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }

     H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }

     pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}

     .marker {font-weight: bold; color: black;text-decoration: none;}

     .version {color: gray;}

     .error {margin-bottom: 10px;}

     .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }

     @media screen and (max-width: 639px) {

      pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }

     }

     @media screen and (max-width: 479px) {

      pre { width: 280px; }

     }

    </style>

</head>



<body bgcolor="white">



        <span><H1>Server Error in '/AcuInterface' Application.<hr width=100% size=1 color=silver></H1>



        <h2> <i>Request timed out.</i> </h2></span>



        <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">



        <b> Description: </b>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.



        <br><br>



        <b> Exception Details: </b>System.Web.HttpException: Request timed out.<br><br>



        <b>Source Error:</b> <br><br>



        <table width=100% bgcolor="#ffffcc">

           <tr>

              <td>

                  <code>



  An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</code>



              </td>

           </tr>

        </table>



        <br>



        <b>Stack Trace:</b> <br><br>



        <table width=100% bgcolor="#ffffcc">

           <tr>

              <td>

                  <code><pre>



[HttpException (0x80004005): Request timed out.]

</pre></code>



              </td>

           </tr>

        </table>



        <br>



        <hr width=100% size=1 color=silver>



        <b>Version Information:</b> Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1098.0



        </font>



</body>

--.

2 个答案:

答案 0 :(得分:0)

由于您收到的错误表示超时,并且您只是为拥有大约或超过6000个预付款文档的一个供应商获取该错误,因此您可能希望在拨打电话之前增加超时值。 此问题涉及增加基于屏幕的API调用的超时值:Link

要恢复在那里说的话,请使用以下行将计时器设置为更大的值。

context.Timeout = 700000;

答案 1 :(得分:0)

我已经解决了这个问题,我只需要在Acumatica ERP实例文件夹中的web.config文件中增加HttpExecution的超时。 .............. ..............

默认Acumatica将此超时设置为300.这意味着300秒或5分钟