If I have understood correctly,
you have a certain items which you have categorized like Electric Item, Mechanical Item, Maintenance Items etc.
You can Extract a part of text using LEFT function
Suppose you have a list of these items in Column A, for which category is mentioned in Column B
Example
Column A(Item) Column B (Category)
Wires Electric Items
Spanner Maintenance Items
Piston Mechanical Items
then in Column C
=LEFT(B2,4)
The result would be Elec, Main, Mech respectively.
you can combine this with Item Name as well
e.g. =A2&"-"&LEFT(B2,4)
The result would be Wires-Elec and likewise.
still how you want to give code is not clear. Is it a Number or Combination of Number and Category? I have just assumed that part for you