This paper provides an integrated model for a two-stage assembly flow shop scheduling problem and distribution through vehicle routing in a soft time window. So, a mixed-integer linear programming (MILP) model has been proposed with the objective of minimizing the total cost of distribution, holding of products, and penalties of violating delivery time windows. To solve this problem, an improved meta-heuristic algorithm based on whale optimization algorithm (WOA) has been developed. A comparison of the integrated and non-integrated model in a case study of industrial gearboxes production shows that the integrated model compared to the non-integrated model has saved 15.6% and 13.6% in terms of delay time and total costs, respectively. Computational experiments also indicate the efficiency of improved WOA in converging to optimal solution and achieve better solution in comparison to the genetic algorithm (GA).