magento2.3 – Magento 2: Check quantity with custom data when create shipment

When creating shipment from the Admin I have to check the qty with the packed quantity from the custom table.

I have created a plugin and it’s calling but after this, it creates shipment for all the quantities. I have to restrict shipment items and qty with the custom table data. For example, in my table, I have Item – 1 with 2 quantity and if an order is 3 then it should allow creating shipment only for 2 Qty.

<type name="MagentoShippingControllerAdminhtmlOrderShipmentSave">
    <plugin name="admin_order_shipment_save" type="Vendor OrderPluginControllerAdminhtmlOrderShipmentSavePlugin"/>
</type>

<?php
use MagentoShippingControllerAdminhtmlOrderShipmentSave;
use MagentoFrameworkControllerResultFactory;

Class SavePlugin
{
/**
 * @var MagentoFrameworkAppResourceConnection
 */
protected $resourceConnection;

protected $messageManager;


protected $resultRedirectFactory;

public function __construct(
    MagentoFrameworkAppResourceConnection $resourceConnection,
    MagentoFrameworkControllerResultRedirectFactory $resultRedirectFactory,
    MagentoFrameworkMessageManagerInterface $messageManager
) {
    $this->resourceConnection = $resourceConnection;
    $this->resultRedirectFactory = $resultRedirectFactory;
    $this->messageManager = $messageManager;
}
public function beforeExecute(Save $subject)
{
    $data = $subject->getRequest()->getParam('shipment');
    $resultRedirect = $this->resultRedirectFactory->create();

    $extraShipItems = 0;
    foreach ($data('items') as $shipmentItem => $qty) {
        if ($qty > 0 && $qty > $customQty) {
                $extraShipItems = 1;
        }
    }

    if($extraShipItems == 1){
        $this->messageManager->addErrorMessage(__('Please create shipment only for custom qty'));
        return $resultRedirect->setPath('sales/order/view', ('order_id' => $subject->getRequest()->getParam('order_id')));   
    }
}
}