Search in sources :

Example 16 with Batch

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

the class MailBatchController method remindTimesheetGeneral.

public void remindTimesheetGeneral(ActionRequest request, ActionResponse response) throws AxelorException {
    MailBatch mailBatch = Beans.get(MailBatchRepository.class).findByCode(MailBatchRepository.CODE_BATCH_EMAIL_TIME_SHEET);
    if (mailBatch != null) {
        Batch batch = null;
        batch = Beans.get(MailBatchService.class).remindMail(mailBatch);
        if (batch != null)
            response.setFlash(batch.getComments());
        response.setReload(true);
    } else {
        throw new AxelorException(TraceBackRepository.CATEGORY_INCONSISTENCY, I18n.get(IExceptionMessage.BASE_BATCH_2), MailBatchRepository.CODE_BATCH_EMAIL_TIME_SHEET);
    }
}
Also used : AxelorException(com.axelor.exception.AxelorException) MailBatch(com.axelor.apps.base.db.MailBatch) MailBatchRepository(com.axelor.apps.base.db.repo.MailBatchRepository) Batch(com.axelor.apps.base.db.Batch) MailBatch(com.axelor.apps.base.db.MailBatch)

Example 17 with Batch

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

the class ProjectInvoicingAssistantBatchController method actionUpdateTask.

public void actionUpdateTask(ActionRequest request, ActionResponse response) {
    try {
        ProjectInvoicingAssistantBatch projectInvoicingAssistantBatch = request.getContext().asType(ProjectInvoicingAssistantBatch.class);
        projectInvoicingAssistantBatch = Beans.get(ProjectInvoicingAssistantBatchRepository.class).find(projectInvoicingAssistantBatch.getId());
        Batch batch = Beans.get(ProjectInvoicingAssistantBatchService.class).updateTask(projectInvoicingAssistantBatch);
        response.setFlash(batch.getComments());
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    } finally {
        response.setReload(true);
    }
}
Also used : Batch(com.axelor.apps.base.db.Batch) ProjectInvoicingAssistantBatch(com.axelor.apps.businessproject.db.ProjectInvoicingAssistantBatch) ProjectInvoicingAssistantBatch(com.axelor.apps.businessproject.db.ProjectInvoicingAssistantBatch) ProjectInvoicingAssistantBatchService(com.axelor.apps.businessproject.service.batch.ProjectInvoicingAssistantBatchService)

Example 18 with Batch

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

the class SaleBatchController method run.

/**
 * 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(SaleBatchService.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 : SaleBatch(com.axelor.apps.sale.db.SaleBatch) Batch(com.axelor.apps.base.db.Batch) HashMap(java.util.HashMap) SaleBatchService(com.axelor.apps.supplychain.service.batch.SaleBatchService)

Example 19 with Batch

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

the class BankPaymentBatchController method actionBankStatement.

public void actionBankStatement(ActionRequest request, ActionResponse response) {
    try {
        BankPaymentBatch bankPaymentBatch = request.getContext().asType(BankPaymentBatch.class);
        bankPaymentBatch = Beans.get(BankPaymentBatchRepository.class).find(bankPaymentBatch.getId());
        Batch batch = Beans.get(BatchBankStatement.class).bankStatement(bankPaymentBatch);
        if (batch != null)
            response.setFlash(batch.getComments());
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    } finally {
        response.setReload(true);
    }
}
Also used : BatchBankStatement(com.axelor.apps.bankpayment.service.batch.BatchBankStatement) Batch(com.axelor.apps.base.db.Batch) BankPaymentBatch(com.axelor.apps.bankpayment.db.BankPaymentBatch) BankPaymentBatch(com.axelor.apps.bankpayment.db.BankPaymentBatch)

Example 20 with Batch

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

the class BatchController method createBankOrder.

public void createBankOrder(ActionRequest request, ActionResponse response) {
    try {
        Batch batch = request.getContext().asType(Batch.class);
        batch = Beans.get(BatchRepository.class).find(batch.getId());
        Beans.get(BatchBankPaymentService.class).createBankOrder(batch);
        response.setReload(true);
    } catch (Exception e) {
        TraceBackService.trace(response, e, ResponseMessageType.ERROR);
    }
}
Also used : Batch(com.axelor.apps.base.db.Batch) BatchBankPaymentService(com.axelor.apps.bankpayment.service.batch.BatchBankPaymentService)

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