If you want your orderlines to have an orderlinenumber, they will need to be the same every time you show the orderlines on screen. If upon rearranging or reloading the order of the orderlines changes and the linenumbers still go from 1 to 4, it is very confusing and the orderlinesnumbers are then even useless. Therefor you should create the linenumber upon committing. So certainly not calculated but stored.
The task of determining the number: retrieve all existing orderlines of the above order and generate the next number. Best do this as part of the BeforeCommit-microflow.