2014-10-17 66 views
1

我有要求將預付款添加到銷售訂單。會計在Acumatica中設置了所需的課程和付款方式。我可以通過GUI完成此操作,但是當我嘗試使用Web Service輸入銷售訂單上的付款信息時,我收到錯誤響應。錯誤響應是:PX.Data.PXException:錯誤#14:插入'SOAdjust'記錄引發了一個或多個錯誤。請查閱。錯誤:'參考號碼'可能不是空的。將預付款添加到銷售訂單

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

 List<Command> cmds = new List<Command>(); 
     cmds.AddRange(new Command[]{ 

      new Value {Value = "C3", LinkedCommand = SO301000.OrderSummary.OrderType}, 
      new Value { Value = orderNbr, LinkedCommand = SO301000.OrderSummary.OrderNbr, Commit = true}, 

      SO301000.Payments.ServiceCommands.NewRow, 

      new Value { Value = "Prepayment", LinkedCommand = SO301000.Payments.DocType}, 
      new Value { Value = paymentNbr, LinkedCommand = SO301000.Payments.ReferenceNbr, Commit = true }, 
      // new Value { Value = "3.00" , LinkedCommand = SO301000.Payments.AppliedToOrder, Commit = true}, 

      SO301000.Actions.Save, 
      SO301000.OrderSummary.OrderNbr 
     }); 

     string orderNumber = string.Empty; 

     try 
     { 
      var SO301000ContentReturned = context.SO301000Submit(cmds.ToArray()); 
      orderNumber = SO301000ContentReturned[0].OrderSummary.OrderNbr.Value; 
      Console.WriteLine(orderNumber); 
     } 
     catch (Exception exception) 
     { 
      orderNumber = exception.Message; 
      Console.WriteLine(exception); 
     } 


     return orderNumber;` 

有什麼建議嗎?我曾嘗試使用AR302000屏幕以將付款應用於付款屏幕中的訂單,並收到相同的錯誤消息。

回答

1

在由兩個關鍵字段(在這種情況下爲DocType + ReferenceNbr)驅動的網格中存在已知的限制。在這種情況下,只有第二個鍵應該具有Commit = true set,因此您需要在DocType字段上設置Commit = false。但是不要從Value對象執行它,你需要在模式內容對象上執行它。

另一個Commit = true和NewRow命令是不必要的。我已經編輯了下面的原始代碼,這是它應該看起來如何:

SO301000.Payments.DocType.Commit = false; //This is the line that I added 
    List<Command> cmds = new List<Command>(); 
    cmds.AddRange(new Command[]{ 
     new Value {Value = "C3", LinkedCommand = SO301000.OrderSummary.OrderType}, 
     new Value { Value = orderNbr, LinkedCommand = SO301000.OrderSummary.OrderNbr}, 

     new Value { Value = "Prepayment", LinkedCommand = SO301000.Payments.DocType}, 
     new Value { Value = paymentNbr, LinkedCommand = SO301000.Payments.ReferenceNbr}, 
     //new Value { Value = "3.00" , LinkedCommand = SO301000.Payments.AppliedToOrder}, 

     SO301000.Actions.Save, 
     SO301000.OrderSummary.OrderNbr 
    }); 

    string orderNumber = string.Empty; 

    try 
    { 
     var SO301000ContentReturned = context.SO301000Submit(cmds.ToArray()); 
     orderNumber = SO301000ContentReturned[0].OrderSummary.OrderNbr.Value; 
     Console.WriteLine(orderNumber); 
    } 
    catch (Exception exception) 
    { 
     orderNumber = exception.Message; 
     Console.WriteLine(exception); 
    } 


    return orderNumber; 
+0

注意 - 我確實應該自動設置提交標誌;我要去諮詢工程團隊爲什麼在這種情況下沒有完成... – Gabriel 2014-10-18 15:43:05

+0

仍然是同樣的錯誤信息。 – Spyder045 2014-10-20 15:17:44

+0

您是否從其他所有行刪除了Commit = True?您可以通過[email protected]通過電子郵件向您的開發站點發送一個示例控制檯應用程序供我查看嗎? – Gabriel 2014-10-20 15:21:45

相關問題