Erp 向销售订单添加预付款

Erp 向销售订单添加预付款,erp,acumatica,Erp,Acumatica,我需要在销售订单中添加预付款。会计部在Acumatica中设置了所需的类别和付款方式。我可以通过GUI实现这一点,但是当我尝试使用Web服务在销售订单上输入付款信息时,我会得到一个错误响应。错误响应为:PX.Data.PXException:错误#14:插入'SOAdjust'记录引发了一个或多个错误。请复习。错误:“Reference Nbr.”不能为空 `SO301000Content SO301000=上下文。SO301000GetSchema(); SO301000Clear() Lis

我需要在销售订单中添加预付款。会计部在Acumatica中设置了所需的类别和付款方式。我可以通过GUI实现这一点,但是当我尝试使用Web服务在销售订单上输入付款信息时,我会得到一个错误响应。错误响应为:PX.Data.PXException:错误#14:插入'SOAdjust'记录引发了一个或多个错误。请复习。错误:“Reference Nbr.”不能为空

`SO301000Content SO301000=上下文。SO301000GetSchema(); SO301000Clear()

List cmds=new List();
cmds.AddRange(新命令[]{
新值{Value=“C3”,LinkedCommand=SO301000.OrderSummary.OrderType},
新值{Value=orderNbr,LinkedCommand=SO301000.OrderSummary.orderNbr,Commit=true},
SO301000.Payments.ServiceCommands.NewRow,
新值{Value=“预付款”,LinkedCommand=SO301000.Payments.DocType},
新值{Value=paymentNbr,LinkedCommand=SO301000.Payments.ReferenceNbr,Commit=true},
//新值{Value=“3.00”,LinkedCommand=SO301000.Payments.AppliedToOrder,Commit=true},
SO301000.Actions.Save,
SO301000.OrderSummary.OrderNbr
});
string orderNumber=string.Empty;
尝试
{
var SO301000ContentReturned=context.SO301000Submit(cmds.ToArray());
orderNumber=SO301000ContentReturned[0]。OrderSummary.OrderNbr.Value;
Console.WriteLine(订单号);
}
捕获(异常)
{
orderNumber=exception.Message;
控制台写入线(例外);
}
退货订单号`

有什么建议吗?我还尝试使用AR302000屏幕将付款应用于来自付款屏幕的订单,并收到相同的错误消息。

由两个关键字段驱动的网格中存在已知的限制(在本例中:DocType+ReferenceNbr)。在这种情况下,只有第二个键应该设置Commit=true,因此需要在DocType字段上设置Commit=false。但是,您需要在schema内容对象上执行,而不是从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;
SO301000.Payments.DocType.Commit=false//这是我添加的一行
List cmds=新列表();
cmds.AddRange(新命令[]{
新值{Value=“C3”,LinkedCommand=SO301000.OrderSummary.OrderType},
新值{Value=orderNbr,LinkedCommand=SO301000.OrderSummary.orderNbr},
新值{Value=“预付款”,LinkedCommand=SO301000.Payments.DocType},
新值{Value=paymentNbr,LinkedCommand=SO301000.Payments.ReferenceNbr},
//新值{Value=“3.00”,LinkedCommand=SO301000.Payments.AppliedToOrder},
SO301000.Actions.Save,
SO301000.OrderSummary.OrderNbr
});
string orderNumber=string.Empty;
尝试
{
var SO301000ContentReturned=context.SO301000Submit(cmds.ToArray());
orderNumber=SO301000ContentReturned[0]。OrderSummary.OrderNbr.Value;
Console.WriteLine(订单号);
}
捕获(异常)
{
orderNumber=exception.Message;
控制台写入线(例外);
}
退货订单号;

注意-我确实认为应该自动设置提交标志;我将与工程团队一起检查,为什么在这种情况下没有这样做……您是否从所有其他行中删除了Commit=True?你能通过电子邮件发送一个示例控制台应用程序,指向你的开发者站点吗gmichaud@acumatica.com让我看看?
    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;