【发布时间】:2021-07-23 16:40:09
【问题描述】:
我在 SOLine 和 SOSshipLine 中创建了 2 个 UDF,我试图在“创建货件”操作中将这些 UDF 的值从 SOLine 复制到 SOShipLine。我的代码正在执行,但值没有被复制。我不确定“SOSshipment_RowPersisting”是否是正确的方法,或者是否有任何其他方法可以解决这个问题。尽管此 RowPersisting 对我将字段从 POOrder 复制到 APInvoice 有用,但请提出建议,谢谢
以下是我的代码:
public class SOShipmentEntry_Extension : PXGraphExtension<SOShipmentEntry>
{
#region Event Handlers
protected void SOShipment_RowPersisting(PXCache cache, PXRowPersistingEventArgs e)
{
var row = (SOShipment)e.Row;
SOShipLine row1 = new SOShipLine();
if (Base.Document.Current != null)
{
foreach (SOShipLine tran in Base.Transactions.Select())
{
SOLine xSOLine = PXSelect<SOLine,
Where<SOLine.orderNbr, Equal<Current<SOLine.orderNbr>>,
And<SOLine.orderType, Equal<Current<SOLine.orderType>>>>>.Select(Base, tran.OrigOrderNbr, tran.OrigOrderNbr);
if (xSOLine != null)
{
SOLineExt soLineExt = PXCache<SOLine>.GetExtension<SOLineExt>(xSOLine);
SOShipLineExt soShipLineExt = PXCache<SOShipLine>.GetExtension<SOShipLineExt>(row1);
soShipLineExt.UsrTerms = soLineExt.UsrTerms;
soShipLineExt.UsrWarrantyDate = soLineExt.UsrCustWarrDate;
}
return;
}
}
}
}
【问题讨论】: