Supplier/Util/SupplierUtil.php
static public function calculateDeliveryRemainingQuantity($item)
    {
        if ($item instanceof SupplierOrderItemInterface) {
            return $item->getQuantity() - static::calculateReceivedQuantity($item);
        }

        if (!$item instanceof SupplierDeliveryItemInterface) {
            throw new InvalidArgumentException(
                "Expected instance of " .
                SupplierOrderItemInterface::class . " or " .
                SupplierDeliveryItemInterface::class
            );
        }

        $orderItem = $item->getOrderItem();

        $result = $orderItem->getQuantity() - static::calculateReceivedQuantity($orderItem);

        if (0 < $item->getQuantity()) {
            $result += $item->getQuantity();
        }

        return $result;
    }
static public function calculateDeliveryRemainingQuantity($item)
    {
        if ($item instanceof SupplierOrderItemInterface) {
            return $item->getQuantity() - static::calculateReceivedQuantity($item);
        }

        if (!$item instanceof SupplierDeliveryItemInterface) {
            throw new InvalidArgumentException(
                "Expected instance of " .
                SupplierOrderItemInterface::class . " or " .
                SupplierDeliveryItemInterface::class
            );
        }

        $orderItem = $item->getOrderItem();

        $result = $orderItem->getQuantity() - static::calculateReceivedQuantity($orderItem);

        if (0 < $item->getQuantity()) {
            $result += $item->getQuantity();
        }

        return $result;
    }
Calculate the given supplier order item's delivery remaining quantity.

@param SupplierOrderItemInterface|SupplierDeliveryItemInterface $item

@return float