use of com.axelor.apps.production.db.ProdResidualProduct in project axelor-open-suite by axelor.
the class ManufOrderServiceImpl method createToProduceProdProductList.
@Override
public void createToProduceProdProductList(ManufOrder manufOrder) {
BigDecimal manufOrderQty = manufOrder.getQty();
BillOfMaterial billOfMaterial = manufOrder.getBillOfMaterial();
BigDecimal bomQty = billOfMaterial.getQty();
// add the produced product
manufOrder.addToProduceProdProductListItem(new ProdProduct(manufOrder.getProduct(), manufOrderQty, billOfMaterial.getUnit()));
// Add the residual products
if (appProductionService.getAppProduction().getManageResidualProductOnBom() && billOfMaterial.getProdResidualProductList() != null) {
for (ProdResidualProduct prodResidualProduct : billOfMaterial.getProdResidualProductList()) {
Product product = productVariantService.getProductVariant(manufOrder.getProduct(), prodResidualProduct.getProduct());
BigDecimal qty = bomQty.signum() != 0 ? prodResidualProduct.getQty().multiply(manufOrderQty).divide(bomQty, appBaseService.getNbDecimalDigitForQty(), RoundingMode.HALF_UP) : BigDecimal.ZERO;
manufOrder.addToProduceProdProductListItem(new ProdProduct(product, qty, prodResidualProduct.getUnit()));
}
}
}
use of com.axelor.apps.production.db.ProdResidualProduct 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);
}
}
}
Aggregations