Search in sources :

Example 36 with BillOfMaterial

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

the class BillOfMaterialServiceImpl method generateNewVersion.

@Override
@Transactional
public BillOfMaterial generateNewVersion(BillOfMaterial billOfMaterial) {
    BillOfMaterial copy = billOfMaterialRepo.copy(billOfMaterial, true);
    copy.setOriginalBillOfMaterial(billOfMaterial);
    copy.clearCostSheetList();
    copy.setCostPrice(BigDecimal.ZERO);
    copy.setOriginalBillOfMaterial(billOfMaterial);
    copy.setVersionNumber(this.getLatestBillOfMaterialVersion(billOfMaterial, billOfMaterial.getVersionNumber(), true) + 1);
    return billOfMaterialRepo.save(copy);
}
Also used : BillOfMaterial(com.axelor.apps.production.db.BillOfMaterial) Transactional(com.google.inject.persist.Transactional)

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