Acumatica 复制到变量
为什么有时需要将实例复制到变量中,更新变量,然后使用变量更新实例Acumatica 复制到变量,acumatica,Acumatica,为什么有时需要将实例复制到变量中,更新变量,然后使用变量更新实例 protected virtual void INRegister_ToSiteID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { if(e.Row != null) { foreach (INTran item in this.transactions.Select())
protected virtual void INRegister_ToSiteID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
{
if(e.Row != null)
{
foreach (INTran item in this.transactions.Select())
{
INTran updated = (INTran)this.transactions.Cache.CreateCopy(item);
updated.ToSiteID = ((INRegister)e.Row).ToSiteID;
this.transactions.Cache.Update(updated);
}
}
Set1Step((INRegister)e.Row);
}
为什么我们不能直接更新属性本身,例如item.ToSiteID?这是因为它阻止触发事件还是什么?在版本5.x之前,需要使用CreateCopy方法更新DAC字段。到目前为止,绝对没有理由创建DAC记录的副本,除非您有意将所有字段值从一个DAC记录复制到另一个DAC记录