You should have a stock log table that acts as a balance sheet connected by a parent id and the children should have the stock added as -ve or positive
+1
-1
+1
-2
And so on and then you can rollup by the these values it will get you a total stock on hands
If you arendoing production then there is something called available stock thatbeill require another table so you can balance on hand vs available allocation