In order to solve the three-stage assembly flowshop scheduling problem, this paper proposes an improved discrete bat algorithm (DBA). Aiming at the bottleneck period of the question, this paper proposes the lower limit theory and improves the lower limit formula of the three-stage bottleneck period. At the same time, a scheduling model is introduced to generate the initial population, and the bat's hunting range (HR) is re-divided. Through the improvement of predation behavior and migration behavior, the local search ability of the algorithm is improved, and the performance of the discrete bat algorithm is effectively improved. The K-means clustering algorithm is improved to group the bats with the highest similarity, shortening the calculation time and speed up the algorithm convergence speed. Through simulation experiments and comparative analysis of examples of different scales, the number of machines, products and sets is tested, and the overall performance of the DBA is verified to be better than other algorithms; in terms of the effectiveness of the algorithm and the quality of the solution, the improvements for the dynamic control parameters, DHR and elite strategy effectively enhance the algorithm's search capabilities.