Search in sources :

Example 11 with SupplyChainConfig

use of com.axelor.apps.supplychain.db.SupplyChainConfig in project axelor-open-suite by axelor.

the class ManufOrderStockMoveService method createToConsumeStockMove.

public void createToConsumeStockMove(ManufOrder manufOrder) throws AxelorException {
    Company company = manufOrder.getCompany();
    SupplyChainConfig supplyChainConfig = supplyChainConfigService.getSupplyChainConfig(company);
    if (manufOrder.getToConsumeProdProductList() != null && company != null) {
        StockMove stockMove = this._createToConsumeStockMove(manufOrder, company);
        for (ProdProduct prodProduct : manufOrder.getToConsumeProdProductList()) {
            this._createStockMoveLine(prodProduct, stockMove, StockMoveLineService.TYPE_IN_PRODUCTIONS);
        }
        if (stockMove.getStockMoveLineList() != null && !stockMove.getStockMoveLineList().isEmpty()) {
            stockMoveService.plan(stockMove);
            if (supplyChainConfig.getAutoRequestReservedQtyOnManufOrder()) {
                requestStockReservation(stockMove);
            }
            manufOrder.addInStockMoveListItem(stockMove);
        }
        // case where we had to split tracked stock move lines
        if (stockMove.getStockMoveLineList() != null) {
            for (StockMoveLine stockMoveLine : stockMove.getStockMoveLineList()) {
                manufOrder.addConsumedStockMoveLineListItem(stockMoveLine);
            }
        }
    }
}
Also used : Company(com.axelor.apps.base.db.Company) StockMove(com.axelor.apps.stock.db.StockMove) StockMoveLine(com.axelor.apps.stock.db.StockMoveLine) SupplyChainConfig(com.axelor.apps.supplychain.db.SupplyChainConfig) ProdProduct(com.axelor.apps.production.db.ProdProduct)

Aggregations

SupplyChainConfig (com.axelor.apps.supplychain.db.SupplyChainConfig)11 Company (com.axelor.apps.base.db.Company)8 SupplyChainConfigService (com.axelor.apps.supplychain.service.config.SupplyChainConfigService)7 StockMove (com.axelor.apps.stock.db.StockMove)5 SaleOrderLine (com.axelor.apps.sale.db.SaleOrderLine)3 Product (com.axelor.apps.base.db.Product)2 StockMoveLine (com.axelor.apps.stock.db.StockMoveLine)2 AppSupplychainService (com.axelor.apps.supplychain.service.app.AppSupplychainService)2 AxelorException (com.axelor.exception.AxelorException)2 BigDecimal (java.math.BigDecimal)2 Invoice (com.axelor.apps.account.db.Invoice)1 Address (com.axelor.apps.base.db.Address)1 Partner (com.axelor.apps.base.db.Partner)1 PartnerService (com.axelor.apps.base.service.PartnerService)1 AppBaseService (com.axelor.apps.base.service.app.AppBaseService)1 ProdProduct (com.axelor.apps.production.db.ProdProduct)1 PurchaseOrderLine (com.axelor.apps.purchase.db.PurchaseOrderLine)1 StockLocation (com.axelor.apps.stock.db.StockLocation)1 StockLocationLine (com.axelor.apps.stock.db.StockLocationLine)1 StockMoveInvoiceService (com.axelor.apps.supplychain.service.StockMoveInvoiceService)1