The resource-constrained hybrid flowshop problem (RCHFS) has been investigated thoroughly in recent years. However, the practical case that considers both resource-constrained and energy consumption still has rare research. To address this issue, a discrete imperialist competitive algorithm (DICA) was proposed to minimize the makespan and energy consumption. In the proposed algorithm, first, each solution was represented by a two-dimensional vector, where one vector represented the scheduling sequence and another one showed the machine assignment. Then, a decoding method considering the resource allocation was designed. Finally, we combined DICA and the simulated annealing algorithm (SA) to improve the performance of the proposed approach. Furthermore, we tested the proposed algorithm based on a randomly generated set of real shop scheduling system instances and compared with the existing heuristic algorithms. The results confirmed that the proposed algorithm can solve the RCHFS with high efficiency.