use of com.axelor.apps.supplychain.service.ReservedQtyService in project axelor-open-suite by axelor.
the class StockMoveLineController method changeReservedQty.
/**
* Called from stock move line request quantity wizard view. Call {@link
* ReservedQtyService#updateReservedQty(StockMoveLine, BigDecimal)}.
*
* @param request
* @param response
*/
public void changeReservedQty(ActionRequest request, ActionResponse response) {
try {
StockMoveLine stockMoveLine = request.getContext().asType(StockMoveLine.class);
BigDecimal newReservedQty = stockMoveLine.getReservedQty();
stockMoveLine = Beans.get(StockMoveLineRepository.class).find(stockMoveLine.getId());
Product product = stockMoveLine.getProduct();
if (product == null || !product.getStockManaged()) {
throw new AxelorException(TraceBackRepository.CATEGORY_INCONSISTENCY, I18n.get(IExceptionMessage.SALE_ORDER_LINE_PRODUCT_NOT_STOCK_MANAGED));
}
Beans.get(ReservedQtyService.class).updateReservedQty(stockMoveLine, newReservedQty);
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.supplychain.service.ReservedQtyService in project axelor-open-suite by axelor.
the class StockMoveLineController method allocateAll.
/**
* Called from stock move form view, on clicking allocateAll button on one stock move line. Call
* {@link ReservedQtyService#allocateAll(StockMoveLine)}.
*
* @param request
* @param response
*/
public void allocateAll(ActionRequest request, ActionResponse response) {
try {
StockMoveLine stockMoveLine = request.getContext().asType(StockMoveLine.class);
stockMoveLine = Beans.get(StockMoveLineRepository.class).find(stockMoveLine.getId());
Product product = stockMoveLine.getProduct();
if (product == null || !product.getStockManaged()) {
throw new AxelorException(TraceBackRepository.CATEGORY_INCONSISTENCY, I18n.get(IExceptionMessage.SALE_ORDER_LINE_PRODUCT_NOT_STOCK_MANAGED));
}
Beans.get(ReservedQtyService.class).allocateAll(stockMoveLine);
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.supplychain.service.ReservedQtyService in project axelor-open-suite by axelor.
the class StockMoveLineController method deallocateAll.
/**
* Called from stock move form view, on clicking allocateAll button on one stock move line. Call
* {@link ReservedQtyService#updateReservedQty(stockMoveLine, BigDecimal.ZERO)}.
*
* @param request
* @param response
*/
public void deallocateAll(ActionRequest request, ActionResponse response) {
try {
StockMoveLine stockMoveLine = request.getContext().asType(StockMoveLine.class);
stockMoveLine = Beans.get(StockMoveLineRepository.class).find(stockMoveLine.getId());
Beans.get(ReservedQtyService.class).updateReservedQty(stockMoveLine, BigDecimal.ZERO);
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.supplychain.service.ReservedQtyService in project axelor-open-suite by axelor.
the class StockMoveLineController method cancelReservation.
/**
* Called from stock move line form view, on request qty click. Call {@link
* ReservedQtyService#cancelReservation(StockMoveLine)}.
*
* @param request
* @param response
*/
public void cancelReservation(ActionRequest request, ActionResponse response) {
try {
StockMoveLine stockMoveLine = request.getContext().asType(StockMoveLine.class);
stockMoveLine = Beans.get(StockMoveLineRepository.class).find(stockMoveLine.getId());
Product product = stockMoveLine.getProduct();
if (product == null || !product.getStockManaged()) {
throw new AxelorException(TraceBackRepository.CATEGORY_INCONSISTENCY, I18n.get(IExceptionMessage.SALE_ORDER_LINE_PRODUCT_NOT_STOCK_MANAGED));
}
Beans.get(ReservedQtyService.class).cancelReservation(stockMoveLine);
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.supplychain.service.ReservedQtyService in project axelor-open-suite by axelor.
the class StockMoveLineController method requestQty.
/**
* Called from stock move line form view, on request qty click. Call {@link
* ReservedQtyService#requestQty(StockMoveLine)}.
*
* @param request
* @param response
*/
public void requestQty(ActionRequest request, ActionResponse response) {
try {
StockMoveLine stockMoveLine = request.getContext().asType(StockMoveLine.class);
stockMoveLine = Beans.get(StockMoveLineRepository.class).find(stockMoveLine.getId());
Product product = stockMoveLine.getProduct();
if (product == null || !product.getStockManaged()) {
throw new AxelorException(TraceBackRepository.CATEGORY_INCONSISTENCY, I18n.get(IExceptionMessage.SALE_ORDER_LINE_PRODUCT_NOT_STOCK_MANAGED));
}
Beans.get(ReservedQtyService.class).requestQty(stockMoveLine);
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
Aggregations