Example #1
0
        void theMultishuttle_OnArrivedAtOutfeedRackConvPosB(object sender, RackConveyorArrivalEventArgs e)
        {
            //e._caseLoad.Stop();
            IATCCaseLoadType atcLoad = e._caseLoad as IATCCaseLoadType;

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

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

                    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   = atcLoad.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);
                }
            }
        }
Example #2
0
        public void ap_Enter(DematicCommunicationPoint sender, Load load)
        {
            IATCCaseLoadType caseLoad = load as IATCCaseLoadType;

            if (caseLoad == null)
            {
                return;
            }

            caseLoad.Location = commPoint.Name; //Update the caseload location

            switch (CommPointType)
            {
            case CommPointATCInfo.CommPointATCTypes.None: break;

            case CommPointATCInfo.CommPointATCTypes.LocationArrived: LocationArrived(CommPoint, caseLoad); break;

            case CommPointATCInfo.CommPointATCTypes.LocationLeft: LocationLeft(commPoint, caseLoad); break;

            case CommPointATCInfo.CommPointATCTypes.TransportRequest: TransportRequest(commPoint, caseLoad); break;

            case CommPointATCInfo.CommPointATCTypes.TransportFinished: TransportFinished(commPoint, caseLoad); break;

            case CommPointATCInfo.CommPointATCTypes.TransportRequestOrFinished: TransportRequestOrFinished(commPoint, caseLoad); break;

            default: break;
            }
        }
Example #3
0
        public void SendTransportRequestTelegram(IATCCaseLoadType load)
        {
            string telegram = CreateTelegramFromLoad(TelegramTypes.TransportRequestTelegram, load);

            telegram = telegram.InsertField("dropIndex", load.DropIndex.ToString().PadLeft(4, '0')); //Additional drop index added to build sequencing into ATC
            SendTelegram(telegram, true);
        }
Example #4
0
        void theMultishuttle_OnArrivedAtDropStationConvPosB(object sender, PickDropStationArrivalEventArgs e)
        {
            IATCCaseLoadType load = (IATCCaseLoadType)e._caseLoad;

            if (e._numberOfLoads == 2 && e._elevator.ElevatorConveyor.Route.Loads.Count == 0) // Double dropoff received
            {
                e._elevator.SetNewElevatorTask();
            }
        }
Example #5
0
        void theTransfer_OnTransferStatusChangedController(object sender, EventArgs e)
        {
            //ReleaseDelayTimer on transfer has timed out, or one of the next conveyors routes has become available,

            //check if there are any loads that can be released

            if (theTransfer.mergeQueue.Count > 0) //There is something waiting to transfer in
            {
                List <Side> priorityQueue = new List <Side>();
                if (theTransfer.mergeQueue.Count == 1 || LoadReleasePriority == ReleasePriority.FIFO)
                {
                    priorityQueue = theTransfer.mergeQueue.ToList();
                }
                else if (LoadReleasePriority == ReleasePriority.Left)
                {
                    priorityQueue.Add(Side.Left);
                    priorityQueue.Add(Side.Right);
                }
                else if (LoadReleasePriority == ReleasePriority.Right)
                {
                    priorityQueue.Add(Side.Right);
                    priorityQueue.Add(Side.Left);
                }

                foreach (Side side in priorityQueue)
                {
                    IATCCaseLoadType atcLoad = theTransfer.SideLoadWaitingStatus(side).WaitingLoad as IATCCaseLoadType;
                    if (atcLoad != null)
                    {
                        bool routeLoadLeft  = LeftRoutes.Contains(atcLoad.Destination) ? true : false;
                        bool routeLoadRight = RightRoutes.Contains(atcLoad.Destination) ? true : false;

                        if (routeLoadLeft && theTransfer.RouteAvailable(Side.Left))
                        {
                            //Load can travel left
                            ReleaseLoad(side, Side.Left, (Load)atcLoad);
                            return;
                        }
                        else if (routeLoadRight && theTransfer.RouteAvailable(Side.Right))
                        {
                            //Load can travel right
                            ReleaseLoad(side, Side.Right, (Load)atcLoad);
                            return;
                        }
                        else
                        {
                            return;
                        }
                    }
                    else
                    {
                        Log.Write(string.Format("Error: {0} load null un expected! theTransfer_OnTransferStatusChangedController", side.ToString()));
                        return;
                    }
                }
            }
        }
Example #6
0
 private void LocationLeft(CommunicationPoint commPoint, IATCCaseLoadType caseLoad)
 {
     if (AlwaysArrival || caseLoad.Location == caseLoad.Destination)
     {
         caseLoad.Location = commPoint.Name;
         //caseLoad.MTS = commPoint.ControllerName;
         casePLC.SendLocationLeftTelegram(caseLoad as IATCCaseLoadType);
     }
 }
Example #7
0
        /// <summary>
        /// Send a Location Left Telegram
        /// </summary>
        /// <param name="load">The load</param>
        /// <param name="weight">default null: Should Location Left Contain Weight</param>
        public void SendLocationArrivedTelegram(IATCCaseLoadType load, string weight = null)
        {
            string telegram = CreateTelegramFromLoad(TelegramTypes.LocationArrivedTelegram, load);

            if (weight != null)
            {
                telegram = telegram.InsertField("weight", weight);
            }
            SendTelegram(telegram, true);
        }
Example #8
0
        void theMultishuttle_OnArrivedAtRackLocation(object sender, TaskEventArgs e)
        {
            IATCCaseLoadType ATCload      = (IATCCaseLoadType)e._load;
            string           sendTelegram = mheController_Multishuttle.CreateTelegramFromLoad(TelegramTypes.MultishuttleTransportFinishedTelegram, ATCload);

            string[] sendTelegramSplit = sendTelegram.Split(',');
            sendTelegramSplit.SetFieldValue(TelegramFields.location, ATCload.Destination);
            sendTelegramSplit.SetFieldValue(TelegramFields.stateCode, ATCload.PresetStateCode);
            mheController_Multishuttle.SendTelegram(string.Join(",", sendTelegramSplit), true);
        }
Example #9
0
        private void SendTransportFinishedTelegram(Case_Load caseLoad, string Location, string status)
        {
            IATCCaseLoadType atcLoad = caseLoad as IATCCaseLoadType;

            atcLoad.Location = Location;
            if (status != null)
            {
                atcLoad.PresetStateCode = status;
            }
            casePLC.SendTransportFinishedTelegram(caseLoad as IATCCaseLoadType);
        }
Example #10
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);
        }
Example #11
0
        private void TransportFinished(CommunicationPoint commPoint, IATCCaseLoadType caseLoad)
        {
            if (AlwaysArrival || caseLoad.Location == caseLoad.Destination)
            {
                caseLoad.Location = commPoint.Name;
                casePLC.SendTransportFinishedTelegram(caseLoad);

                if (LoadWait)
                {
                    caseLoad.LoadWaitingForWCS = true;
                    caseLoad.Stop();
                }
            }
        }
Example #12
0
        void theMultishuttle_OnArrivedAtElevatorConvPosA(object sender, ArrivedOnElevatorEventArgs e)
        {
            if (e._loadB == null) //Only send the arrival for the load once when it arrves at position A - Do not send again if a double pick is detected (LoadB is populated)
            {
                IATCCaseLoadType load = (IATCCaseLoadType)e._loadA;
                load.Location = string.Format("MSAI{0}E{1}01LO00", e._elevator.AisleNumber.ToString().PadLeft(2, '0'), (char)e._elevator.Side);
                string sendMessage = mheController_Multishuttle.CreateTelegramFromLoad(TelegramTypes.LocationArrivedTelegram, load);
                mheController_Multishuttle.SendTelegram(sendMessage, true);

                if (((ElevatorTask)e._task).NumberOfLoadsInTask == 1 && ((ElevatorTask)e._task).Flow == TaskType.Outfeed)
                {
                    ((ElevatorTask)e._task).OptimiseTask(e._elevator);
                }
            }
        }
Example #13
0
        private void SendConfirmationTelegram(Case_Load caseLoad, string Location)
        {
            IATCCaseLoadType atcLoad = caseLoad as IATCCaseLoadType;

            atcLoad.Location = Location;
            switch (DivertMessageType)
            {
            case DivertTelegram.LocationArrived: casePLC.SendLocationArrivedTelegram(caseLoad as IATCCaseLoadType); break;

            case DivertTelegram.LocationLeft: casePLC.SendLocationLeftTelegram(caseLoad as IATCCaseLoadType); break;

            case DivertTelegram.TransportFinished: casePLC.SendTransportFinishedTelegram(caseLoad as IATCCaseLoadType); break;

            case DivertTelegram.TransportRequest: casePLC.SendTransportRequestTelegram(caseLoad as IATCCaseLoadType); break;
            }
        }
Example #14
0
        //TODO: For the loads that are stopping on the case conveyor at these communication points it
        //has to be placed in the correct position otherwise its can be an issue (I have found that placing
        //them in exactly the correct place compaired to a accumulation sensor is a good position as all atction point are triggered
        private void TransportRequest(CommunicationPoint commPoint, IATCCaseLoadType caseLoad)
        {
            if (AlwaysArrival || caseLoad.Location == caseLoad.Destination || string.IsNullOrEmpty(caseLoad.Destination))
            {
                caseLoad.Location = commPoint.Name;
                //caseLoad.MTS = commPoint.ControllerName;
                casePLC.SendTransportRequestTelegram(caseLoad);

                if (LoadWait)
                {
                    //[BG] Not happy with this, if this is used then it needs to be understood what the issues are with it
                    //(Like stopping on a belt is bad and you need to put the Comm Point in the right place on accumulation conveyor)
                    caseLoad.LoadWaitingForWCS = true;
                    caseLoad.Stop();
                }
            }
        }
Example #15
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);
            }
        }
Example #16
0
        void theMultishuttle_OnArrivedAtDropStationConvPosA(object sender, PickDropStationArrivalEventArgs e)
        {
            IATCCaseLoadType load = (IATCCaseLoadType)e._caseLoad;

            load.Location = load.Destination;
            load.UserData = null;

            string sendMessage;

            sendMessage = mheController_Multishuttle.CreateTelegramFromLoad(TelegramTypes.MultishuttleTransportFinishedTelegram, load);
            sendMessage = sendMessage.SetFieldValue(TelegramFields.dropIndex, load.DropIndex.ToString());
            mheController_Multishuttle.SendTelegram(sendMessage, true);

            if (e._elevator.CurrentTask != null && e._elevator.CurrentTask.RelevantElevatorTask(e._caseLoad))
            {
                e._elevator.SetNewElevatorTask();
            }
        }
Example #17
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
        }
Example #18
0
        void theMultishuttle_OnArrivedAtInfeedRackConvPosA(object sender, RackConveyorArrivalEventArgs e)
        {
            ShuttleTask st          = new ShuttleTask();
            string      destination = ((IATCCaseLoadType)e._caseLoad).Destination;

            if (destination.LocationType() == LocationTypes.RackConv)
            {
                IATCCaseLoadType atcLoad = e._caseLoad as IATCCaseLoadType;
                atcLoad.Location = atcLoad.Destination;
                string sendTelegram = mheController_Multishuttle.CreateTelegramFromLoad(TelegramTypes.MultishuttleTransportFinishedTelegram, atcLoad);
                mheController_Multishuttle.SendTelegram(sendTelegram, true);

                //return;
            }

            if (e._elevator.ElevatorConveyor.Route.Loads.Count == 0)
            {
                e._elevator.SetNewElevatorTask();
            }
        }
Example #19
0
        private void TransportRequestOrFinished(CommunicationPoint commPoint, IATCCaseLoadType caseLoad)
        {
            if (caseLoad.Location == caseLoad.Destination)
            {
                //Send TransportFinishedTelegram
                caseLoad.Location = commPoint.Name;
                casePLC.SendTransportFinishedTelegram(caseLoad);
            }
            else
            {
                //Send TransportRequestTelegram
                caseLoad.Location = commPoint.Name;
                casePLC.SendTransportRequestTelegram(caseLoad);
            }

            if (LoadWait)
            {
                caseLoad.LoadWaitingForWCS = true;
                caseLoad.Stop();
            }
        }
Example #20
0
        void transfer_OnArrivedAtTransferController(object sender, TransferArrivalArgs e)
        {
            IATCCaseLoadType atcLoad = e._load as IATCCaseLoadType;

            //Load has arrived at one of entry points to the transfer

            //Calculate the preferred route for the load and save
            if (!theTransfer.PreferredLoadRoutes.ContainsKey((Case_Load)e._load))
            {
                if (LeftRoutes.Contains(atcLoad.Destination))
                {
                    theTransfer.PreferredLoadRoutes.Add((Case_Load)e._load, Side.Left);
                }
                else if (RightRoutes.Contains(atcLoad.Destination))
                {
                    theTransfer.PreferredLoadRoutes.Add((Case_Load)e._load, Side.Right);
                }
            }

            //bool LoadRouted = false;
            if (!theTransfer.ReleaseDelayTimerRunning) //Timer not running can i release a load
            {
                if (LeftRoutes.Contains(atcLoad.Destination) && theTransfer.RouteAvailable(Side.Left))
                {
                    ReleaseLoad(e._fromSide, Side.Left, e._load);
                    //LoadRouted = true;
                }
                else if (RightRoutes.Contains(atcLoad.Destination) && theTransfer.RouteAvailable(Side.Right))
                {
                    ReleaseLoad(e._fromSide, Side.Right, e._load);
                    //LoadRouted = true;
                }
                else if (!LeftRoutes.Contains(atcLoad.Destination) && !RightRoutes.Contains(atcLoad.Destination) && theTransfer.RouteAvailable(e._defaultDirection))
                {
                    ReleaseLoad(e._fromSide, e._defaultDirection, (Case_Load)e._load);
                    //LoadRouted = true;
                }
            }
        }
Example #21
0
        void theMultishuttle_OnArrivedAtOutfeedRackConvPosA(object sender, RackConveyorArrivalEventArgs e)
        {
            IATCCaseLoadType caseload = (IATCCaseLoadType)(e._caseLoad);

            caseload.Location = FormatRackConvLocation(e._locationName, ConveyorTypes.OutfeedRack);    //Update the location

            if (BaseATCController.GetLocFields(caseload.Destination, PSDSRackLocFields.ConvType) == "D")
            {
                string sendMessage = mheController_Multishuttle.CreateTelegramFromLoad(TelegramTypes.LocationArrivedTelegram, caseload);
                mheController_Multishuttle.SendTelegram(sendMessage, true); //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     = BaseATCController.GetLocFields(((IATCCaseLoadType)e._caseLoad).Destination, PSDSRackLocFields.Level);
                    string destLoadA = string.Format("{0}{1}{2}{3}A", aisle, (char)e._locationName.Side(), 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 = mheController_Multishuttle.CreateTelegramFromLoad(TelegramTypes.MultishuttleTransportFinishedTelegram, caseload);
                mheController_Multishuttle.SendTelegram(sendMessage, true); //Always Send a notification at location A
            }
        }
Example #22
0
        private void CancelTransportTelegramReceived(string[] telegramFields)
        {
            //If cancel telegram is received, find the load in the model, delete it and send a Confirm
            string           tuIdent = telegramFields.GetFieldValue(TelegramFields.tuIdent);
            IATCCaseLoadType atcLoad = (IATCCaseLoadType)Case_Load.GetCaseFromIdentification(tuIdent);

            if (atcLoad != null)
            {
                //string telegram = string.Empty.InsertType(TelegramTypes.ConfirmCancelTelegram);
                //telegram = telegram.AppendField(TelegramFields.tuIdent, atcLoad.TUIdent);
                //telegram = telegram.AppendField(TelegramFields.mts, telegramFields.GetFieldValue(TelegramFields.mts));
                //telegram = telegram.AppendField(TelegramFields.stateCode, telegramFields.GetFieldValue(TelegramFields.presetStateCode));
                //telegram = telegram.AppendField(TelegramFields.location, atcLoad.Location);
                //SendTelegram(telegram, true);
                atcLoad.Dispose();
            }
            else
            {
                //Could not find the load, it has not been deleted
                Log.Write(string.Format("ATC Error {0}: Could not find load {1} in CancelTransportTelegram, load has not been deleted", Name, tuIdent), Color.Red);
            }
        }
Example #23
0
        void theMultishuttle_OnArrivedAtShuttle(object sender, TaskEventArgs e)
        {
            IATCCaseLoadType load = (IATCCaseLoadType)e._load;
            //load.Location = string.Format("MSAI{0}LV{1}SH01", BaseATCController.GetRackLocFields(load.Destination, PSDSRackLocFields.Aisle), BaseATCController.GetRackLocFields(load.Destination, PSDSRackLocFields.Level));
            string aisle = BaseATCController.GetBinLocField(load.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;
                }
            }
            //load.Location = string.Format("MSAI{0}LV{1}SH01", BaseATCController.GetBinLocField(load.Source, BinLocFields.Aisle), ((ShuttleTask)e._task).Level.ToString().PadLeft(2, '0'));

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

            string sendMessage = mheController_Multishuttle.CreateTelegramFromLoad(TelegramTypes.LocationArrivedTelegram, load);

            mheController_Multishuttle.SendTelegram(sendMessage, true);
        }
Example #24
0
        private void StartTransportTelegramReceived(string[] telegramFields)
        {
            //Look for the load somewhere in the model, if the load is found then change it's status, if not create it at the source location
            //ATCCaseLoad caseLoad = (ATCCaseLoad)Case_Load.GetCaseFromIdentification(telegramFields.GetFieldValue(TelegramFields.tuIdent));
            IATCCaseLoadType caseLoad = (IATCCaseLoadType)Case_Load.GetCaseFromIdentification(telegramFields.GetFieldValue(TelegramFields.tuIdent));


            if (caseLoad != null) //The load has been found so some attributes need to be changed (Cannot change the dimensions of the load however)
            {
                caseLoad.TUType          = telegramFields.GetFieldValue(TelegramFields.tuType);
                caseLoad.Source          = telegramFields.GetFieldValue(TelegramFields.source);
                caseLoad.Destination     = telegramFields.GetFieldValue(TelegramFields.destination);
                caseLoad.PresetStateCode = telegramFields.GetFieldValue(TelegramFields.presetStateCode);
                caseLoad.Color           = LoadColor(telegramFields.GetFieldValue(TelegramFields.color));

                float weight;
                float.TryParse(telegramFields.GetFieldValue(TelegramFields.weight), out weight);
                caseLoad.CaseWeight = weight / 1000;

                //Deal with additional project specific fields
                foreach (string field in ProjectFields)
                {
                    string fieldValue = telegramFields.GetFieldValue(field);
                    if (fieldValue != null)
                    {
                        if (caseLoad.ProjectFields.ContainsKey(field))
                        {
                            caseLoad.ProjectFields[field] = fieldValue;
                        }
                        else
                        {
                            caseLoad.ProjectFields.Add(field, fieldValue);
                        }
                    }
                }

                //The load may be at a request location and the load will need to be released
                if (caseLoad.LoadWaitingForWCS && caseLoad.Stopped)
                {
                    //Load may be waiting on a transfer so call the mergeDivert
                    if (caseLoad.Route.Parent.Parent is MergeDivertConveyor)
                    {
                        MergeDivertConveyor mergeDivert = caseLoad.Route.Parent.Parent as MergeDivertConveyor;
                        //if (mergeDivert.divertArrival != null)
                        //{
                        //    mergeDivert.divertArrival(caseLoad);
                        //}
                        mergeDivert.ControlDivertPoint((Load)caseLoad);
                    }

                    caseLoad.LoadWaitingForWCS = false;
                    caseLoad.ReleaseLoad();
                }
            }
            else //The load has not been found but should one be created? Normally created through the Emulation Control Telegrams
            {
                if (Core.Assemblies.Assembly.Items.ContainsKey(telegramFields.GetFieldValue(TelegramFields.source)) &&
                    Core.Assemblies.Assembly.Items[telegramFields.GetFieldValue(TelegramFields.source)] is StraightConveyor)
                {
                    caseLoad = CreateCaseLoad(TelegramTypes.StartTransportTelegram, telegramFields);
                    StraightConveyor sourceConv = Core.Assemblies.Assembly.Items[telegramFields.GetFieldValue(TelegramFields.source)] as StraightConveyor;
                    caseLoad.SetYaw(sourceConv.Width, sourceConv.CaseOrientation);
                    float position = 0;
                    if (caseLoad.Yaw == 0)
                    {
                        position = position + (caseLoad.Length / 2);
                    }
                    else
                    {
                        position = position + (caseLoad.Width / 2);
                    }
                    sourceConv.TransportSection.Route.Add((Load)caseLoad, position);
                }
                else
                {
                    Log.Write(string.Format("ATC Error {0}: Cannot create load at location from StartTransportTelegram, location {1} does not exist, message ignored", Name, telegramFields.GetFieldValue(TelegramFields.source)), Color.Red);
                }
            }
        }
Example #25
0
        public void SendTransportFinishedTelegram(IATCCaseLoadType load)
        {
            string telegram = CreateTelegramFromLoad(TelegramTypes.TransportFinishedTelegram, load);

            SendTelegram(telegram, true);
        }
Example #26
0
        public void SendLocationLeftTelegram(IATCCaseLoadType load)
        {
            string telegram = CreateTelegramFromLoad(TelegramTypes.LocationLeftTelegram, load);

            SendTelegram(telegram, true);
        }