Search in sources :

Example 1 with LogisticalFormService

use of com.axelor.apps.stock.service.LogisticalFormService in project axelor-open-suite by axelor.

the class LogisticalFormController method addStockMove.

public void addStockMove(ActionRequest request, ActionResponse response) {
    try {
        @SuppressWarnings("unchecked") Map<String, Object> stockMoveMap = (Map<String, Object>) request.getContext().get("stockMove");
        if (stockMoveMap != null) {
            StockMove stockMove = Mapper.toBean(StockMove.class, stockMoveMap);
            stockMove = Beans.get(StockMoveRepository.class).find(stockMove.getId());
            if (stockMove.getStockMoveLineList() != null) {
                LogisticalForm logisticalForm = request.getContext().asType(LogisticalForm.class);
                LogisticalFormService logisticalFormService = Beans.get(LogisticalFormService.class);
                logisticalFormService.addDetailLines(logisticalForm, stockMove);
                response.setValue("logisticalFormLineList", logisticalForm.getLogisticalFormLineList());
                response.setValue("$stockMove", null);
            }
        }
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : StockMove(com.axelor.apps.stock.db.StockMove) LogisticalForm(com.axelor.apps.stock.db.LogisticalForm) LogisticalFormService(com.axelor.apps.stock.service.LogisticalFormService) Map(java.util.Map)

Example 2 with LogisticalFormService

use of com.axelor.apps.stock.service.LogisticalFormService in project axelor-open-suite by axelor.

the class LogisticalFormController method checkLines.

public void checkLines(ActionRequest request, ActionResponse response) {
    try {
        LogisticalForm logisticalForm = request.getContext().asType(LogisticalForm.class);
        LogisticalFormService logisticalFormService = Beans.get(LogisticalFormService.class);
        logisticalFormService.sortLines(logisticalForm);
        logisticalFormService.checkLines(logisticalForm);
    } catch (LogisticalFormWarning e) {
        response.setAlert(e.getLocalizedMessage());
    } catch (LogisticalFormError e) {
        response.setError(e.getLocalizedMessage());
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : LogisticalForm(com.axelor.apps.stock.db.LogisticalForm) LogisticalFormService(com.axelor.apps.stock.service.LogisticalFormService) LogisticalFormError(com.axelor.apps.stock.exception.LogisticalFormError) LogisticalFormWarning(com.axelor.apps.stock.exception.LogisticalFormWarning)

Example 3 with LogisticalFormService

use of com.axelor.apps.stock.service.LogisticalFormService in project axelor-open-suite by axelor.

the class LogisticalFormController method refreshProductNetMass.

public void refreshProductNetMass(ActionRequest request, ActionResponse response) {
    try {
        LogisticalForm logisticalForm = request.getContext().asType(LogisticalForm.class);
        LogisticalFormService logisticalFormService = Beans.get(LogisticalFormService.class);
        logisticalFormService.updateProductNetMass(logisticalForm);
        response.setValue("logisticalFormLineList", logisticalForm.getLogisticalFormLineList());
        response.setValue("totalNetMass", logisticalForm.getTotalNetMass());
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : LogisticalForm(com.axelor.apps.stock.db.LogisticalForm) LogisticalFormService(com.axelor.apps.stock.service.LogisticalFormService)

Aggregations

LogisticalForm (com.axelor.apps.stock.db.LogisticalForm)3 LogisticalFormService (com.axelor.apps.stock.service.LogisticalFormService)3 StockMove (com.axelor.apps.stock.db.StockMove)1 LogisticalFormError (com.axelor.apps.stock.exception.LogisticalFormError)1 LogisticalFormWarning (com.axelor.apps.stock.exception.LogisticalFormWarning)1 Map (java.util.Map)1