use of com.axelor.apps.base.db.Batch in project axelor-open-suite by axelor.
the class AccountingCutOffServiceImpl method getStockMoveLines.
public List<Long> getStockMoveLines(Batch batch) {
int offset = 0;
Boolean includeNotStockManagedProduct = batch.getSupplychainBatch().getIncludeNotStockManagedProduct();
List<StockMoveLine> stockMoveLineList;
List<Long> stockMoveLineIdList = new ArrayList<>();
Query<StockMove> stockMoveQuery = stockMoverepository.all().filter(":batch MEMBER OF self.batchSet").bind("batch", batch);
List<Long> stockMoveIdList = stockMoveQuery.select("id").fetch(0, 0).stream().map(m -> (Long) m.get("id")).collect(Collectors.toList());
if (stockMoveIdList.isEmpty()) {
stockMoveLineIdList.add(0L);
} else {
Query<StockMoveLine> stockMoveLineQuery = stockMoveLineRepository.all().filter("self.stockMove.id IN :stockMoveIdList").bind("stockMoveIdList", stockMoveIdList).order("id");
while (!(stockMoveLineList = stockMoveLineQuery.fetch(FETCH_LIMIT, offset)).isEmpty()) {
offset += stockMoveLineList.size();
for (StockMoveLine stockMoveLine : stockMoveLineList) {
Product product = stockMoveLine.getProduct();
if (!checkStockMoveLine(stockMoveLine, product, includeNotStockManagedProduct)) {
stockMoveLineIdList.add(stockMoveLine.getId());
}
}
JPA.clear();
}
}
return stockMoveLineIdList;
}
use of com.axelor.apps.base.db.Batch in project axelor-open-suite by axelor.
the class AccountingBatchController method actionMoveLineExport.
/**
* Lancer le batch de calcul du compte client
*
* @param request
* @param response
*/
public void actionMoveLineExport(ActionRequest request, ActionResponse response) {
AccountingBatch accountingBatch = request.getContext().asType(AccountingBatch.class);
Batch batch = null;
batch = Beans.get(AccountingBatchService.class).moveLineExport(Beans.get(AccountingBatchRepository.class).find(accountingBatch.getId()));
if (batch != null)
response.setFlash(batch.getComments());
response.setReload(true);
}
use of com.axelor.apps.base.db.Batch in project axelor-open-suite by axelor.
the class AccountingBatchController method run.
// WS
/**
* Lancer le batch à travers un web service.
*
* @param request
* @param response
* @throws AxelorException
*/
public void run(ActionRequest request, ActionResponse response) throws AxelorException {
Batch batch = Beans.get(AccountingBatchService.class).run((String) request.getContext().get("code"));
Map<String, Object> mapData = new HashMap<String, Object>();
mapData.put("anomaly", batch.getAnomaly());
response.setData(mapData);
}
use of com.axelor.apps.base.db.Batch in project axelor-open-suite by axelor.
the class AccountingBatchController method actionDirectDebit.
/**
* Lancer le batch de prélèvement
*
* @param request
* @param response
*/
public void actionDirectDebit(ActionRequest request, ActionResponse response) {
try {
AccountingBatch accountingBatch = request.getContext().asType(AccountingBatch.class);
accountingBatch = Beans.get(AccountingBatchRepository.class).find(accountingBatch.getId());
Batch batch = Beans.get(AccountingBatchService.class).directDebit(accountingBatch);
response.setFlash(batch.getComments());
} catch (Exception e) {
TraceBackService.trace(response, e);
} finally {
response.setReload(true);
}
}
use of com.axelor.apps.base.db.Batch in project axelor-open-suite by axelor.
the class MailBatchController method remindTimesheet.
public void remindTimesheet(ActionRequest request, ActionResponse response) throws AxelorException {
MailBatch mailBatch = request.getContext().asType(MailBatch.class);
Batch batch = null;
batch = Beans.get(MailBatchService.class).remindMail(Beans.get(MailBatchRepository.class).find(mailBatch.getId()));
if (batch != null)
response.setFlash(batch.getComments());
response.setReload(true);
}
Aggregations