【问题标题】:Adding prepayment to a Sales Order向销售订单添加预付款
【发布时间】:2014-12-13 11:13:04
【问题描述】:

我需要在销售订单中添加预付款。会计已在 Acumatica 中设置了所需的课程和付款方式。我可以通过 GUI 执行此操作,但是当我尝试使用 Web 服务在销售订单上输入付款信息时,我收到了错误响应。错误响应是:PX.Data.PXException: Error #14: Inserting '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 屏幕从付款屏幕将付款应用到订单并收到相同的错误消息。

【问题讨论】:

    标签: erp acumatica


    【解决方案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;
    

    【讨论】:

    • 注意 - 我确实认为应该自动设置提交标志;我将与工程团队核实为什么在这种情况下没有完成...
    • 您是否从所有其他行中删除了 Commit = True ?您能否通过电子邮件将指向您的开发站点的示例控制台应用程序发送到 gmichaud@acumatica.com 供我查看?
    猜你喜欢
    • 1970-01-01
    • 2016-07-16
    • 2012-05-01
    • 2018-08-25
    • 2022-12-20
    • 2019-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多