private void ProcessCompletionEvent(InWorkEvent inWorkEvent) { try { // put shift resources back into availability pool _shiftManager.CompleteJob(inWorkEvent.Shift, inWorkEvent.Owner); var completedJob = inWorkEvent.Owner.Job; // job is complete, update status _availableJobs.Complete(completedJob, inWorkEvent.End); // remove job from jobs needing to be processed _jobs.Remove(completedJob); _inWorkEvents.Remove(inWorkEvent); var zone = inWorkEvent.Owner.LocationZone; if (zone != null) { zone.Resource.WorkCompleted(inWorkEvent); } // check to see if the completing job has successors that are ready to be worked foreach (var job in completedJob.Successors.OrderBy(x => x.Duration)) { var ready = job.Predecessors.All(x => _availableJobs.ProcessedJobs.ContainsKey(x.ID)); if (ready) { _availableJobs.Enqueue(job); } } } catch (Exception ex) { string test = ex.Message; } }