//Load has arrived at divert point void divertConveyor_OnDivertPointArrivedControl(object sender, AngleDivertArgs e) { Case_Load caseload = e._load as Case_Load; if (casePLC.DivertSet(caseload.SSCCBarcode, DivertRoutes)) { selectedRoute = DivertRoute.Divert; divertConveyor.RouteLoad(DivertRoute.Divert); } else if (casePLC.DivertSet(caseload.SSCCBarcode, StraightRoutes)) { selectedRoute = DivertRoute.Straight; divertConveyor.RouteLoad(DivertRoute.Straight); } else { selectedRoute = divertConveyor.DefaultRoute; divertConveyor.RouteLoad(divertConveyor.DefaultRoute); } }
void angledDivertConveyor_OnDivertArrivalController(object sender, AngleDivertArgs e) { List <DivertRoute> validRoutes = new List <DivertRoute>(); List <DivertRoute> directions = new List <DivertRoute>(); directions.Add(DivertRoute.Straight); directions.Add(DivertRoute.Divert); DivertRoute divertDirection = DivertRoute.None; if (Distribution == RouteDistribution.Random) { divertDirection = directions[random.Next(0, 2)]; } else if (Distribution == RouteDistribution.RoundRobin) { if (lastRouting != DivertRoute.Straight) { divertDirection = DivertRoute.Straight; } else { divertDirection = DivertRoute.Divert; } } lastRouting = divertDirection; if (divertDirection != DivertRoute.None) { validRoutes.Add(divertDirection); //A list of loads, sometimes either route will be valid and the divert //can decide which is the best. //angledDivertConveyor.RouteLoad(e._load, validRoutes); angledDivertConveyor.RouteLoad(divertDirection); } }