【发布时间】:2021-08-16 17:33:10
【问题描述】:
如何使用自定义插件创建自定义订单类型?我使用了来自here 的手册。我尝试从现有订单类型初始化所需的字段,但没有成功。我也尝试在图表上使用 Update 方法。每次我遇到一个常见错误时:插入“订单类型”记录至少会引发一个错误。请检查错误。并且看不到问题与哪个领域有关。我的 UpdateDatabase() 方法:
public override void UpdateDatabase()
{
SOOrderTypeMaint orderTypeGraph = PXGraph.CreateInstance<SOOrderTypeMaint>();
string newOrderTypeName = "SR";
var existingOrderType = orderTypeGraph.soordertype.Search<SOOrderType.orderType>(newOrderTypeName);
if (existingOrderType.Count != 0)
{
WriteLog(string.Format("{0} type already exist", newOrderTypeName));
}
else
{
SOOrderType exempleOrderType = SOOrderType.PK.Find(orderTypeGraph, "SO");
SOOrderTypeOperation exgrid = SOOrderTypeOperation.PK.Find(orderTypeGraph, "SO", "I");
var ourGrid = new SOOrderTypeOperation();
var sROrderType = new SOOrderType();
ourGrid.Operation = exgrid.Operation;
ourGrid.INDocType = exgrid.INDocType;
ourGrid.OrderPlanType = exgrid.OrderPlanType;
ourGrid.ShipmentPlanType = exgrid.ShipmentPlanType;
ourGrid.RequireReasonCode = exgrid.RequireReasonCode;
sROrderType.OrderType = newOrderTypeName;
sROrderType.Descr = "description";
sROrderType.Active = exempleOrderType.Active;
sROrderType.OrderNumberingID = exempleOrderType.OrderNumberingID;
sROrderType.FreightSubID = exempleOrderType.FreightSubID;
sROrderType.DiscountAcctID = exempleOrderType.DiscountAcctID;
sROrderType.DiscountSubID = exempleOrderType.DiscountSubID;
sROrderType.Behavior = exempleOrderType.Behavior;
sROrderType.DefaultOperation = exempleOrderType.DefaultOperation;
sROrderType.ARDocType = exempleOrderType.ARDocType;
sROrderType.AllowQuickProcess = exempleOrderType.AllowQuickProcess;
sROrderType.DiscSubMask = exempleOrderType.DiscSubMask;
sROrderType.CalculateFreight = exempleOrderType.CalculateFreight;
sROrderType.SalesSubMask = exempleOrderType.SalesSubMask;
sROrderType.FreightSubMask = exempleOrderType.FreightSubMask;
sROrderType.FreightAcctID = exempleOrderType.FreightAcctID;
sROrderType.InvoiceNumberingID = exempleOrderType.InvoiceNumberingID;
sROrderType.RequireShipping = exempleOrderType.RequireShipping;
orderTypeGraph.soordertype.Insert(sROrderType);
orderTypeGraph.operations.Insert(ourGrid);
orderTypeGraph.soordertype.Update(sROrderType);
orderTypeGraph.operations.Update(ourGrid);
orderTypeGraph.Save.Press();
WriteLog(string.Format("{0} type has been added", newOrderTypeName));
}
}
Acumatica 痕迹:
8/6/2021 6:27:14 PM Error:
Publishing of a customization project failed with an error CustomizationProjects:TestAssignment2
PX.Data.PXOuterException: Error: Inserting 'Order Type' record raised at least one error. Please review the errors.
at PX.Data.PXUIFieldAttribute.CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e)
at PX.Data.PXCache.OnCommandPreparing(String name, Object row, Object value, PXDBOperation operation, Type table, FieldDescription& description)
at PX.Data.PXCache`1.PersistInserted(Object row, Boolean bypassInterceptor)
at PX.Data.PXCache`1.Persist(PXDBOperation operation)
at PX.Data.PXGraph.Persist(Type cacheType, PXDBOperation operation)
at PX.Data.PXGraph.Persist()
at PX.Data.PXSave`1.d__2.MoveNext()
at PX.Data.PXAction`1.d__33.MoveNext()
at PX.Data.PXAction`1.d__33.MoveNext()
at PX.Data.PXAction`1.PressImpl(Boolean internalCall, Boolean externalCall)
at PX.Data.PXAction`1.Press()
at TestAssignment2.ServiceRepairCreator.UpdateDatabase() in D:\AcumaticaFolder\TestAssignment\App_Data\Projects\TestAssignment2\TestAssignment2\ServiceRepairCreator.cs:line 58
at Customization.CstWebsiteStorage.UpdateDatabaseFromPlugin(CustomizationPlugin plugin, PXPublishOptions options)
at Customization.CstWebsiteStorage.RunPluginsDbUpdate()
at PX.Web.Customization.Controls.Publish.RunPlugins(HttpResponse response)
【问题讨论】:
-
Acumatica 跟踪中是否有错误消息?
-
是的,我添加了问题。
-
这是跟踪中唯一的“错误”类型元素吗?
-
是的,就是这样
-
@Den251 您的系统是否启用了自定义订单类型功能?
标签: acumatica