Acumatica 如何跳过SOLine_RowUpdate事件中的基本逻辑
我在SOLine_RowUpdated event中有一个自定义代码,我的代码运行良好,这就是我所需要的,但当我最终在SOLine.curyUnitPrice字段上获得预期值时,基本事件或基本逻辑会更改该值 我想知道如何跳过基本事件或基本逻辑,以便我的值不会改变 这是我的SOOrderEntry\u扩展图:Acumatica 如何跳过SOLine_RowUpdate事件中的基本逻辑,acumatica,acumatica-kb,Acumatica,Acumatica Kb,我在SOLine_RowUpdated event中有一个自定义代码,我的代码运行良好,这就是我所需要的,但当我最终在SOLine.curyUnitPrice字段上获得预期值时,基本事件或基本逻辑会更改该值 我想知道如何跳过基本事件或基本逻辑,以便我的值不会改变 这是我的SOOrderEntry\u扩展图: using System; using System.Collections; using System.Collections.Generic; using System.Diagnost
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using PX.Common;
using PX.Data;
using PX.Objects.AP;
using PX.Objects.AR;
using PX.Objects.CA;
using PX.Objects.CM;
using PX.Objects.CR;
using PX.Objects.CS;
using PX.Objects.DR;
using PX.Objects.EP;
using PX.Objects.GL;
using PX.Objects.IN;
using PX.Objects.PM;
using PX.Objects.PO;
using PX.Objects.TX;
using POLine = PX.Objects.PO.POLine;
using POOrder = PX.Objects.PO.POOrder;
using System.Threading.Tasks;
using PX.CarrierService;
using CRLocation = PX.Objects.CR.Standalone.Location;
using PX.Objects.AR.CCPaymentProcessing;
using PX.Objects.AR.CCPaymentProcessing.Common;
using PX.Objects.AR.CCPaymentProcessing.Helpers;
using PX.Objects.AR.CCPaymentProcessing.Interfaces;
using ARRegisterAlias = PX.Objects.AR.Standalone.ARRegisterAlias;
using PX.Objects.AR.MigrationMode;
using PX.Objects.Common;
using PX.Objects.Common.Discount;
using PX.Objects.Common.Extensions;
using PX.Objects.IN.Overrides.INDocumentRelease;
using PX.CS.Contracts.Interfaces;
using Message = PX.CarrierService.Message;
using PX.TaxProvider;
using PX.Data.DependencyInjection;
using PX.LicensePolicy;
using PX.Objects.Extensions.PaymentTransaction;
using PX.Objects.SO.GraphExtensions.CarrierRates;
using PX.Objects.Common.Bql;
using PX.Objects;
using PX.Objects.SO;
namespace PX.Objects.SO
{
public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
{
#region Event Handlers
protected void SOLine_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e)
{
SOLine row = (SOLine)e.Row;
if (row == null)
{
return;
}
if (row.SubItemID == null)
{
row.CuryUnitPrice = (decimal?) 0.01;
return;
}
if (row.SubItemID != null)
{
if (row.SiteID == null)
{
row.CuryUnitPrice = (decimal?) 0.01;
return;
}
if (row.OrderQty > 0)
{
return;
}
else
{
string cadena = "MAIN";
Location location = PXSelect<Location,
Where<Location.bAccountID, Equal<Required<Location.bAccountID>>,
And<Location.locationCD, Equal<Required<Location.locationCD>>>
>>.Select(Base, row.CustomerID, cadena);
ARSalesPrice salesprice = PXSelect<ARSalesPrice,
Where<ARSalesPrice.custPriceClassID, Equal<Required<ARSalesPrice.custPriceClassID>>,
And<ARSalesPrice.inventoryID, Equal<Required<ARSalesPrice.inventoryID>>,
And<ARSalesPriceExt.usrSubItemID, Equal<Required<ARSalesPriceExt.usrSubItemID>>,
And<ARSalesPrice.breakQty, LessEqual<Required<ARSalesPrice.breakQty>>
>
>
>
>,
OrderBy<Desc<ARSalesPrice.breakQty>>
>.Select(Base, location.CPriceClassID, row.InventoryID, row.SubItemID, row.Qty);
if(salesprice == null)
{
ARSalesPrice salesprice2 = PXSelect<ARSalesPrice,
Where<ARSalesPrice.custPriceClassID, Equal<Required<ARSalesPrice.custPriceClassID>>,
And<ARSalesPrice.inventoryID, Equal<Required<ARSalesPrice.inventoryID>>,
And<ARSalesPriceExt.usrSubItemID, Equal<Required<ARSalesPriceExt.usrSubItemID>>
>
>
>,
OrderBy<Asc<ARSalesPrice.breakQty>>
>.Select(Base, location.CPriceClassID, row.InventoryID, row.SubItemID);
if (salesprice2 != null)
{
cache.SetValue<SOLine.curyUnitPrice>(row, salesprice2.SalesPrice);
}
else
{
row.CuryUnitPrice = (decimal?) 0.01;
}
}
else
{
cache.SetValue<SOLine.curyUnitPrice>(row, salesprice.SalesPrice);
}
}
}
}
#endregion
}
}
使用系统;
使用系统集合;
使用System.Collections.Generic;
使用系统诊断;
使用System.Linq;
使用系统文本;
使用PX.Common;
使用PX数据;
使用PX.Objects.AP;
使用PX.Objects.AR;
使用PX.Objects.CA;
使用PX.Objects.CM;
使用PX.Objects.CR;
使用PX.Objects.CS;
使用PX.Objects.DR;
使用PX.Objects.EP;
使用PX.Objects.GL;
使用PX.Objects.IN;
使用PX.Objects.PM;
使用PX.Objects.PO;
使用PX.Objects.TX;
使用POLine=PX.Objects.PO.POLine;
使用POOrder=PX.Objects.PO.POOrder;
使用System.Threading.Tasks;
使用PX.CarrierService;
使用CRLocation=PX.Objects.CR.Standalone.Location;
使用PX.Objects.AR.CCPaymentProcessing;
使用PX.Objects.AR.CCPaymentProcessing.Common;
使用PX.Objects.AR.CCPaymentProcessing.Helpers;
使用PX.Objects.AR.CCPaymentProcessing.interface;
使用ARRegisterAlias=PX.Objects.AR.Standalone.ARRegisterAlias;
使用PX.Objects.AR.MigrationMode;
使用PX.Objects.Common;
使用PX.Objects.Common.Discount;
使用PX.Objects.Common.Extensions;
使用PX.Objects.IN.Overrides.INDocumentRelease;
使用PX.CS.Contracts.Interface;
使用Message=PX.CarrierService.Message;
使用PX.TaxProvider;
使用PX.Data.DependencyInjection;
使用PX.LicensePolicy;
使用PX.Objects.Extensions.PaymentTransaction;
使用PX.Objects.SO.GraphExtensions.CarrierRates;
使用PX.Objects.Common.Bql;
使用PX.Objects;
使用PX.Objects.SO;
命名空间PX.Objects.SO
{
公共类SOOrderEntry\u扩展:pxGrapherExtension
{
#区域事件处理程序
受保护的void SOLine_rowUpdate(PXCache缓存,PXRowUpdatedEventArgs e)
{
SOLine行=(SOLine)e.row;
if(行==null)
{
返回;
}
if(row.SubItemID==null)
{
row.CuryUnitPrice=(十进制?)0.01;
返回;
}
if(row.SubItemID!=null)
{
if(row.SiteID==null)
{
row.CuryUnitPrice=(十进制?)0.01;
返回;
}
如果(row.OrderQty>0)
{
返回;
}
其他的
{
字符串cadena=“MAIN”;
位置=PXSelect.Select(Base,row.CustomerID,cadena);
ARSalesPrice salesprice=PXSelect.Select(基本,location.CPriceClassID,row.InventoryID,row.SubItemID,row.Qty);
如果(salesprice==null)
{
ARSalesPrice salesprice2=PXSelect.Select(Base,location.CPriceClassID,row.InventoryID,row.SubItemID);
if(售价2!=null)
{
SetValue(行,salesprice2.SalesPrice);
}
其他的
{
row.CuryUnitPrice=(十进制?)0.01;
}
}
其他的
{
SetValue(行,salesprice.salesprice);
}
}
}
}
#端区
}
}
您能帮我解决这个问题吗?您添加了一个事件,而不是覆盖它。重写基本事件时,需要指定适当的委托。然后,您可以调用该基本事件,或者在您的情况下,不调用它
using PX.Data;
namespace PX.Objects.SO
{
public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
{
#region Event Handlers
protected void SOLine_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e, PXRowUpdated baseEvent)
{
baseEvent.Invoke(cache, e); // <- comment out to prevent calling the base event
// Insert my custom code here
}
#endregion
}
}
使用PX.Data;
命名空间PX.Objects.SO
{
公共类SOOrderEntry\u扩展:pxGrapherExtension
{
#区域事件处理程序
受保护的无效SOLine_RowUpdate(PXCache缓存、PXRowUpdatedEventArgs e、PXRowUpdated baseEvent)
{
调用(缓存,e);//您好,我已经这样做了,但是我仍然有同样的问题,我没有调用基本事件。@Brianstevens您发布的内容没有将PXRowUpdated用作委托。如果不指定PXRowUpdated委托,您就不会重写基本事件,因此它将始终激发。您需要包含委托才能将事件处理程序转换为重写。也许我没有解释我自己,在你回答后我按照你的建议,但我仍然有相同的问题。目前这是我代码的一部分:protectedvoid SOLine_RowUpdated(PXCache缓存,PXRowUpdatedEventArgs e,PXRowUpdated invokebaseholder){/*if(invokebaseholder!=null)invokebaseholder(cache,e);*/var row=(SOLine)e.row;if(row==null){return;}明白了。注释中的行被注释掉后,基地不应该启动。你能解释一下基地启动时看到的情况吗?另外,你确定你的图形扩展已经发布到项目中了吗?我的系统管理员在我的定制项目中更新了文件(来自生产)在上周发布之前,所以他在项目中丢失了我的DLL。您可以通过在事件处理程序中使用PXTrace.WriteInformation(“您在这里”)来确认,以确保您的Override实际上正在启动。经过深入调查,我发现事件处理程序正在更改CuryUnitPrice字段的值,该事件被调用“SOLine_OrderQty_FieldUpdated”,我能够覆盖此事件并进行适当的自定义,一切正常。感谢您的建议。@BrianStevens