Search in sources :

Example 26 with BillOfMaterial

use of com.axelor.apps.production.db.BillOfMaterial in project axelor-open-suite by axelor.

the class BillOfMaterialController method computeCostPrice.

public void computeCostPrice(ActionRequest request, ActionResponse response) throws AxelorException {
    BillOfMaterial billOfMaterial = request.getContext().asType(BillOfMaterial.class);
    CostSheet costSheet = Beans.get(CostSheetService.class).computeCostPrice(Beans.get(BillOfMaterialRepository.class).find(billOfMaterial.getId()), CostSheetService.ORIGIN_BILL_OF_MATERIAL, null);
    response.setView(ActionView.define(String.format(I18n.get("Cost sheet - %s"), billOfMaterial.getName())).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);
}
Also used : BillOfMaterial(com.axelor.apps.production.db.BillOfMaterial) CostSheetService(com.axelor.apps.production.service.costsheet.CostSheetService) CostSheet(com.axelor.apps.production.db.CostSheet)

Example 27 with BillOfMaterial

use of com.axelor.apps.production.db.BillOfMaterial in project axelor-open-suite by axelor.

the class BillOfMaterialController method generateNewVersion.

public void generateNewVersion(ActionRequest request, ActionResponse response) {
    BillOfMaterial billOfMaterial = Beans.get(BillOfMaterialRepository.class).find(request.getContext().asType(BillOfMaterial.class).getId());
    BillOfMaterial copy = Beans.get(BillOfMaterialService.class).generateNewVersion(billOfMaterial);
    response.setView(ActionView.define("Bill of materials").model(BillOfMaterial.class.getName()).add("form", "bill-of-material-form").add("grid", "bill-of-material-grid").param("search-filters", "bill-of-material-filters").domain("self.defineSubBillOfMaterial = true AND self.personalized = false").context("_showRecord", String.valueOf(copy.getId())).map());
}
Also used : BillOfMaterial(com.axelor.apps.production.db.BillOfMaterial) BillOfMaterialService(com.axelor.apps.production.service.BillOfMaterialService) BillOfMaterialRepository(com.axelor.apps.production.db.repo.BillOfMaterialRepository)

Example 28 with BillOfMaterial

use of com.axelor.apps.production.db.BillOfMaterial in project axelor-open-suite by axelor.

the class BillOfMaterialController method setBillOfMaterialAsDefault.

public void setBillOfMaterialAsDefault(ActionRequest request, ActionResponse response) {
    try {
        BillOfMaterial billOfMaterial = request.getContext().asType(BillOfMaterial.class);
        billOfMaterial = Beans.get(BillOfMaterialRepository.class).find(billOfMaterial.getId());
        Beans.get(BillOfMaterialService.class).setBillOfMaterialAsDefault(billOfMaterial);
        response.setReload(true);
    } catch (Exception e) {
        TraceBackService.trace(e);
    }
}
Also used : BillOfMaterial(com.axelor.apps.production.db.BillOfMaterial) BillOfMaterialService(com.axelor.apps.production.service.BillOfMaterialService) AxelorException(com.axelor.exception.AxelorException)

Example 29 with BillOfMaterial

use of com.axelor.apps.production.db.BillOfMaterial in project axelor-open-suite by axelor.

the class BillOfMaterialController method print.

public void print(ActionRequest request, ActionResponse response) throws AxelorException {
    BillOfMaterial billOfMaterial = request.getContext().asType(BillOfMaterial.class);
    BillOfMaterialService billOfMaterialService = Beans.get(BillOfMaterialService.class);
    String language = ReportSettings.getPrintingLocale(null);
    String name = billOfMaterialService.getFileName(billOfMaterial);
    String fileLink = billOfMaterialService.getReportLink(billOfMaterial, name, language, ReportSettings.FORMAT_PDF);
    LOG.debug("Printing " + name);
    response.setView(ActionView.define(name).add("html", fileLink).map());
}
Also used : BillOfMaterial(com.axelor.apps.production.db.BillOfMaterial) BillOfMaterialService(com.axelor.apps.production.service.BillOfMaterialService)

Example 30 with BillOfMaterial

use of com.axelor.apps.production.db.BillOfMaterial in project axelor-open-suite by axelor.

the class BillOfMaterialController method openBomTree.

public void openBomTree(ActionRequest request, ActionResponse response) {
    BillOfMaterial billOfMaterial = request.getContext().asType(BillOfMaterial.class);
    billOfMaterial = Beans.get(BillOfMaterialRepository.class).find(billOfMaterial.getId());
    TempBomTree tempBomTree = Beans.get(BillOfMaterialService.class).generateTree(billOfMaterial, false);
    response.setView(ActionView.define(I18n.get("Bill of materials")).model(TempBomTree.class.getName()).add("tree", "bill-of-material-tree").context("_tempBomTreeId", tempBomTree.getId()).map());
}
Also used : BillOfMaterial(com.axelor.apps.production.db.BillOfMaterial) TempBomTree(com.axelor.apps.production.db.TempBomTree) BillOfMaterialService(com.axelor.apps.production.service.BillOfMaterialService)

Aggregations

BillOfMaterial (com.axelor.apps.production.db.BillOfMaterial)36 Product (com.axelor.apps.base.db.Product)19 BigDecimal (java.math.BigDecimal)16 AxelorException (com.axelor.exception.AxelorException)15 Transactional (com.google.inject.persist.Transactional)11 ProdProduct (com.axelor.apps.production.db.ProdProduct)10 ArrayList (java.util.ArrayList)8 ProdResidualProduct (com.axelor.apps.production.db.ProdResidualProduct)7 BillOfMaterialService (com.axelor.apps.production.service.BillOfMaterialService)7 Unit (com.axelor.apps.base.db.Unit)4 ProductRepository (com.axelor.apps.base.db.repo.ProductRepository)4 ProdProcess (com.axelor.apps.production.db.ProdProcess)4 ProdProcessLine (com.axelor.apps.production.db.ProdProcessLine)4 ProductionOrder (com.axelor.apps.production.db.ProductionOrder)4 AppProductionService (com.axelor.apps.production.service.app.AppProductionService)4 ProductCompanyService (com.axelor.apps.base.service.ProductCompanyService)3 AppBaseService (com.axelor.apps.base.service.app.AppBaseService)3 ManufOrder (com.axelor.apps.production.db.ManufOrder)3 UnitCostCalcLine (com.axelor.apps.production.db.UnitCostCalcLine)3 BillOfMaterialRepository (com.axelor.apps.production.db.repo.BillOfMaterialRepository)3