Gains power through what source? Solar? Electric? How often? How long must the system operate without a recharge? Worst case time periods?
I'm not a battery expert, so defer to others. But when dealing with questions like this, I personally like to start with a simple spreadsheet modeling the power usage, battery capacity, usage/time periods, etc. The spreadsheet complexity will grow as my understanding of the problem/system increases, with the goal of helping me understand if the system can really meet the desired 24/7 operation, or at least what time periods will result in failure, etc.
And of course, make sure the hardware/EE team carefully selects low power versions of major components, such as the microcontroller, etc.
The system is supposed to protect trucks. If somebody open it a alarm will be send to the server. As long as it is driving it can use the power from the truck, but if it is turned off the goods still have to be protected. Also it is possible that the trailer will be left alone. So at maximum the system is for several days out of energy.
The important thing is the energy balance, so that the system can be designed to take in enough to charge the battery or other storage you have.
I agree with Matthew's suggestion to generate a spreadsheet to calculate the energy balance, and go from there to figure out how much storage you need between charging events.
There's no problem charging modern batteries randomly with the proper charging circuits, but if your source is only available in very short time increments, you may need to use a supercapacitor to quickly accept the energy and then either operate from that, or use it to charge the battery at a slower rate, which would allow you to accept random events and average out the charging without a huge supercapacitor. Lots of things to consider!
As it was said before, you need to work out a power budget.
Random charging is not necessarily a battery killer. What you need to consider, though, is that batteries have a limited life. So you also need to calculate the number of charge-discharge cycles and work out how long your batteries will last.
Also, if you have more than one battery, either in series or parallel, you might need to consider charge balancing.
You really need to provide more details if you want useful help, your description is very vague in its current form.