1

我需要在销售订单中添加预付款。会计已在 Acumatica 中设置了所需的课程和付款方式。我可以通过 GUI 执行此操作,但是当我尝试使用 Web 服务在销售订单上输入付款信息时,我收到了错误响应。错误响应是:PX.Data.PXException: Error #14: Inserting 'SOAdjust' 记录引发一个或多个错误。请查阅。错误:“参考编号。” 不能为空。

` SO301000Content SO301000 = context.SO301000GetSchema(); 上下文.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 屏幕将付款从付款屏幕应用到订单并收到相同的错误消息。

4

1 回答 1

1

由两个关键字段(在本例中为:DocType+ReferenceNbr)驱动的网格存在一个已知限制。在这种情况下,只有第二个键应该设置 Commit=true,因此您需要在 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;
于 2014-10-17T23:34:51.580 回答