如何在Axapta 3.0中创建X ++批处理作业? [英] How to create an X++ batch job in Axapta 3.0?

查看:80
本文介绍了如何在Axapta 3.0中创建X ++批处理作业?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在X ++中为Microsoft Axapta 3.0(Dynamics AX)创建一个批处理作业.

I'd like to create a batch job in X++ for Microsoft Axapta 3.0 (Dynamics AX).

我如何创建一个执行像这样的X ++函数的作业?

How can I create a job which executes an X++ function like this one?

static void ExternalDataRead(Args _args)
{
...
}

推荐答案

以下是在AX中创建批处理作业所需的最低要求:

Here's the bare minimum needed to create a batch job in AX:

通过创建扩展RunBaseBatch类的新类来创建批处理作业:

Create a batch job by creating a new class that extends the RunBaseBatch class:

class MyBatchJob extends RunBaseBatch
{
}

实现抽象方法pack():

public container pack()
{
    return connull();
}

实现抽象方法unpack():

public boolean unpack(container packedClass)
{
    return true;
}

用您要执行的代码覆盖run()方法:

Override the run() method with the code you want to execute:

public void run()
{
    ;
    ...
    info("MyBatchJob completed");
}

将静态main方法添加到您的类中以创建您的类的实例并调用标准的RunBaseBatch对话框:

Add a static main method to your class to create an instance of your class and call the standard RunBaseBatch dialog:

static void main(Args _args)
{
    MyBatchJob myBatchJob = new MyBatchJob();
    ;
    if(myBatchJob.prompt())
    {
        myBatchJob.run();
    }
}

如果您希望批处理作业在批处理列表中有说明,请向您的班级添加静态description方法:

If you want your batch job to have a description in the batch list, add a static description method to your class:

server client static public ClassDescription description()
{
    return "My batch job";
}

这篇关于如何在Axapta 3.0中创建X ++批处理作业?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆