/// <summary> /// Determine which range of Isle to be on, the rotation of the isles, and what the current shelf is, and which bay (front or back) to work from. /// </summary> /// <param name="FC">Fc.</param> public void AssignIsles(iWarehouse FC) { //Creates the ranges of isles SKU are prioritized into List <Tuple <int, int> > Ranges = new List <Tuple <int, int> >() { new Tuple <int, int>(FC.Isles.Min(f => f.IsleID), 10), new Tuple <int, int>(11, 15), new Tuple <int, int>(16, 20), new Tuple <int, int>(21, 25), new Tuple <int, int>(26, 30), new Tuple <int, int>(31, FC.Isles.Max(f => f.IsleID)) }; if (!int.TryParse(ConfigurationManager.AppSettings["InputFilePath"].ToString(), out int shelfCount)) { throw new ConfigurationErrorsException("Failed to parse shelf count in app config."); } //Loopes through each range of isles foreach (Tuple <int, int> range in Ranges) { //Goes shelf by shelf across each range. for (int s = 1; s <= shelfCount; s++) { restartRangeAt = 0; currentIsle = range.Item1; if (FC.Isles.Min(v => v.IsleID) <= range.Item2 && FC.Isles.Min(v => v.IsleID) > range.Item1) { currentIsle = FC.Isles.Min(v => v.IsleID); } frontBay = true; //checks that shelf in that range has space while (FC.HasOpenSpace(s, range)) { if (FC.Isles.Select(e => e.IsleID).ToList().Contains(currentIsle)) { if (FC.Isles.FirstOrDefault(l => l.IsleID == currentIsle).HasOpenSpace(s)) { assignPositionResults result = AssignBays(FC.Isles.FirstOrDefault(l => l.IsleID == currentIsle), s); if (result == assignPositionResults.outOfSkusToAssign) { return; } } } //cleanup at end of assignment each time currentIsle += 3; if (frontBay) { frontBay = false; } else { frontBay = true; } //Cleanup at end of looop through range if (currentIsle > range.Item2) { restartRangeAt += 1; if (restartRangeAt == 3) { restartRangeAt = 0; } currentIsle = range.Item1 + restartRangeAt; if (frontBay) { frontBay = false; } else { frontBay = true; } } } } } }