Exemplo n.º 1
0
        bool divertArrival(Load load)
        {
            IATCCaseLoadType atcLoad = load as IATCCaseLoadType;

            if (LoadDestination && mergeDivertConveyor.Name == atcLoad.Destination && !atcLoad.LoadWaitingForWCS)
            {
                atcLoad.Stop();
                atcLoad.LoadWaitingForWCS = true;
                atcLoad.Location          = mergeDivertConveyor.Name;
                casePLC.SendTransportFinishedTelegram(atcLoad);
                return(true);
                //Send a message to WMS and wait for the routing
            }

            List <Direction> validRoutes = new List <Direction>();

            Case_Load caseload = load as Case_Load;

            if (atcLoad.Destination != null && mergeDivertConveyor.LeftMode == Modes.Divert && LeftRoutes != null && LeftRoutes.Contains(atcLoad.Destination))
            {
                validRoutes.Add(Direction.Left);
            }

            if (atcLoad.Destination != null && mergeDivertConveyor.RightMode == Modes.Divert && RightRoutes != null && RightRoutes.Contains(atcLoad.Destination))
            {
                validRoutes.Add(Direction.Right);
            }

            if (atcLoad.Destination != null && mergeDivertConveyor.StraightMode == Modes.Divert && StraightRoutes != null && StraightRoutes.Contains(atcLoad.Destination))
            {
                validRoutes.Add(Direction.Straight);
            }

            //Check if the load has the priority bit set
            bool priority = false;

            if (atcLoad.Destination != null && PriorityRoutes != null && PriorityRoutes.Contains(atcLoad.Destination))
            {
                priority = true;
            }

            mergeDivertConveyor.RouteLoad(load, validRoutes, priority);
            return(true); //returns true if handled by this controller
        }
Exemplo n.º 2
0
        bool divertArrival(Load load)
        {
            List <Direction> validRoutes = new List <Direction>();

            Case_Load caseload = load as Case_Load;

            if (mergeDivertConveyor.LeftMode == Modes.Divert &&
                ((casePLC.DivertSet(caseload.SSCCBarcode, LeftRoutes) &&
                  (LeftAndRoutes == null || casePLC.DivertSet(caseload.SSCCBarcode, LeftAndRoutes))) ||
                 (LeftOrRoutes != null && casePLC.DivertSet(caseload.SSCCBarcode, LeftOrRoutes))))
            {
                validRoutes.Add(Direction.Left);
            }

            if (mergeDivertConveyor.RightMode == Modes.Divert &&
                ((casePLC.DivertSet(caseload.SSCCBarcode, RightRoutes) &&
                  (RightAndRoutes == null || casePLC.DivertSet(caseload.SSCCBarcode, RightAndRoutes))) ||
                 (RightOrRoutes != null && casePLC.DivertSet(caseload.SSCCBarcode, RightOrRoutes))))
            //if (casePLC.DivertSet(caseload.SSCCBarcode, RightRoutes) && mergeDivertConveyor.RightMode == MergeDivertConveyor.Modes.Divert)
            {
                validRoutes.Add(Direction.Right);
            }
            if (mergeDivertConveyor.StraightMode == Modes.Divert &&
                ((casePLC.DivertSet(caseload.SSCCBarcode, StraightRoutes) &&
                  (StraightAndRoutes == null || casePLC.DivertSet(caseload.SSCCBarcode, StraightAndRoutes))) ||
                 (StraightOrRoutes != null && casePLC.DivertSet(caseload.SSCCBarcode, StraightOrRoutes))))
            //if (casePLC.DivertSet(caseload.SSCCBarcode, StraightRoutes) && mergeDivertConveyor.StraightMode == MergeDivertConveyor.Modes.Divert)
            {
                validRoutes.Add(Direction.Straight);
            }

            //Check if the load has the priority bit set
            bool priority = false;

            if (casePLC.DivertSet(caseload.SSCCBarcode, new List <int[]> {
                new int[] { 4, 16 }
            }))
            {
                priority = true;
            }

            mergeDivertConveyor.RouteLoad(load, validRoutes, priority);
            return(true); //returns true if handled by this controller
        }
Exemplo n.º 3
0
        bool divertArrival(Load load)
        {
            if (ControllerPoint)
            {
                return(false); //Returns false if it should be handled by the routing script need to add this to the main component
            }
            //int validRouteCount = 0;
            bool             DivertLeft = false, DivertRight = false, DivertStraight = false;
            List <Direction> validRoutes = new List <Direction>();

            List <Direction> directions = new List <Direction>();

            if (mergeDivertConveyor.LeftMode == MergeDivertConveyor.Modes.Divert)
            {
                directions.Add(Direction.Left);
            }
            if (mergeDivertConveyor.StraightMode == MergeDivertConveyor.Modes.Divert)
            {
                directions.Add(Direction.Straight);
            }
            if (mergeDivertConveyor.RightMode == MergeDivertConveyor.Modes.Divert)
            {
                directions.Add(Direction.Right);
            }

            if (directions.Count == 0)
            {
                return(true); //Returns true as if you return false the routing script event will be called
            }
            Direction divertDirection = Direction.None;

            if (Distribution == RouteDistribution.Random)
            {
                divertDirection = directions[random.Next(0, directions.Count)];
            }
            else if (Distribution == RouteDistribution.RoundRobin)
            {
                for (int i = 0; i < directions.Count; i++)
                {
                    if (directions[i] == lastRouting)
                    {
                        if (i + 1 == directions.Count)
                        {
                            divertDirection = directions[0];
                        }
                        else
                        {
                            divertDirection = directions[i + 1];
                        }
                    }
                }
                if (divertDirection == Direction.None)
                {
                    divertDirection = directions[0];
                }
            }
            lastRouting = divertDirection;

            if (divertDirection == Direction.None)
            {
                return(true); //Failed to find a valid routing, just jumping out
            }
            else
            {
                switch (divertDirection)
                {
                case Direction.Left: DivertLeft = true; break;

                case Direction.Right: DivertRight = true; break;

                case Direction.Straight: DivertStraight = true; break;
                }
            }

            validRoutes.Add(divertDirection);

            mergeDivertConveyor.RouteLoad(load, validRoutes, false);
            return(true); //returns true if handled by this controller
        }