首页 > 解决方案 > 在销售价格网格中添加 subitemID 列,但出现错误

问题描述

我想在销售价格屏幕的网格中添加 subitemID 列,我已经添加了,但是打开屏幕时出现错误,请参见下面的屏幕截图:

在此处输入图像描述

这是错误:

Error: An error occurred during processing of the field Inventory ID: Specified cast is not valid..

System.InvalidCastException: Specified cast is not valid.
   at System.Data.SqlClient.SqlBuffer.get_Int32()
   at PX.Data.PXDataRecord.GetInt32(Int32 i) in C:\Bld\AC-FULL2019R214-JOB1\Sources\NetTools\PX.Data\Database\Record.cs:line 458
   at PX.Data.PXDBIdentityAttribute.RowSelecting(PXCache sender, PXRowSelectingEventArgs e) in C:\Bld\AC-FULL2019R214-JOB1\Sources\NetTools\PX.Data\Descriptor\Attributes\DBFieldAttribute.cs:line 4624
   at PX.Data.PXCache.OnRowSelecting(Object item, PXDataRecord record, Int32& position, Boolean isReadOnly) in C:\Bld\AC-FULL2019R214-JOB1\Sources\NetTools\PX.Data\Cache\ModelEventHandling.cs:line 399
   at PX.Data.PXCache.OnRowSelecting(Object item, PXDataRecord record, Int32& position, Boolean isReadOnly) in C:\Bld\AC-FULL2019R214-JOB1\Sources\NetTools\PX.Data\Cache\ModelEventHandling.cs:line 315
   at PX.Data.PXCache`1.Select(PXDataRecord record, Int32& position, Boolean isReadOnly, Boolean& wasUpdated) in C:\Bld\AC-FULL2019R214-JOB1\Sources\NetTools\PX.Data\Cache\Model.cs:line 3932
   at PX.Data.PXView.GetResult(Object[] parameters, PXFilterRow[] filters, Boolean reverseOrder, Int32 topCount, PXSearchColumn[] sorts, Boolean& overrideSort, Boolean& extFilter) in C:\Bld\AC-FULL2019R214-JOB1\Sources\NetTools\PX.Data\Database\Cached.cs:line 3588
   at PX.Data.PXView.Select(Object[] currents, Object[] parameters, Object[] searches, String[] sortcolumns, Boolean[] descendings, PXFilterRow[] filters, Int32& startRow, Int32 maximumRows, Int32& totalRows) in C:\Bld\AC-FULL2019R214-JOB1\Sources\NetTools\PX.Data\Database\Cached.cs:line 5943
   at PX.Objects.AR.ARSalesPriceMaint.QSelect(PXGraph graph, BqlCommand bqlCommand, Object[] viewParameters) in C:\Bld\AC-FULL2019R214-JOB1\Sources\WebSites\Pure\PX.Objects\AR\ARSalesPriceMaint.cs:line 183
   at PX.Objects.AR.ARSalesPriceMaint.d__14.MoveNext() in C:\Bld\AC-FULL2019R214-JOB1\Sources\WebSites\Pure\PX.Objects\AR\ARSalesPriceMaint.cs:line 154
   at System.Linq.Enumerable.d__95`1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at PX.Data.PXView.ToList(IEnumerable src) in C:\Bld\AC-FULL2019R214-JOB1\Sources\NetTools\PX.Data\Database\Cached.cs:line 6458
   at _CustomMethod(Object , Object[] )
   at PX.Data.PXView.InvokeDelegate(Object[] parameters) in C:\Bld\AC-FULL2019R214-JOB1\Sources\NetTools\PX.Data\Database\Cached.cs:line 6508
   at PX.Data.PXView.Select(Object[] currents, Object[] parameters, Object[] searches, String[] sortcolumns, Boolean[] descendings, PXFilterRow[] filters, Int32& startRow, Int32 maximumRows, Int32& totalRows) in C:\Bld\AC-FULL2019R214-JOB1\Sources\NetTools\PX.Data\Database\Cached.cs:line 5862
   at PX.Data.PXGraph.ExecuteSelect(String viewName, Object[] currents, Object[] parameters, Object[] searches, String[] sortcolumns, Boolean[] descendings, PXFilterRow[] filters, Int32& startRow, Int32 maximumRows, Int32& totalRows) in C:\Bld\AC-FULL2019R214-JOB1\Sources\NetTools\PX.Data\Graph\Graph.cs:line 3422

这些是 SubItemID 列的属性:

[PXDBInt]
[PXUIField(DisplayName="SubItemID")]
[PXDefault(typeof(Search<InventoryItem.defaultSubItemID,
    Where<InventoryItem.inventoryID, Equal<Current<ARSalesPrice.inventoryID>>,
    And<InventoryItem.defaultSubItemOnEntry, Equal<boolTrue>>>>),
    PersistingCheck = PXPersistingCheck.Nothing)]
[PXFormula(typeof(Default<ARSalesPrice.inventoryID>))]
[SubItem(typeof(ARSalesPrice.inventoryID))]
[SubItemStatusVeryfier(typeof(ARSalesPrice.inventoryID), typeof(ARSalesPrice.siteID), InventoryItemStatus.Inactive, InventoryItemStatus.NoSales)]

我想像销售订单屏幕一样创建它,请参见下面的屏幕截图:

在此处输入图像描述

你能帮我解决这个问题吗?

标签: acumaticaacumatica-kb

解决方案


推荐阅读