I thing the quality is lost right when the ammo is replaced.
There is then a question, what must have the quality: "ammo" / "turret"
There then must be generated combination of all qualities and it may cause crash of game, if count of ammo types will be bigger than 3.
It is cube count
Quality of Equipment (5) * Ammo type count (3) * Quality of Ammo (5) => now would be 75 combinations for single turret.