use of com.axelor.apps.production.db.CostSheetLine in project axelor-open-suite by axelor.
the class CostSheetServiceImpl method computeResidualProduct.
protected void computeResidualProduct(BillOfMaterial billOfMaterial) throws AxelorException {
if (this.manageResidualProductOnBom && billOfMaterial.getProdResidualProductList() != null) {
for (ProdResidualProduct prodResidualProduct : billOfMaterial.getProdResidualProductList()) {
CostSheetLine costSheetLine = costSheetLineService.createResidualProductCostSheetLine(prodResidualProduct.getProduct(), prodResidualProduct.getUnit(), prodResidualProduct.getQty(), billOfMaterial.getCompany());
costSheet.addCostSheetLineListItem(costSheetLine);
}
}
}
use of com.axelor.apps.production.db.CostSheetLine in project axelor-open-suite by axelor.
the class CostSheetServiceImpl method computeRealResidualProduct.
protected void computeRealResidualProduct(ManufOrder manufOrder) throws AxelorException {
for (StockMoveLine stockMoveLine : manufOrder.getProducedStockMoveLineList()) {
if (stockMoveLine.getProduct() != null && manufOrder.getProduct() != null && (!stockMoveLine.getProduct().equals(manufOrder.getProduct()))) {
CostSheetLine costSheetLine = costSheetLineService.createResidualProductCostSheetLine(stockMoveLine.getProduct(), stockMoveLine.getUnit(), stockMoveLine.getRealQty(), manufOrder.getCompany());
costSheet.addCostSheetLineListItem(costSheetLine);
}
}
}
use of com.axelor.apps.production.db.CostSheetLine in project axelor-open-suite by axelor.
the class CostSheetServiceImpl method _computeToConsumeProduct.
protected void _computeToConsumeProduct(Company company, BillOfMaterial billOfMaterial, int bomLevel, CostSheetLine parentCostSheetLine, int origin, UnitCostCalculation unitCostCalculation) throws AxelorException {
if (billOfMaterial.getBillOfMaterialSet() != null) {
for (BillOfMaterial billOfMaterialLine : billOfMaterial.getBillOfMaterialSet()) {
Product product = billOfMaterialLine.getProduct();
if (product != null) {
CostSheetLine costSheetLine = costSheetLineService.createConsumedProductCostSheetLine(company, product, billOfMaterialLine.getUnit(), bomLevel, parentCostSheetLine, billOfMaterialLine.getQty(), origin, unitCostCalculation);
BigDecimal wasteRate = billOfMaterialLine.getWasteRate();
if (wasteRate != null && wasteRate.compareTo(BigDecimal.ZERO) > 0) {
costSheetLineService.createConsumedProductWasteCostSheetLine(company, product, billOfMaterialLine.getUnit(), bomLevel, parentCostSheetLine, billOfMaterialLine.getQty(), wasteRate, origin, unitCostCalculation);
}
if (billOfMaterialLine.getDefineSubBillOfMaterial()) {
this._computeCostPrice(company, billOfMaterialLine, bomLevel, costSheetLine, origin, unitCostCalculation);
}
}
}
}
}
use of com.axelor.apps.production.db.CostSheetLine in project axelor-open-suite by axelor.
the class CostSheetLineServiceImpl method createIndirectCostSheetLine.
protected CostSheetLine createIndirectCostSheetLine(CostSheetLine parentCostSheetLine, CostSheetGroup costSheetGroup, BigDecimal costPrice) {
CostSheetLine indirectCostSheetLine = this.getCostSheetLine(costSheetGroup, parentCostSheetLine);
if (indirectCostSheetLine == null) {
indirectCostSheetLine = this.createCostSheetLine(costSheetGroup.getCode(), costSheetGroup.getName(), parentCostSheetLine.getBomLevel() + 1, BigDecimal.ONE, null, costSheetGroup, null, CostSheetLineRepository.TYPE_INDIRECT_COST, CostSheetLineRepository.TYPE_INDIRECT_COST, null, null, parentCostSheetLine);
parentCostSheetLine.addCostSheetLineListItem(indirectCostSheetLine);
}
indirectCostSheetLine.setCostPrice(indirectCostSheetLine.getCostPrice().add(this.getIndirectCostPrice(costSheetGroup, costPrice)));
return indirectCostSheetLine;
}
use of com.axelor.apps.production.db.CostSheetLine in project axelor-open-suite by axelor.
the class CostSheetServiceImpl method computeCostPrice.
protected BigDecimal computeCostPrice(CostSheetLine parentCostSheetLine) {
BigDecimal costPrice = BigDecimal.ZERO;
if (parentCostSheetLine.getCostSheetLineList() != null) {
for (CostSheetLine costSheetLine : parentCostSheetLine.getCostSheetLineList()) {
if (costSheetLine.getCostSheetLineList() != null && !costSheetLine.getCostSheetLineList().isEmpty()) {
costPrice = costPrice.add(this.computeCostPrice(costSheetLine));
} else {
costPrice = costPrice.add(costSheetLine.getCostPrice());
}
}
}
parentCostSheetLine.setCostPrice(costPrice);
return costPrice;
}
Aggregations