A real-time scheduling algorithm which guarantees an optimal makespan to each part which arrives in a line of chemical baths for surface treatment purpose is proposed. We first consider the case when the treatment preriods are much greater than the transportation times, which allows us to neglect these times. We then extend our approach to the case when transportation times cannot be neglected. Some numerical examples are provided to illustrate this approach