Ejemplo n.º 1
0
        private int GetIdToMatchLast <T>(T queue) where T : ICustomQueue, IEnumerable <IWork>
        {
            Core.Resources.Op.OpTypes last = _machine.LastType;
            var set = from wo in queue
                      where (wo.CurrentOpType == last)
                      select wo;

            if (!set.Any())
            {
                return(queue.FirstId().Value);
            }

            return(set.First().Id);
        }
Ejemplo n.º 2
0
        private int GetBasicSchedule <T>(T queue) where T : ICustomQueue, IEnumerable <IWork>
        {
            IEnumerable <int>    passedIds = queue.Select(x => x.Id);
            List <Rating <int> > ratings   = _plant.PlantScheduler.GetWorkorderRatings();

            ratings = ratings.Where(x => passedIds.Contains(x.Object)).ToList();

            Core.Resources.Op.OpTypes last = _machine.LastType;
            var wosWithSameAsLastType      = from wo in queue
                                             where (wo.CurrentOpType == last)
                                             select wo.Id;

            ratings.Where(x => wosWithSameAsLastType.Contains(x.Object)).ToList().ForEach(x => x.Value += Configuration.MachineOpTypeVariable);

            ratings.Where(x => !wosWithSameAsLastType.Contains(x.Object)).ToList().ForEach(x => x.Value += GetWaitTime(x.Object) * Configuration.MachineWaitTimeVariable);

            int maxValue = ratings.Max(x => x.Value);

            return(ratings.First(x => x.Value == maxValue).Object);
        }