Today I had an identical fault on a customers Mazak T1, If you swap the encoder and cables where they go into the main PCB and it stays on the same axis , then it points to the encoder input IC's on the MB.
It might check to see what common ic's are first inline from the connectors and replace them, or the PCB.
Al.