C31= X axis (X)
C34 = Y axis (Y/Z)
C37= T axis (Z/P

The 4 cable wires are the motor power. Should connect to 5,6,7,8 on the drives there. I imagine X to X, Y to Y, the other to T. 5=Red, 6=White, 7=Black, 8=Green(GND).

Then try to move the axes. If you get alarms, you may have the power cables swapped. Do a continuity test to find which motor those cables go to