use of com.axelor.apps.stock.db.Inventory in project axelor-open-suite by axelor.
the class InventoryService method createInventory.
public Inventory createInventory(LocalDate plannedStartDate, LocalDate plannedEndDate, String description, StockLocation stockLocation, boolean excludeOutOfStock, boolean includeObsolete, ProductFamily productFamily, ProductCategory productCategory) throws AxelorException {
if (stockLocation == null) {
throw new AxelorException(TraceBackRepository.CATEGORY_CONFIGURATION_ERROR, I18n.get(IExceptionMessage.INVENTORY_1));
}
Inventory inventory = new Inventory();
inventory.setInventorySeq(this.getInventorySequence(stockLocation.getCompany()));
inventory.setPlannedStartDateT(plannedStartDate.atStartOfDay(ZoneOffset.UTC));
inventory.setPlannedEndDateT(plannedEndDate.atStartOfDay(ZoneOffset.UTC));
inventory.setDescription(description);
inventory.setFormatSelect(InventoryRepository.FORMAT_PDF);
inventory.setStockLocation(stockLocation);
inventory.setExcludeOutOfStock(excludeOutOfStock);
inventory.setIncludeObsolete(includeObsolete);
inventory.setProductCategory(productCategory);
inventory.setProductFamily(productFamily);
inventory.setStatusSelect(InventoryRepository.STATUS_DRAFT);
return inventory;
}
use of com.axelor.apps.stock.db.Inventory in project axelor-open-suite by axelor.
the class ImportInventory method importInventory.
public Object importInventory(Object bean, Map<String, Object> values) throws AxelorException {
assert bean instanceof Inventory;
Inventory inventory = (Inventory) bean;
inventory.setInventoryTitle(inventoryService.computeTitle(inventory));
return inventory;
}
use of com.axelor.apps.stock.db.Inventory in project axelor-open-suite by axelor.
the class InventoryController method cancel.
public void cancel(ActionRequest request, ActionResponse response) {
try {
Inventory inventory = request.getContext().asType(Inventory.class);
inventory = Beans.get(InventoryRepository.class).find(inventory.getId());
Beans.get(InventoryService.class).cancel(inventory);
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.stock.db.Inventory in project axelor-open-suite by axelor.
the class InventoryController method fillInventoryLineList.
public void fillInventoryLineList(ActionRequest request, ActionResponse response) {
try {
Long inventoryId = (Long) request.getContext().get("id");
if (inventoryId != null) {
Inventory inventory = Beans.get(InventoryRepository.class).find(inventoryId);
Boolean succeed = Beans.get(InventoryService.class).fillInventoryLineList(inventory);
if (succeed == null) {
response.setFlash(I18n.get(IExceptionMessage.INVENTORY_9));
} else {
if (succeed) {
response.setNotify(I18n.get(IExceptionMessage.INVENTORY_10));
} else {
response.setNotify(I18n.get(IExceptionMessage.INVENTORY_11));
}
}
}
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.stock.db.Inventory in project axelor-open-suite by axelor.
the class InventoryController method validateInventory.
public void validateInventory(ActionRequest request, ActionResponse response) {
try {
Long id = request.getContext().asType(Inventory.class).getId();
Inventory inventory = Beans.get(InventoryRepository.class).find(id);
Beans.get(InventoryService.class).validateInventory(inventory);
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
Aggregations