【发布时间】:2019-06-25 15:12:55
【问题描述】:
我在屏幕上有一个标题/行结构,需要在输入数据时提供很大的灵活性,但要防止在所有行项目都有库存 ID 之前暂停记录。在创建记录时,库存 ID 可能不存在,因此我无法在初始输入时设置库存 ID 字段。
我预计 PXSelect 会从数据库中提取任何新记录,但会保留当前缓存的条目中的数据。相反,我发现在我保存记录之前,似乎无法通过 PXSelect 访问新行项目的条目。这意味着取消选中 Hold 会忽略我在屏幕上看到的库存 ID,并且下面给出的代码会生成“NoInventoryID”的异常。
#region MyHdr_Hold_FieldVerifying
protected virtual void _(Events.FieldVerifying<MyHdr.hold> e)
{
if ((bool?)e.NewValue == true) return;
MyHdr row = (MyHdr)e.Row;
MyLine line =
PXSelect<MyLine, Where<MyLine.hdrID, Equal<Current<MyHdr.hdrID>>>>
.SelectSingleBound(this, new object[] { e.Row });
if (line == null)
throw new PXSetPropertyException(Messages.NoLines, PXErrorLevel.Warning);
line =
PXSelect<MyLine, Where<MyLine.hdrID, Equal<Current<MyHdr.hdrID>>, And<MyLine.inventoryID, NotEqual<Null>>>>
.SelectSingleBound(this, new object[] { e.Row });
if (line != null)
throw new PXSetPropertyException(Messages.NoInventoryID, PXErrorLevel.Warning);
}
#endregion
我在 Inventory ID 字段上有 CommitChanges = True,因此在验证标题保留字段时似乎需要一种特殊技术来验证网格线。
如何查看网格上未保存的数据(标题的子行)以进行验证而不让用户先保存记录?
【问题讨论】:
-
您可以执行 dataview.Select() 或检查缓存的插入/更新集合[typeof(DAC)].Inserted。
标签: acumatica