Search in sources :

Example 1 with MrpRepository

use of com.axelor.apps.supplychain.db.repo.MrpRepository in project axelor-open-suite by axelor.

the class MrpController method runCalculation.

public void runCalculation(ActionRequest request, ActionResponse response) {
    Mrp mrp = request.getContext().asType(Mrp.class);
    MrpService mrpService = Beans.get(MrpService.class);
    MrpRepository mrpRepository = Beans.get(MrpRepository.class);
    try {
        mrpService.runCalculation(mrpRepository.find(mrp.getId()));
    } catch (Exception e) {
        TraceBackService.trace(response, e);
        mrpService.onError(mrpRepository.find(mrp.getId()), e);
    } finally {
        response.setReload(true);
    }
}
Also used : Mrp(com.axelor.apps.supplychain.db.Mrp) MrpService(com.axelor.apps.supplychain.service.MrpService) MrpRepository(com.axelor.apps.supplychain.db.repo.MrpRepository) AxelorException(com.axelor.exception.AxelorException)

Example 2 with MrpRepository

use of com.axelor.apps.supplychain.db.repo.MrpRepository in project axelor-open-suite by axelor.

the class MrpController method undoManualChanges.

public void undoManualChanges(ActionRequest request, ActionResponse response) {
    Mrp mrp = request.getContext().asType(Mrp.class);
    MrpService mrpService = Beans.get(MrpService.class);
    MrpRepository mrpRepository = Beans.get(MrpRepository.class);
    try {
        mrpService.undoManualChanges(mrpRepository.find(mrp.getId()));
    } catch (Exception e) {
        TraceBackService.trace(response, e);
        mrpService.reset(mrpRepository.find(mrp.getId()));
    } finally {
        response.setReload(true);
    }
}
Also used : Mrp(com.axelor.apps.supplychain.db.Mrp) MrpService(com.axelor.apps.supplychain.service.MrpService) MrpRepository(com.axelor.apps.supplychain.db.repo.MrpRepository) AxelorException(com.axelor.exception.AxelorException)

Aggregations

Mrp (com.axelor.apps.supplychain.db.Mrp)2 MrpRepository (com.axelor.apps.supplychain.db.repo.MrpRepository)2 MrpService (com.axelor.apps.supplychain.service.MrpService)2 AxelorException (com.axelor.exception.AxelorException)2