客户需要在Acumatica上进行雾化,以将发票参考号添加到“运行识别”图的网格中,数据视图为“项目”。 我已经将该列添加到网格并定义了自定义数据视图的委托: Nbr没有被填充,有人可以协助将新数据视图绑定到现有网格吗? 这是我的代码扩展。
namespace PX.Objects.DR
{
public class ScheduledTranExt : PXCacheExtension<PX.Objects.DR.DRRecognition.ScheduledTran>
{
#region UsrRefNbr
[PXString]
[PXUIField(DisplayName = "Ref. Nbr.")]
public virtual string UsrRefNbr { get; set; }
public abstract class usrRefNbr : IBqlField { }
#endregion
}
public class DRRecognitionPXExt : PXGraphExtension<DRRecognition>
{
#region Event Handlers
public PXFilteredProcessing<DRRecognition.ScheduledTran,DRRecognition.ScheduleRecognitionFilter> ItemsCustom;
public PXSelectJoin<ARInvoice,
InnerJoin<DRSchedule, On<DRSchedule.docType, Equal<ARInvoice.docType>,
And<DRSchedule.refNbr, Equal<ARInvoice.refNbr>>>>,
Where<DRSchedule.scheduleNbr, Equal<Required<DRSchedule.scheduleNbr>>>> Invoices;
protected
virtual IEnumerable itemsCustom()
{
foreach (DRRecognition.ScheduledTran result
in Base.Items.Select())
{
ARInvoice invoice = Invoices.Select(result.ScheduleNbr);
var cache = Base.Caches[typeof(DRRecognition.ScheduledTran)];
var tranExt = cache.GetExtension<ScheduledTranExt>(result);
tranExt.UsrRefNbr = invoice.RefNbr;`enter code here`
cache.Update(result);
yield return result;
}
}
#endregion
}
}
答案 0 :(得分:0)
避免重新定义DataView并在视图委托中分配值。 还有其他一些不那么繁重的方法可以实现这一目标。
应该可以使用PXFormula / PXDBScalar或RowSelected / FieldSelecting来实现。 示例:
using PX.Data;
using PX.Objects.AR;
namespace PX.Objects.DR
{
public class DRRecognition_Extension:PXGraphExtension<DRRecognition>
{
public void ScheduledTran_UsrRefNbr_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e)
{
DRRecognition.ScheduledTran tran = e.Row as DRRecognition.ScheduledTran;
if (tran != null)
{
ARInvoice invoice = PXSelectJoin<ARInvoice,
InnerJoin<DRSchedule, On<DRSchedule.scheduleNbr, Equal<Required<DRRecognition.ScheduledTran.scheduleNbr>>>>,
Where<ARInvoice.docType, Equal<DRSchedule.docType>,
And<ARInvoice.refNbr, Equal<DRSchedule.refNbr>>>>.Select(Base, tran.ScheduleNbr);
if (invoice != null)
{
e.ReturnValue = invoice.RefNbr;
}
}
}
}
}