【发布时间】:2018-12-05 20:57:07
【问题描述】:
我在销售订单中有修改需要用派生值更新销售订单行单价。这运行良好,并且在选择项目并且我在 SOLine_RowUpdating 事件中的代码已执行后显示新的单价。然而,在选择数量后 SOLine_RowUpdating 再次执行,之后系统会像往常一样计算折扣。由于我有自己的不应该打折的价格,我想覆盖或取消这个标准折扣计算,并保持我的价格不变。这是 SOLine_RowUpdating 代码,它运行良好。
protected virtual void SOLine_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
{
if (e.NewRow == null) {return; }
Customer customer = Base.customer.Current;
if (customer == null) return;
SOLine soLine = (SOLine)e.NewRow;
int BAAccountID = Convert.ToInt32(customer.BAccountID);
int lCompanyID = PX.Data.Update.PXInstanceHelper.CurrentCompany;
int lInventoryID = Convert.ToInt32(soLine.InventoryID);
LookupPriceAndDiscountDetails(BAAccountID, lCompanyID, lInventoryID); // My own code
sender.SetValueExt<SOLine.curyUnitPrice>(soLine, gdNewUnitPrice); //New price is in gdNewUnitPrice
Base.Transactions.Cache.RaiseRowUpdated(soLine, soLine);
Base.Transactions.View.RequestRefresh();
}
经过大量调查,我发现各种帖子建议的这种方法应该清除/取消折扣,实际上我可以在标准 PX.Objects.SO.SOOrderEntry Row_Updated 事件中找到它,但是当我在我的图形扩展它不会更新或清除,因为 soline(缓存)值仍然显示折扣数字。我一定错过了一些简单的东西。
在这一点上赞赏的任何想法......
protected void SOLine_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
{
SOLine row = e.Row as SOLine;
DiscountEngine<SOLine>.ClearDiscount(sender,row);
// RecalculateDiscounts(sender, row); // ? (Maybe this)
}
【问题讨论】:
标签: acumatica