/// <summary> /// Reserves a setup in manager (FindNextFreeSpace will consider this setup as a reserved area) /// </summary> /// <param name="newSetup">reserved smartRange from previous step which has newSetup type</param> /// <param name="job"></param> internal void Reserve(SmartRange newSetup, SmartJob job) { var reserve = _reserve.FirstOrDefault(x => x.Key == newSetup.StationId).Value; var range = SmartRange.NewReserve(newSetup.StartDT, newSetup.DurationSeconds, newSetup.WarmupId, newSetup.ChangeoverId); //insert to reserve (but maintain its order) var insertionPoint = reserve.FirstOrDefault(x => x.StartDT > newSetup.StartDT); if (insertionPoint == null) reserve.Add(range); else { int index = reserve.IndexOf(insertionPoint); reserve.Insert(index, range); } }
public static SmartRange ExistingSetup(Model.NonProductiveTask model) { var setup = model as Model.Setup; if (setup == null) return null; if (setup.Warmup == null || setup.Changeover == null) return null; var sr = new SmartRange { StartDT = model.StartDateTime, DurationSeconds = model.DurationSeconds, Type = RangeType.Setup, SetupId = model.Id, StationId = setup.Warmup.Station.Id, ProductReworkId = setup.Warmup.ProductRework.Id, FromProductReworkId = setup.Changeover.FromProductRework.Id, WarmupId = setup.Warmup.Id, ChangeoverId = setup.Changeover.Id, }; return sr; }
public static SmartRange NewDeleteSetup(SmartRange sr) { return new SmartRange { Type = RangeType.DeleteSetup, SetupId = sr.SetupId, StartDT = sr.StartDT, StationId = sr.StationId, DurationSeconds = sr.DurationSeconds, }; }