use of com.axelor.apps.stock.db.repo.StockRulesRepository in project axelor-open-suite by axelor.
the class StockLocationServiceImpl method getBadStockLocationLineId.
public List<Long> getBadStockLocationLineId() {
List<StockLocationLine> stockLocationLineList = Beans.get(StockLocationLineRepository.class).all().filter("self.stockLocation.typeSelect = 1 OR self.stockLocation.typeSelect = 2").fetch();
List<Long> idList = new ArrayList<>();
StockRulesRepository stockRulesRepository = Beans.get(StockRulesRepository.class);
for (StockLocationLine stockLocationLine : stockLocationLineList) {
StockRules stockRules = stockRulesRepository.all().filter("self.stockLocation = ?1 AND self.product = ?2", stockLocationLine.getStockLocation(), stockLocationLine.getProduct()).fetchOne();
if (stockRules != null && stockLocationLine.getFutureQty().compareTo(stockRules.getMinQty()) < 0) {
idList.add(stockLocationLine.getId());
}
}
if (idList.isEmpty()) {
idList.add(0L);
}
return idList;
}
Aggregations