예제 #1
0
        void miniloadPickStation_OnPickStationStatusUpdate(object sender, PickStationStatusUpdateEventArgs e)
        {
            string load1 = e._LoadPosOutside == null ? "Empty" : e._LoadPosOutside.Identification;
            string load2 = e._LoadPosInside == null ? "Empty" : e._LoadPosInside.Identification;

            if (e._LoadPosOutside != null && e._LoadPosInside != null)
            {
                string telegram1 = casePLC.CreateTelegramFromLoad(TelegramTypes.TransportFinishedTelegram, (ATCCaseLoad)e._LoadPosOutside);
                string telegram2 = casePLC.CreateTelegramFromLoad(TelegramTypes.TransportFinishedTelegram, (ATCCaseLoad)e._LoadPosInside);
                telegram1 = telegram1.SetFieldValue(TelegramFields.location, OutsidePSName);
                telegram2 = telegram2.SetFieldValue(TelegramFields.location, InsidePSName);
                telegram1 = telegram1.SetFieldValue(TelegramFields.stateCode, ((ATCCaseLoad)e._LoadPosOutside).PresetStateCode);
                telegram2 = telegram2.SetFieldValue(TelegramFields.stateCode, ((ATCCaseLoad)e._LoadPosInside).PresetStateCode);

                string telegram = Telegrams.CreateMultipalMessage(new List <string>()
                {
                    telegram1, telegram2
                }, TelegramTypes.MultipleTransportFinishedTelegram, casePLC.Name);
                casePLC.SendTelegram(telegram, true);
            }
            else
            {
                //string telegram = casePLC.CreateTelegramFromLoad(TelegramTypes.TransportFinishedTelegram, (ATCCaseLoad)e._LoadPosOutside);
                //telegram = telegram.SetFieldValue(TelegramFields.location, OutsidePSName);
                //telegram = telegram.SetFieldValue(TelegramFields.stateCode, ((ATCCaseLoad)e._LoadPosOutside).PresetStateCode);
                //casePLC.SendTelegram(telegram, true);

                string telegram = casePLC.CreateTelegramFromLoad(TelegramTypes.TransportFinishedTelegram, (ATCCaseLoad)e._LoadPosInside);
                telegram = telegram.SetFieldValue(TelegramFields.location, InsidePSName);
                telegram = telegram.SetFieldValue(TelegramFields.stateCode, ((ATCCaseLoad)e._LoadPosInside).PresetStateCode);
                casePLC.SendTelegram(telegram, true);
            }
        }
예제 #2
0
        public void SendMultipleTransportFinishedTelegram(IATCCaseLoadType load1, IATCCaseLoadType load2)
        {
            string telegram1 = CreateTelegramFromLoad(TelegramTypes.TransportFinishedTelegram, load1);
            string telegram2 = CreateTelegramFromLoad(TelegramTypes.TransportFinishedTelegram, load2);
            string telegram  = Telegrams.CreateMultipalMessage(new List <string>()
            {
                telegram1, telegram2
            }, TelegramTypes.MultipleTransportFinishedTelegram, Name);

            SendTelegram(telegram, true);
        }
예제 #3
0
        void theMultishuttle_OnArrivedAtPickStationConvPosA(object sender, PickDropStationArrivalEventArgs e)
        {
            IATCCaseLoadType caseloadA = (IATCCaseLoadType)(e._caseLoad);

            caseloadA.Location    = FormatPickDropLocation(e._locationName, ConveyorTypes.Pick); //Update the location
            caseloadA.Destination = caseloadA.Location;

            string tlg = mheController_Multishuttle.CreateTelegramFromLoad(TelegramTypes.TransportRequestTelegram, caseloadA);

            string[] tlgSplit = tlg.Split(',');
            tlgSplit.SetFieldValue(TelegramFields.stateCode, "OK");
            caseloadA.UserData = 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)
            {
                var caseLoadB = (IATCCaseLoadType)conv.TransportSection.Route.Loads.Last.Value; //Front load
                if (caseLoadB == caseloadA)
                {
                    Core.Environment.Log.Write($"{this.theMultishuttle.Name} Error: theMultishuttle_OnArrivedAtPickStationConvPosA LoadA == LoadB!!");
                    Core.Environment.Scene.Pause();
                }

                mheController_Multishuttle.RemoveIgnoreCase(caseLoadB);

                string bodyB = (string)(caseLoadB.UserData); //Grab the already created message from the load using the load reference
                string bodyA = (string)(caseloadA.UserData);
                if (MultiPSTelegrams)
                {
                    string sendTelegram = Telegrams.CreateMultipalMessage(new List <string>()
                    {
                        bodyB, bodyA
                    },
                                                                          TelegramTypes.MultipleTransportRequestTelegram, mheController_Multishuttle.Name);
                    mheController_Multishuttle.SendTelegram(sendTelegram, true);
                }
                else
                {
                    mheController_Multishuttle.SendTelegram(bodyB, true);
                    //MRP 24-10-2018. Wait until transport telegram is received for load B. mheController_Multishuttle.SendTelegram(bodyA, true); //position A load
                }
                mheController_Multishuttle.PickStationLock(caseLoadB);
            }
        }
예제 #4
0
        void theMiniload_OnMiniloadTaskComplete(object sender, MiniloadTaskCompleteEventArgs e)
        {
            if (TaskList[0].HalfCycles[0] == e._miniloadTask) //TaskLis[0].HalfCycle[0] Should be the current task
            {
                //Need to send a message to the WMS at this point depending on the cycle
                if (e._miniloadTask.Cycle == MiniloadCycle.DropRack || e._miniloadTask.Cycle == MiniloadCycle.DropDS)
                {
                    //Log.Write(string.Format("A load has been dropped in the rack"));
                    //string[] index = new string[] {null, null};
                    int?[] index = new int?[] { null, null };
                    if (!string.IsNullOrEmpty(e._miniloadTask.TuIdentPos1))
                    {
                        index[0] = GetIndex(TaskList[0].MissionData, e._miniloadTask.TuIdentPos1);
                    }
                    if (!string.IsNullOrEmpty(e._miniloadTask.TuIdentPos2))
                    {
                        index[1] = GetIndex(TaskList[0].MissionData, e._miniloadTask.TuIdentPos2);
                    }

                    if (index[0] != null && index[1] != null) //Multiple drop to drop station
                    {
                        string blah = ((string[])TaskList[0].MissionData[(int)index[0]]).CreateTelegramFromTelegram(TelegramTypes.TransportFinishedTelegram, true);


                        List <string> telegrams = new List <string> {
                            ((string[])TaskList[0].MissionData[(int)index[0]]).CreateTelegramFromTelegram(TelegramTypes.TransportFinishedTelegram, true),
                            ((string[])TaskList[0].MissionData[(int)index[1]]).CreateTelegramFromTelegram(TelegramTypes.TransportFinishedTelegram, true)
                        };

                        for (int i = 0; i < 2; i++)
                        {
                            telegrams[i] = telegrams[i].SetFieldValue(TelegramFields.source, ((string[])TaskList[0].MissionData[(int)index[i]]).GetFieldValue(TelegramFields.source));
                            telegrams[i] = telegrams[i].SetFieldValue(TelegramFields.location, ((string[])TaskList[0].MissionData[(int)index[i]]).GetFieldValue(TelegramFields.destination));
                            telegrams[i] = telegrams[i].SetFieldValue(TelegramFields.stateCode, ((string[])TaskList[0].MissionData[(int)index[i]]).GetFieldValue(TelegramFields.presetStateCode));
                        }

                        string telegram = Telegrams.CreateMultipalMessage(telegrams, TelegramTypes.MultipleTransportFinishedTelegram, controller.Name);
                        //telegram = telegram.SetFieldValue(TelegramFields.mts, controller.Name);
                        controller.SendTelegram(telegram, true);
                    }
                    else if (index[0] != null || index[1] != null) //Single drop from multiple pick
                    {
                        foreach (int?dex in index)                 //Double loads being dropped
                        {
                            if (dex != null)
                            {
                                string telegram = ((string[])TaskList[0].MissionData[(int)dex]).CreateTelegramFromTelegram(TelegramTypes.TransportFinishedTelegram, true);
                                telegram = telegram.SetFieldValue(TelegramFields.mts, controller.Name);
                                telegram = telegram.SetFieldValue(TelegramFields.source, ((string[])TaskList[0].MissionData[(int)dex]).GetFieldValue(TelegramFields.source));
                                telegram = telegram.SetFieldValue(TelegramFields.location, ((string[])TaskList[0].MissionData[(int)dex]).GetFieldValue(TelegramFields.destination));
                                telegram = telegram.SetFieldValue(TelegramFields.stateCode, ((string[])TaskList[0].MissionData[(int)dex]).GetFieldValue(TelegramFields.presetStateCode)); //May need to be changed when dealing with exceptions
                                controller.SendTelegram(telegram, true);
                            }
                        }
                    }
                    else //Single load being droppped from single pick
                    {
                        string telegram = ((string[])TaskList[0].MissionData[0]).CreateTelegramFromTelegram(TelegramTypes.TransportFinishedTelegram, true);
                        telegram = telegram.SetFieldValue(TelegramFields.mts, controller.Name);
                        telegram = telegram.SetFieldValue(TelegramFields.source, ((string[])TaskList[0].MissionData[0]).GetFieldValue(TelegramFields.source));
                        telegram = telegram.SetFieldValue(TelegramFields.location, ((string[])TaskList[0].MissionData[0]).GetFieldValue(TelegramFields.destination));
                        telegram = telegram.SetFieldValue(TelegramFields.stateCode, ((string[])TaskList[0].MissionData[0]).GetFieldValue(TelegramFields.presetStateCode)); //May need to be changed when dealing with exception
                        controller.SendTelegram(telegram, true);
                    }
                }
                else if ((e._miniloadTask.Cycle == MiniloadCycle.PickPS && SendPSArrival) || e._miniloadTask.Cycle == MiniloadCycle.PickRack)
                {
                    //Log.Write(string.Format("A load or loads have been picked from the Pick Station"));
                    if (!string.IsNullOrEmpty(e._miniloadTask.TuIdentPos1))
                    {
                        string telegram = ((string[])TaskList[0].MissionData[(int)GetIndex(TaskList[0].MissionData, e._miniloadTask.TuIdentPos1)]).CreateTelegramFromTelegram(TelegramTypes.LocationArrivedTelegram, true);
                        telegram = telegram.SetFieldValue(TelegramFields.location, string.Format("{0}11", LHDName));
                        telegram = telegram.SetFieldValue(TelegramFields.mts, controller.Name);
                        controller.SendTelegram(telegram, true);
                    }
                    if (!string.IsNullOrEmpty(e._miniloadTask.TuIdentPos2))
                    {
                        string telegram = ((string[])TaskList[0].MissionData[(int)GetIndex(TaskList[0].MissionData, e._miniloadTask.TuIdentPos2)]).CreateTelegramFromTelegram(TelegramTypes.LocationArrivedTelegram, true);
                        telegram = telegram.SetFieldValue(TelegramFields.location, string.Format("{0}12", LHDName));
                        telegram = telegram.SetFieldValue(TelegramFields.mts, controller.Name);
                        controller.SendTelegram(telegram, true);
                    }
                }

                TaskList[0].HalfCycles.RemoveAt(0);
                if (TaskList[0].HalfCycles.Count == 0) //All half cycles for this task are complete
                {
                    TaskList.RemoveAt(0);
                    StartNewTask();
                }
                else //Or just send the next half cycle to the miniload
                {
                    theMiniload.StartMiniloadHalfCycle(TaskList[0].HalfCycles[0]);
                }

                StartNewTask();
            }
            else
            {
                Log.Write(string.Format("Miniload {0}: Cycle error controller and Miniload tasks are not aligned", theMiniload.Name));
            }
        }