Ejemplo n.º 1
0
        public void ShuttleOnArrived(object sender, EventArgs e)
        {
            Track.Route.Motor.Stop();
            if (CurrentTask != null)
            {
                if (Vehicle.DestAP.Distance == InfeedRackShuttleLocation) //workarround for experior bug...if the straight transport section is already at the correct location then the load will not be releasable from the action point but if shuttle moves to th position then it can be released...WTF
                {
                    MoveShuttle(InfeedRackShuttleLocation + 0.01f);
                    //MoveShuttle(InfeedRackShuttleLocation);
                    return;
                }
                else if (HasArrivedAtRackInfeedConv() && Vehicle.LoadsOnBoard == 0)
                {
                    var cl = ParentMS.ConveyorLocations.Find(x => x.LocName == CurrentTask.Source);
                    if (cl != null)
                    {
                        if (cl.Active)
                        {
                            Vector3 v3 = Vehicle.Position - cl.ActiveLoad.Position;
                            v3.Y = 0; //Y is up so do not move the height.
                            cl.ActiveLoad.Translate(() => cl.ActiveLoad.Switch(Vehicle.shuttleAP, true), v3, ParentMS.TimeToPos1);
                            waitingForLoadAtRI = false;
                        }
                        else
                        {
                            waitingForLoadAtRI = true;
                        }
                    }
                    return;
                }

                if (Vehicle.DestAP.Distance == CurrentTask.SourcePosition && Vehicle.LoadsOnBoard == 0 && !HasArrivedAtRackInfeedConv()) //Retrieving from a bin location
                {
                    Case_Load boxLoad = ParentMS.Controller.CreateCaseLoad(CurrentTask.caseData);
                    Load.Items.Add(boxLoad);
                    boxLoad.Yaw = (float)Math.PI / 2;
                    ParentMS.LoadCreated(new LoadCreatedEventArgs(boxLoad));
                    boxLoad.Switch(Vehicle.shuttleAP2);

                    float   timeToTransfer;
                    Vector3 transferVector;
                    CreateTransferVector(boxLoad, out timeToTransfer, out transferVector);

                    boxLoad.Translate(transferVector, 0);                                                                                  //Translate away from the suttle AP in zero time
                    Vehicle.shuttleAP2.ActiveLoad.Translate(() => boxLoad.Switch(Vehicle.shuttleAP), transferVector * -1, timeToTransfer); //Then translate back (hence -1) in in time to transfer
                }
                else if (Vehicle.LoadsOnBoard != 0)                                                                                        //Delevering to a rackbin location or an outfeed point
                {
                    float   timeToTransfer;
                    Vector3 transferVector;
                    CreateTransferVector((Case_Load)Vehicle.LoadOnBoard, out timeToTransfer, out transferVector);

                    int dir = 1;
                    if (CurrentTask.Source.Side() != CurrentTask.Destination.Side())
                    {
                        dir = -1;
                    }
                    Load load = Vehicle.LoadOnBoard;
                    //Vehicle.LoadOnBoard.Translate(() => ArrivedAtDest(Vehicle.LoadOnBoard), transferVector * dir, timeToTransfer);

                    if (load != null)
                    {
                        Vehicle.LoadOnBoard.Translate(() => ArrivedAtDest(load), transferVector * dir, timeToTransfer);
                    }
                    else
                    {
                        Log.Write(string.Format("ERROR {0}: ShuttleOnArrived - load is null!", Name), Color.Red);
                        Core.Environment.Scene.Pause();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void ShuttleOnArrived()
        {
            if (CurrentTask != null)
            {
                if (trackRail.Destination.Distance == 0) //workarround for experior bug...if the straight transport section is already at the correct location then the load will not be releasable from the action point but if shuttle moves to th position then it can be released...WTF
                {
                    MoveShuttle(ParentMultiShuttle.workarround);
                    return;
                }
                else if (trackRail.Destination.Distance == ParentMultiShuttle.workarround)
                {
                    var cl = ParentMultiShuttle.ConveyorLocations.Find(x => x.LocName == CurrentTask.Source);
                    if (cl != null && cl.Active)
                    {
                        cl.ActiveLoad.Switch(transferIn); //switch from rack to shuttleAP
                    }
                }

                if (trackRail.Destination.Distance == CurrentTask.SourcePosition && shuttleConveyor.Route.Loads.Count == 0) //Have arrived at the rack bin location
                {
                    MeshInfo boxInfo = new MeshInfo()
                    {
                        color    = CurrentTask.caseData.colour,
                        filename = Case_Load.GraphicsMesh,
                        length   = CurrentTask.caseData.Length,
                        width    = CurrentTask.caseData.Width,
                        height   = CurrentTask.caseData.Height
                    };

                    Case_Load boxLoad = new Case_Load(boxInfo)
                    {
                        Weight = CurrentTask.caseData.Weight,
                        //SSCCBarcode    = CurrentTask.LoadID,
                        Identification = CurrentTask.LoadID,
                        Case_Data      = CurrentTask.caseData //[BG] 23/03/15 Removed cast
                    };

                    Load.Items.Add(boxLoad);
                    ParentMultiShuttle.LoadCreated(new LoadCreatedEventArgs(boxLoad));

                    ChangeShuttleConvDirection(CurrentTask.Source.Side(), ShuttleConvDirRef.Loading);

                    if (CurrentTask.Source.LoadDepth() == 1)
                    {
                        boxLoad.Switch(enterPointDepth1);
                    }
                    else
                    {
                        boxLoad.Switch(enterPointDepth2);
                    }
                }
                else if (trackRail.Destination.Distance == ParentMultiShuttle.workarround && CurrentTask.DestPosition == 0 || trackRail.Destination.Distance == CurrentTask.DestPosition)
                {
                    if (CurrentTask.Destination.RackXLocation() == 0) //Have arrived at rack conveyor
                    {
                        var v = ParentMultiShuttle.ConveyorLocations.Find(x => x.LocName == CurrentTask.Destination);
                        if (v == null)
                        {
                            Core.Environment.Log.Write(string.Format("Destination {0} does not exist. Are you trying to drop at an infeed rack conveyor or pick from an outfeed rackconveyor", CurrentTask.Destination), Color.Red);
                            Core.Environment.Scene.Pause();
                        }
                        else if (v.Active)
                        {
                            Core.Environment.Log.Write("Shuttle can't drop off destination is blocked", Color.Red);
                            return;
                        }

                        shuttleAP.Release();
                    }
                    else
                    {
                        //ParentMultiShuttle.ArrivedAtRackLocation(new TaskEventArgs(CurrentTask,shuttleAP.ActiveLoad));
                        shuttleAP.ActiveLoad.Release();
                    }
                }
                else
                {
                    ChangeShuttleConvDirection(CurrentTask.Source.Side(), ShuttleConvDirRef.Loading);
                }
            }
        }
Ejemplo n.º 3
0
        public void ShuttleOnArrived()
        {
            if (CurrentTask != null)
            {
                if (trackRail.MoveTo.Distance == ParentMultiShuttle.InfeedRackShuttleLocation) //workarround for experior bug...if the straight transport section is already at the correct location then the load will not be releasable from the action point but if shuttle moves to th position then it can be released...WTF
                {
                    MoveShuttle(ParentMultiShuttle.InfeedRackShuttleLocation + 0.01f);
                    return;
                }
                else if (HasArrivedAtRackInfeedConv() && shuttleConveyor.Route.Loads.Count == 0)
                {
                    var cl = ParentMultiShuttle.ConveyorLocations.Find(x => x.LocName == CurrentTask.Source);
                    if (cl != null && cl.Active)
                    {
                        Vector3 v3 = shuttleAP.Position - cl.ActiveLoad.Position;
                        v3.Y = 0; //Y is up so do not move the height.
                        cl.ActiveLoad.Translate(() => cl.ActiveLoad.Switch(shuttleAP, true), v3, ParentMultiShuttle.TimeToPos1);
                    }
                    return;
                }

                if (trackRail.MoveTo.Distance == CurrentTask.SourcePosition && shuttleConveyor.Route.Loads.Count == 0 && !HasArrivedAtRackInfeedConv()) //Retrieving from a bin location
                {
                    Case_Load boxLoad = ParentMultiShuttle.Controller.CreateCaseLoad(CurrentTask.caseData);
                    Load.Items.Add(boxLoad);
                    boxLoad.Yaw = (float)Math.PI / 2;
                    ParentMultiShuttle.LoadCreated(new LoadCreatedEventArgs(boxLoad));
                    boxLoad.Switch(shuttleAP2);

                    float   timeToTransfer;
                    Vector3 transferVector;
                    CreateTransferVector(boxLoad, out timeToTransfer, out transferVector);

                    boxLoad.Translate(transferVector, 0);                                                                  //Translate away from the suttle AP in zero time
                    shuttleAP2.ActiveLoad.Translate(() => boxLoad.Switch(shuttleAP), transferVector * -1, timeToTransfer); //Then translate back (hence -1) in in time to transfer
                }
                else if (shuttleConveyor.Route.Loads.Count != 0)                                                           //Delevering to a rackbin location or an outfeed point
                {
                    float   timeToTransfer;
                    Vector3 transferVector;
                    CreateTransferVector((Case_Load)shuttleAP.ActiveLoad, out timeToTransfer, out transferVector);

                    //rackLoc = CurrentTask.Destination.Side() == RackSide.Right ? shuttleAP_Zpos * -1 : shuttleAP_Zpos; //Get the side

                    //int loadDepth = CurrentTask.Destination.LoadDepth(); //Get the depth in the rack
                    //float timeToTransfer = ParentMultiShuttle.TimeToPos1;

                    //if (loadDepth == -1)  //-1 = IA = Inter Aisle Transfer
                    //{
                    //    timeToTransfer = ParentMultiShuttle.TimeToPos1 + ParentMultiShuttle.TimeToPos2;
                    //    rackLoc = rackLoc * 3; //dropoff into the other aisle
                    //}
                    //else if(loadDepth == 2)
                    //{
                    //    rackLoc =  rackLoc * 2;
                    //    timeToTransfer = ParentMultiShuttle.TimeToPos2;
                    //}

                    //Vector3 direction = Trigonometry.DirectionYaw(Trigonometry.Yaw(shuttleAP.ActiveLoad.Route.Orientation));
                    //Vector3 rotated = Trigonometry.CrossProduct(direction, new Vector3(0, rackLoc, 0));

                    int dir = 1;
                    if (CurrentTask.Source.Side() != CurrentTask.Destination.Side())
                    {
                        dir = -1;
                    }
                    shuttleAP.ActiveLoad.Translate(() => ArrivedAtDest(shuttleAP.ActiveLoad), transferVector * dir, timeToTransfer);
                }
            }
        }