Block sales when quantity is 0

How can I block the sales if the on hand quantity is less than the sales quantity to avoid inventory goes to negative.

You can’t, many business (especially online ones) sell inventory before they purchase the inventory required. The negative inventory tells them what to purchase.