This issue is generally caused by liquid damage / corrosion on the charging port resulting in the device detecting short-circuit (charging pins touching each other) which stops the tablet from charging.
To fix this problem, the tablet would need to be opened off, starting from the back cover, removing the charging port daughterboard assembly and cleaning the corrosion if there is on the charging port behind or the charging port would need to be replaced as a whole if it's physically damaged or no signs of liquid damage.
If this does not end up fixing it, it is a board level which I would estimate not being worth to fix as it would get very expensive with a low chance of fixing it.
Here is link to part and guide on how to replace it if needed:
[product|IF250-006]
[guide|72293]