use of com.axelor.apps.stock.service.config.StockConfigService in project axelor-open-suite by axelor.
the class PurchaseOrderStockServiceImpl method getStartStockLocation.
protected StockLocation getStartStockLocation(PurchaseOrder purchaseOrder) throws AxelorException {
Company company = purchaseOrder.getCompany();
StockLocation startLocation = purchaseOrder.getFromStockLocation();
if (startLocation == null) {
startLocation = partnerStockSettingsService.getDefaultExternalStockLocation(purchaseOrder.getSupplierPartner(), company);
}
if (startLocation == null) {
StockConfigService stockConfigService = Beans.get(StockConfigService.class);
StockConfig stockConfig = stockConfigService.getStockConfig(company);
startLocation = stockConfigService.getSupplierVirtualStockLocation(stockConfig);
}
if (startLocation == null) {
throw new AxelorException(purchaseOrder, TraceBackRepository.CATEGORY_CONFIGURATION_ERROR, I18n.get(IExceptionMessage.PURCHASE_ORDER_1), company.getName());
}
return startLocation;
}
use of com.axelor.apps.stock.service.config.StockConfigService in project axelor-open-suite by axelor.
the class LogisticalFormServiceImpl method processCollected.
@Override
@Transactional(rollbackOn = { Exception.class })
public void processCollected(LogisticalForm logisticalForm) throws AxelorException {
if (logisticalForm.getLogisticalFormLineList() == null) {
return;
}
Set<StockMove> stockMoveSet = new HashSet<>();
logisticalForm.getLogisticalFormLineList().stream().filter(logisticalFormLine -> logisticalFormLine.getTypeSelect() == LogisticalFormLineRepository.TYPE_DETAIL && logisticalFormLine.getStockMoveLine() != null && logisticalFormLine.getStockMoveLine().getStockMove() != null).forEach(logisticalFormLine -> stockMoveSet.add(logisticalFormLine.getStockMoveLine().getStockMove()));
StockMoveService stockMoveService = Beans.get(StockMoveService.class);
stockMoveSet.forEach(stockMoveService::updateFullySpreadOverLogisticalFormsFlag);
StockConfigService stockConfigService = Beans.get(StockConfigService.class);
StockConfig stockConfig = stockConfigService.getStockConfig(logisticalForm.getCompany());
if (stockConfig.getRealizeStockMovesUponParcelPalletCollection()) {
for (StockMove stockMove : stockMoveSet) {
if (stockMove.getFullySpreadOverLogisticalFormsFlag()) {
stockMoveService.realize(stockMove);
}
}
}
logisticalForm.setStatusSelect(LogisticalFormRepository.STATUS_COLLECTED);
}
use of com.axelor.apps.stock.service.config.StockConfigService in project axelor-open-suite by axelor.
the class StockLocationServiceImpl method getDefaultReceiptStockLocation.
@Override
public StockLocation getDefaultReceiptStockLocation(Company company) {
try {
StockConfigService stockConfigService = Beans.get(StockConfigService.class);
StockConfig stockConfig = stockConfigService.getStockConfig(company);
return stockConfigService.getReceiptDefaultStockLocation(stockConfig);
} catch (Exception e) {
return null;
}
}
use of com.axelor.apps.stock.service.config.StockConfigService in project axelor-open-suite by axelor.
the class StockLocationServiceImpl method getPickupDefaultStockLocation.
@Override
public StockLocation getPickupDefaultStockLocation(Company company) {
try {
StockConfigService stockConfigService = Beans.get(StockConfigService.class);
StockConfig stockConfig = stockConfigService.getStockConfig(company);
return stockConfigService.getPickupDefaultStockLocation(stockConfig);
} catch (Exception e) {
return null;
}
}
Aggregations