Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Acumatica覆盖方法-扫描和接收屏幕_Acumatica - Fatal编程技术网

Acumatica覆盖方法-扫描和接收屏幕

Acumatica覆盖方法-扫描和接收屏幕,acumatica,Acumatica,你好 我正在寻找一种方法来重写公共类INScanReceive:WMSBase中的函数ProcessItemBarcodestring Barcode 其思想是扩展INScanReceiveHost图,并在处理条形码之前对其进行操作。这是为了改变如何扫描和接收页面扫描的条形码,以便我可以阅读和操作二维码 namespace PX.Objects.IN { // Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveM

你好

我正在寻找一种方法来重写公共类INScanReceive:WMSBase中的函数ProcessItemBarcodestring Barcode

其思想是扩展INScanReceiveHost图,并在处理条形码之前对其进行操作。这是为了改变如何扫描和接收页面扫描的条形码,以便我可以阅读和操作二维码

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
    }
}

然后我可以设置标题,只需将扫描仪重置为确认状态。您认为呢?

因为您试图覆盖的方法是受保护的,而不是公共的,所以您需要使用PXProtectedAccess属性和抽象图扩展以不同的方式覆盖逻辑

namespace MyCustomPackage.Graph.Extension
{
    public class INScanReceiveHostExtCustomPackage : PXGraphExtension<INScanReceive, INScanReceiveHost>
    {
        public static bool IsActive() => true;

        #region Overrides

        public delegate void ProcessItemBarcodeDelegate(string barcode);

        [PXOverride]
        public virtual void ProcessItemBarcode(string barcode, ProcessItemBarcodeDelegate baseMethod)
        {
            PXTrace.WriteInformation("Running abstract override");
            baseMethod?.Invoke(barcode);

        }

        #endregion
    }


    [PXProtectedAccess]
    public abstract class INScanReceiveHostExtProtectedAccess : PXGraphExtension<INScanReceiveHostExtCustomPackage, INScanReceive, INScanReceiveHost>
    {
        [PXProtectedAccess(typeof(INScanReceive))]
        protected abstract void ProcessItemBarcode(string barcode);        
    }
}

不幸的是,我没有一个很好的方法来测试它,因此您可能需要调整传递给抽象方法上方的PXProtectedAccess属性的类型。如果这不起作用,请尝试将INScanReceiveHost类型传递给属性,看看是否对您有效。

因为您试图覆盖的方法是受保护的,而不是公共的,所以您需要使用PXProtectedAccess属性和抽象图扩展以不同的方式覆盖逻辑

namespace MyCustomPackage.Graph.Extension
{
    public class INScanReceiveHostExtCustomPackage : PXGraphExtension<INScanReceive, INScanReceiveHost>
    {
        public static bool IsActive() => true;

        #region Overrides

        public delegate void ProcessItemBarcodeDelegate(string barcode);

        [PXOverride]
        public virtual void ProcessItemBarcode(string barcode, ProcessItemBarcodeDelegate baseMethod)
        {
            PXTrace.WriteInformation("Running abstract override");
            baseMethod?.Invoke(barcode);

        }

        #endregion
    }


    [PXProtectedAccess]
    public abstract class INScanReceiveHostExtProtectedAccess : PXGraphExtension<INScanReceiveHostExtCustomPackage, INScanReceive, INScanReceiveHost>
    {
        [PXProtectedAccess(typeof(INScanReceive))]
        protected abstract void ProcessItemBarcode(string barcode);        
    }
}

不幸的是,我没有一个很好的方法来测试它,因此您可能需要调整传递给抽象方法上方的PXProtectedAccess属性的类型。如果这不起作用,请尝试将INScanReceiveHost类型传递给属性,看看是否适合您。

谢谢Sean,我当然会给您一个快照!如果这还不能解决你的问题,让我知道。谢谢你到目前为止的帮助肖恩,如果你有时间,我在上面的问题中有一个后续问题。谢谢肖恩,我当然会给你一个机会!如果这不能解决你的问题,让我知道。谢谢你到目前为止的帮助肖恩,如果你有时间,我有一个跟进问题在我的问题上面
namespace MyCustomPackage.Graph.Extension
{
    public class INScanReceiveHostExtCustomPackage : PXGraphExtension<INScanReceive, INScanReceiveHost>
    {
        public static bool IsActive() => true;

        #region Overrides

        public delegate void ProcessItemBarcodeDelegate(string barcode);

        [PXOverride]
        public virtual void ProcessItemBarcode(string barcode, ProcessItemBarcodeDelegate baseMethod)
        {
            PXTrace.WriteInformation("Running abstract override");
            baseMethod?.Invoke(barcode);

        }

        #endregion
    }


    [PXProtectedAccess]
    public abstract class INScanReceiveHostExtProtectedAccess : PXGraphExtension<INScanReceiveHostExtCustomPackage, INScanReceive, INScanReceiveHost>
    {
        [PXProtectedAccess(typeof(INScanReceive))]
        protected abstract void ProcessItemBarcode(string barcode);        
    }
}