通过基于屏幕的webservices创建SO返回抛出错误[PXRowPersistingException:错误#4:'RevisionID'不能为空]

时间:2017-03-17 09:05:24

标签: acumatica

我们有webservice集成,它一直在工作,但突然在创建RC类型订单时开始抛出以下错误。不明白到底出了什么问题。我们没有更新任何内容,所以我认为这是一些与数据相关的问题。

我通过UI尝试了相同的过程,并没有给出这个错误。请协助。非常感谢您的帮助。

  

PX.Data.PXRowPersistingException:错误#4:'RevisionID'不能   空。

     

System.Web.Services.Protocols.SoapException:服务器无法执行   处理请求。 ---&GT; PX.Data.PXRowPersistingException:错误#4:   'RevisionID'不能为空。在   PX.Data.PXDefaultAttribute.RowPersisting(PXCache发送者,   PXRowPersistingEventArgs e)at   PX.Data.PXCache.OnRowPersisting(对象项,PXDBOperation操作)   在PX.Data.PXCache 1.PersistInserted(Object row) at PX.Objects.CS.SharedRecordAttribute.RowPersisting(PXCache sender, PXRowPersistingEventArgs e) at PX.Data.PXCache.OnRowPersisting(Object item, PXDBOperation operation) at PX.Data.PXCache 1.PersistInserted(对象行)at   PX.Data.PXCache 1.Persist(PXDBOperation operation) at PX.Data.PXGraph.Persist(Type cacheType, PXDBOperation operation) at PX.Data.PXGraph.Persist() at PX.Objects.SO.SOShipmentEntry.Persist() at PX.Data.PXSave 1.d__2.MoveNext()at   PX.Data.PXAction 1.<Press>d__31.MoveNext() at PX.Data.PXAction 1.d__31.MoveNext()at   PX.Api.SyImportProcessor.SyStep.a(对象A_0,PXFilterRow [] A_1,   PXFilterRow [] A_2)at   PX.Api.SyImportProcessor.ExportTableHelper.ExportTable()at   PX.Api.ScreenUtils.Submit(String screenId,Command []命令,   SchemaMode schemaMode,PXGraph&amp; graph,String&amp; redirectContainerView,   字符串和放大器; redirectScreen,Boolean mobile,Dictionary 2 viewFilters)
at PX.Api.Services.ScreenService.Submit(String id, IEnumerable
1   命令,SchemaMode schemaMode,Boolean mobile,PXGraph&amp; forceGraph,   字符串和放大器; redirectContainerView,String&amp; redirectScreen,Dictionary 2 viewFilters) at PX.Api.Services.ScreenService.Submit(String id, IEnumerable 1个命令,SchemaMode schemaMode)at   PX.Api.Soap.Screen.ScreenGate.Submit(Command []命令)

     

---内部异常堆栈跟踪结束---

修改

此订单类型启用了自动编号,代码如下所示。 Acumatica版本6.00.1384

如前所述,此代码正常运行。突然间行为改变了,我不知道是什么原因。

    apitest.Screen context = BuisnessLogicACU.context;
                        SO301000Content SOSchema;

                        try
                        {
                            SOSchema = context.SO301000GetSchema();
                        }
                        catch
                        {
                            BuisnessLogicACU.contextLogin();
                            SOSchema = context.SO301000GetSchema();
                        }              
                        SOSchema.Actions.LSSOLineBinLotSerial.Commit = true;
                        SOSchema.Actions.CreateReceiptAction.Commit = true;

                        //HEADER INFO
                        AcumaticaInterface.apitest.Command[] commands = new AcumaticaInterface.apitest.Command[]
                    {
                        new Value
                        {
                            Value = returnInterfaceStatus.SalesOrderType,
                            LinkedCommand = SOSchema.OrderSummary.OrderType
                        },
                        SOSchema.Actions.Insert,

                        new Value 
                        {
                            Value = "false", 
                            LinkedCommand = SOSchema.OrderSummary.Hold
                        },
                        new Value 
                        {
                            Value = OrderStatus == POSOrderstatus.Normal ? (ConfigValues.POSNormalCustomerID ?? CustomerID) : CustomerID,  
                            LinkedCommand = SOSchema.OrderSummary.Customer
                        },
                        new Value 
                        {
                            Value = BizDate.HasValue ? ((DateTime)BizDate).ToLongDateString() : "", 
                            LinkedCommand = SOSchema.OrderSummary.Date
                        },
                        new Value 
                        {
                            Value = BizDate.HasValue ? ((DateTime)BizDate.Value).ToLongDateString() : "", 
                            LinkedCommand = SOSchema.OrderSummary.RequestedOn
                        },                   
                        new Value 
                        {
                            Value = POSID, 
                            LinkedCommand = SOSchema.OrderSummary.ExternalReference
                        },                
                        new Value 
                        {
                            Value = SIPosOrdrCreatedBy, 
                            LinkedCommand = SOSchema.OrderSummary.POSOrdrBy
                        },                
                        new Value 
                        {
                            Value = CustomerTaxZone, 
                            LinkedCommand = SOSchema.FinancialSettingsFinancialInformation.CustomerTaxZone
                        }
                    };

     AcumaticaInterface.apitest.Command[] commandline = new AcumaticaInterface.apitest.Command[]
                                {
                                 SOSchema.DocumentDetails.ServiceCommands.NewRow,
                                new Value 
                                {
                                    Value = line.InventoryID, 
                                    LinkedCommand = SOSchema.DocumentDetails.InventoryID 
                                },
                                new Value 
                                {
                                    Value = SIOutletCode, 
                                    LinkedCommand = SOSchema.DocumentDetails.Warehouse
                                },
                                new Value 
                                {
                                    Value = line.Quantity.ToString(), 
                                    LinkedCommand = SOSchema.DocumentDetails.Quantity,
                                    Commit = true
                                },                         
                                new Value 
                                {
                                    Value = line.UnitPrice.ToString(), 
                                    LinkedCommand = SOSchema.DocumentDetails.UnitPrice
                                },
                                new Value 
                                {
                                    Value = line.Uom, 
                                    LinkedCommand = SOSchema.DocumentDetails.UOM
                                },
                                new Value 
                                {
                                    Value = (line.DiscTotal ?? 0).ToString(), 
                                    LinkedCommand = SOSchema.DocumentDetails.DiscountAmount
                                },
                                  new Value 
                                {
                                    Value = (line.LineTotal ?? 0).ToString(), 
                                    LinkedCommand = SOSchema.DocumentDetails.ExtPrice
                                },
                                new Value 
                                {
                                    Value = line.DiscType ?? "", 
                                    LinkedCommand = SOSchema.DocumentDetails.POSDiscType
                                },
                                new Value 
                                {
                                    Value = line.LineType ?? "", 
                                    LinkedCommand = SOSchema.DocumentDetails.POSLineType
                                },
                                new Value 
                                {
                                    Value = line.VoucherSerial ?? "", 
                                    LinkedCommand = SOSchema.DocumentDetails.POSVoucherSerial
                                },
                                new Value 
                                {
                                    Value = line.PromoID ?? "", 
                                    LinkedCommand = SOSchema.DocumentDetails.POSPromoID
                                },
                                new Value 
                                {
                                    Value = line.PromoType ?? "", 
                                    LinkedCommand = SOSchema.DocumentDetails.POSPromoType
                                },
                                new Value 
                                {
                                    Value = (line.PromoPct ?? 0).ToString(), 
                                    LinkedCommand = SOSchema.DocumentDetails.POSPromoPct
                                },
                                new Value 
                                {
                                    Value = line.PromoBaseItem ?? "", 
                                    LinkedCommand = SOSchema.DocumentDetails.POSPromoBaseItem
                                },
                                //new Value 
                                //{
                                //    Value = SalesPerson, 
                                //    LinkedCommand = SOSchema.DocumentDetails.SalespersonID
                                //},
                                new Value 
                                {
                                    Value = line.Remarks ?? "", 
                                    LinkedCommand = SOSchema.DocumentDetails.NoteText,
                                    Commit = true 
                                },
                                 new Value 
                                {
                                    Value = POSID,
                                    LinkedCommand = SOSchema.DocumentDetails.PackUoM,
                                    Commit = true 
                                }
                            };
                            commands = commands.Concat(commandline).ToArray();

  AcumaticaInterface.apitest.Command[] save = new AcumaticaInterface.apitest.Command[] {
                        SOSchema.Actions.Save                       
                    };
                    commands = commands.Concat(save).ToArray();
  AcumaticaInterface.apitest.Command[] returnResult= new AcumaticaInterface.apitest.Command[] {                 
                SOSchema.OrderSummary.OrderType,
                SOSchema.OrderSummary.OrderNbr,
                SOSchema.OrderSummary.Status
            };
                commands = commands.Concat(returnResult).ToArray();

                var SOrder = context.SO301000Submit(commands)[0];

1 个答案:

答案 0 :(得分:1)

到目前为止,我已多次看到此错误消息,通常是由于错误的API命令集导致更新现有转储订单而不是创建新订单。

如果为 TR 设置 TR ,如果为编号序列启用了自动编号,请务必通过Insert操作 TR 订单类型:

Screen context = new Screen();
context.CookieContainer = new System.Net.CookieContainer();
context.Url = "http://localhost/StackOverflow/Soap/SO301000.asmx";
context.Login(username, password);
try
{
    Content salesOrderSchema = PX.Soap.Helper.GetSchema<Content>(context);
    var commands = new Command[]
    {
        new Value
        {
            LinkedCommand = salesOrderSchema.OrderSummary.OrderType,
            Value = "TR"
        },
        salesOrderSchema.Actions.Insert,
        new Value
        {
            LinkedCommand = salesOrderSchema.OrderSummary.DestinationWarehouse,
            Value = "RETAIL"
        },
        salesOrderSchema.Actions.Save,
        salesOrderSchema.OrderSummary.OrderNbr
    };
    var transferOrder = context.Submit(commands);
}
finally
{
    context.Logout();
}

或者,如果对 TR 订单类型的编号顺序禁用自动编号,则应设置OrderNumber而不是Insert操作:

Screen context = new Screen();
context.CookieContainer = new System.Net.CookieContainer();
context.Url = "http://localhost/StackOverflow/Soap/SO301000.asmx";
context.Login(username, password);
try
{
    Content salesOrderSchema = PX.Soap.Helper.GetSchema<Content>(context);
    var commands = new Command[]
    {
        new Value
        {
            LinkedCommand = salesOrderSchema.OrderSummary.OrderType,
            Value = "TR"
        },
        new Value
        {
            LinkedCommand = salesOrderSchema.OrderSummary.OrderNbr,
            Value = "NEWNUMBER"
        },
        new Value
        {
            LinkedCommand = salesOrderSchema.OrderSummary.DestinationWarehouse,
            Value = "RETAIL"
        },
        salesOrderSchema.Actions.Save,
        salesOrderSchema.OrderSummary.OrderNbr
    };
    var transferOrder = context.Submit(commands);
}
finally
{
    context.Logout();
}

以下是我能够在全新的6.00.1384网站上运行的最接近的SOAP命令集,仅部署了Sales Demo。 并且它没有任何问题。不确定如何在没有您的确切步骤的情况下在本地计算机上重现报告的问题。

Screen context = new Screen();
context.CookieContainer = new System.Net.CookieContainer();
context.Url = "http://localhost/SOReturn/Soap/SO301000.asmx";
context.Login(Login, Password);

var SOSchema = context.GetSchema();

SOSchema.Actions.LSSOLineBinLotSerial.Commit = true;
SOSchema.Actions.CreateReceiptAction.Commit = true;

//HEADER INFO
var headerCommands = new Command[]
{
    new Value
    {
        Value = "RC",
        LinkedCommand = SOSchema.OrderSummary.OrderType
    },
    SOSchema.Actions.Insert,

    new Value
    {
        Value = "false",
        LinkedCommand = SOSchema.OrderSummary.Hold
    },
    new Value
    {
        Value = "ABARTENDE",
        LinkedCommand = SOSchema.OrderSummary.Customer
    },
    //new Value
    //{
    //    Value = BizDate.HasValue ? ((DateTime)BizDate).ToLongDateString() : "",
    //    LinkedCommand = SOSchema.OrderSummary.Date
    //},
    //new Value
    //{
    //    Value = BizDate.HasValue ? ((DateTime)BizDate.Value).ToLongDateString() : "",
    //    LinkedCommand = SOSchema.OrderSummary.RequestedOn
    //},
    new Value
    {
        Value = "TEST",
        LinkedCommand = SOSchema.OrderSummary.ExternalReference
    },
    //new Value
    //{
    //    Value = SIPosOrdrCreatedBy,
    //    LinkedCommand = SOSchema.OrderSummary.POSOrdrBy
    //},
    //new Value
    //{
    //    Value = CustomerTaxZone,
    //    LinkedCommand = SOSchema.FinancialSettingsFinancialInformation.CustomerTaxZone
    //}
};

var commandline = new Command[]
{
    SOSchema.DocumentDetails.ServiceCommands.NewRow,

    new Value
    {
        Value = "AACOMPUT01",
        LinkedCommand = SOSchema.DocumentDetails.InventoryID
    },
    new Value
    {
        Value = "WHOLESALE",
        LinkedCommand = SOSchema.DocumentDetails.Warehouse
    },
    new Value
    {
        Value = "10.0",
        LinkedCommand = SOSchema.DocumentDetails.Quantity,
        Commit = true
    },
    new Value
    {
        Value = "234.01",
        LinkedCommand = SOSchema.DocumentDetails.UnitPrice
    },
    new Value
    {
        Value = "EA",
        LinkedCommand = SOSchema.DocumentDetails.UOM
    },
    new Value
    {
        Value = "50.0",
        LinkedCommand = SOSchema.DocumentDetails.DiscountAmount
    },
    new Value
    {
        Value = "4500.00",
        LinkedCommand = SOSchema.DocumentDetails.ExtPrice,
        Commit = true
    },
    //new Value
    //{
    //    Value = line.DiscType ?? "",
    //    LinkedCommand = SOSchema.DocumentDetails.POSDiscType
    //},
    //new Value
    //{
    //    Value = line.LineType ?? "",
    //    LinkedCommand = SOSchema.DocumentDetails.POSLineType
    //},
    //new Value
    //{
    //    Value = line.VoucherSerial ?? "",
    //    LinkedCommand = SOSchema.DocumentDetails.POSVoucherSerial
    //},
    //new Value
    //{
    //    Value = line.PromoID ?? "",
    //    LinkedCommand = SOSchema.DocumentDetails.POSPromoID
    //},
    //new Value
    //{
    //    Value = line.PromoType ?? "",
    //    LinkedCommand = SOSchema.DocumentDetails.POSPromoType
    //},
    //new Value
    //{
    //    Value = (line.PromoPct ?? 0).ToString(),
    //    LinkedCommand = SOSchema.DocumentDetails.POSPromoPct
    //},
    //new Value
    //{
    //    Value = line.PromoBaseItem ?? "",
    //    LinkedCommand = SOSchema.DocumentDetails.POSPromoBaseItem
    //},
    new Value
    {
        Value = "Remarks",
        LinkedCommand = SOSchema.DocumentDetails.NoteText,
        Commit = true
    },
    //new Value
    //{
    //    Value = POSID,
    //    LinkedCommand = SOSchema.DocumentDetails.PackUoM,
    //    Commit = true
    //}
};

var commands = headerCommands.Concat(commandline).ToArray();

Command[] save = new Command[] 
{
    SOSchema.Actions.Save
};
commands = commands.Concat(save).ToArray();
Command[] returnResult = new Command[] 
{
    SOSchema.OrderSummary.OrderType,
    SOSchema.OrderSummary.OrderNbr,
    SOSchema.OrderSummary.Status
};
commands = commands.Concat(returnResult).ToArray();

var SOrder = context.Submit(commands)[0];