How to Set Up the Auto Numbering for the files uploaded

I want to Define Codes in Master against List of Masters and use the Code to generate Auto Numbering based on the user selection on the upload form.

Master shall have code
Upload Form shall have Meta Fields and also Choice List which are from master.

Would like to know the process to do Generate Auto Numbering against the document.
Note : I am not referring to UID of record or Row ID of record its an backend ID. Instead i want generate number for the user to track the same in future based on master as filter.

What if the data in master is in below fashion

I want to use just the highlighted masters code to consider for auto numbering purpose