要在Acumatica中实现机会屏幕的推送通知,您可以使用以下代码示例:
public class OpportunityMaint_Extension : PXGraphExtension
{
public delegate void PersistDelegate();
[PXOverride]
public void Persist(PersistDelegate baseMethod)
{
baseMethod();
// 检查是否有新的机会被保存
Opportunity currentOpportunity = Base.Opportunity.Current;
if (currentOpportunity != null && Base.Opportunity.Cache.GetStatus(currentOpportunity) == PXEntryStatus.Inserted)
{
// 发送推送通知
PX.Data.EP.Employee employee = PX.Data.EP.EmployeeMaint.GetCurrentEmployee(Base);
PXNotification.PushNotification.Send(new PX.Data.EP.NotificationRecipient
{
Source = employee,
SourceType = typeof(PX.Data.EP.Employee),
Destination = PX.SM.NotificationDestination.AllUsers,
Message = "New Opportunity Saved: " + currentOpportunity.OpportunityID
});
}
}
}
public class OpportunityMaint_Extension : PXGraphExtension
{
public delegate void PersistDelegate();
[PXOverride]
public void Persist(PersistDelegate baseMethod)
{
baseMethod();
// 检查是否有新的机会被保存
Opportunity currentOpportunity = Base.Opportunity.Current;
if (currentOpportunity != null && Base.Opportunity.Cache.GetStatus(currentOpportunity) == PXEntryStatus.Inserted)
{
// 发送推送通知
PX.Data.EP.Employee employee = PX.Data.EP.EmployeeMaint.GetCurrentEmployee(Base);
PXNotification.PushNotification.Send(new PX.Data.EP.NotificationRecipient
{
Source = employee,
SourceType = typeof(PX.Data.EP.Employee),
Destination = PX.SM.NotificationDestination.AllUsers,
Message = "New Opportunity Saved: " + currentOpportunity.OpportunityID
});
}
}
}
确保在Acumatica中将此代码示例添加到适当的扩展类中,并在适当的时候注册事件处理程序。这将使您能够在保存机会时发送推送通知。