在Acumatica中为自定义表添加了其他字段导致错误。怎么解决?

时间:2017-12-29 00:24:03

标签: acumatica

我们在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

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:0)

在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