Search in sources :

Example 1 with ProjectedStockService

use of com.axelor.apps.supplychain.service.ProjectedStockService in project axelor-open-suite by axelor.

the class ProjectedStockController method showProjectedStock.

public void showProjectedStock(ActionRequest request, ActionResponse response) {
    try {
        ProjectedStockService projectedStockService = Beans.get(ProjectedStockService.class);
        Map<String, Long> mapId = projectedStockService.getProductIdCompanyIdStockLocationIdFromContext(request.getContext());
        if (mapId == null || mapId.get("productId") == 0L) {
            return;
        }
        final List<MrpLine> mrpLineList = new ArrayList<>();
        try {
            mrpLineList.addAll(projectedStockService.createProjectedStock(mapId.get("productId"), mapId.get("companyId"), mapId.get("stockLocationId")));
            response.setView(ActionView.define(I18n.get("Projected stock")).model(MrpLine.class.getName()).add("form", "projected-stock-form").param("popup", "true").param("popup-save", "false").param("popup.maximized", "true").context("_mrpLineList", mrpLineList).map());
        } catch (Exception e) {
            TraceBackService.trace(response, e);
        } finally {
            projectedStockService.removeMrpAndMrpLine(mrpLineList);
        }
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : ProjectedStockService(com.axelor.apps.supplychain.service.ProjectedStockService) ArrayList(java.util.ArrayList) MrpLine(com.axelor.apps.supplychain.db.MrpLine)

Aggregations

MrpLine (com.axelor.apps.supplychain.db.MrpLine)1 ProjectedStockService (com.axelor.apps.supplychain.service.ProjectedStockService)1 ArrayList (java.util.ArrayList)1