Aiming at the real-time robust optimization problem of perishable supply-chain systems in complex environments, a real-time robust optimization scheme based on supply-chain digital twins is proposed. Firstly, based on the quantitative logical relationship between production and sales of single-chain series supply-chain system products, the state space equation of the supply-chain system with logical characteristics, structural characteristics, and quantitative characteristics was constructed, and twin data were introduced to construct the digital twins of supply chains based on the state-space equation. Secondly, the perishable supply-chain system in complex environments was regarded as an uncertain closed-loop system from the perspective of the state space equation, and then a robust H∞ controller design strategy was proposed, and the supply-chain digital twins was used to update and correct the relevant parameters of the supply-chain system in real-time, to implement the real-time robust optimization based on the supply-chain digital twins. Finally, the simulation experiment was carried out with a cake supply-chain production as an example. The experimental results show that the real-time updating of relevant parameters through the digital twins can help enterprise managers to formulate reasonable management plans, effectively avoid the shortage problem of enterprises in the cake supply-chain system, and reduce the maximum inventory movement standard deviation of each link by 12.65%, 6.50%, and 14.87%, and the maximum production movement standard deviation by 70.21%, 56.84%, and 45.19%.