【发布时间】:2021-06-08 14:33:02
【问题描述】:
美好的一天
我正在寻找一种方法来覆盖公共类 INScanReceive 中的函数 ProcessItemBarcode(string Barcode):WMSBase
这个想法是扩展 INScanReceiveHost 图并在处理条形码之前对其进行操作。这是为了更改扫描和接收页面扫描条形码的方式,以便我可以读取和操作 QR 码
namespace PX.Objects.IN
{
// Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
public class INScanReceiveHost_Extension : PXGraphExtension<INScanReceive>
{
#region Event Handlers
[PXOverride]
public virtual void ProcessItemBarcode(string barcode)
{
//change barcode
Base.ProcessItemBarcode.Invoke(barcode);
}
#endregion
}
}
但它告诉我我无法访问该功能?
2021/06/15 更新
感谢 Sean Prouty 迄今为止的帮助。我已经非常接近解决方案了。
我有一个后续问题。
我已经覆盖了 ProcessItemBarcode 函数和 ProcessLotSerialBarcode
问题:我可以从 ProcessItemBarcode 调用 ProcessLotSerialBarcode 因为我有二维码的位置,所以我可以在第一次扫描时设置它:
#region Overrides ProcessItemBarcode
//ProcessItemBarcode
public delegate void ProcessItemBarcodeDelegate(string barcode);
[PXOverride]
public virtual void ProcessItemBarcode(string barcode, ProcessItemBarcodeDelegate baseMethod)
{
try
{
string inventoryBC = barcode;
//...//get InvetoryID using Barcode
baseMethod?.Invoke(inventoryBC);
//how do you call the ProcessLotSerialBarcode function?
ProcessLotSerialBarcode(barcode, ProcessLotSerialBarcodeDelegate);
}
catch (Exception ex)
{//TODO: check if not a QR code
PXTrace.WriteError("ProcessItemBarcode Override: " + ex.Message);
baseMethod?.Invoke(barcode);
}
}
#endregion
#region Overrides ProcessLotSerialBarcode
//ProcessLotSerialBarcode
public delegate void ProcessLotSerialBarcodeDelegate(string barcode);
[PXOverride]
public virtual void ProcessLotSerialBarcode(string barcode, ProcessLotSerialBarcodeDelegate baseMethod)
{
try
{
string inventoryBC = "LOgic";
baseMethod?.Invoke(inventoryBC);
}
catch (Exception)
{
//TODO: check if not a QR code
baseMethod?.Invoke(barcode);
}
}
#endregion
[PXProtectedAccess]
public abstract class INScanReceiveHostExtProtectedAccess : PXGraphExtension<INScanReceiveHostExtCustomPackage, INScanReceive, INScanReceiveHost>
{
[PXProtectedAccess(typeof(INScanReceive))]
protected abstract void ProcessItemBarcode(string barcode);
[PXProtectedAccess(typeof(INScanReceive))]
protected abstract void ApplyState(string state);
[PXProtectedAccess(typeof(INScanReceive))]
protected abstract void ProcessLotSerialBarcode(string barcode);
}
我也在考虑从第一种方法设置状态,但后来我需要调用
Base.ApplyState(INScanIssue.ScanStates.Confirm);
然后我可以设置标题并继续将扫描仪重置为确认状态。你怎么看?
【问题讨论】:
标签: acumatica