Search in sources :

Example 1 with Batch

use of com.axelor.apps.base.db.Batch in project axelor-open-suite by axelor.

the class CrmBatchController method run.

// WS
/**
 * Lancer le batch à travers un web service.
 *
 * @param request
 * @param response
 * @throws AxelorException
 */
public void run(ActionRequest request, ActionResponse response) throws AxelorException {
    Batch batch = Beans.get(CrmBatchService.class).run((String) request.getContext().get("code"));
    Map<String, Object> mapData = new HashMap<String, Object>();
    mapData.put("anomaly", batch.getAnomaly());
    response.setData(mapData);
}
Also used : Batch(com.axelor.apps.base.db.Batch) CrmBatch(com.axelor.apps.crm.db.CrmBatch) HashMap(java.util.HashMap) CrmBatchService(com.axelor.apps.crm.service.batch.CrmBatchService)

Example 2 with Batch

use of com.axelor.apps.base.db.Batch in project axelor-open-suite by axelor.

the class CrmBatchController method actionEventReminder.

/**
 * Lancer le batch de relance
 *
 * @param request
 * @param response
 */
public void actionEventReminder(ActionRequest request, ActionResponse response) {
    CrmBatch crmBatch = request.getContext().asType(CrmBatch.class);
    Batch batch = Beans.get(CrmBatchService.class).eventReminder(Beans.get(CrmBatchRepository.class).find(crmBatch.getId()));
    if (batch != null)
        response.setFlash(batch.getComments());
    response.setReload(true);
}
Also used : Batch(com.axelor.apps.base.db.Batch) CrmBatch(com.axelor.apps.crm.db.CrmBatch) CrmBatch(com.axelor.apps.crm.db.CrmBatch) CrmBatchService(com.axelor.apps.crm.service.batch.CrmBatchService)

Example 3 with Batch

use of com.axelor.apps.base.db.Batch in project axelor-open-suite by axelor.

the class CrmBatchController method actionTarget.

/**
 * Lancer le batch des objectifs
 *
 * @param request
 * @param response
 */
public void actionTarget(ActionRequest request, ActionResponse response) {
    CrmBatch crmBatch = request.getContext().asType(CrmBatch.class);
    Batch batch = Beans.get(CrmBatchService.class).target(Beans.get(CrmBatchRepository.class).find(crmBatch.getId()));
    if (batch != null)
        response.setFlash(batch.getComments());
    response.setReload(true);
}
Also used : Batch(com.axelor.apps.base.db.Batch) CrmBatch(com.axelor.apps.crm.db.CrmBatch) CrmBatch(com.axelor.apps.crm.db.CrmBatch) CrmBatchService(com.axelor.apps.crm.service.batch.CrmBatchService)

Example 4 with Batch

use of com.axelor.apps.base.db.Batch in project axelor-open-suite by axelor.

the class ContractBatchController method runBatch.

public void runBatch(ActionRequest request, ActionResponse response) {
    try {
        ContractBatch contractBatch = request.getContext().asType(ContractBatch.class);
        contractBatch = Beans.get(ContractBatchRepository.class).find(contractBatch.getId());
        Batch batch = Beans.get(BatchContract.class).run(contractBatch);
        response.setFlash(batch.getComments());
        response.setReload(true);
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : Batch(com.axelor.apps.base.db.Batch) ContractBatch(com.axelor.apps.contract.db.ContractBatch) BatchContract(com.axelor.apps.contract.batch.BatchContract) ContractBatch(com.axelor.apps.contract.db.ContractBatch)

Example 5 with Batch

use of com.axelor.apps.base.db.Batch in project axelor-open-suite by axelor.

the class AccountingBatchService method run.

@Override
public Batch run(Model batchModel) throws AxelorException {
    Batch batch;
    AccountingBatch accountingBatch = (AccountingBatch) batchModel;
    switch(accountingBatch.getActionSelect()) {
        case AccountingBatchRepository.ACTION_REIMBURSEMENT:
            if (accountingBatch.getReimbursementTypeSelect() == AccountingBatchRepository.REIMBURSEMENT_TYPE_EXPORT) {
                batch = reimbursementExport(accountingBatch);
            } else if (accountingBatch.getReimbursementTypeSelect() == AccountingBatchRepository.REIMBURSEMENT_TYPE_IMPORT) {
                batch = reimbursementImport(accountingBatch);
            }
            batch = null;
            break;
        case AccountingBatchRepository.ACTION_DEBT_RECOVERY:
            batch = debtRecovery(accountingBatch);
            break;
        case AccountingBatchRepository.ACTION_DOUBTFUL_CUSTOMER:
            batch = doubtfulCustomer(accountingBatch);
            break;
        case AccountingBatchRepository.ACTION_ACCOUNT_CUSTOMER:
            batch = accountCustomer(accountingBatch);
            break;
        case AccountingBatchRepository.ACTION_MOVE_LINE_EXPORT:
            batch = moveLineExport(accountingBatch);
            break;
        case AccountingBatchRepository.ACTION_CREDIT_TRANSFER:
            batch = creditTransfer(accountingBatch);
            break;
        case AccountingBatchRepository.ACTION_REALIZE_FIXED_ASSET_LINES:
            batch = realizeFixedAssetLines(accountingBatch);
            break;
        default:
            throw new AxelorException(TraceBackRepository.CATEGORY_INCONSISTENCY, I18n.get(IExceptionMessage.BASE_BATCH_1), accountingBatch.getActionSelect(), accountingBatch.getCode());
    }
    return batch;
}
Also used : AxelorException(com.axelor.exception.AxelorException) Batch(com.axelor.apps.base.db.Batch) AccountingBatch(com.axelor.apps.account.db.AccountingBatch) AccountingBatch(com.axelor.apps.account.db.AccountingBatch)

Aggregations

Batch (com.axelor.apps.base.db.Batch)43 AccountingBatch (com.axelor.apps.account.db.AccountingBatch)12 AxelorException (com.axelor.exception.AxelorException)12 AccountingBatchService (com.axelor.apps.account.service.batch.AccountingBatchService)6 AccountingBatchRepository (com.axelor.apps.account.db.repo.AccountingBatchRepository)5 HashMap (java.util.HashMap)5 CrmBatch (com.axelor.apps.crm.db.CrmBatch)4 InvoiceBatch (com.axelor.apps.account.db.InvoiceBatch)3 BankPaymentBatch (com.axelor.apps.bankpayment.db.BankPaymentBatch)3 ProjectInvoicingAssistantBatch (com.axelor.apps.businessproject.db.ProjectInvoicingAssistantBatch)3 CrmBatchService (com.axelor.apps.crm.service.batch.CrmBatchService)3 SupplychainBatch (com.axelor.apps.supplychain.db.SupplychainBatch)3 SupplychainBatchService (com.axelor.apps.supplychain.service.batch.SupplychainBatchService)3 InvoiceBatchService (com.axelor.apps.account.service.invoice.InvoiceBatchService)2 BaseBatch (com.axelor.apps.base.db.BaseBatch)2 MailBatch (com.axelor.apps.base.db.MailBatch)2 MailBatchRepository (com.axelor.apps.base.db.repo.MailBatchRepository)2 ProjectInvoicingAssistantBatchService (com.axelor.apps.businessproject.service.batch.ProjectInvoicingAssistantBatchService)2 Account (com.axelor.apps.account.db.Account)1 AccountConfig (com.axelor.apps.account.db.AccountConfig)1