Multi-agent systems (MAS) can be widely applied in warehouse management to enhance logistics operation efficiency, reduce costs, and improve decision-making. In a MAS, robots can serve as agents to optimize the routing and scheduling of shipments, reducing delivery times and improving customer satisfaction in the warehouse environment. It is widely recognized that the more robots are deployed, the higher efficiency logistics operation will be. However, with the increasing number of robots, a growing number of challenges emerge, particularly in the domain of task allocation—a process aimed at assigning tasks to a group of robots to achieve a common goal. The task allocation often requires multi-objective optimization to balance various factors. This paper presents an efficient multi-agent task allocation algorithm that can handle both static and dynamic task allocation. To handle static tasks, the paper employs the NSGA2 algorithm, which can handle multi-objective optimization, to efficiently generate scheduling schemes and assign agents in the warehouse to execute tasks. For dynamic tasks, an auction-bid scheme is employed to quickly respond to task changes and ensure the efficient completion of the task. Meanwhile, we also design an effective scheme traffic-rules based to sufficiently avoid the robot collision. The simulation results demonstrated the capability of our algorithm to efficiently allocate tasks and plan the shortest path based on A*. Moreover, the algorithm effectively minimizes both the sum of the travel costs over all robots and the maximum individual travel cost over all robots simultaneously.