Hi Donald,
We are doing something extremely similar! We are about to go live with this tomorrow actually. What we have done to solve this is that I created a couple of custom tables in the database to store the codes given to us and to store their assignments to patrons. I then created a custom procedure that takes in a lineitem id, checks to see if a code has already been assigned to that lineitem, and if not, maps it to the next available code. Then to get this procedure to execute as soon as possible after a patron purchases a ticket, I call it from within the order confirmation (we are using the new HTML template format) and it then returns the code for the patron to see in the order confirmation. Since most of this is done in SQL, you'll need to have some proficiency (or someone else in your organization) to set this up. Let me know if you have questions or want to talk further!
Sara