【问题标题】:Added additional fields to custom table in Acumatica has caused error. How to resolve?向 Acumatica 中的自定义表格添加附加字段导致错误。如何解决?
【发布时间】:2017-12-29 00:24:02
【问题描述】:

我们在 Acumatica 的自定义表格中添加了许多附加字段。其中一个字段导致错误。我们在 SQL Server 中进行了更改并更新了代码。有错误的字段在代码中定义:

#region LastRevisionInventoryID
[PXDBInt]       
[PXUIField(DisplayName = "Last Revision Inventory ID")]

public int LastRevisionInventoryID { get; set; }

public class lastRevisionInventoryID : IBqlField{}

#endregion

代码验证并发布,但在将字段添加到屏幕后尝试打开屏幕时出现以下错误。

堆栈跟踪:

[NullReferenceException: Object reference not set to an instance of an 
object.]
_SetValueByOrdinal(ItemBaseDocument , Int32 , Object , 
PXCacheExtension[] ) +1012
PX.Data.PXCache`1.SetValueByOrdinal(TNode data, Int32 ordinal, Object 
value, PXCacheExtension[] extensions) +84
PX.Data.PXCache`1.a(TNode A_0, TNode A_1, IDictionary A_2, 
PXCacheOperation A_3, Boolean A_4) +1273

[PXException: Error: An error occurred during processing of the field 
LastRevisionInventoryID : Object reference not set to an instance of an 
object..]
PX.Data.PXCache`1.a(TNode A_0, TNode A_1, IDictionary A_2, 
PXCacheOperation A_3, Boolean A_4) +2908
PX.Data.PXCache`1.a(TNode A_0, TNode A_1, IDictionary A_2, 
PXCacheOperation A_3) +87
PX.Data.PXCache`1.Insert(IDictionary values) +237
PX.Data.PXGraph.ExecuteInsert(String viewName, IDictionary values, 
Object[] parameters) +187
PX.Web.UI.PXBaseDataSource.a(Object[] A_0, Object[] A_1, String[] A_2, 
Boolean[] A_3, PXFilterRow[] A_4, DataSourceSelectArguments A_5) +1783
PX.Web.UI.PXBaseDataSource.ExecuteSelect(String viewName, 
DataSourceSelectArguments arguments, PXDSSelectArguments pxarguments) 
+13769
PX.Web.UI.PXDataSource.ExecuteSelect(String viewName, 
DataSourceSelectArguments arguments, PXDSSelectArguments pxarguments) 
+211
PX.Web.UI.PXDataSourceView.Select(DataSourceSelectArguments arguments, 
PXDSSelectArguments swarguments, DataSourceViewSelectCallback callback) 
+65
PX.Web.UI.PXFormDataProvider.DataBind() +381
PX.Web.UI.PXBoundPanel.PerformSelect() +134
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +138
PX.Web.UI.PXDataViewBar.OnPreRender(EventArgs e) +33
System.Web.UI.Control.PreRenderRecursiveInternal() +162
System.Web.UI.Control.PreRenderRecursiveInternal() +256
System.Web.UI.Control.PreRenderRecursiveInternal() +256
System.Web.UI.Control.PreRenderRecursiveInternal() +256
System.Web.UI.Control.PreRenderRecursiveInternal() +256
System.Web.UI.Control.PreRenderRecursiveInternal() +256
System.Web.UI.Control.PreRenderRecursiveInternal() +256
System.Web.UI.Control.PreRenderRecursiveInternal() +256
System.Web.UI.Control.PreRenderRecursiveInternal() +256
System.Web.UI.Page.ProcessRequestMain(Boolean 
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 
+6925

谁能帮忙?

【问题讨论】:

  • 我删除了对具有 int 数据类型的新字段的引用,现在它可以正常工作了。为什么下面的代码会报错:
  • #region LastRevisionInventoryID [PXDBInt] [PXUIField(DisplayName = "Last Revision Inventory ID")] public int LastRevisionInventoryID { get;放; } 公共类 lastRevisionInventoryID : IBqlField{} #endregion
  • 请参阅下面的答案。将再次生成相同的错误,直到您将所有自定义字段类型更改为 Nullable 类型。

标签: acumatica


【解决方案1】:

在 Acumatica 中,所有 DAC 字段都必须是可为空的类型,在您的情况下为 Nullable<int>int?

#region LastRevisionInventoryID
public abstract class lastRevisionInventoryID : IBqlField { }

[PXDBInt]       
[PXUIField(DisplayName = "Last Revision Inventory ID")]
public int? LastRevisionInventoryID { get; set; }
#endregion

【讨论】:

猜你喜欢
  • 2017-07-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-12-08
  • 1970-01-01
  • 1970-01-01
  • 2014-11-03
  • 1970-01-01
相关资源
最近更新 更多