我目前在Acumatica的SOLine和POLine上有自定义RowPersisted事件 . 基本上,当用户将它们保存在Acumatica中时,我需要确保PO中的自定义供应商成本字段和PO中的单价字段相互更新所有链接的PO和SO . 所以我在POLine_RowPersisted中有这样的东西:
soRecExt.UsrVendorCost = line.CuryUnitCost;
SOOrderEntry graph = PXGraph.CreateInstance<SOOrderEntry>();
graph.CurrentDocument.Current = soOrd;
var result = graph.Transactions.Select();
graph.Transactions.Update(soRec);
graph.Actions.PressSave();
在SOLine_RowPersisted中有类似的东西:
poRec.CuryUnitCost = lineExt.UsrVendorCost;
POOrderEntry graph = PXGraph.CreateInstance<POOrderEntry>();
graph.CurrentDocument.Current = poOrd;
var result = graph.Transactions.Select();
graph.Transactions.Update(poRec);
graph.Actions.PressSave();
所以不幸的是,当一个人更新时,整个事情就会进入无限循环 . 我尝试过这样的事情:
POOrderEntry_Extension graphExt = graph.GetExtension<POOrderEntry_Extension>();
graphExt.RowPersisted.RemoveHandler<SOOrderEntry_Extension>(graphExt.POLine_RowPersisted);
但是,图表扩展上没有RowPersisted . 我的活动是公开的 . 有人可以帮忙吗?
1 回答
事件由Base图注册并触发,因此您必须在基本图上删除它们 .
我相信你想要完成的事情更多的是:
其中'graph'的类型为POOrderEntry,那么使用'graph'相当于'graphExt.Base' .