With increasingly diversified consumer demands, mixed-model assembly lines have been increasingly adopted by manufacturing enterprises. In recent years, more and more manufacturers adopted material supermarkets to enable a flexible and reliable Just-in-Time part supply of their mixed-model assembly lines. However, it is still a crucial challenge to ensure the implementation of Just-in-time part supply, and few research studies on the problem. Therefore, this article proposes the problem of collaborative optimizing route planning and material distribution scheduling with just-in-time principle. A mixed integer linear programming model is established with the objective of minimizing the total costs. Moreover, a dynamic programming based heuristic algorithm is developed to deal with large-sized problems. Computational experiments on different scales are carried out to test this algorithm. The computational results reveal the feasibility and effectiveness of the proposed algorithm. And considering different capacity of tow trains, results show the change of capacity affects the total cost by affecting the number of paths divided, which provides guidance for manufacturing enterprises.