The stochastic nature of container terminals is known to give rise to substantial challenges in the design of software algorithms for their control. In this study, we focus on the online optimisation of vertical container handling using automated stacking cranes. Such configurations are in place at an increasing number of modern container terminals and consist of several container storage blocks, each with up to three automated Rail Mounted Gantry cranes (RMGs). Using heuristic rules that are based on road pricing and congestion charging schemes we develop a crane assignment algorithm that is capable of operating in conditions of uncertainty. The assignment procedure determines the net-benefit stemming from the execution of every task through the consideration of expected delays, urgency, service time and its variations as well as the nature of interaction with other terminal entities.