使用下面的 Acumatica 代码,我能够有条件地在案例屏幕中创建一个新网格;但是,PXSelect 命令并未显示网格中的所有行。 我想要做的是基于“关系”获取 CRRelation.targetNoteID 的值并将所有 ARRegister 数据拉入一个名为“CAM 信息”的新网格中。但是“CAM 信息”图表视图仅显示“关系”的第一行,而不是所有其他行。 (请参阅屏幕截图以供参考) 我需要如何编写 Acumatica 代码来查找、选择和显示“CAM 信息”网格中的所有行?
using System.Collections.Specialized;
using System.Linq;
using PX.Common;
using PX.Data;
using System.Collections;
using PX.Data.EP;
using PX.Objects.AR;
using PX.Objects.CT;
using PX.Objects.CR.Workflows;
using PX.Objects.GL;
using PX.Objects.EP;
using PX.Objects.IN;
using PX.Objects.PM;
using PX.SM;
using PX.TM;
using PX.Objects;
using PX.Objects.CR;
using System.Net.Http;
using System.Collections.Generic;
using System.Collections;
namespace PX.Objects.CR
{
public class CRCaseMaint_Extension : PXGraphExtension<CRCaseMaint>
{
#region Event Handlers
protected virtual void CRCase_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
{
InvokeBaseHandler?.Invoke(cache, e);
var row = (CRCase)e.Row;
if (row != null)
{
if (row.CaseClassID == "CAM")
{
PXUIFieldAttribute.SetVisible<Objects.CR.CRCaseExt.usrRMAReason>(cache, row, false);
PXUIFieldAttribute.SetVisible<Objects.CR.CRCaseExt.usrSupportCategory >(cache, row, false);
PXUIFieldAttribute.SetVisible<Objects.CR.CRCaseExt.usrContractDesc>(cache, row, false);
PXUIFieldAttribute.SetVisible<Objects.CR.CRCaseExt.usrCaseStage>(cache, row, false);
PXUIFieldAttribute.SetVisible<Objects.CR.CRCaseExt.usrIGAHEquipmentID>(cache, row, false);
}
}
}
#endregion
// Following view delaration populates the ARRegister info; but only one line
#region Selects
public PXSelect<ARRegister, Where<ARRegister.noteID, Equal<CurrentValue<CRRelation.targetNoteID>>>> CAMRelationsView;
#endregion
}
}```
[![Cases Relations Tab grid][1]][1]
[![Cases CAM Info Tab grid][2]][2]
[1]: https://i.stack.imgur.com/m4KA0.jpg
[2]: https://i.stack.imgur.com/CBYNQ.jpg
声明视图不正确。你需要这样声明
public PXSelect<ARRegister, Where<ARRegister.noteID, Equal<Current<CRRelation.targetNoteID>>>> CAMRelationsView;
另外,你还需要设置2个设置
SyncPosition
应设置为true
AutoCallBack
事件上,您需要使用网格 ID
.Current<Field>
- 从缓存的 Current
属性插入字段值。如果Current
属性为null或字段值为null,参数将被替换为默认值。CurrentValue<Field>
- 等同于 Current
参数,但用于 PXProjection
属性。