如何在Axapta 3.0中创建X ++批处理作业? [英] How to create an X++ batch job in Axapta 3.0?
问题描述
我想在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屋!