Im trying to build a simple ERP system in javascript for my company and learn something in progress.
I have most things set up but I cant figure out how to handle a time.
For an example:
I have 3 machines, 2 operators working on some hours. Than i got list of things to be done for next 3 days (some of them takes 5 min others 3h). What i want to do is go through all jobs by its importance and place it with free operator and create a plan for all activities - what time they should start and end.
Sooo...
Operator 1 start first job at 8:00 and hes busy till 8:45,
Operator 2 get second job because operator 1 is busy he start at 8:00 and finish at 8:35.
Third job goes to operator 2 because he will finish first...ect
I know how to do it in theory i just dont know how to write it in code...
In other words, what is the best way to represent a timeline in code?
Regards
Record time info (start and duration) for each job. Record the occupying jobs for each operator.
Something like this:
Then, order the jobs by they're start time, and find for every job, an available operator - that is an operator who has no other jobs in the wanted time span. Here's the rest of the code:
Here's a JSFiddle Demo