(Bloomberg) -- Sixteen months after Mary Barra angered Donald Trump by announcing plans to close several U.S. factories in states the president vowed to revive, the General Motors Co. CEO is back on the outs with the White House.

Unlike in late 2018, Trump’s Friday fracas over ventilators caught GM completely off guard, according to people familiar with the matter. Trump first went on a Twitter tirade, accusing the company of taking too long to make the desperately needed medical devices and of trying to gouge the government. By the evening, he dredged up an old grudge, taking another shot at the automaker for closing a car factory in Ohio.

Executives at GM -- which had worked around the clock for a week to convert an Indiana parts plant into a breathing-machine factory -- were themselves frustrated over how long it was taking the federal government to finalize terms with its partner Ventec Life Systems Inc., said people familiar with the private deliberations. GM forged ahead and detailed the ventilator deal in a midday statement that didn’t refer to Trump but disputed him by saying it would be “contributing its resources at cost.”

Trump followed up his angry tweets hours later with an order that GM accept a federal contract that the company and Ventec had been seeking all along. His missives marked another set of twists and turns in what has been a tumultuous relationship between one of America’s most prominent companies and a president who prides himself on an ability to work with the private sector.

Patching things up with the White House will be crucial for a company that is struggling to cope with its plants having to idle amid the coronavirus pandemic. The company is freezing work on new-vehicle programs, deferring pay for white-collar staff and piling up cash to weather a global health crisis and the economic fallout expected to follow for months to come.

“The entire GM team is proud to support this initiative,” the company said in response to Trump’s order. “Our commitment to build Ventec’s high-quality critical care ventilator, VOCSN, has never wavered.”

Reminiscent Run-In

For Barra, 58, the run-in with Trump is reminiscent of attacks the president waged after she went public in November 2018 with plans to close plants in Michigan, Ohio and elsewhere. Within hours of the announcement, Trump told reporters he had a conversation with Barra. Describing himself as “very tough” with the CEO, he told her “you better get back in,” referring specifically to GM’s plant in Lordstown, Ohio.

The next day, Trump claimed his administration was looking into cutting all government subsidies the company received, including for electric cars. He didn’t follow through on the threat.

In March 2019, Trump tweeted that GM needed to reopen the Lordstown plant or sell it to a new owner. The next day, he told followers he’d just spoken with Barra and claimed she blamed the United Auto Workers union for supposed intransigence. The next day, he urged the company and union to have talks on the plant immediately rather than when they were scheduled to negotiate a new labor deal in the fall.

Barra had a breakthrough in May, when she gave Trump a heads-up that GM was working on a deal to sell the Lordstown factory to a maker of electric pickups. Trump tweeted “GREAT NEWS FOR OHIO!” and thanked “Mary B.” His posts preempted GM’s press release about the still-preliminary discussions by more than an hour.

Taking Trump’s Side

In October, GM sided with the Trump administration’s in the legal fight he’d been having with California over the future of fuel economy rules.

When other automakers were trying to arrange a compromise side deal with California, they purposely avoided broaching the idea with GM, the Wall Street Journal later reported. The group was worried GM was meeting with the administration and would try to derail their effort, the newspaper said, citing Mary Nichols, the head of California’s Air Resources Board.

The same month, GM ended a painful and costly 40-day strike by reaching a deal with the UAW that saved a plant in Michigan the company had planned to close, though not the one in Ohio.

Still, the company committed to investing $7.7 billion in U.S. facilities and creating or retaining 9,000 jobs as part of the four-year contract.

“General Motors gave us a little hard time with one building, wasn’t happy about that,” Trump said at a December rally in Battle Creek, Michigan. “It was the only building I had a problem with in the whole car industry. Right? Alright, you know the one I’m talking about. I didn’t like that. Anyway, but they’re spending money, you know, what can I tell you.”

‘Patriotic’ Offer

By March, as the Trump administration was responding to the coronavirus pandemic, Barra again had a private conversation with the White House, this time telling top economic adviser Larry Kudlow that the company was willing to call back workers to idled plants and try converting them to build ventilators.

Kudlow alluded to the conversation during a March 18 interview on Fox News. He praised Barra’s offer to reporters afterward, saying it was made “on a voluntary basis for civic and patriotic reasons.”

On March 20, GM announced its collaboration with Ventec. In the week since then, when Trump and other officials in his administration were asked why they hadn’t invoked the Cold War-era Defense Production Act and compelled manufacturers to make ventilators, they said companies including GM were already stepping up.

‘Extremely Unhappy’

That stance changed in dramatic fashion on Friday. Trump referred to “Mary B” again on Twitter, though this time he said it was “always a mess” working with her.

During an evening press conference in the White House briefing room, he criticized GM anew for closing the plant in Ohio, which is now owned by Lordstown Motors Corp.

“I was extremely unhappy with Lordstown, Ohio, when they left Lordstown, Ohio,” Trump said of GM. “Frankly, I think that would be a good place to build the ventilators, but we’ll see, we’ll see how that all works out.”

GM’s wheels were in motion to make ventilators before Trump’s order, and the federal government isn’t going to make the company move any faster than it was already, said Kristin Dziczek, the vice president of industry, labor and economics at the Center for Automotive Research in Ann Arbor, Michigan.

“Mary seems pretty unflappable, and she’s going to do what’s the right thing to do,” Dziczek said by phone. “She’ll just keep on keeping on and hope to receive some degree of clarity about what it is the customer wants, which is the federal government.”

©2020 Bloomberg L.P.