public function aroundLockProductsStock(
        \Magento\CatalogInventory\Model\ResourceModel\Stock $subject,
        \Closure $proceed,
        $productIds,
        $stockId
    ) {
        if (empty($productIds)) {
            return [];
        }
        /** @var \Magento\Framework\DB\Adapter\AdapterInterface $conn */
        $conn = $subject->getConnection();
        $itemTable = $subject->getTable('cataloginventory_stock_item');
        $productTable = $subject->getTable('catalog_product_entity');
        /** @var \Magento\Framework\DB\Select $select */
        $select = $conn->select();
        $select->from(['si' => $itemTable]);
        $select->join(['p' => $productTable], 'p.entity_id=si.product_id', ['type_id']);
        $select->where('product_id IN(?)', $productIds);
        $select->forUpdate(true);
        /* MOBI-375 add filter by $stockId */
        $select->where('stock_id=?', $stockId);
        /* select data */
        $result = $conn->fetchAll($select);
        return $result;
    }
public function aroundLockProductsStock(
        \Magento\CatalogInventory\Model\ResourceModel\Stock $subject,
        \Closure $proceed,
        $productIds,
        $stockId
    ) {
        if (empty($productIds)) {
            return [];
        }
        /** @var \Magento\Framework\DB\Adapter\AdapterInterface $conn */
        $conn = $subject->getConnection();
        $itemTable = $subject->getTable('cataloginventory_stock_item');
        $productTable = $subject->getTable('catalog_product_entity');
        /** @var \Magento\Framework\DB\Select $select */
        $select = $conn->select();
        $select->from(['si' => $itemTable]);
        $select->join(['p' => $productTable], 'p.entity_id=si.product_id', ['type_id']);
        $select->where('product_id IN(?)', $productIds);
        $select->forUpdate(true);
        /* MOBI-375 add filter by $stockId */
        $select->where('stock_id=?', $stockId);
        /* select data */
        $result = $conn->fetchAll($select);
        return $result;
    }
public function aroundLockProductsStock ( \ Magento \ CatalogInventory \ Model \ ResourceModel \ Stock $ subject , \ Closure $ proceed , $ productIds , $ stockId ) { if ( empty ( $ productIds ) ) { return [ ] ; } /** @var \Magento\Framework\DB\Adapter\AdapterInterface $conn */ $ conn = $ subject -> getConnection ( ) ; $ itemTable = $ subject -> getTable ( 'cataloginventory_stock_item' ) ; $ productTable = $ subject -> getTable ( 'catalog_product_entity' ) ; /** @var \Magento\Framework\DB\Select $select */ $ select = $ conn -> select ( ) ; $ select -> from ( [ 'si' => $ itemTable ] ) ; $ select -> join ( [ 'p' => $ productTable ] , 'p.entity_id=si.product_id' , [ 'type_id' ] ) ; $ select -> where ( 'product_id IN(?)' , $ productIds ) ; $ select -> forUpdate ( true ) ; /* MOBI-375 add filter by $stockId */ $ select -> where ( 'stock_id=?' , $ stockId ) ; /* select data */ $ result = $ conn -> fetchAll ( $ select ) ; return $ result ; }
Filter locked items by stock ID.

@param \Magento\CatalogInventory\Model\ResourceModel\Stock $subject
@param \Closure $proceed
@param int[] $productIds
@param int $stockId defined in \Praxigento\Warehouse\Plugin\Magento\CatalogInventory\Model\StockManagement::aroundRegisterProductsSale
@return array found stock items data as an associative array
Filter locked items by stock ID .