private ShuttleTask GenerateBinLocRetrival(int aisle, int level = 0) { ShuttleTask sT = new ShuttleTask(); string freeLevel = string.Empty; string binLocation = string.Empty; if (level == 0) // no level has been imputted { freeLevel = GetRandomFreeLevel(); } else if (level > 0) { freeLevel = level.ToString().PadLeft(2, '0'); } if (freeLevel != string.Empty) // if nothing was returned from GetRandomFreeLevel then string will be empty { //sT.LoadColor = System.Drawing.Color.Peru; //sT.LoadHeight = 0.32f; //sT.LoadLength = 0.6f; //sT.LoadWidth = 0.4f; //sT.LoadWeight = 2.3f; sT.Source = GenerateBinLocation(freeLevel); //sT.Source = string.Format("{0}{1}{2}{3}", (char)GetRackSide() //s - side // , rand.Next(1, (int)theMultishuttle.RackBays + 1).ToString().PadLeft(3, '0') //xxx - Bin loc // , freeLevel //yy - level // , rand.Next(1, 3).ToString().PadLeft(2, '0')); //dd - depth //Core.Environment.Log.Write(sT.Source); string side = "R"; int intFreeLevel; int.TryParse(freeLevel, out intFreeLevel); if (theMultishuttle.LeftEvenLevelInfeed) //infeeds and outfeeds are mixed { if (theMultishuttle.LeftEvenLevelInfeed && intFreeLevel % 2 == 0) { side = "R"; } else if (theMultishuttle.LeftEvenLevelInfeed && intFreeLevel % 2 > 0) { side = "L"; } } sT.Destination = string.Format("{0}{1}{2}OB", aisle.ToString().PadLeft(2, '0'), side, freeLevel); sT.Barcode = FeedCase.GetSSCCBarcode(); return(sT); } return(null); }
private void DelayedShuttleTask(RackConveyorArrivalEventArgs e) { Core.Environment.Log.Write("task"); ShuttleTask sT = new ShuttleTask(); sT.Level = e._locationName.Level(); //sT.LoadColor = Color.Peru; //sT.LoadHeight = 0.32f; //sT.LoadLength = 0.65f; //sT.LoadWidth = 0.32f; //sT.LoadWeight = 2.3f; sT.Destination = "01R06OB"; sT.Source = e._locationName; sT.Barcode = FeedCase.GetSSCCBarcode(); theMultishuttle.shuttlecars[sT.Level].ShuttleTasks.Add(sT); }
/// <summary> /// Rack Location for an ElevatorTask takes the form: aasyyxz: a=aisle, s = side, y = level, x = input or output, Z = loc A or B e.g. 01R05OA /// Elevator Source location for a shuttleTask takes the form: sxxxyydd: Side, xxx location, yy = level, dd = depth /// </summary> /// <param name="info"></param> /// <param name="cPoint"></param> public MHEControl_MultiShuttleSimulation(MultiShuttleSimInfo info, MultiShuttle cPoint) { theMultishuttle = cPoint; multiShuttleSimInfo = info; // set this to save properties theMultishuttle.OnArrivedAtPickStationConvPosB += multiShuttle_OnArrivedAtPickStationConvPosB; theMultishuttle.OnArrivedAtPickStationConvPosA += multiShuttle_OnArrivedAtPickStationConvPosA; theMultishuttle.OnArrivedAtInfeedRackConvPosB += theMultishuttle_OnArrivedAtInfeedRackConvPosB; theMultishuttle.OnArrivedAtOutfeedRackConvPosA += theMultishuttle_OnArrivedAtOutfeedRackConvPosA; theMultishuttle.OnArrivedAtOutfeedRackConvPosB += theMultishuttle_OnArrivedAtOutfeedRackConvPosB; theMultishuttle.OnLoadTransferingToPickStation += theMultishuttle_OnLoadTransferingToPickStation; theMultishuttle.OnArrivedAtRackLocation += theMultishuttle_OnArrivedAtRackLocation; //List<string> setShuttleTasks = new List<string>() { "L0270902", "R0150202", "L0340102", "R0280302", "L0090701", "R0400802", "L0370802", "R0140102", "L0390402", "R0180602" }; //foreach (string item in setShuttleTasks) //{ // ShuttleTask sT = new ShuttleTask(); // sT.LoadColor = Color.Peru; // sT.LoadHeight = 0.32f; // sT.LoadLength = 0.65f; // sT.LoadWidth = 0.32f; // sT.LoadWeight = 2.3f; // sT.Source = item; // sT.Level = sT.Source.Level(); // sT.Destination = string.Format("01R{0}OB", sT.Level.ToString().PadLeft(2, '0')); // sT.Barcode = FeedCase.GetSSCCBarcode(); // theMultishuttle.shuttlecars[sT.Level].ShuttleTasks.Add(sT); //} ShuttleTask sT = new ShuttleTask(); try { //sT.LoadColor = Color.Peru; //sT.LoadHeight = 0.32f; //sT.LoadLength = 0.65f; //sT.LoadWidth = 0.32f; //sT.LoadWeight = 2.3f; sT.Source = "R0011001";//"L0011001" sT.Level = sT.Source.Level(); sT.Destination = string.Format("01{0}{1}OA", (char)(sT.Source.Side()), sT.Level.ToString().PadLeft(2, '0')); sT.Barcode = FeedCase.GetSSCCBarcode(); theMultishuttle.shuttlecars[sT.Level].ShuttleTasks.Add(sT); sT = new ShuttleTask(); //sT.LoadColor = Color.Peru; //sT.LoadHeight = 0.32f; //sT.LoadLength = 0.65f; //sT.LoadWidth = 0.32f; //sT.LoadWeight = 2.3f; sT.Source = "R0110801"; sT.Level = sT.Source.Level(); sT.Destination = string.Format("01{0}{1}OA", (char)sT.Source.Side(), sT.Level.ToString().PadLeft(2, '0')); sT.Barcode = FeedCase.GetSSCCBarcode(); theMultishuttle.shuttlecars[sT.Level].ShuttleTasks.Add(sT); } catch (Exception ex) { Log.Write("Error in simulation: " + ex.Message, Color.Red); } //for (int i = 0; i < 30; i++) //{ // ShuttleTask task = GenerateBinLocRetrival(1); // if (task != null) // { // theMultishuttle.shuttlecars[task.Source.Level()].ShuttleTasks.Add(task); // task = null; // } //} //List<RackConveyor> infeedRackConvTemp = new List<RackConveyor>(); //foreach (DematicActionPoint dAP in theMultishuttle.ConveyorLocations) //{ // if (dAP.LocName.ConvType() == ConveyorTypes.InfeedRack) // { // infeedRackConvTemp.Add((dAP.Parent.Parent.Parent) as RackConveyor); // } //} //var hash = new HashSet<RackConveyor>(infeedRackConvTemp); //List<RackConveyor> infeedRackConv = hash.ToList(); }