Acumatica 在扫描和接收屏幕中调用 ApplyState 方法
Acumatica calling ApplyState method in Scan and Receive screen
美好的一天
我正在尝试调用 ApplyState(state) 函数。这是 PX.Objects.IN.INScanReceive.
中的一个受保护函数
我正在读取二维码,该值有一个 lot/serial 编号和有效期。这个想法是在 ProcessItemBarcode 函数调用期间设置 2 个值。问题是调用基本方法时设置了状态并且“屏幕状态”要我扫描 lot/serial.
我需要做的是调用 ProcessConfirm() 或 ApplyState(state)。但是调用 ProcessItemBarcode 中的函数是我卡住的地方:
using PX.Common;
using PX.Data;
using WMSBase = PX.Objects.IN.WarehouseManagementSystemGraph<PX.Objects.IN.INScanReceive, PX.Objects.IN.INScanReceiveHost, PX.Objects.IN.INRegister, PX.Objects.IN.INScanReceive.Header>;
using PX.Objects.IN;
namespace MyCustomPackage.Graph.Extension
{
public class INScanReceiveHostExtCustomPackage2 : PXGraphExtension<INScanReceive, INScanReceiveHost>
{
public static bool IsActive() => true;
#region Overrides ProcessItemBarcode
//ProcessItemBarcode
public delegate void ProcessItemBarcodeDelegate(string barcode);
[PXOverride]
public virtual void ProcessItemBarcode(string barcode, ProcessItemBarcodeDelegate baseMethod)
{
//..//logic go change barcode
baseMethod?.Invoke(barcode);
// Option one call ApplyState()
Base.ApplyState()
// Option2 one call ProcessLotSerialBarcode
// I dont know how to send the delegate
ProcessLotSerialBarcode(barcode, );
}
#endregion
#region Overrides ProcessLotSerialBarcode
//ProcessLotSerialBarcode
public delegate void ProcessLotSerialBarcodeDelegate(string barcode);
[PXOverride]
public virtual void ProcessLotSerialBarcode(string barcode, ProcessLotSerialBarcodeDelegate baseMethod)
{
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);
}
}
}
这不是首选方法,但当我想不出其他选择时,我会从 Acumatica 复制源代码,例如静态方法和私有方法。我会在我的代码中注明它们已被复制,因此我可以确保在版本更改时复制该过程。然后您可以在本地调用这些方法。不优雅但适合我:)
美好的一天
我正在尝试调用 ApplyState(state) 函数。这是 PX.Objects.IN.INScanReceive.
中的一个受保护函数我正在读取二维码,该值有一个 lot/serial 编号和有效期。这个想法是在 ProcessItemBarcode 函数调用期间设置 2 个值。问题是调用基本方法时设置了状态并且“屏幕状态”要我扫描 lot/serial.
我需要做的是调用 ProcessConfirm() 或 ApplyState(state)。但是调用 ProcessItemBarcode 中的函数是我卡住的地方:
using PX.Common;
using PX.Data;
using WMSBase = PX.Objects.IN.WarehouseManagementSystemGraph<PX.Objects.IN.INScanReceive, PX.Objects.IN.INScanReceiveHost, PX.Objects.IN.INRegister, PX.Objects.IN.INScanReceive.Header>;
using PX.Objects.IN;
namespace MyCustomPackage.Graph.Extension
{
public class INScanReceiveHostExtCustomPackage2 : PXGraphExtension<INScanReceive, INScanReceiveHost>
{
public static bool IsActive() => true;
#region Overrides ProcessItemBarcode
//ProcessItemBarcode
public delegate void ProcessItemBarcodeDelegate(string barcode);
[PXOverride]
public virtual void ProcessItemBarcode(string barcode, ProcessItemBarcodeDelegate baseMethod)
{
//..//logic go change barcode
baseMethod?.Invoke(barcode);
// Option one call ApplyState()
Base.ApplyState()
// Option2 one call ProcessLotSerialBarcode
// I dont know how to send the delegate
ProcessLotSerialBarcode(barcode, );
}
#endregion
#region Overrides ProcessLotSerialBarcode
//ProcessLotSerialBarcode
public delegate void ProcessLotSerialBarcodeDelegate(string barcode);
[PXOverride]
public virtual void ProcessLotSerialBarcode(string barcode, ProcessLotSerialBarcodeDelegate baseMethod)
{
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);
}
}
}
这不是首选方法,但当我想不出其他选择时,我会从 Acumatica 复制源代码,例如静态方法和私有方法。我会在我的代码中注明它们已被复制,因此我可以确保在版本更改时复制该过程。然后您可以在本地调用这些方法。不优雅但适合我:)