This paper proposes a two-layer path-planning method, where an optimized artificial potential field (APF) method and an improved dynamic window approach (DWA) are used at the global and local layer, respectively. This method enables the robot to plan a better path under a multi-obstacle environment while avoiding the moving obstacles effectively. For the part of global path planning, a new repulsive field is proposed based on the APF method. The length and smoothness of the global path are taken as fitness functions of particle swarm optimization (PSO) to obtain the obstacle influence range, the coefficients of gravitation and repulsion in APF. At the level of local path planning, on the basis of DWA, a fuzzy control scheme is adopted to evaluate the danger level of moving obstacles via collision risk index and relative distance. In brief, compared with existing methods, the robot can reasonably plan a shorter and smoother path with the aid of PSO-based APF, meanwhile quickly react to the moving obstacles and avoid them by fuzzy-based DWA. Finally, a static multi-obstacle environment and two dynamic scenarios with moving obstacles are simulated to verify the effectiveness of the proposed path-planning method.