In order to comprehensively consider the safety, efficiency, and other factors in the in-and-out operation of dangerous goods, this article takes the setting of forklift rounding rules as the research background and uses optimization theory and the newly proposed cost formula to study the partitioning question of a warehouse. Numerical simulation is also used in this essay, and 2 rules for the storage area zoning of the warehouse are obtained. The practical innovation of this article is to propose the concept of the safety red line, as well as obtain the safety formula under these circumstances. The theoretical innovation of this paper is to combine the labyrinth path finding algorithm and the utility theory together to solve the problem of in-and-out operations of dangerous goods. Finally, this article takes the actual data of the Shanghai Lingang Dangerous Goods Warehouse as parameters and uses the dual-container-truck out operation and single-container-truck in operation as examples. Simulation technology is also used to verify the newly proposed model, as well as its validity and feasibility.