there is already a method in the WMS (press the ALT key and double click on WMS).
There you find a method removeProducts. This is a good base for developing your own method or just use it.
The stock of the parts you can find in the table content.
this is easy:
look, these are the parameters of the method
param OrderNo : string, product : string, quantity : integer
the call would look like this
orderNumber+=1--global variable type integer
--remove D from store