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);
}
}
Aggregations