Well you are not joining to the ttTables so you are ok in that aspect. I haven’t had a chance to look at the rest… but from your original concern you are fine.
For what is worth Epicor has facilities built in to keep track of AutoSequence numbers at the Company Level. @timshuwy made a post about it a while back. So you don’t have to find the next one yourself.