Exemple #1
0
        public static void CreateGanttChartForRessource(JobInProgress jobInProgress, IJobQueue scopeQueue, Agent agent)
        {
            List <GanttChartItem> ganttData = new List <GanttChartItem>();

            if (jobInProgress.IsSet)
            {
                ganttData.AddRange(CreateGanttProcessingQueueLog(new[] { jobInProgress.GanttItem }, true, "Processing", jobInProgress, agent));
                // add from scope
            }
            ganttData.AddRange(CreateGanttProcessingQueueLog(jobInProgress.GanttItems.ToArray(), false, "ReadyElement", jobInProgress, agent));

            var jobs = scopeQueue.GetAllJobs().OrderBy(x => x.Job.Priority(agent.CurrentTime)).ToList();

            ganttData.AddRange(CreateGanttProcessingQueueLog(jobs.ToArray(), false, "ScopeQueue", jobInProgress, agent));

            CustomFileWriter.WriteToFile($"Logs//ResourceScheduleAt-{agent.CurrentTime}.log",
                                         JsonConvert.SerializeObject(ganttData).Replace("[", "").Replace("]", ","));


            if (jobs.Count > 0)
            {
                if (jobs.First().ScopeConfirmation.GetScopeStart() < jobInProgress.ResourceIsBusyUntil)
                {
                    agent.DebugMessage("Seems wrong");
                }
            }
        }