void divertConveyor_OnDivertPointDivertedControl(object sender, AngleDivertArgs e) { Case_Load caseLoad = e._load as Case_Load; if (e._direction != selectedRoute && !string.IsNullOrEmpty(FailedToDivertLocation)) { //Send failed to divert message if (FailedToDivertMessageType == FailedMessageType._02) { casePLC.SendDivertConfirmation(FailedToDivertLocation, caseLoad.SSCCBarcode); } else if (FailedToDivertMessageType == FailedMessageType._06) { string body = string.Format("{0},{1},{2}", caseLoad.SSCCBarcode, FailedToDivertLocation, FailedToDivertMessageReasonCode); casePLC.SendTelegram("06", body, 1, true); } } else if (e._direction == DivertRoute.Divert && !string.IsNullOrEmpty(DivertRoutingLocation)) { //Send Diverted message casePLC.SendDivertConfirmation(DivertRoutingLocation, caseLoad.SSCCBarcode); } else if (e._direction == DivertRoute.Straight && !string.IsNullOrEmpty(StraightRoutingLocation)) { //Send Diverted straight message casePLC.SendDivertConfirmation(StraightRoutingLocation, caseLoad.SSCCBarcode); } }
void divertConveyor_OnDivertPointDivertedControl(object sender, AngleDivertArgs e) { Case_Load caseLoad = e._load as Case_Load; if (e._direction != selectedRoute && !string.IsNullOrEmpty(FailedToDivertLocation)) { //Send failed to divert message casePLC.SendDivertConfirmation(FailedToDivertLocation, caseLoad.SSCCBarcode); } else if (e._direction == DivertRoute.Divert && !string.IsNullOrEmpty(DivertRoutingLocation)) { //Send Diverted message casePLC.SendDivertConfirmation(DivertRoutingLocation, caseLoad.SSCCBarcode); } else if (e._direction == DivertRoute.Straight && !string.IsNullOrEmpty(StraightRoutingLocation)) { //Send Diverted straight message casePLC.SendDivertConfirmation(StraightRoutingLocation, caseLoad.SSCCBarcode); } }
//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); } }