Asymptotically optimal energy consumption and inventory control in a make-to-stock manufacturing system