use of com.axelor.apps.base.db.Product 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.base.db.Product in project axelor-open-suite by axelor.
the class UnitCostCalculationServiceImpl method calculationProcess.
protected void calculationProcess(UnitCostCalculation unitCostCalculation) throws AxelorException {
for (int level = this.getMaxLevel(); level >= 0; level--) {
for (Product product : this.getProductList(level)) {
this.calculationProductProcess(unitCostCalculationRepository.find(unitCostCalculation.getId()), productRepository.find(product.getId()));
JPA.clear();
}
}
}
use of com.axelor.apps.base.db.Product in project axelor-open-suite by axelor.
the class ProductController method openProductTree.
public void openProductTree(ActionRequest request, ActionResponse response) {
Product product = request.getContext().asType(Product.class);
product = Beans.get(ProductRepository.class).find(product.getId());
TempBomTree tempBomTree = Beans.get(BillOfMaterialService.class).generateTree(product.getDefaultBillOfMaterial(), true);
response.setView(ActionView.define(I18n.get("Bill of materials")).model(TempBomTree.class.getName()).add("tree", "bill-of-material-tree").context("_tempBomTreeId", tempBomTree.getId()).map());
}
use of com.axelor.apps.base.db.Product in project axelor-open-suite by axelor.
the class ProductionProjectedStockController method showMissingQuantityOfProduct.
public void showMissingQuantityOfProduct(ActionRequest request, ActionResponse response) {
Map<String, Long> mapId = Beans.get(ProjectedStockService.class).getProductIdCompanyIdStockLocationIdFromContext(request.getContext());
if (mapId == null || mapId.get("productId") == 0L) {
return;
}
Long productId = mapId.get("productId");
Long companyId = mapId.get("companyId");
Long stockLocationId = mapId.get("stockLocationId");
String domain = Beans.get(ManufOrderService.class).getConsumeAndMissingQtyForAProduct(productId, companyId, stockLocationId);
Product product = Beans.get(ProductRepository.class).find(mapId.get("productId"));
String title = I18n.get(VIEW_MISSING_QTY_TITLE);
title = String.format(title, product.getName());
response.setView(ActionView.define(title).model(StockMoveLine.class.getName()).add("grid", "stock-move-line-consumed-manuf-order-grid").add("form", "stock-move-line-form").domain(domain).param("popup", "true").param("popup-save", "false").map());
}
use of com.axelor.apps.base.db.Product in project axelor-open-suite by axelor.
the class ProductionProjectedStockController method showBuildingQuantityOfProduct.
public void showBuildingQuantityOfProduct(ActionRequest request, ActionResponse response) {
Map<String, Long> mapId = Beans.get(ProjectedStockService.class).getProductIdCompanyIdStockLocationIdFromContext(request.getContext());
if (mapId == null || mapId.get("productId") == 0L) {
return;
}
Long productId = mapId.get("productId");
Long companyId = mapId.get("companyId");
Long stockLocationId = mapId.get("stockLocationId");
String domain = Beans.get(ManufOrderService.class).getBuildingQtyForAProduct(productId, companyId, stockLocationId);
Product product = Beans.get(ProductRepository.class).find(mapId.get("productId"));
String title = I18n.get(VIEW_BUILDING_QTY_TITLE);
title = String.format(title, product.getName());
response.setView(ActionView.define(title).model(StockMoveLine.class.getName()).add("grid", "stock-move-line-produced-manuf-order-grid").add("form", "stock-move-line-form").domain(domain).param("popup", "true").param("popup-save", "false").map());
}
Aggregations