c# - APReleaseProcess_Extension 自定义代码在 Acumatica ERP 版本 2017 R2 中不起作用
问题描述
然后我使用了以下代码:
namespace PX.Objects.AP
{
public class APReleaseProcess_Extension : PXGraphExtension<APReleaseProcess>
{
public delegate List<APRegister> ReleaseDocProcDel(JournalEntry je, ref APRegister doc, PXResult<APInvoice,
CurrencyInfo, Terms, Vendor> res, bool isPrebooking,
out List<INRegister> inDocs);
[PXOverride]
public List<APRegister> ReleaseDocProc(JournalEntry je, ref APRegister doc,
PXResult<APInvoice, CurrencyInfo, Terms, Vendor> res,
bool isPrebooking,
out List<INRegister> inDocs, ReleaseDocProcDel del)
{
je.RowInserting.AddHandler<GLTran>((sender, e) =>
{
GLTran glTran = e.Row as GLTran;
APTran apTran = PXResult<APTran>.Current;
if (glTran != null && apTran != null)
{
APTranExt apTranEx = PXCache<APTran>.GetExtension<APTranExt>(apTran);
if (apTran != null && apTranEx.UsrJobOrderNbr != null)
{
GLTranExt glTranEx = PXCache<GLTran>.GetExtension<GLTranExt>(glTran);
glTranEx.UsrJobOrderNbr = apTranEx.UsrJobOrderNbr;
}
}
//APInvoice apInv = PXResult<APInvoice>.Current;
APInvoice apInv = PXSelect<APInvoice,
Where<APInvoice.refNbr, Equal<Required<GLTran.refNbr>>,
And<APInvoice.docType,
Equal<Required<GLTran.tranType>>>>>.Select(sender.Graph, glTran.RefNbr, glTran.TranType);
if (glTran != null && apInv != null)
{
GLTranExt glTranEx = PXCache<GLTran>.GetExtension<GLTranExt>(glTran);
glTranEx.UsrInvoiceNbr = apInv.InvoiceNbr;
}
APTaxTran apTaxTran = PXResult<APTaxTran>.Current;
if (glTran != null && apTaxTran != null)
{
APTaxTranExt apTaxTranEx = PXCache<APTaxTran>.GetExtension<APTaxTranExt>(apTaxTran);
if (apTaxTran != null && apTaxTranEx != null)
{
GLTranExt glTranEx = PXCache<GLTran>.GetExtension<GLTranExt>(glTran);
glTranEx.UsrNoSeriFaktur = apTaxTranEx.UsrNoSeriFaktur;
}
}
}
);
return del(je, ref doc, res, isPrebooking, out inDocs);
}
}
}
我尝试调试此代码,但没有命中断点,这是自定义按钮释放的正确方法吗?有人知道这个问题吗?
解决方案
在 Acumatica 自定义项目编辑器中,在该CODE
部分中,在 APReleaseProcess 上添加图形扩展。然后打开生成的代码文件并使用操作按钮OVERRIDE METHOD
。在列表中选择目标方法并单击SAVE
按钮。这将为您正在使用的 Acumatica 版本插入正确的事件处理程序:
namespace PX.Objects.AP
{
public class APReleaseProcess_Extension : PXGraphExtension<APReleaseProcess>
{
#region Event Handlers
public delegate List<APRegister> ReleaseDocProcDelegate(JournalEntry je, APRegister doc, Boolean isPrebooking, ref List<INRegister> inDocs);
[PXOverride]
public List<APRegister> ReleaseDocProc(JournalEntry je, APRegister doc, Boolean isPrebooking, ref List<INRegister> inDocs, ReleaseDocProcDelegate baseMethod)
{
return baseMethod(je,doc,isPrebooking,inDocs);
}
#endregion
}
}
推荐阅读
- c# - 如何将字符串从 C++ 原生传递到 C# Unity?
- python - 在 Seaborn 中设置默认饱和度
- java - 何时在 Cassandra 中使用 UUID 而不是毫秒时间戳?
- algorithm - 在 Python 上实现 Miller-Rabin 算法
- android - 如何检查android手机中是否可以使用显示在其他应用程序上的功能
- kubernetes - kubectl - 错误:您必须登录到服务器(服务器已要求客户端提供凭据)
- android-emulator - Android 模拟器 - 无法重置您设备上的状态
- c# - DbContext ,实体框架 6,查询当前会话中添加的实体
- sql-server - Rowversion 字段导致 BULK INSERT 仅导入每隔一行
- python - C语言中是否有像Python这样的“If in”关键字?