Search in sources :

Example 16 with Inventory

use of com.axelor.apps.stock.db.Inventory in project axelor-open-suite by axelor.

the class InventoryController method showInventory.

/**
 * Fonction appeler par le bouton imprimer
 *
 * @param request
 * @param response
 * @return
 * @throws BirtException
 * @throws IOException
 */
public void showInventory(ActionRequest request, ActionResponse response) {
    try {
        Inventory inventory = request.getContext().asType(Inventory.class);
        String name = I18n.get("Inventory") + " " + inventory.getInventorySeq();
        String fileLink = ReportFactory.createReport(IReport.INVENTORY, Beans.get(InventoryService.class).computeExportFileName(inventory)).addParam("InventoryId", inventory.getId()).addParam("Timezone", inventory.getCompany() != null ? inventory.getCompany().getTimezone() : null).addParam("Locale", ReportSettings.getPrintingLocale(null)).addParam("activateBarCodeGeneration", Beans.get(AppBaseService.class).getAppBase().getActivateBarCodeGeneration()).addFormat(inventory.getFormatSelect()).generate().getFileLink();
        logger.debug("Printing " + name);
        response.setView(ActionView.define(name).add("html", fileLink).map());
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : InventoryService(com.axelor.apps.stock.service.InventoryService) Inventory(com.axelor.apps.stock.db.Inventory) BirtException(org.eclipse.birt.core.exception.BirtException) NoResultException(javax.persistence.NoResultException) AxelorException(com.axelor.exception.AxelorException) IOException(java.io.IOException)

Example 17 with Inventory

use of com.axelor.apps.stock.db.Inventory in project axelor-open-suite by axelor.

the class InventoryLineController method compute.

public void compute(ActionRequest request, ActionResponse response) {
    InventoryLine inventoryLine = request.getContext().asType(InventoryLine.class);
    Inventory inventory = request.getContext().getParent() != null ? request.getContext().getParent().asType(Inventory.class) : inventoryLine.getInventory();
    inventoryLine = Beans.get(InventoryLineService.class).compute(inventoryLine, inventory);
    response.setValue("unit", inventoryLine.getUnit());
    response.setValue("gap", inventoryLine.getGap());
    response.setValue("gapValue", inventoryLine.getGapValue());
    response.setValue("realValue", inventoryLine.getRealValue());
}
Also used : Inventory(com.axelor.apps.stock.db.Inventory) InventoryLine(com.axelor.apps.stock.db.InventoryLine)

Example 18 with Inventory

use of com.axelor.apps.stock.db.Inventory in project axelor-open-suite by axelor.

the class InventoryLineController method updateInventoryLine.

public void updateInventoryLine(ActionRequest request, ActionResponse response) throws AxelorException {
    InventoryLine inventoryLine = request.getContext().asType(InventoryLine.class);
    Inventory inventory = request.getContext().getParent() != null ? request.getContext().getParent().asType(Inventory.class) : inventoryLine.getInventory();
    inventoryLine = Beans.get(InventoryLineService.class).updateInventoryLine(inventoryLine, inventory);
    response.setValue("rack", inventoryLine.getRack());
    response.setValue("currentQty", inventoryLine.getCurrentQty());
}
Also used : Inventory(com.axelor.apps.stock.db.Inventory) InventoryLine(com.axelor.apps.stock.db.InventoryLine)

Aggregations

Inventory (com.axelor.apps.stock.db.Inventory)18 AxelorException (com.axelor.exception.AxelorException)12 IOException (java.io.IOException)9 NoResultException (javax.persistence.NoResultException)9 BirtException (org.eclipse.birt.core.exception.BirtException)8 InventoryService (com.axelor.apps.stock.service.InventoryService)7 InventoryLine (com.axelor.apps.stock.db.InventoryLine)5 InventoryRepository (com.axelor.apps.stock.db.repo.InventoryRepository)4 SequenceService (com.axelor.apps.base.service.administration.SequenceService)3 StockLocation (com.axelor.apps.stock.db.StockLocation)3 Product (com.axelor.apps.base.db.Product)2 StockLocationLine (com.axelor.apps.stock.db.StockLocationLine)2 StockMove (com.axelor.apps.stock.db.StockMove)2 TrackingNumber (com.axelor.apps.stock.db.TrackingNumber)2 StockLocationLineRepository (com.axelor.apps.stock.db.repo.StockLocationLineRepository)2 Beans (com.axelor.inject.Beans)2 MetaFile (com.axelor.meta.db.MetaFile)2 Transactional (com.google.inject.persist.Transactional)2 Company (com.axelor.apps.base.db.Company)1 ProductCategory (com.axelor.apps.base.db.ProductCategory)1