The solar and battery hardware maker will cut about 12% of its workforce, lean on AI and automation, and book $25 million to $28 million in charges.