Acumatica 将用户字段从CRM报价复制到销售订单
我正在尝试将一些用户字段从CRM报价复制到销售订单。CRM报价使用与销售报价不同的对象,并且似乎没有一种方法将其关联起来。我试图覆盖创建销售订单以添加处理程序,但这似乎不起作用。如有任何帮助,将不胜感激。以下是我尝试的代码:Acumatica 将用户字段从CRM报价复制到销售订单,acumatica,Acumatica,我正在尝试将一些用户字段从CRM报价复制到销售订单。CRM报价使用与销售报价不同的对象,并且似乎没有一种方法将其关联起来。我试图覆盖创建销售订单以添加处理程序,但这似乎不起作用。如有任何帮助,将不胜感激。以下是我尝试的代码: public class OpportunityMaint_Extension : PXGraphExtension<OpportunityMaint> { public delegate IEnumerable CreateSalesOrderDele
public class OpportunityMaint_Extension : PXGraphExtension<OpportunityMaint>
{
public delegate IEnumerable CreateSalesOrderDelegate(PXAdapter adapter);
[PXOverride]
public virtual IEnumerable CreateSalesOrder(PXAdapter adapter, CreateSalesOrderDelegate baseMethod)
{
Base.RowInserting.AddHandler<SOLine>((sender, e) =>
{
SOLine orderLine = e.Row as SOLine;
if (orderLine == null) return;
SOLineExt orderLineExt = orderLine.GetExtension<SOLineExt>();
var product = Base.Products.Current;
CROpportunityProductsExt productExt = product.GetExtension<CROpportunityProductsExt>();
orderLineExt.UsrHasAnticipatedDiscount = productExt.UsrHasAnticipatedDiscount;
orderLineExt.UsrAnticipatedDiscountPct = productExt.UsrAnticipatedDiscountPct;
orderLineExt.UsrAnticipatedDiscountAmt = productExt.UsrAnticipatedDiscountAmt;
orderLineExt.UsrAnticipatedUnitPrice = productExt.UsrAnticipatedUnitPrice;
orderLineExt.UsrTotalAnticipatedDiscountAmt = productExt.UsrTotalAnticipatedDiscountAmt;
});
return baseMethod(adapter);
}
}
公共类机会主义维护扩展:pxGrapherExtension
{
公共委托IEnumerable CreateSalesOrderDelegate(PXAdapter);
[PXOverride]
公共虚拟IEnumerable CreateSalesOrder(PXAdapter适配器,CreateSalesOrderDelegate baseMethod)
{
Base.rowinting.AddHandler((发送方,e)=>
{
SOLine orderLine=e.行作为SOLine;
if(orderLine==null)返回;
solinext orderLineExt=orderLine.GetExtension();
var product=基本产品电流;
CropportUnityProductSextProductExt=product.GetExtension();
orderLineExt.usrhasanticipateddiscont=productExt.usrhasanticipateddiscont;
orderLineExt.UsranticatedDiscountPCT=productExt.UsranticatedDiscountPCT;
orderLineExt.usranticateddisuntamt=产品ext.usranticateddisuntamt;
orderLineExt.usranticatedunitprice=productExt.usranticatedunitprice;
orderLineExt.UsrTotalExpectedDiscountAmt=productExt.UsrTotalExpectedDiscountAmt;
});
返回方法(适配器);
}
}
谢谢 对于同一个问题,有两个帖子给出了答案: 总之,您可以在按钮操作中添加行插入事件处理程序,或者我的首选项在DoCreateSalesOrder(扩展OpportunityMaint)中,如下面的示例所示
[PXOverride]
public virtual void DoCreateSalesOrder(OpportunityMaint.CreateSalesOrderFilter param, Action<OpportunityMaint.CreateSalesOrderFilter> del)
{
PXGraph.InstanceCreated.AddHandler<SOOrderEntry>(graph =>
{
graph.RowInserting.AddHandler<SOLine>((cache, args) =>
{
var soLine = (SOLine)args.Row;
if (soLine == null)
{
return;
}
CROpportunityProducts opProduct = PXResult<CROpportunityProducts>.Current;
if (opProduct == null)
{
return;
}
var opProductExt = PXCache<CROpportunityProducts>.GetExtension<CROpportunityProductsExt>(opProduct);
var soLineExt = PXCache<SOLine>.GetExtension<SOLineExt>(soLine);
//Copy all extension fields here...
});
});
del(param);
}
[PXOverride]
公共虚拟无效DoCreateSalesOrder(OpportunityMaint.CreateSalesOrderFilter参数,操作del)
{
PXGraph.InstanceCreated.AddHandler(图形=>
{
graph.RowInserting.AddHandler((缓存,参数)=>
{
var soLine=(soLine)args.Row;
if(soLine==null)
{
返回;
}
CROpportunityProducts opProduct=PXResult.Current;
if(opProduct==null)
{
返回;
}
var opProductExt=PXCache.GetExtension(opProduct);
var soLineExt=PXCache.GetExtension(soLine);
//将所有扩展字段复制到此处。。。
});
});
del(param);
}
有两篇文章回答了同一个问题:
总之,您可以在按钮操作中添加行插入事件处理程序,或者我的首选项在DoCreateSalesOrder(扩展OpportunityMaint)中,如下面的示例所示
[PXOverride]
public virtual void DoCreateSalesOrder(OpportunityMaint.CreateSalesOrderFilter param, Action<OpportunityMaint.CreateSalesOrderFilter> del)
{
PXGraph.InstanceCreated.AddHandler<SOOrderEntry>(graph =>
{
graph.RowInserting.AddHandler<SOLine>((cache, args) =>
{
var soLine = (SOLine)args.Row;
if (soLine == null)
{
return;
}
CROpportunityProducts opProduct = PXResult<CROpportunityProducts>.Current;
if (opProduct == null)
{
return;
}
var opProductExt = PXCache<CROpportunityProducts>.GetExtension<CROpportunityProductsExt>(opProduct);
var soLineExt = PXCache<SOLine>.GetExtension<SOLineExt>(soLine);
//Copy all extension fields here...
});
});
del(param);
}
[PXOverride]
公共虚拟无效DoCreateSalesOrder(OpportunityMaint.CreateSalesOrderFilter参数,操作del)
{
PXGraph.InstanceCreated.AddHandler(图形=>
{
graph.RowInserting.AddHandler((缓存,参数)=>
{
var soLine=(soLine)args.Row;
if(soLine==null)
{
返回;
}
CROpportunityProducts opProduct=PXResult.Current;
if(opProduct==null)
{
返回;
}
var opProductExt=PXCache.GetExtension(opProduct);
var soLineExt=PXCache.GetExtension(soLine);
//将所有扩展字段复制到此处。。。
});
});
del(param);
}
很好的可能重复的可能重复,谢谢Brendan!我正在搜索CRM报价。。。如果我寻找机会,那会更好!没问题。有时,如果不确定要使用哪个关键字,只搜索图形名称也会返回一些结果。本例中的“OpportunityMaint”将返回与Opportunity相关的问题。太好了,谢谢Brendan!我正在搜索CRM报价。。。如果我寻找机会,那会更好!没问题。有时,如果不确定要使用哪个关键字,只搜索图形名称也会返回一些结果。本例中的“OpportunityMaint”将返回与Opportunity相关的问题。