AX 2009 批处理 - 非法对象代码。重新编译脚本

AX 2009 Batch - Illegal object code. Recompile Script

我用于从销售订单创建采购订单的批次 class 有问题。如果我尝试 运行 class 通常一切正常,但是如果我 运行 它作为批处理我得到一个错误

--- 非法对象代码。重新编译脚本。 ---

(S)\Classes\RunBaseBatch\new - 第 8 行

(S)\Classes\OESCreatePurchFromSales\construct - 第 3 行

(S)\Classes\OESCreatePurchFromSalesBatch\run - 第 10 行

(S)\Classes\BatchRun\runJobStatic - 第 63 行

public void run()
{
    OESCreatePurchFromSales oesCreatePurchFromSales;
    InterCompanyPurchSalesReference Reference;
    ;

    try
    {
        oesCreatePurchFromSales = oesCreatePurchFromSales::construct();
        select firstonly reference where reference.SalesId == SalesId;

        if(!reference)
        {
            oesCreatePurchFromSales.InitClass(SalesId);
        }        
    }
    catch(Exception::Deadlock)
    {
        retry;
    }
    catch(Exception::UpdateConflict)
    {
        throw Exception::UpdateConflict;
    }
    catch(Exception::Error)
    { 
        throw Exception::Error;
    }
}

在我看来问题出在 construct 方法上,新的 class 不能用参数创建,但是没有参数。我不太清楚为什么会这样

public static OESCreatePurchFromSales construct()
{
    return new OesCreatePurchFromSales();
}

有什么想法吗?

确保向前编译您更改的任何 classes(在加载项中找到,以编译 class 和子 classes)。也许 OESCreatePurchFromSales 或其超级 class。 重新启动批处理 AOS 服务器,然后再进行测试。