Acumatica 将数据保存到不同的公司

Acumatica 将数据保存到不同的公司,acumatica,Acumatica,我们有代码在Acumatica BLC中使用Acumatica Web服务,因为我们希望将数据保存到其他公司。我知道了不使用Web服务的另一种方法,比如“公司上下文”之类的,但是我找不到任何引用 是否存在创建具有不同公司上下文的屏幕图形以将数据保存到该公司的现有示例?要将数据保存到不同的公司,您应该在PXLoginScope中执行代码。在下面的示例中,新库存项目保存在newcommpany租户下: using (PXLoginScope ls = new PXLoginScope("admin@

我们有代码在Acumatica BLC中使用Acumatica Web服务,因为我们希望将数据保存到其他公司。我知道了不使用Web服务的另一种方法,比如“公司上下文”之类的,但是我找不到任何引用


是否存在创建具有不同公司上下文的屏幕图形以将数据保存到该公司的现有示例?

要将数据保存到不同的公司,您应该在PXLoginScope中执行代码。在下面的示例中,新库存项目保存在
newcommpany
租户下:

using (PXLoginScope ls = new PXLoginScope("admin@NewCompany"))
{
    InventoryItemMaint maint = PXGraph.CreateInstance<InventoryItemMaint>();
    InventoryItem item = new InventoryItem();
    item.InventoryCD = "TEST";
    item = maint.Item.Insert(item);
    item.ItemClassID = "ALLOTHER";
    maint.Item.Update(item);
    maint.Actions.PressSave();
}
使用(PXLoginScope ls=new PXLoginScope(“admin@NewCompany"))
{
InventoryItemMaint maint=PXGraph.CreateInstance();
InventoryItem=新的InventoryItem();
item.InventoryCD=“测试”;
项目=维护项目。插入(项目);
item.itemsclassid=“分配者”;
维护项目更新(项目);
maint.Actions.按Save();
}

要将数据保存到其他公司,您应该在PXLoginScope中执行代码。在下面的示例中,新库存项目保存在
newcommpany
租户下:

using (PXLoginScope ls = new PXLoginScope("admin@NewCompany"))
{
    InventoryItemMaint maint = PXGraph.CreateInstance<InventoryItemMaint>();
    InventoryItem item = new InventoryItem();
    item.InventoryCD = "TEST";
    item = maint.Item.Insert(item);
    item.ItemClassID = "ALLOTHER";
    maint.Item.Update(item);
    maint.Actions.PressSave();
}
使用(PXLoginScope ls=new PXLoginScope(“admin@NewCompany"))
{
InventoryItemMaint maint=PXGraph.CreateInstance();
InventoryItem=新的InventoryItem();
item.InventoryCD=“测试”;
项目=维护项目。插入(项目);
item.itemsclassid=“分配者”;
维护项目更新(项目);
maint.Actions.按Save();
}