要将自定义字段值从 ARTran 粘贴到 GLTran ,您应该为ARReleaseProcess BLC创建一个扩展并覆盖ReleaseInvoice方法,如下面的示例所示:
public class ARReleaseProcess_Extension : PXGraphExtension<PX.Objects.AR.ARReleaseProcess>
{
public delegate List<ARRegister> ReleaseInvoiceDel(
JournalEntry je,
ref ARRegister doc,
PXResult<ARInvoice, CurrencyInfo, Terms, Customer, Account> res,
out PMRegister pmDoc);
[PXOverride]
public List<ARRegister> ReleaseInvoice(
JournalEntry je,
ref ARRegister doc,
PXResult<ARInvoice, CurrencyInfo, Terms, Customer, Account> res,
out PMRegister pmDoc,
ReleaseInvoiceDel del)
{
je.RowInserting.AddHandler<GLTran>((s, a) =>
{
var tran = (GLTran)a.Row;
var arTran = (ARTran)PXResult<ARTran>.Current;
if (tran != null && tran.TranLineNbr != null &&
arTran != null && arTran.TranType == tran.TranType &&
arTran.RefNbr == tran.RefNbr && arTran.LineNbr == tran.TranLineNbr)
{
var stockNbr = arTran.GetExtension<ARTranExt>().UsrLineStockNbr;
if (!string.IsNullOrEmpty(stockNbr))
tran.GetExtension<GLTranExt>().UsrLineStockNbr = stockNbr;
}
});
return del(je, ref doc, res, out pmDoc);
}
}
这是新生成的 GL Batch 的样子:
在下面的 AR 发票发布之后:

要将自定义字段值从 APTran 粘贴到 GLTran ,您应该为APReleaseProcess BLC创建一个扩展并覆盖ReleaseInvoice方法,如下面的示例所示:
public class APReleaseProcess_Extension : PXGraphExtension<PX.Objects.AP.APReleaseProcess>
{
public delegate List<APRegister> ReleaseInvoiceDel(
JournalEntry je,
ref APRegister doc,
PXResult<APInvoice, CurrencyInfo, Terms, Vendor> res,
bool isPrebooking,
out List<INRegister> inDocs);
[PXOverride]
public virtual List<APRegister> ReleaseInvoice(
JournalEntry je,
ref APRegister doc,
PXResult<APInvoice, CurrencyInfo, Terms, Vendor> res,
bool isPrebooking,
out List<INRegister> inDocs,
ReleaseInvoiceDel del)
{
je.RowInserting.AddHandler<GLTran>((s, a) =>
{
var tran = (GLTran)a.Row;
var apTran = (APTran)PXResult<APTran>.Current;
if (tran != null && tran.TranLineNbr != null &&
apTran != null && apTran.TranType == tran.TranType &&
apTran.RefNbr == tran.RefNbr && apTran.LineNbr == tran.TranLineNbr)
{
var stockNbr = apTran.GetExtension<APTranExt>().UsrLineStockNbr;
if (!string.IsNullOrEmpty(stockNbr))
tran.GetExtension<GLTranExt>().UsrLineStockNbr = stockNbr;
}
});
return del(je, ref doc, res, isPrebooking, out inDocs);
}
}
下面是一个新 GL 批次的示例:
在下面的 AP 法案发布期间生成:
