Пример #1
0
 public RackConveyorArrivalEventArgs(string locationName, Case_Load caseLoad, Elevator elevator, RackConveyor rackConveyor, Cycle?unloadcycle)
 {
     _locationName = locationName;
     _caseLoad     = caseLoad;
     _elevator     = elevator;
     _rackConveyor = rackConveyor;
     _UnloadCycle  = unloadcycle;
 }
Пример #2
0
        internal void MoveShuttle(float position)
        {
            if (CurrentTask.Source.ConvType() == ConveyorTypes.InfeedRack)
            {
                RackConveyor sourceConv = ParentMultiShuttle.GetConveyorFromLocName(CurrentTask.Source) as RackConveyor;

                if (CurrentTask.Level == Level && sourceConv != null && (shuttleAP.Active || (!shuttleAP.Active && (sourceConv.LocationB.Active && sourceConv.LocationB.ActiveLoad.Identification == CurrentTask.LoadID))))
                {
                    //continue....temp debug code!
                }
                else
                {
                    Log.Write("Error in CurrentTask removing current task", Color.Red);
                    CurrentTask = null;
                    return;
                }
            }

            float currentDistance = trackRail.Destination.Distance;

            if (trackRail.Destination.Distance != position)
            {
                trackRail.Destination.Distance = position;

                if (trackRail.Destination.Distance < currentDistance)
                {
                    trackRail.Route.Motor.Backward();
                }
                else if (trackRail.Destination.Distance > currentDistance)
                {
                    trackRail.Route.Motor.Forward();
                }
                trackRail.Route.Motor.Start();
                trackRail.ShuttleCar.Release();
            }
            else //no need to move as already at the correct location
            {
                ShuttleOnArrived();
            }
        }
Пример #3
0
        private void ElevatorOnArrived(object sender, EventArgs e)
        {
            if (CurrentTask == null)
            {
                //Log.Write("Elevator arrived with a null current task");
                return;
            }

            ElevatorConveyor.Route.NextRoute = null;
            ElevatorConveyor.Route.LastRoute = null;

            if (OnElevatorArrived != null)
            {
                OnElevatorArrived(this, new EventArgs());
            }

            if (CurrentTask.Flow == TaskType.Infeed || CurrentTask.Flow == TaskType.HouseKeep)
            {
                if (ElevatorConveyor.Route.Loads.Count == 0) //Arrived at the pickstation so release whatever is waiting for the elevator to arrive
                {
                    Load loadASpecial = null, loadBSpecial = null;

                    var A = ParentMultiShuttle.ConveyorLocations.Find(x => x.LocName == CurrentTask.SourceLoadA);
                    if (A != null)
                    {
                        loadASpecial = A.ActiveLoad;
                    }

                    var B = ParentMultiShuttle.ConveyorLocations.Find(x => x.LocName == CurrentTask.SourceLoadB);
                    if (B != null)
                    {
                        loadBSpecial = B.ActiveLoad;
                    }

                    if (loadASpecial != null)
                    {
                        loadASpecial.Release();
                    }

                    if (loadBSpecial != null)
                    {
                        loadBSpecial.Release();
                    }

                    if (B != null && B.Parent.Parent.Parent is PickStationConveyor ps)
                    {
                        int pickCount = 1;
                        if (loadASpecial != null)
                        {
                            pickCount = 2;
                        }

                        if (ps.TransportSection.Route.Loads.Count > 1 && pickCount == 1)
                        {
                            //Pick station has two totes but elevator should only pick 1.
                            ps.ElevatorPickOneOfTwo = true;
                            Log.Write($"{ParentMultiShuttle.Name}, {ElevatorName}: Two loads at PS but elevator will just pick 1.");
                        }
                    }
                }
                else if (CurrentTask.UnloadCycle == Cycle.Single)
                {
                    ElevatorConveyor.LocationB.Release();
                    //  Load.Get(CurrentTask.LoadB_ID).Release();
                }
                else if (CurrentTask.LoadCycle == Cycle.Double)
                {
                    //Arrived at a double dropoff infeed rack conveyor so release both elevator loc
                    ElevatorConveyor.LocationB.Release();
                    ElevatorConveyor.LocationA.Release();
                    ElevatorConveyor.LocationB.Enabled = false;
                }
            }
            else if (CurrentTask.Flow == TaskType.Outfeed)
            {
                if (ElevatorConveyor.UnLoading) //outfeed and unloading so have arrived at a DS
                {
                    if (CurrentTask.DestinationLoadBConv != null && CurrentTask.DestinationLoadBConv.ThisRouteStatus.Available != RouteStatuses.Available)
                    {
                        CurrentTask.DestinationLoadBConv.ThisRouteStatus.OnRouteStatusChanged += ThisRouteStatus_OnRouteStatusChanged;
                        return;
                    }

                    ElevatorConveyor.LocationB.Release();
                    ElevatorConveyor.LocationA.Release();

                    if (CurrentTask.UnloadCycle == Cycle.Double || CurrentTask.NumberOfLoadsInTask == 1)
                    {
                        ElevatorConveyor.LocationB.Enabled = false; // if only 1 load in task don't care about this but doesn't do any harm
                        ElevatorConveyor.UnLoading         = false;
                    }
                }
                else if (!ElevatorConveyor.UnLoading) // still loading the elevator
                {
                    RackConveyor rc = moveToConvLevel as RackConveyor;
                    if (rc == null)
                    {
                        Log.Write("Offloading at DS but elevator thinks it is at a rack conv.", Color.Red);
                    }
                    else
                    {
                        //MRP Auchan 11-10-2018. Cancel task if front load ID does not match task ID.
                        //Maybe this is not needed because I also changed how tasks are started. (Only start sequenced task if the load id match - unsequenced already did this).
                        if (rc.LocationB.Active)
                        {
                            //Check if we have the right ID.
                            if (!CurrentTask.RelevantElevatorTask(rc.LocationB.ActiveLoad))
                            {
                                Log.Write(string.Format($"Load at front rack conveyor is not relevant for this task! ({rc.LocationB.ActiveLoad.Identification}) Aisle {ParentMultiShuttle.Name} Elevator {ElevatorName}. Elevator task - {CurrentTask}."));

                                if (CurrentTask.LoadCycle == Cycle.Single && CurrentTask.UnloadCycle == Cycle.Single &&
                                    CurrentTask.NumberOfLoadsInTask == 1)
                                {
                                    //it should be ok to just cancel the task
                                    Log.Write($"Task cancelled! (task: {CurrentTask})");
                                    CurrentTask = null;
                                    SetNewElevatorTask();
                                    return;
                                }

                                if (CurrentTask.LoadCycle == Cycle.Single && CurrentTask.UnloadCycle == Cycle.Double &&
                                    CurrentTask.NumberOfLoadsInTask == 2)
                                {
                                    //We have another load on the elevator which needs to be unloaded.
                                    Log.Write($"Task modified! (task: {CurrentTask})");
                                    CurrentTask.UnloadCycle = Cycle.Single;
                                    CurrentTask.CancelLoadA();
                                    MoveElevator(CurrentTask.DestinationLoadBConv);
                                    return;
                                }

                                Log.Write($"Could not cancel or modify task. Elevator will probably fail. (task: {CurrentTask})");
                            }
                        }

                        rc.LocationB.Release();

                        if (CurrentTask.LoadCycle == Cycle.Double) // If its a double also release A as well
                        {
                            rc.LocationA.Release();
                        }
                    }
                }
            }
        }