Under Industry 4.0, manufacturing workshops are confronted with escalating uncertainties, dynamic shifts in demands, and the challenges of optimizing resources. The ability of traditional scheduling methods to deal with dynamic emergencies is relatively weak. A three-layered (physical, digital twin, and service) digital twin-based real-time scheduling framework for the hybrid flow shop (DTRSF-HFS) is suggested to tackle the difficulties above. This framework integrates workshop status monitoring, state visualization, and real-time dynamic scheduling capabilities, improving the real-time scheduling performance by making it possible to choose the best scheduling rules depending on various production statuses. To implement this framework while ensuring alignment with practical production scenarios, this study investigates the scheduling problem of a hybrid flow shop with sequence-dependent setup times and blocking (HFSP-SDSTB). A real-time adaptive dynamic scheduling method based on deep reinforcement learning (DRL) is designed. First, a two-stage real-time scheduling framework (learning and online application stages) is proposed. Subsequently, five key components are designed sequentially: scheduling points, state space, action space, reward function, and training algorithm based on proximal policy optimization (PPO). Experimental results indicate that, compared to other methods, this approach achieves superior scheduling performance and enables real-time adaptive dynamic scheduling.