Search in sources :

Example 11 with StockMove

use of com.axelor.apps.stock.db.StockMove 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 12 with StockMove

use of com.axelor.apps.stock.db.StockMove in project axelor-open-suite by axelor.

the class StockMoveController method plan.

public void plan(ActionRequest request, ActionResponse response) {
    try {
        StockMove stockMove = request.getContext().asType(StockMove.class);
        // we have to inject TraceBackService to use non static methods
        TraceBackService traceBackService = Beans.get(TraceBackService.class);
        long tracebackCount = traceBackService.countMessageTraceBack(stockMove);
        Beans.get(StockMoveService.class).plan(Beans.get(StockMoveRepository.class).find(stockMove.getId()));
        response.setReload(true);
        if (traceBackService.countMessageTraceBack(stockMove) > tracebackCount) {
            traceBackService.findLastMessageTraceBack(stockMove).ifPresent(traceback -> response.setNotify(String.format(I18n.get(com.axelor.apps.message.exception.IExceptionMessage.SEND_EMAIL_EXCEPTION), traceback.getMessage())));
        }
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : TraceBackService(com.axelor.exception.service.TraceBackService) StockMove(com.axelor.apps.stock.db.StockMove) StockMoveService(com.axelor.apps.stock.service.StockMoveService) AxelorException(com.axelor.exception.AxelorException)

Example 13 with StockMove

use of com.axelor.apps.stock.db.StockMove in project axelor-open-suite by axelor.

the class StockMoveController method changeConformityStockMove.

public void changeConformityStockMove(ActionRequest request, ActionResponse response) {
    try {
        StockMove stockMove = request.getContext().asType(StockMove.class);
        response.setValue("stockMoveLineList", Beans.get(StockMoveService.class).changeConformityStockMove(stockMove));
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : StockMove(com.axelor.apps.stock.db.StockMove) AxelorException(com.axelor.exception.AxelorException)

Example 14 with StockMove

use of com.axelor.apps.stock.db.StockMove in project axelor-open-suite by axelor.

the class StockMoveController method refreshProductNetMass.

public void refreshProductNetMass(ActionRequest request, ActionResponse response) {
    try {
        StockMove stockMove = request.getContext().asType(StockMove.class);
        Beans.get(StockMoveService.class).updateProductNetMass(stockMove);
        response.setReload(true);
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : StockMove(com.axelor.apps.stock.db.StockMove) StockMoveService(com.axelor.apps.stock.service.StockMoveService) AxelorException(com.axelor.exception.AxelorException)

Example 15 with StockMove

use of com.axelor.apps.stock.db.StockMove in project axelor-open-suite by axelor.

the class StockMoveController method shipReciveAllProducts.

public void shipReciveAllProducts(ActionRequest request, ActionResponse response) {
    try {
        StockMove stockMove = request.getContext().asType(StockMove.class);
        Beans.get(StockMoveService.class).copyQtyToRealQty(Beans.get(StockMoveRepository.class).find(stockMove.getId()));
        response.setReload(true);
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : StockMove(com.axelor.apps.stock.db.StockMove) StockMoveService(com.axelor.apps.stock.service.StockMoveService) AxelorException(com.axelor.exception.AxelorException)

Aggregations

StockMove (com.axelor.apps.stock.db.StockMove)129 AxelorException (com.axelor.exception.AxelorException)57 StockMoveLine (com.axelor.apps.stock.db.StockMoveLine)50 ArrayList (java.util.ArrayList)36 StockMoveRepository (com.axelor.apps.stock.db.repo.StockMoveRepository)33 Transactional (com.google.inject.persist.Transactional)32 StockMoveService (com.axelor.apps.stock.service.StockMoveService)31 BigDecimal (java.math.BigDecimal)30 List (java.util.List)25 Company (com.axelor.apps.base.db.Company)23 Map (java.util.Map)21 Product (com.axelor.apps.base.db.Product)19 Invoice (com.axelor.apps.account.db.Invoice)18 StockLocation (com.axelor.apps.stock.db.StockLocation)18 Beans (com.axelor.inject.Beans)17 Optional (java.util.Optional)16 StockMoveLineService (com.axelor.apps.stock.service.StockMoveLineService)15 I18n (com.axelor.i18n.I18n)15 Inject (com.google.inject.Inject)14 HashMap (java.util.HashMap)14