use of com.axelor.apps.supplychain.service.app.AppSupplychainService in project axelor-open-suite by axelor.
the class StockMoveServiceSupplychainImpl method copySplittedStockMoveLine.
/**
* The splitted stock move line needs an allocation and will be planned before the previous stock
* move line is realized. To solve this issue, we deallocate here in the previous stock move line
* the quantity that will be allocated in the generated stock move line. The quantity will be
* reallocated when the generated stock move is planned.
*
* @param stockMoveLine the previous stock move line
* @return the generated stock move line
* @throws AxelorException
*/
@Override
protected StockMoveLine copySplittedStockMoveLine(StockMoveLine stockMoveLine) throws AxelorException {
StockMoveLine newStockMoveLine = super.copySplittedStockMoveLine(stockMoveLine);
AppSupplychainService appSupplychainService = Beans.get(AppSupplychainService.class);
if (appSupplychainService.getAppSupplychain().getManageStockReservation() && appSupplychainService.isApp("supplychain")) {
BigDecimal requestedReservedQty = stockMoveLine.getRequestedReservedQty().subtract(stockMoveLine.getRealQty()).max(BigDecimal.ZERO);
newStockMoveLine.setRequestedReservedQty(requestedReservedQty);
newStockMoveLine.setReservedQty(BigDecimal.ZERO);
reservedQtyService.deallocateStockMoveLineAfterSplit(stockMoveLine, stockMoveLine.getReservedQty());
stockMoveLine.setReservedQty(BigDecimal.ZERO);
}
return newStockMoveLine;
}
use of com.axelor.apps.supplychain.service.app.AppSupplychainService in project axelor-open-suite by axelor.
the class StockMoveServiceSupplychainImpl method plan.
@Override
@Transactional(rollbackOn = { Exception.class })
public void plan(StockMove stockMove) throws AxelorException {
super.plan(stockMove);
AppSupplychainService appSupplychainService = Beans.get(AppSupplychainService.class);
if (appSupplychainService.getAppSupplychain().getManageStockReservation() && appSupplychainService.isApp("supplychain")) {
Beans.get(ReservedQtyService.class).updateReservedQuantity(stockMove, StockMoveRepository.STATUS_PLANNED);
}
}
Aggregations