Search in sources :

Example 1 with CostSheetService

use of com.axelor.apps.production.service.costsheet.CostSheetService in project axelor-open-suite by axelor.

the class ManufOrderController method computeCostPrice.

/**
 * Called from manuf order form, on clicking "compute cost price" button. Call {@link
 * CostSheetService#computeCostPrice(ManufOrder, int, LocalDate)}.
 *
 * @param request
 * @param response
 */
public void computeCostPrice(ActionRequest request, ActionResponse response) {
    try {
        ManufOrder manufOrder = request.getContext().asType(ManufOrder.class);
        manufOrder = Beans.get(ManufOrderRepository.class).find(manufOrder.getId());
        CostSheet costSheet = Beans.get(CostSheetService.class).computeCostPrice(manufOrder, CostSheetRepository.CALCULATION_WORK_IN_PROGRESS, Beans.get(AppBaseService.class).getTodayDate(manufOrder.getCompany()));
        response.setView(ActionView.define(I18n.get("Cost sheet")).model(CostSheet.class.getName()).param("popup", "true").param("show-toolbar", "false").param("show-confirm", "false").param("popup-save", "false").add("grid", "cost-sheet-bill-of-material-grid").add("form", "cost-sheet-bill-of-material-form").context("_showRecord", String.valueOf(costSheet.getId())).map());
        response.setReload(true);
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : CostSheetService(com.axelor.apps.production.service.costsheet.CostSheetService) CostSheet(com.axelor.apps.production.db.CostSheet) BirtException(org.eclipse.birt.core.exception.BirtException) AxelorException(com.axelor.exception.AxelorException) IOException(java.io.IOException) ManufOrder(com.axelor.apps.production.db.ManufOrder)

Aggregations

CostSheet (com.axelor.apps.production.db.CostSheet)1 ManufOrder (com.axelor.apps.production.db.ManufOrder)1 CostSheetService (com.axelor.apps.production.service.costsheet.CostSheetService)1 AxelorException (com.axelor.exception.AxelorException)1 IOException (java.io.IOException)1 BirtException (org.eclipse.birt.core.exception.BirtException)1