AX 2009 Batch - 非法目标代码。重新编译脚本

时间:2016-12-22 10:32:21

标签: axapta x++ dynamics-ax-2009

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

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

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

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

(S)\ Classes \ OESCreatePurchFromSalesBatch \ run - line 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;
    }
}

在我看来,问题在于构造方法,并且新类不能使用参数创建,但是没有参数。我不太确定为什么会发生这种情况

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

任何想法?

1 个答案:

答案 0 :(得分:0)

确保编译您更改的任何类(在加载项中找到,以编译类和子类)。也许是OESCreatePurchFromSales或它的超类。 在再次测试之前重新启动批处理AOS服务器。