As the name indicate, this job is used to send the XML (Out bound).
static void SendElectronically(Args _args)
{
AxdSendContext axdSendContext = AxdSendContext::construct();
AifEntityKey aifEntityKey = AifEntityKey::construct();
Map keyData;
AifConstraintList aifConstraintList = new AifConstraintList();
AifConstraint aifConstraint = new AifConstraint();
LedgerJournalTable ledgerJournalTable;
//PurchTable purchTable;
CustInvoiceJour custinvoiceJour;
;
//select firstOnly purchTable
//where purchTable.purchid == "PO-0000013";
while select custinvoiceJour
order by InvoiceId
where custinvoiceJour.SalesId == "0000005"
{
keyData = SysDictTable::getKeyData(custinvoiceJour);
aifEntityKey.parmTableId(custinvoiceJour.TableId);
aifEntityKey.parmRecId(custinvoiceJour.RecId);
aifEntityKey.parmKeyDataMap(keyData);
axdSendContext.parmXMLDocPurpose(XMLDocPurpose::Original);
axdSendContext.parmSecurity(false);
aifConstraint.parmType(AifConstraintType::NoConstraint) ;
aifConstraintList.addConstraint(aifConstraint) ;
AifSendService::submitDefault( classnum(AvaSalesInvoiceTransService),
aifEntityKey,
aifConstraintList,
AifSendMode::Async,
axdSendContext.pack());
}
}
-----------------------------------------------------------------------------------------------------------
This job is used to process AIF Inbound
static void aifInboundJob()
{
new AifGatewayReceiveService().run();
new AifInboundProcessingService().run();
}
-------------------------------------------------------------------------------------------------------------
This job is used to process AIF Outbound
static void aifOutboundJob()
{
new AifOutboundProcessingService().run();
new AifGatewaySendService().run();
}
--------------------------------------------------------------------------------------------------------------
static void AifSetupMainBatchJobs(Args _args)
{
#AvaAif
BatchJob batchJob;
Batch batch;
if(!BatchJob::existAvaCaption(#AIF+"2"))
{
ttsBegin;
//create batch job
batchJob.initValue();
batchJob.Caption = #AIF+"2";
batchJob.OrigStartDateTime = DateTimeUtil::getSystemDateTime();
batchJob.Status = BatchStatus::Waiting;
batchJob.insert();
//create AIF receive service task
batch.initFromClass(new AifGatewayReceiveService());
batch.Caption = #AifGatewayReceiveServiceCaption;
batch.BatchJobId = batchJob.RecId;
batch.Status = BatchStatus::Waiting;
batch.RunType = BatchRunType::Server;
batch.Company = curext();
batch.insert();
//create AIF send service task
batch.initFromClass(new AifGatewaySendService());
batch.Caption = #AifGatewaySendServiceCaption;
batch.BatchJobId = batchJob.RecId;
batch.Status = BatchStatus::Waiting;
batch.RunType = BatchRunType::Server;
batch.Company = curext();
batch.insert();
//create AIF inbound service task
batch.initFromClass(new AifInboundProcessingService());
batch.Caption = #AifInboundProcessingServiceCaption;
batch.BatchJobId = batchJob.RecId;
batch.Status = BatchStatus::Waiting;
batch.RunType = BatchRunType::Server;
batch.Company = curext();
batch.insert();
//create AIF outbound service task
batch.initFromClass(new AifOutboundProcessingService());
batch.Caption = #AifOutboundProcessingServiceCaption;
batch.BatchJobId = batchJob.RecId;
batch.Status = BatchStatus::Waiting;
batch.RunType = BatchRunType::Server;
batch.Company = curext();
batch.insert();
//start the batch job
ttsCommit;
}
}
static void SendElectronically(Args _args)
{
AxdSendContext axdSendContext = AxdSendContext::construct();
AifEntityKey aifEntityKey = AifEntityKey::construct();
Map keyData;
AifConstraintList aifConstraintList = new AifConstraintList();
AifConstraint aifConstraint = new AifConstraint();
LedgerJournalTable ledgerJournalTable;
//PurchTable purchTable;
CustInvoiceJour custinvoiceJour;
;
//select firstOnly purchTable
//where purchTable.purchid == "PO-0000013";
while select custinvoiceJour
order by InvoiceId
where custinvoiceJour.SalesId == "0000005"
{
keyData = SysDictTable::getKeyData(custinvoiceJour);
aifEntityKey.parmTableId(custinvoiceJour.TableId);
aifEntityKey.parmRecId(custinvoiceJour.RecId);
aifEntityKey.parmKeyDataMap(keyData);
axdSendContext.parmXMLDocPurpose(XMLDocPurpose::Original);
axdSendContext.parmSecurity(false);
aifConstraint.parmType(AifConstraintType::NoConstraint) ;
aifConstraintList.addConstraint(aifConstraint) ;
AifSendService::submitDefault( classnum(AvaSalesInvoiceTransService),
aifEntityKey,
aifConstraintList,
AifSendMode::Async,
axdSendContext.pack());
}
}
-----------------------------------------------------------------------------------------------------------
This job is used to process AIF Inbound
static void aifInboundJob()
{
new AifGatewayReceiveService().run();
new AifInboundProcessingService().run();
}
-------------------------------------------------------------------------------------------------------------
This job is used to process AIF Outbound
static void aifOutboundJob()
{
new AifOutboundProcessingService().run();
new AifGatewaySendService().run();
}
--------------------------------------------------------------------------------------------------------------
static void AifSetupMainBatchJobs(Args _args)
{
#AvaAif
BatchJob batchJob;
Batch batch;
if(!BatchJob::existAvaCaption(#AIF+"2"))
{
ttsBegin;
//create batch job
batchJob.initValue();
batchJob.Caption = #AIF+"2";
batchJob.OrigStartDateTime = DateTimeUtil::getSystemDateTime();
batchJob.Status = BatchStatus::Waiting;
batchJob.insert();
//create AIF receive service task
batch.initFromClass(new AifGatewayReceiveService());
batch.Caption = #AifGatewayReceiveServiceCaption;
batch.BatchJobId = batchJob.RecId;
batch.Status = BatchStatus::Waiting;
batch.RunType = BatchRunType::Server;
batch.Company = curext();
batch.insert();
//create AIF send service task
batch.initFromClass(new AifGatewaySendService());
batch.Caption = #AifGatewaySendServiceCaption;
batch.BatchJobId = batchJob.RecId;
batch.Status = BatchStatus::Waiting;
batch.RunType = BatchRunType::Server;
batch.Company = curext();
batch.insert();
//create AIF inbound service task
batch.initFromClass(new AifInboundProcessingService());
batch.Caption = #AifInboundProcessingServiceCaption;
batch.BatchJobId = batchJob.RecId;
batch.Status = BatchStatus::Waiting;
batch.RunType = BatchRunType::Server;
batch.Company = curext();
batch.insert();
//create AIF outbound service task
batch.initFromClass(new AifOutboundProcessingService());
batch.Caption = #AifOutboundProcessingServiceCaption;
batch.BatchJobId = batchJob.RecId;
batch.Status = BatchStatus::Waiting;
batch.RunType = BatchRunType::Server;
batch.Company = curext();
batch.insert();
//start the batch job
ttsCommit;
}
}