【发布时间】:2017-09-28 10:07:56
【问题描述】:
我正在处理 Acumatica 中的表单,我正在尝试从采购订单中选择 InventoryID,特别是从 POLine。这是我的代码
[PXDBInt()]
[PXUIField(DisplayName = "Inventory ID")]
[PXDefault()]
[PXParent(typeof(Select<InventoryItem, Where<InventoryItem.inventoryID, Equal<Current<POInspectionDetail.inventoryID>>>>))]
[PXSelector(typeof(Search2<POLine.inventoryID,
LeftJoin<POInspectionDetail, On<POLine.inventoryID, Equal<POInspectionDetail.inventoryID>>>,
Where<POLine.orderNbr, Equal<Current<POInspection.orderNbr>>,
And<POLineExt.qControl, Equal<True>>>>),
typeof(POLine.siteID),
typeof(POLine.orderQty),
typeof(POLineExt.qControl))]
public int? InventoryID { get; set; }
public class inventoryID : IBqlField{}
我可以看到像这张图片中的 ID Selector,但如果我选择它,它会显示错误。
你能帮我解决这个问题吗?提前致谢
编辑
protected void POInspectionDetail_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
POInspectionDetail poInspectiondetail = e.Row as POInspectionDetail;
if(poInspectiondetail.InventoryID != null)
{
POLine polines = (POLine)PXSelectorAttribute.Select<POInspectionDetail.inventoryID>(cache, poInspectiondetail);
poInspectiondetail.WarehouseID = polines.SiteID;
poInspectiondetail.OpenQty = polines.OrderQty;
poInspectiondetail.QtyonReceipts = polines.ReceivedQty;
}
}
【问题讨论】:
-
发布代码中的哪一行是第 30 行(如错误指出的那样)?此外,您应该在 RowSelecting 中设置字段 - 而不是选中行。行选择将用于未绑定的字段。 Row Selected 用于 UI 逻辑,例如可见或启用。
-
这一行,POLine polines = (POLine)PXSelectorAttribute.Select
(cache, poInspectiondetail);我尝试使用行选择,但不幸的是它什么也没做 -
您应该在行选择中调用 cache.setvalueext 而不是像在示例中那样设置行值。 POInspectionDetail dac 是否继承自另一个 DAC?可能与指向 InventoryItem 的 PXParent 冲突。尝试删除该属性,然后重试。
-
谢谢,我试过缓存,它可以工作。再次感谢