Basic rigging doesn't work!
Your mesh is super messy and has too many double vertices, which means vertices overlaying other vertices at the same position or too close to. You must select your object, go in Edit mode, select all and W > Remove Doubles. On the bottom of the Tools panel (activated with T), on the left of your 3D view, you can change the Merge Distance, choose 1cm.

Now you can parent the mesh to the armature.

But note that the Automatic Weight mode is not the good one for this kind of object, as this is not an organic but a mechanic object. You should rather choose With Empty Groups, which will create in your object as many vertex groups as you have bones, but without assigning them to any part of the mesh ("empty groups").

First you need to separate your mesh in several parts (well, it will be very hard with your topology, I suggest you redo it from scratch). Then parent With Empty Groups. To assign each part of the mesh to the right group, go in the Properties panel of the object > Data > Vertex Groups, select the part of the mesh you want, select the vertex group it is supposed to be part of in the list, and click Assign.