如何跳过 SOLine_RowUpdated 事件中的基本逻辑
How can I skip base logic in SOLine_RowUpdated event
我在 SOLine_RowUpdated 事件中有一个自定义代码,我的代码工作正常,这就是我所需要的,但是当我最终在 SOLine.curyUnitPrice 字段上获得预期值时,基本事件或基本逻辑发生了变化值。
我想知道如何跳过基本事件或基本逻辑,使我的值不改变。
这是我的SOOrderEntry_Extension图表:
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
}
}
你能帮我解决这个问题吗?
您添加了一个事件而不是覆盖它。覆盖基本事件时需要指定适当的委托。然后您可以调用该基本事件,或者在您的情况下不调用。
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
}
}
我在 SOLine_RowUpdated 事件中有一个自定义代码,我的代码工作正常,这就是我所需要的,但是当我最终在 SOLine.curyUnitPrice 字段上获得预期值时,基本事件或基本逻辑发生了变化值。
我想知道如何跳过基本事件或基本逻辑,使我的值不改变。
这是我的SOOrderEntry_Extension图表:
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
}
}
你能帮我解决这个问题吗?
您添加了一个事件而不是覆盖它。覆盖基本事件时需要指定适当的委托。然后您可以调用该基本事件,或者在您的情况下不调用。
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
}
}