The invention discloses a rail-mounted gantry crane automatic yard operation control system and an automatic loading and unloading method, and the control system and the automatic loading and unloading method can reduce investment for reconstruction and enables technological process to be simplified. The system comprises a rail-mounted gantry crane automatic controller, a rail-mounted gantry crane PLC controller, a hanger PLC controller, a container truck hoist-preventing device, a rail-mounted gantry crane positioning device, a container landing detection device, a hoisting box automatic control device, a target container positioning device and a hanger positioning device. The system refits a conventional rail-mounted gantry crane into an automatic rail-mounted gantry crane and can carry out container landing, locking, hanger rising, container dropping, unlocking, hanger rising and the like on containers through controlling by the automatic loading and unloading method, a cycle of operation can be automatically finished without intervention by a remote operator, so work efficiency is improved, labor cost is reduced and work cost is lowered down; moreover, equipment investment is small, and operation is simple and convenient.