Like a *Recycling station. Converts junk like slag to small amounts of metal.
this could be really useful, as i have seen a few LPs where the junkpiles got a bit out of hand... putting those waste materials to use seems reasonable...

I see potential micro management hell...
oh, absolutely... hence my suggestion about making the idea a bit "cheaper" by simply having the result be completely random... you have a "weapons table"... you select a unit, right-click the table and choose "upgrade current weapon"...
your unit walks over, a certain amount of metal is removed from inventory (perhaps relative to the current quality of the gun?)... and the randomness kicks in, potentially improving the efficiency of the weapon, and also potentially damaging or destroying the gun in the process...
no interaction on the players behalf, other than initiating the action at the table...