使用最新版本的Acumatica 5以及最新和最好的更新,我遇到了一个我无法解决的Web API问题。我有代码在客户屏幕上执行“扩展到供应商”操作。它似乎运行良好,并没有错误,但它无法创建供应商。在我看来,当通过网站界面执行相同的操作时,问题是我没有发送正确的命令来选择弹出警告框中的“是”按钮“请确认您是否要更新当前的供应商设置使用Vendor Class默认值。原始设置将以其他方式保留。“我可以完全关闭,任何帮助将不胜感激。
这是我的代码:
String customerId = "SomeCustomerId";
String vendorClass = “SomeVendorClass”;
AcumaticaApiWS.AR303000Content AR303000 = context.AR303000GetSchema();
AcumaticaApiWS.AP303000Content AP303000 = context.AP303000GetSchema();
context.AR303000Clear();
AR303000.Actions.ExtendToVendor.Commit = true;
AcumaticaApiWS.AR303000Content[] AR303000result = context.AR303000Submit
(
new AcumaticaApiWS.Command[]
{
new AcumaticaApiWS.Value { Value = customerId, LinkedCommand = AR303000.CustomerSummary.CustomerID },
AR303000.Actions.ExtendToVendor
}
);
AcumaticaApiWS.AP303000Content[] AP303000result = context.AP303000Submit
(
new AcumaticaApiWS.Command[]
{
new AcumaticaApiWS.Value { Value = vendorClass, LinkedCommand = AP303000.GeneralInfoFinancialSettings.VendorClass },
new AcumaticaApiWS.Value { Value = "YES", LinkedCommand = AP303000.GeneralInfoFinancialSettings.ServiceCommands.DialogAnswer, Commit = true },
AP303000.Actions.Save
}
);
谢谢!
答案 0 :(得分:4)
你快到了。这不是一个简单的场景,因为它涉及多个屏幕和对话框,这两件事情并不容易使用。代码示例中的问题是:
AP303000.VendorSummary.ServiceCommands.DialogAnswer
)的主视图上设置对话框答案,其中显示对话框。没有查看源代码就无法知道这一点,但我相信这通常是对话框的情况。 Commit = true
个不同的设置(但在这种情况下不要受伤)。这是我使用的代码,在我的情况下,它将客户扩展到供应商并同时更改供应商类:
String customerId = "ACTIVESTAF";
String vendorClass = "DATACENTER";
AcumaticaApiWS.AR303000Content AR303000 = context.AR303000GetSchema();
AcumaticaApiWS.AP303000Content AP303000 = context.AP303000GetSchema();
context.AR303000Clear();
AcumaticaApiWS.AR303000Content[] AR303000result = context.AR303000Submit
(
new AcumaticaApiWS.Command[]
{
new AcumaticaApiWS.Value { Value = customerId, LinkedCommand = AR303000.CustomerSummary.CustomerID },
AR303000.Actions.ExtendToVendor
}
);
AcumaticaApiWS.AP303000Content[] AP303000result = context.AP303000Submit
(
new AcumaticaApiWS.Command[]
{
new AcumaticaApiWS.Value { Value = "Yes", LinkedCommand = AP303000.VendorSummary.ServiceCommands.DialogAnswer },
new AcumaticaApiWS.Value { Value = vendorClass, LinkedCommand = AP303000.GeneralInfoFinancialSettings.VendorClass },
AP303000.Actions.Save
}
);