Exemple #1
0
        void theMultishuttle_OnArrivedAtOutfeedRackConvPosB(object sender, RackConveyorArrivalEventArgs e)
        {
            DCICaseData caseData = e._caseLoad.Case_Data as DCICaseData;

            //If destination is a drop station ("D") there will be no new StartTransportTelegram so continue and create a elevator task
            if (BaseDCIController.GetLocFields(caseData.Destination, PSDSRackLocFields.ConvType) == "D")
            {
                if (e._elevator.CurrentTask == null || (e._elevator.CurrentTask != null && !e._elevator.CurrentTask.RelevantElevatorTask(e._caseLoad)))
                {
                    string level = BaseDCIController.GetPSDSLocFields(caseData.Destination, PSDSRackLocFields.Level);

                    // create an elevator task
                    string aisle = e._locationName.AisleNumber().ToString().PadLeft(2, '0');
                    char   side  = (char)ExtensionMethods.Side(e._locationName);

                    ElevatorTask et = new ElevatorTask(null, e._caseLoad.Identification)
                    {
                        SourceLoadB      = e._locationName,
                        DestinationLoadB = string.Format("{0}{1}{2}{3}A", aisle, side, level, (char)ConveyorTypes.Drop), // aasyyxz: a=aisle, s = side, yy = level, x = input or output, Z = loc A or B e.g. 01R05OA
                        DropIndexLoadB   = caseData.DropIndex,
                        LoadCycle        = Cycle.Single,
                        UnloadCycle      = Cycle.Single,
                        Flow             = TaskType.Outfeed
                    };

                    string elevatorName = string.Format("{0}{1}", side, aisle);
                    theMultishuttle.elevators.First(x => x.ElevatorName == elevatorName).ElevatorTasks.Add(et);
                }
            }
        }
Exemple #2
0
        void theMultishuttle_OnArrivedAtRackLocation(object sender, TaskEventArgs e)
        {
            Case_Load   caseLoad = (Case_Load)e._load;
            DCICaseData caseData = caseLoad.Case_Data as DCICaseData;

            string sendTelegram = controller.CreateTelegramFromLoad(TelegramTypes.TUReport, caseLoad);

            sendTelegram = sendTelegram.SetFieldValue(controller, TelegramFields.Current, caseData.Destination);
            sendTelegram = sendTelegram.SetFieldValue(controller, TelegramFields.EventCode, caseData.EventCode);
            controller.SendTelegram(sendTelegram);
        }
Exemple #3
0
        void theMultishuttle_OnArrivedAtInfeedRackConvPosB(object sender, RackConveyorArrivalEventArgs e)
        {
            ShuttleTask st          = new ShuttleTask();
            DCICaseData caseData    = e._caseLoad.Case_Data as DCICaseData;
            string      destination = caseData.Destination;

            if (destination.LocationType() == LocationTypes.RackConvIn)
            {
                Case_Load atcLoad = e._caseLoad as Case_Load;
                caseData.Current = caseData.Destination;
                string sendTelegram = controller.CreateTelegramFromLoad(TelegramTypes.TUReport, atcLoad);
                controller.SendTelegram(sendTelegram);
                return;
            }

            if (destination.LocationType() == LocationTypes.DropStation)
            {
                //Need to create a RI to RO task to the shuttle
                int level;
                if (!int.TryParse(e._locationName.Substring(3, 2), out level))
                {
                    Log.Write(string.Format("Multishuttle Control {0} Error: Error arriving at infeed rack conveyor when trying to find level", ParentAssembly.Name));
                    return; //Error!
                }

                st.Destination = MHEController_Multishuttle.DCILocToMultiShuttleConvLoc(level, destination);
                st.Level       = level;
                st.LoadID      = e._caseLoad.Identification;
                st.Source      = e._locationName;

                theMultishuttle.shuttlecars[level].ShuttleTasks.Add(st);
            }
            else if (destination.LocationType() != LocationTypes.BinLocation)
            {
                Log.Write("WARNING: Arrived at infeed rack and destination is NOT a binlocation.", Color.Red);
                return;
            }
            else
            {
                int level;
                st.Destination = controller.DCIbinLocToMultiShuttleLoc(destination, out level, theMultishuttle);
                st.Level       = level;
                st.LoadID      = e._caseLoad.Identification;
                st.Source      = e._locationName;

                theMultishuttle.shuttlecars[level].ShuttleTasks.Add(st);
            }
        }
Exemple #4
0
        void theMultishuttle_OnArrivedAtDropStationConvPosA(object sender, PickDropStationArrivalEventArgs e)
        {
            DCICaseData caseData = e._caseLoad.Case_Data as DCICaseData;

            caseData.Current     = caseData.Destination;
            e._caseLoad.UserData = null;

            string sendMessage;

            sendMessage = controller.CreateTelegramFromLoad(TelegramTypes.TUReport, e._caseLoad);
            controller.SendTelegram(sendMessage);

            if (e._elevator.CurrentTask != null && e._elevator.CurrentTask.RelevantElevatorTask(e._caseLoad))
            {
                e._elevator.SetNewElevatorTask();
            }
        }
Exemple #5
0
        void theMultishuttle_OnArrivedAtPickStationConvPosA(object sender, PickDropStationArrivalEventArgs e)
        {
            Case_Load   caseLoad = e._caseLoad;
            DCICaseData caseData = new DCICaseData();

            caseData.Length = caseLoad.Length;
            caseData.Width  = caseLoad.Width;
            caseData.Height = caseLoad.Height;
            caseData.Weight = caseLoad.Weight;

            //DCICaseData caseData = caseLoad.Case_Data as DCICaseData;
            caseLoad.Case_Data   = caseData;
            caseData.Current     = FormatPickDropLocation(e._locationName, ConveyorTypes.Pick); //Update the location
            caseData.Destination = caseData.Current;
            caseData.Source      = caseData.Current;
            caseData.TUType      = tuType;

            string telegram = controller.CreateTelegramFromLoad(TelegramTypes.TUDataRequest, caseLoad);

            telegram.SetFieldValue(controller, TelegramFields.EventCode, "OK");
            caseLoad.UserData = telegram;//string.Join(",", tlgSplit); //putting it in user data alows easer message creation for the ATC multipal messages , the load reference is held on the conveyor see below

            var loc  = theMultishuttle.ConveyorLocations.Find(x => x.LocName == e._locationName);
            var conv = loc.Parent.Parent.Parent as PickStationConveyor;

            if (e._numberOfLoads == 2)
            {
                string[] bodies = new string[2];
                bodies[0] = (string)((Case_Load)conv.UserData).UserData; //Grab the already created message from the load using the conveyor load reference created below
                bodies[1] = (string)(caseLoad.UserData);

                string sendTelegram = controller.Template.GroupTelegrams(controller, TelegramTypes.TUDataRequest, bodies, true);


                controller.SendTelegram(sendTelegram);
            }
            else //save the load reference so that if a second load arrives multipal telegram construction is easier
            {
                conv.UserData = caseLoad; //save case load to userdata for easier multipal message creation i.e. when e._numberOfLoads == 2
            }
        }
Exemple #6
0
        void theMultishuttle_OnArrivedAtOutfeedRackConvPosA(object sender, RackConveyorArrivalEventArgs e)
        {
            DCICaseData caseData = e._caseLoad.Case_Data as DCICaseData;

            caseData.Current = FormatRackConvLocation(e._locationName, ConveyorTypes.OutfeedRack); //Update the location

            if (BaseDCIController.GetLocFields(caseData.Destination, PSDSRackLocFields.ConvType) == "D")
            {
                string sendMessage = controller.CreateTelegramFromLoad(TelegramTypes.TUNotification, e._caseLoad);
                controller.SendTelegram(sendMessage); //Always Send a notification at location A

                //Combine a task with an existing task but only if the final destination is a drop station because if destination is the rack conveyor then we need to wait for another message from the WMS
                if (e._elevator.CurrentTask != null && e._rackConveyor.LocationB.Active && !e._elevator.CurrentTask.RelevantElevatorTask(e._rackConveyor.LocationB.ActiveLoad))
                {
                    string aisle     = e._elevator.AisleNumber.ToString().PadLeft(2, '0');
                    string level     = BaseDCIController.GetLocFields(caseData.Destination, PSDSRackLocFields.Level);
                    string destLoadA = string.Format("{0}{1}{2}{3}A", aisle, (char)ExtensionMethods.Side(e._locationName), level, (char)ConveyorTypes.Drop);

                    //Create the task but do not add it to elevator tasks list
                    ElevatorTask et = new ElevatorTask(e._caseLoad.Identification, null)
                    {
                        SourceLoadA          = e._locationName,
                        DestinationLoadA     = destLoadA,
                        SourceLoadAConv      = theMultishuttle.GetConveyorFromLocName(e._locationName),
                        DestinationLoadAConv = theMultishuttle.GetConveyorFromLocName(destLoadA),
                        Elevator             = e._elevator
                    };

                    //This task should just be added and not combined as the combining is now done later
                    //TODO: Make it so that direct outfeed loads still work
                    et.CreateNewDoubleLoadCycleTask(et, e._rackConveyor.LocationB.ActiveLoad.Identification);
                }
            }
            else
            {
                string sendMessage = controller.CreateTelegramFromLoad(TelegramTypes.TUReport, e._caseLoad);
                controller.SendTelegram(sendMessage); //Always Send a notification at location A
            }
        }
Exemple #7
0
        void theMultishuttle_OnArrivedAtShuttle(object sender, TaskEventArgs e)
        {
            Case_Load   caseLoad = (Case_Load)e._load;
            DCICaseData caseData = caseLoad.Case_Data as DCICaseData;

            string aisle = BaseDCIController.GetBinLocField(caseData.Source, BinLocFields.Aisle);

            if (aisle == "" && ((ShuttleTask)e._task).Source.Length > 2) //If you cannot get the aisle from the bin location, then get from the task instead
            {
                string checkAisle = ((ShuttleTask)e._task).Source.Substring(0, 2);
                int    result;
                if (int.TryParse(checkAisle, out result))
                {
                    aisle = checkAisle;
                }
            }

            caseData.Current = string.Format("MSAI{0}LV{1}SH01", aisle, ((ShuttleTask)e._task).Level.ToString().PadLeft(2, '0'));

            string sendMessage = controller.CreateTelegramFromLoad(TelegramTypes.TUNotification, caseLoad);

            controller.SendTelegram(sendMessage);
        }
Exemple #8
0
        private void LoadAtRackConv(string telegram, Case_Load caseLoad)
        {
            if (telegram.GetFieldValue(this, TelegramFields.Destination).LocationType() == LocationTypes.DropStation)
            {
                DCICaseData caseData = caseLoad.Case_Data as DCICaseData;

                string currentLevel = GetRackLocFields(caseData.Current, PSDSRackLocFields.Level);
                string destLevel    = GetPSDSLocFields(caseData.Destination, PSDSRackLocFields.Level);
                string aisle        = GetRackLocFields(caseData.Current, PSDSRackLocFields.Aisle);
                string side         = GetRackLocFields(caseData.Current, PSDSRackLocFields.Side);

                //Set somedata on the load
                caseData.Current     = telegram.GetFieldValue(this, TelegramFields.Current);
                caseData.Destination = telegram.GetFieldValue(this, TelegramFields.Destination);

                int dropIndex = 0;
                if (int.TryParse(telegram.GetFieldValue(this, TelegramFields.DropIndex), out dropIndex))
                {
                    caseData.DropIndex = dropIndex;
                }

                ElevatorTask et = new ElevatorTask(null, caseLoad.Identification)
                {
                    SourceLoadB      = string.Format("{0}{1}{2}{3}B", aisle, side, currentLevel, (char)ConveyorTypes.OutfeedRack),
                    DestinationLoadB = string.Format("{0}{1}{2}{3}A", aisle, side, destLevel, (char)ConveyorTypes.Drop), // aasyyxz: a=aisle, s = side, yy = level, x = input or output, Z = loc A or B e.g. 01R05OA
                    DropIndexLoadB   = dropIndex,
                    LoadCycle        = Cycle.Single,
                    UnloadCycle      = Cycle.Single,
                    Flow             = TaskType.Outfeed
                };

                string       elevatorName = string.Format("{0}{1}", side, aisle);
                MultiShuttle ms           = GetMultishuttleFromAisleNum(aisle);
                Elevator     elevator     = ms.elevators.First(x => x.ElevatorName == elevatorName);
                elevator.ElevatorTasks.Add(et);
            }
            else if (telegram.GetFieldValue(this, TelegramFields.Destination).LocationType() == LocationTypes.RackConvIn) //This will only work for drive through!
            {
                DCICaseData caseData = caseLoad.Case_Data as DCICaseData;

                string currentLevel = GetRackLocFields(caseData.Current, PSDSRackLocFields.Level);
                string destLevel    = GetRackLocFields(caseData.Destination, PSDSRackLocFields.Level);
                string aisle        = GetRackLocFields(caseData.Current, PSDSRackLocFields.Aisle);
                string side         = GetRackLocFields(caseData.Current, PSDSRackLocFields.Side);

                //Set somedata on the load
                caseData.Current     = telegram.GetFieldValue(this, TelegramFields.Current);
                caseData.Destination = telegram.GetFieldValue(this, TelegramFields.Destination);

                int dropIndex = 0;
                if (int.TryParse(telegram.GetFieldValue(this, TelegramFields.DropIndex), out dropIndex))
                {
                    caseData.DropIndex = dropIndex;
                }

                ElevatorTask et = new ElevatorTask(null, caseLoad.Identification)
                {
                    SourceLoadB      = string.Format("{0}{1}{2}{3}B", aisle, side, currentLevel, (char)ConveyorTypes.OutfeedRack),
                    DestinationLoadB = string.Format("{0}{1}{2}{3}A", aisle, side, destLevel, (char)ConveyorTypes.InfeedRack), // aasyyxz: a=aisle, s = side, yy = level, x = input or output, Z = loc A or B e.g. 01R05OA
                    DropIndexLoadB   = dropIndex,
                    LoadCycle        = Cycle.Single,
                    UnloadCycle      = Cycle.Single,
                    Flow             = TaskType.HouseKeep
                };

                string       elevatorName = string.Format("{0}{1}", side, aisle);
                MultiShuttle ms           = GetMultishuttleFromAisleNum(aisle);
                Elevator     elevator     = ms.elevators.First(x => x.ElevatorName == elevatorName);
                elevator.ElevatorTasks.Add(et);
            }
        }
Exemple #9
0
        private void TUMissionSingleBlock(string telegram)
        {
            try
            {
                if (Core.Environment.InvokeRequired)
                {
                    Core.Environment.Invoke(() => TUMissionSingleBlock(telegram));
                    return;
                }

                //Look for the load somewhere in the model, if the load is found then change it's status, if not create it at the current location
                Case_Load caseLoad = Case_Load.GetCaseFromIdentification(telegram.GetFieldValue(this, TelegramFields.TUIdent));

                if (caseLoad != null)
                {
                    DCICaseData caseData = caseLoad.Case_Data as DCICaseData;
                    UpDateLoadParameters(telegram, caseLoad);

                    if (telegram.GetFieldValue(this, TelegramFields.Current).LocationType() == LocationTypes.PickStation)
                    {
                        //Check how many loads are at the pickstation, first i need to find the pick station

                        string currentLoc = telegram.GetFieldValue(this, TelegramFields.Current);
                        string destLoc    = telegram.GetFieldValue(this, TelegramFields.Destination);
                        string aisle      = GetPSDSLocFields(currentLoc, PSDSRackLocFields.Aisle);
                        string side       = GetPSDSLocFields(currentLoc, PSDSRackLocFields.Side);
                        string psLevel    = GetPSDSLocFields(currentLoc, PSDSRackLocFields.Level);

                        string psA = string.Format("{0}{1}{2}{3}A", aisle, side, psLevel, GetPSDSLocFields(currentLoc, PSDSRackLocFields.ConvType));
                        string psB = string.Format("{0}{1}{2}{3}B", aisle, side, psLevel, GetPSDSLocFields(currentLoc, PSDSRackLocFields.ConvType));

                        MultiShuttle        ms     = GetMultishuttleFromAisleNum(psA);
                        PickStationConveyor psConv = ms.PickStationConveyors.Find(x => x.Name == string.Format("{0}{1}PS{2}", aisle, side, psLevel));

                        //Check how many loads are on the pickstation if there is only 1 then send a single mission
                        if (psConv.LocationA.Active && psConv.LocationB.Active)
                        {
                            Case_Load caseA = psConv.LocationA.ActiveLoad as Case_Load;
                            Case_Load caseB = psConv.LocationB.ActiveLoad as Case_Load;

                            DCICaseData caseDataA = caseA.Case_Data as DCICaseData;
                            DCICaseData caseDataB = caseB.Case_Data as DCICaseData;

                            //This is a double move to the elevator so don't send a single
                            if (caseB.Identification == telegram.GetFieldValue(this, TelegramFields.TUIdent)) //LocationB just set the destination
                            {
                                UpDateLoadParameters(telegram, caseB);
                                return;
                            }
                            else if (caseA.Identification == telegram.GetFieldValue(this, TelegramFields.TUIdent)) //LocationA Should be the second message so create the elevator task
                            {
                                UpDateLoadParameters(telegram, caseA);

                                string DestLoadA, DestLoadB;

                                if (caseDataA.Destination.LocationType() == LocationTypes.DropStation && GetPSDSLocFields(caseDataA.Destination, PSDSRackLocFields.Side) != side)
                                {
                                    //First check if the destination is to a drop station... check if the drop station is on this elevator
                                    //If not choose a destination to level 1 and remember the load route
                                    DestLoadA = string.Format("{0}{1}{2}{3}B",
                                                              GetPSDSLocFields(caseDataA.Current, PSDSRackLocFields.Aisle),
                                                              GetPSDSLocFields(caseDataA.Current, PSDSRackLocFields.Side),
                                                              FindLevelForReject(ms),
                                                              "I");
                                }
                                else
                                {
                                    DestLoadA = string.Format("{0}{1}{2}{3}B",
                                                              aisle,
                                                              side,
                                                              //GetLocFields(caseDataA.Destination, PSDSRackLocFields.Level),
                                                              //GetLocFields(caseDataA.Destination, PSDSRackLocFields.ConvType));
                                                              GetLocFields(caseDataA.Destination, PSDSRackLocFields.Level) != "" ? GetLocFields(caseDataA.Destination, PSDSRackLocFields.Level) : GetBinLocField(caseDataA.Destination, BinLocFields.YLoc),
                                                              GetLocFields(caseDataA.Destination, PSDSRackLocFields.ConvType) != "" ? GetLocFields(caseDataA.Destination, PSDSRackLocFields.ConvType) : "I");
                                }

                                if (caseDataB.Destination.LocationType() == LocationTypes.DropStation && GetPSDSLocFields(caseDataB.Destination, PSDSRackLocFields.Side) != side)
                                {
                                    //First check if the destination is to a drop station... check if the drop station is on this elevator
                                    //If not choose a destination to level 1 and remember the load route
                                    DestLoadB = string.Format("{0}{1}{2}{3}B",
                                                              GetPSDSLocFields(caseDataB.Current, PSDSRackLocFields.Aisle),
                                                              GetPSDSLocFields(caseDataB.Current, PSDSRackLocFields.Side),
                                                              FindLevelForReject(ms),
                                                              "I");
                                }
                                else
                                {
                                    DestLoadB = string.Format("{0}{1}{2}{3}B",
                                                              aisle,
                                                              side,
                                                              GetLocFields(caseDataB.Destination, PSDSRackLocFields.Level) != "" ? GetLocFields(caseDataB.Destination, PSDSRackLocFields.Level) : GetBinLocField(caseDataB.Destination, BinLocFields.YLoc),
                                                              GetLocFields(caseDataB.Destination, PSDSRackLocFields.ConvType) != "" ? GetLocFields(caseDataB.Destination, PSDSRackLocFields.ConvType) : "I");
                                }

                                ElevatorTask et = new ElevatorTask(caseA.Identification, caseB.Identification)
                                {
                                    LoadCycle        = Cycle.Double,
                                    Flow             = TaskType.Infeed,
                                    SourceLoadA      = psA,
                                    SourceLoadB      = psB,
                                    DestinationLoadA = DestLoadA,
                                    DestinationLoadB = DestLoadB,
                                    UnloadCycle      = Cycle.Single
                                };
                                if (et.DestinationLoadA == et.DestinationLoadB)
                                {
                                    et.UnloadCycle = Cycle.Double;
                                }

                                ms.elevators.First(x => x.ElevatorName == side + aisle).ElevatorTasks.Add(et);
                            }
                            else
                            {
                                Log.Write(string.Format("Error {0}: None of the tuIdents match any of the loads at the PS on StartTransportTelegram"), Color.Orange);
                            }
                        }
                        else
                        {
                            SingleLoadAtPS(telegram, caseLoad);
                        }
                    }
                    else if (telegram.GetFieldValue(this, TelegramFields.Current).LocationType() == LocationTypes.RackConvOut)
                    {
                        LoadAtRackConv(telegram, caseLoad);
                    }
                    else if (telegram.GetFieldValue(this, TelegramFields.Current).LocationType() == LocationTypes.RackConvIn &&
                             caseData.Current == telegram.GetFieldValue(this, TelegramFields.Current)) //Mission for load at Infeed Rack conveyor
                    {
                        ShuttleTask st          = new ShuttleTask();
                        string      destination = caseData.Destination;


                        if (destination.LocationType() != LocationTypes.BinLocation)
                        {
                            Log.Write("WARNING: Arrived at infeed rack and destination is NOT a binlocation.", Color.Red);
                            return;
                        }

                        string current  = telegram.GetFieldValue(this, TelegramFields.Current);
                        string aisle    = GetRackLocFields(current, PSDSRackLocFields.Aisle);
                        string side     = GetRackLocFields(current, PSDSRackLocFields.Side);
                        string location = string.Format("{0}{1}{2}IB", aisle, side, GetRackLocFields(current, PSDSRackLocFields.Level));

                        MultiShuttle ms = GetMultishuttleFromAisleNum(location);

                        int level;
                        st.Destination = DCIbinLocToMultiShuttleLoc(destination, out level, ms);
                        st.Level       = level;
                        st.LoadID      = caseLoad.Identification;
                        st.Source      = location;

                        ms.shuttlecars[level].ShuttleTasks.Add(st);
                    }
                    else
                    {
                        Log.Write(string.Format("{0}: MultishuttleStartTransportTelegram received but the load was found elsewhere in the model ({1}) message ignored", Name, caseData.Current), Color.Red);
                    }
                }
                //Anything FROM a binloc will not have a load until the shuttle gets to the bin location at this point it will be created.
                else if (telegram.GetFieldValue(this, TelegramFields.Current).LocationType() == LocationTypes.BinLocation)
                {
                    CreateShuttleTask(telegram);
                }
                else if (telegram.GetFieldValue(this, TelegramFields.Current).LocationType() == LocationTypes.BinLocation &&
                         telegram.GetFieldValue(this, TelegramFields.Destination).LocationType() == LocationTypes.DropStation) //It's a shuffle move
                {
                    SingleLoadOut(telegram);
                }
                else
                {
                    Log.Write("Error: Load not found in StartTransportTelegramReceived", Color.Red);
                }
            }
            catch (Exception ex)
            {
                Log.Write(ex.ToString());
                if (ex.InnerException != null)
                {
                    Log.Write(ex.InnerException.ToString());
                }
            }
        }