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