How to solve this problem?
You want to have a device counting boxes from a production line and measuring the temperature of the oil, but suddenly the internet goes down and returns after 1 hour, how to obtain reliable data on the number of boxes produced and the temperature reported every minute.
Should I think on a Programmable Logic Controller connected to local network ?
It definitely is possible to have the Photon continue counting even without WiFi.
Once the network is back the Photon can reconnect and forward the accumulated data.
To keep the Photon running without connection, just add SYSTEM_THREAD(ENABLED) at the top of your code.
For storing the data you just use an array of a fitting struct (possibly using Backup RAM).
And depending on your counting and measuring hardware you may need to employ the suitable sensor libraries.
A code example that shows all of these features would already mean writing the project for you 
wifi state is available too, to see if wifi is connected Device OS API | Reference Documentation | Particle
you could also connect an sd card and backup years of data to it just incase