mardi 7 août 2018

PHP calculate next available time

I've done a lot of research on this matter and, to yet, had no luck in finding a solution.

I have a project management system, built on Laravel 5.6, which tracks time of current working projects on each of the fabrication bays there are.

I need to be able to find the next available time for a particular bay, but only during working hours/days.

e.g

The last job for Bay A was at 07/08/2018 07:00.

It was due to last for 660 minutes (11 hours), so it would be due to end at 10:15 08/08/2018 (11 business hours after, the bay closes at 15:00, and a 15 minute standard changeover period).

This means that next job for Bay A, which we're just adding to the system, can start at 10:15 08/08/2018. Thus giving us a start time, ready for the calculation of the next job added to the system.

Some jobs could last for 2000+ minutes, meaning it would spill over to a 2nd/3rd etc. day. So I also need to be able to work out whether it's a weekend or bank holiday and ignore those days.

The start/finish times for the bays are stored in the database (Mon-Fri). When the previous job is added to the system, the time (in minutes) is also stored.

function bay_available($last_job_length, $last_job_start_time, $bay_meta, $changeover_period)
{

}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire