コード例 #1
0
    private ElevatorTask SetDirectionForTask(ElevatorTask task)
    {
        if (task == null)
        {
            return(null);
        }

        Elevator.Direction task_dir;
        if (task.TargetFloor > currentFloor)
        {
            task_dir = Elevator.Direction.Up;
        }
        else if (task.TargetFloor < currentFloor)
        {
            task_dir = Elevator.Direction.Down;
        }
        else
        {
            task_dir      = Elevator.Direction.Stop;
            task.TaskType = ElevatorTask.MOVE_TASK_TYPE;
        }
        task.TargetDirection = task_dir;
        if (task.TaskType == ElevatorTask.MOVE_TASK_TYPE)
        {
            task.DesiredDirection = task.TargetDirection;
        }
        return(task);
    }
コード例 #2
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);
                }
            }
        }
コード例 #3
0
        private void SingleLoadAtPS(string telegramFields, Case_Load caseLoad)
        {
            // Rack Location for an ElevatorTask takes the form:  aasyyxz: aa=aisle, s = side, yy = level, x = conv type see enum ConveyorTypes , Z = loc A or B e.g. 01R05OA e.g. 01R05OA
            // Source location for a shuttleTask takes the form: sxxxyydd: Side, xxx location, yy = level, dd = depth
            // Elevator Format saa s = Side ( L or R), aa = aisle

            string currentLoc  = telegramFields.GetFieldValue(this, TelegramFields.Current);
            string destLoc     = telegramFields.GetFieldValue(this, TelegramFields.Destination);
            string aisle       = GetPSDSLocFields(currentLoc, PSDSRackLocFields.Aisle);
            string side        = GetPSDSLocFields(currentLoc, PSDSRackLocFields.Side);
            string dest        = null;
            string sourceLoadB = string.Format("{0}{1}{2}{3}B", aisle,    //Single load will always be at B
                                               side,
                                               GetPSDSLocFields(currentLoc, PSDSRackLocFields.Level),
                                               GetPSDSLocFields(currentLoc, PSDSRackLocFields.ConvType));

            MultiShuttle ms = GetMultishuttleFromAisleNum(sourceLoadB);

            if (telegramFields.GetFieldValue(this, TelegramFields.Destination).LocationType() == LocationTypes.DropStation)
            {
                //First check if the destination is to a drop station... check if the drop station is on this elevator
                if (GetPSDSLocFields(destLoc, PSDSRackLocFields.Side) != side)
                {
                    //If not choose a destination to level 1 and remember the load route
                    dest = string.Format("{0}{1}{2}{3}A", aisle, side, FindLevelForReject(ms), "I");
                }
                else
                {
                    dest = string.Format("{0}{1}{2}{3}A",
                                         aisle,
                                         side,
                                         GetPSDSLocFields(destLoc, PSDSRackLocFields.Level),
                                         GetPSDSLocFields(destLoc, PSDSRackLocFields.ConvType));
                }
            }
            else if (telegramFields.GetFieldValue(this, TelegramFields.Destination).LocationType() == LocationTypes.RackConvIn)
            {
                dest = string.Format("{0}{1}{2}{3}B", aisle,
                                     side,
                                     GetLocFields(destLoc, PSDSRackLocFields.Level),
                                     GetLocFields(destLoc, PSDSRackLocFields.ConvType));
            }
            else
            {
                dest = GetRackDestinationFromDCIBinLocation(string.Join(",", telegramFields), 0);
            }


            ElevatorTask et = new ElevatorTask(null, caseLoad.Identification)
            {
                SourceLoadB      = sourceLoadB,
                DestinationLoadB = dest,
                LoadCycle        = Cycle.Single,
                UnloadCycle      = Cycle.Single,
                Flow             = TaskType.Infeed
            };

            ms.elevators.First(x => x.ElevatorName == side + aisle).ElevatorTasks.Add(et);
            //ms.elevators[side+aisle].ElevatorTasks.Add(et);
        }
コード例 #4
0
ファイル: FloorsPanel.cs プロジェクト: andreyGladin/Elevator
    private void OnElevatorDownButtonClick(int floor)
    {
        downButtons[floor - 1].interactable = false;
        ElevatorTask task = new ElevatorTask(ElevatorTask.STOP_FLOOR_TASK_TYPE, floor);

        task.DesiredDirection = Elevator.Direction.Down;
        ElevatorManager.GetInstance().AddTaskToQueue(task);
    }
コード例 #5
0
    public void SetTaskComplete(ElevatorTask task)
    {
        elevatorPanel.UnlockButton(task.TargetFloor);
        floorsPanel.UnlockButton(task.TargetFloor);

        elevatorTasks.Remove(task);
        currentTask = null;
        ChooseCurrentTask();
        currentTask = SetDirectionForTask(currentTask);
        elevator.ExecuteTask(currentTask == null ? new ElevatorTask(ElevatorTask.STOP_TASK_TYPE) : currentTask);
    }
コード例 #6
0
        void multiShuttle_OnArrivedAtPickStationConvPosA(object sender, PickDropStationArrivalEventArgs e)
        {
            string str  = string.Format("{0}B", e._locationName.Substring(0, e._locationName.Length - 1));
            var    locB = theMultishuttle.ConveyorLocations.Find(x => x.LocName == str);

            if (locB.Active)
            {
                ElevatorTask elevatorTask = new ElevatorTask();
                elevatorTask.BarcodeLoadB = ((Case_Load)locB.ActiveLoad).SSCCBarcode;
                elevatorTask.BarcodeLoadA = e._caseLoad.SSCCBarcode;

                elevatorTask.DestinationLoadA = "01L06IB";
                elevatorTask.DestinationLoadB = "01L08IB";


                // Randomly choose between doing a single cycle off load and a double offload
                // This assumes that that there will be space for a double somewhere but woulf bbe easy to check for this condition
                //   if (rand.Next(0, 2) == 0)
                //{
                //    ////UnLoad cycle single
                //    elevatorTask.UnloadCycle = Cycle.Single;
                //    //var infeedsWithSpace = theMultishuttle.RackConveyors.FindAll(x => (x.RackConveyorType == MultiShuttleDirections.Infeed && x.TransportSection.Route.Loads.Count < 2));
                //    //var infeedConv = infeedsWithSpace[rand.Next(infeedsWithSpace.Count)];
                //    //infeedsWithSpace.Remove(infeedConv);         //remove so that it is not choosen again for this task

                //    elevatorTask.DestinationLoadA = string.Format("{0}L02IB", e._elevator.AisleNumber.ToString().PadLeft(2, '0'));

                //    //infeedConv = infeedsWithSpace[rand.Next(infeedsWithSpace.Count)]; //rechoose infeedConv

                //    elevatorTask.DestinationLoadB = string.Format("{0}L04IB", e._elevator.AisleNumber.ToString().PadLeft(2, '0'));
                //}
                //  else
                {
                    //Unload cycle Double

                    //var infeedsWithSpace = theMultishuttle.RackConveyors.FindAll(x => (x.RackConveyorType == MultiShuttleDirections.Infeed && x.TransportSection.Route.Loads.Count == 0));
                    //var infeedConv = infeedsWithSpace[rand.Next(infeedsWithSpace.Count)];

                    elevatorTask.DestinationLoadA = string.Format("{0}L20IB", e._elevator.AisleNumber.ToString().PadLeft(2, '0'));
                    elevatorTask.DestinationLoadB = elevatorTask.DestinationLoadA;
                    elevatorTask.UnloadCycle      = Cycle.Double;
                }

                elevatorTask.SourceLoadA = e._locationName;
                elevatorTask.SourceLoadB = locB.LocName;
                elevatorTask.LoadCycle   = Cycle.Double;

                elevatorTask.Flow = TaskType.Infeed;
                e._elevator.ElevatorTasks.Add(elevatorTask);
            }

            LoadTransfering = false;
        }
コード例 #7
0
    private void ChooseCurrentTask()
    {
        if (elevatorTasks.Count > 0)
        {
            currentTask = elevatorTasks[0];
        }

        if (currentTask == null)
        {
            return;
        }

        CheckForTaskOnTheWay();
    }
コード例 #8
0
        /// <summary>
        /// Creates a PS to DS task for the elevator
        /// Loads always travel from A to B
        /// </summary>
        /// <param name="originA">Load A origin</param>
        /// <param name="destA">Load A destination</param>
        /// <param name="cDataA">case data for load A</param>
        /// <param name="originB">Load B origin</param>
        /// <param name="destB">Load B destination</param>
        /// <param name="cDataB"> case data for load B</param>
        /// <param name="loadCycle">The load cycle type</param>
        /// <param name="unloadCycle">The unload cycle type</param>
        public void CreateElevatorTask(string originA, string destA, CaseData cDataA, string originB, string destB, CaseData cDataB, Cycle loadCycle, Cycle unloadCycle)
        {
            ElevatorTask eT = new ElevatorTask(GetLoadIDFromCaseData(cDataA), GetLoadIDFromCaseData(cDataB));

            eT.SourceLoadB = string.Format("{0}{1}{2}{3}B",
                                           originB.Datcom_Aisle(),
                                           originB.Datcom_Side(),
                                           originB.Datcom_Y_Vertical(),
                                           (char)ConveyorTypes.Pick);

            eT.DestinationLoadB = string.Format("{0}{1}{2}{3}A",
                                                destB.Datcom_Aisle(),
                                                destB.Datcom_Side(),
                                                destB.Datcom_Y_Vertical(),
                                                (char)ConveyorTypes.Drop);

            eT.caseDataB = cDataB;

            ((Case_Load)Load.Get(cDataB.ULID)).Case_Data = cDataB;

            //Should always have a set of B data but no always a set of A data.
            if (cDataA != null)
            {
                eT.SourceLoadA = string.Format("{0}{1}{2}{3}A",
                                               originA.Datcom_Aisle(),
                                               originA.Datcom_Side(),
                                               originA.Datcom_Y_Vertical(),
                                               (char)ConveyorTypes.Pick);

                eT.DestinationLoadA = string.Format("{0}{1}{2}{3}A",
                                                    destA.Datcom_Aisle(),
                                                    destA.Datcom_Side(),
                                                    destA.Datcom_Y_Vertical(),
                                                    (char)ConveyorTypes.Drop);

                eT.caseDataA = cDataA;

                ((Case_Load)Load.Get(cDataA.ULID)).Case_Data = cDataA;
            }

            eT.LoadCycle   = loadCycle;
            eT.UnloadCycle = unloadCycle;
            eT.Flow        = TaskType.Infeed;

            string elevatorName = string.Format("{0}{1}", destB.Datcom_Side(), destB.Datcom_Aisle());

            theMultishuttle.elevators.First(x => x.ElevatorName == elevatorName).ElevatorTasks.Add(eT);
        }
コード例 #9
0
ファイル: Elevator.cs プロジェクト: andreyGladin/Elevator
    public void ExecuteTask(ElevatorTask task)
    {
        currentTask = task;

        switch (task.TaskType)
        {
        case ElevatorTask.STOP_FLOOR_TASK_TYPE:
        case ElevatorTask.MOVE_TASK_TYPE:
            MoveElevatorOnFloor(task.TargetFloor);
            break;

        case ElevatorTask.STOP_TASK_TYPE:
            StopElevator();
            break;

        default:
            break;
        }
    }
コード例 #10
0
    public void AddTaskToQueue(ElevatorTask task)
    {
        if (task.TaskType == ElevatorTask.STOP_TASK_TYPE)
        {
            floorsPanel.ResetPanel();
            elevatorPanel.ResetPanel();

            elevator.ExecuteTask(task);
            elevatorTasks.Clear();

            return;
        }

        task = SetDirectionForTask(task);

        elevatorTasks.Add(task);

        ChooseCurrentTask();
        elevator.ExecuteTask(currentTask);
    }
コード例 #11
0
        void theMultishuttle_OnArrivedAtPickStationConvPosB(object sender, MultiShuttle.Assemblies.PickDropStationArrivalEventArgs e)
        {
            var locB = theMultishuttle.ConveyorLocations.Find(x => x.LocName == e._locationName);
            PickStationConveyor psConv = locB.Parent.Parent.Parent as PickStationConveyor;

            if (psConv.TransportSection.Route.Loads.Count == 1)
            {
                ElevatorTask elevatorTask = new ElevatorTask()
                {
                    BarcodeLoadB     = e._caseLoad.SSCCBarcode,
                    DestinationLoadB = string.Format("01L{0}IB", GetRandomLevel()),
                    SourceLoadB      = e._locationName,
                    LoadCycle        = Cycle.Single,
                    UnloadCycle      = Cycle.Single,
                    Flow             = TaskType.Infeed
                };
                e._elevator.ElevatorTasks.Add(elevatorTask);
            }

            new EventWaiter(TestFunc);
        }
コード例 #12
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
            }
        }
コード例 #13
0
        /// <summary>
        /// After sending an 02 arrival then try to get a new elevator task but only if the loads that the 02 was sent is relevant to the current task
        /// </summary>
        private void TryGetNewElevatorTask(ElevatorTask task, Case_Load load1, Case_Load load2 = null)
        {
            if (task.Elevator.ElevatorConveyor.Route.Loads.Count == 0)  //Only get a new task if the evlevator is empty
            {
                if (task.Elevator.ElevatorConveyor.Route.Loads.Count == 0 && ((load1 != null && task.RelevantElevatorTask(load1)) || (load2 != null && task.RelevantElevatorTask(load2))))
                {
                    Func <ObservableCollection <ElevatorTask>, ElevatorTask, ElevatorTask> elevatorPriority = (tasks, lastTask) =>
                    {
                        if (tasks.Any())
                        {
                            return(tasks.First());
                        }
                        else
                        {
                            return(null);
                        }
                    };

                    //task.Elevator.GetNewElevatorTask((tasks) => tasks.Any() ? tasks.First() : null));
                    // TODO [CN] This method was removed in a previous release, however as Multishuttle is not needed for final project commenting this out to fix build issues
                    //task.Elevator.GetNewElevatorTask(elevatorPriority);
                }
            }
        }
コード例 #14
0
        void theMultishuttle_OnArrivedAtOutfeedRackConvPosB(object sender, RackConveyorOutfeedArrivalEventArgs e)
        {
            //aasyyxz: a=aisle, s = side, y = level, x = input or output, Z = loc A or B e.g. 01R05OA
            //if (loading)//2 loads out from different levels
            //{
            //    if (load1Args == null)
            //    {
            //        load1Args = e;
            //    }
            //    else
            //    {
            //        loading = false;
            //        load2Args = e;

            //        ElevatorTask elevatorTask = new ElevatorTask();
            //        elevatorTask.BarcodeLoadA = load1Args._caseLoad.SSCCBarcode;
            //        elevatorTask.SourceLoadA = string.Format("{0}{1}{2}{3}B",
            //                                                      load1Args._locationName.AisleNumber().ToString().PadLeft(2, '0'),
            //                                                      (char)load1Args._locationName.Side(),
            //                                                      load1Args._locationName.Level().ToString().PadLeft(2, '0'),
            //                                                      (char)load1Args._locationName.ConvType());

            //        elevatorTask.DestinationLoadA = string.Format("{0}{1}02DB",
            //                                                      load1Args._locationName.AisleNumber().ToString().PadLeft(2, '0'),
            //                                                      (char)load1Args._locationName.Side());

            //        elevatorTask.BarcodeLoadB = load2Args._caseLoad.SSCCBarcode;
            //        elevatorTask.SourceLoadB = string.Format("{0}{1}{2}{3}B",
            //                                                      load2Args._locationName.AisleNumber().ToString().PadLeft(2, '0'),
            //                                                      (char)load2Args._locationName.Side(),
            //                                                      load2Args._locationName.Level().ToString().PadLeft(2, '0'),
            //                                                      (char)load2Args._locationName.ConvType());

            //        elevatorTask.DestinationLoadB = string.Format("{0}{1}01DB",
            //                                                      load2Args._locationName.AisleNumber().ToString().PadLeft(2, '0'),
            //                                                      (char)load2Args._locationName.Side());

            //        elevatorTask.LoadCycle = Cycle.Single;
            //        elevatorTask.UnloadCycle = Cycle.Single;
            //        elevatorTask.Flow = TaskType.Outfeed;
            //        load2Args._elevator.ElevatorTasks.Add(elevatorTask);
            //        load1Args = null;
            //        load2Args = null;
            //    }
            //}

            //Single load out
            ElevatorTask elevatorTask = new ElevatorTask();

            elevatorTask.BarcodeLoadB = e._caseLoad.SSCCBarcode;
            elevatorTask.SourceLoadB  = string.Format("{0}{1}{2}{3}B",
                                                      e._locationName.AisleNumber().ToString().PadLeft(2, '0'),
                                                      (char)e._locationName.Side(),
                                                      e._locationName.Level().ToString().PadLeft(2, '0'),
                                                      (char)e._locationName.ConvType());

            elevatorTask.DestinationLoadB = string.Format("{0}{1}02DB",
                                                          e._locationName.AisleNumber().ToString().PadLeft(2, '0'),
                                                          (char)e._locationName.Side());
            elevatorTask.LoadCycle   = Cycle.Single;
            elevatorTask.UnloadCycle = Cycle.Single;
            elevatorTask.Flow        = TaskType.Outfeed;
            e._elevator.ElevatorTasks.Add(elevatorTask);
        }
コード例 #15
0
        //aasyyxz: a=aisle, s = side, y = level, x = conv type see enum ConveyorTypes, Z = loc A or B e.g. 01R05OA
        //TODO refactor this nastyness
        public void CreateElevatorTask(string originA, string destA, CaseData cDataA, string originB, string destB, CaseData cDataB, Cycle loadCycle, Cycle unloadCycle, TaskType taskType)
        {
            ElevatorTask eT = new ElevatorTask(GetLoadIDFromCaseData(cDataA), GetLoadIDFromCaseData(cDataB));
            char         sourceConvType, destConvType;

            if (taskType == TaskType.Outfeed)
            {
                sourceConvType = (char)ConveyorTypes.OutfeedRack;
                destConvType   = (char)ConveyorTypes.Drop;
            }
            else
            {
                sourceConvType = (char)ConveyorTypes.Pick;
                destConvType   = (char)ConveyorTypes.InfeedRack;
            }

            eT.SourceLoadB = string.Format("{0}{1}{2}{3}B",
                                           originB.Datcom_Aisle(),
                                           originB.Datcom_Side(),
                                           originB.Datcom_Y_Vertical(),
                                           sourceConvType);

            eT.DestinationLoadB = string.Format("{0}{1}{2}{3}A",
                                                destB.Datcom_Aisle(),
                                                destB.Datcom_Side(),
                                                destB.Datcom_Y_Vertical(),
                                                destConvType);

            // eT.LoadB_ID = cDataB.ULID;
            eT.caseDataB = cDataB;

            var locB = theMultishuttle.ConveyorLocations.Find(x => x.LocName == eT.SourceLoadB);

            if (locB != null && locB.Active)
            {
                ((Case_Load)locB.ActiveLoad).Case_Data = cDataB; //
                locB.ActiveLoad.Identification         = cDataB.ULID;
            }
            else
            {
                Log.Write(string.Format("Multishuttle {0}: Cannot create elevator task as source location does not have load", originB.Datcom_Aisle()));
            }

            if (loadCycle == Cycle.Double) //just assuming that if you have a double load cycle then you have all the rest of the informatiom to go with it
            {
                eT.SourceLoadA = string.Format("{0}{1}{2}{3}A",
                                               originA.Datcom_Aisle(),
                                               originA.Datcom_Side(),
                                               originA.Datcom_Y_Vertical(),
                                               sourceConvType);

                eT.DestinationLoadA = string.Format("{0}{1}{2}{3}B",
                                                    destA.Datcom_Aisle(),
                                                    destA.Datcom_Side(),
                                                    destA.Datcom_Y_Vertical(),
                                                    destConvType);

                //eT.LoadA_ID = cDataA.ULID;
                eT.caseDataA = cDataA;
                // Case_Load.GetCaseFromULID(cDataA.ULID).Case_Data = cDataA;

                var locA = theMultishuttle.ConveyorLocations.Find(x => x.LocName == eT.SourceLoadA);
                if (locA != null && locA.Active)
                {
                    ((Case_Load)locA.ActiveLoad).Case_Data = cDataA;
                    locA.ActiveLoad.Identification         = cDataA.ULID;
                }
            }
            else if (loadCycle == Cycle.Single && unloadCycle == Cycle.Double)
            {
                eT.SourceLoadA = string.Format("{0}{1}{2}{3}B",
                                               originA.Datcom_Aisle(),
                                               originA.Datcom_Side(),
                                               originA.Datcom_Y_Vertical(),
                                               sourceConvType);

                eT.DestinationLoadA = string.Format("{0}{1}{2}{3}B",
                                                    destA.Datcom_Aisle(),
                                                    destA.Datcom_Side(),
                                                    destA.Datcom_Y_Vertical(),
                                                    destConvType);

                // eT.LoadA_ID = cDataA.ULID;
                eT.caseDataA = cDataA;
                // Case_Load.GetCaseFromULID(cDataA.ULID).Case_Data = cDataA;

                var locA = theMultishuttle.ConveyorLocations.Find(x => x.LocName == eT.SourceLoadA);
                if (locA != null && locA.Active)
                {
                    ((Case_Load)locA.ActiveLoad).Case_Data = cDataA;
                    locA.ActiveLoad.Identification         = cDataA.ULID;
                }
            }
            else if (loadCycle == Cycle.Single && unloadCycle == Cycle.Single && cDataA != null && cDataB != null)
            {
                eT.SourceLoadA = string.Format("{0}{1}{2}{3}B",
                                               originA.Datcom_Aisle(),
                                               originA.Datcom_Side(),
                                               originA.Datcom_Y_Vertical(),
                                               sourceConvType);

                eT.DestinationLoadA = string.Format("{0}{1}{2}{3}B",
                                                    destA.Datcom_Aisle(),
                                                    destA.Datcom_Side(),
                                                    destA.Datcom_Y_Vertical(),
                                                    destConvType);

                // eT.LoadA_ID = cDataA.ULID;
                eT.caseDataA = cDataA;
                // Case_Load.GetCaseFromULID(cDataA.ULID).Case_Data = cDataA;

                var locA = theMultishuttle.ConveyorLocations.Find(x => x.LocName == eT.SourceLoadA);
                if (locA != null && locA.Active)
                {
                    ((Case_Load)locA.ActiveLoad).Case_Data = cDataA;
                    locA.ActiveLoad.Identification         = cDataA.ULID;
                }
            }


            eT.LoadCycle   = loadCycle;
            eT.UnloadCycle = unloadCycle;
            eT.Flow        = taskType;

            string elevatorName = string.Format("{0}{1}", destB.Datcom_Side(), destB.Datcom_Aisle());

            theMultishuttle.elevators.First(x => x.ElevatorName == elevatorName).ElevatorTasks.Add(eT);
            //theMultishuttle.elevators[elevatorName].ElevatorTasks.Add(eT);
        }
コード例 #16
0
        private void TUMissionMultiBlock(string telegram)
        {
            string             currentLoc = string.Empty;
            DematicActionPoint locA = null, locB = null;
            MultiShuttle       ms = null;

            TelegramTypes type = telegram.GetTelegramType(this);


            //List<string> indexTags;
            //List<string> messageBodies = Telegrams.DeMultaplise(telegram, telegram.GetTelegramType(), out indexTags);
            //string[] messageBodySplit  = messageBodies.First().Split(',');//don't care which message is used as both on the same conveyor
            string current = telegram.GetFieldValue(this, TelegramFields.Current);
            string destLoc0 = telegram.GetFieldValue(this, TelegramFields.Destination, 0);
            string destLoc1 = telegram.GetFieldValue(this, TelegramFields.Destination, 1);
            string tuIdent0 = telegram.GetFieldValue(this, TelegramFields.TUIdent, 0);
            string tuIdent1 = telegram.GetFieldValue(this, TelegramFields.TUIdent, 1);
            string aisle = GetPSDSLocFields(current, PSDSRackLocFields.Aisle);
            string side = GetPSDSLocFields(current, PSDSRackLocFields.Side);
            string destA = null, destB = null;

            // takes the form aasyyxz: aa=aisle, s = side, yy = level, x = conv type see enum ConveyorTypes , Z = loc A or B e.g. 01R05OA
            string loc = string.Format("{0}{1}{2}P", aisle, side, GetPSDSLocFields(current, PSDSRackLocFields.Level));

            ms   = GetMultishuttleFromAisleNum(loc + "A");
            locA = ms.ConveyorLocations.Find(x => x.LocName == loc + "A");
            locB = ms.ConveyorLocations.Find(x => x.LocName == loc + "B");

            if ((locA != null && locA.Active) && (locB != null && locB.Active))
            {
                string messageA = telegram.Split(',').ToList().Find(x => x.Contains(locA.ActiveLoad.Identification));
                string messageB = telegram.Split(',').ToList().Find(x => x.Contains(locB.ActiveLoad.Identification));

                if (destLoc0 == null || destLoc1 == null)
                {
                    Log.Write(string.Format("{0}: Invalid destinations sent in TUMission - Logically Grouped", Name), Color.Red);
                    return;
                }

                if (telegram.GetFieldValue(this, TelegramFields.Destination, 0).LocationType() == LocationTypes.DropStation)  //Assume that both going to DS
                {
                    destA = string.Format("{0}{1}{2}{3}A", aisle,
                                          side,
                                          GetPSDSLocFields(destLoc0, PSDSRackLocFields.Level),
                                          GetPSDSLocFields(destLoc0, PSDSRackLocFields.ConvType));
                    destB = destA;
                }
                else if (telegram.GetFieldValue(this, TelegramFields.Destination).LocationType() == LocationTypes.RackConvIn)
                {
                    //need to calculate which way around the loads are on the PS and ensure that the elevator task is correct
                    if (locA.ActiveLoad.Identification == tuIdent0)
                    {
                        destA = string.Format("{0}{1}{2}{3}B", aisle, side, GetLocFields(destLoc0, PSDSRackLocFields.Level), GetLocFields(destLoc0, PSDSRackLocFields.ConvType));
                    }
                    else if (locA.ActiveLoad.Identification == tuIdent1)
                    {
                        destA = string.Format("{0}{1}{2}{3}B", aisle, side, GetLocFields(destLoc1, PSDSRackLocFields.Level), GetLocFields(destLoc1, PSDSRackLocFields.ConvType));
                    }
                    else
                    {
                        Log.Write(string.Format("Error {0}: The tuIdent at the PS does not match the tuIdent in the TU Mission - Logically Grouped (Position A"), Color.Orange);
                        return;
                    }

                    if (locB.ActiveLoad.Identification == tuIdent0)
                    {
                        destB = string.Format("{0}{1}{2}{3}B", aisle, side, GetLocFields(destLoc0, PSDSRackLocFields.Level), GetLocFields(destLoc0, PSDSRackLocFields.ConvType));
                    }
                    else if (locB.ActiveLoad.Identification == tuIdent1)
                    {
                        destB = string.Format("{0}{1}{2}{3}B", aisle, side, GetLocFields(destLoc1, PSDSRackLocFields.Level), GetLocFields(destLoc1, PSDSRackLocFields.ConvType));
                    }
                    else
                    {
                        Log.Write(string.Format("Error {0}: The tuIdent at the PS does not match the tuIdent in the TU Mission - Logically Grouped (Position A"), Color.Orange);
                        return;
                    }
                }
                else
                {
                    destA = GetRackDestinationFromDCIBinLocation(telegram, 0);
                    destB = GetRackDestinationFromDCIBinLocation(telegram, 1);
                }

                if (messageA != null && messageB != null)
                {
                    ElevatorTask et = new ElevatorTask(locA.ActiveLoad.Identification, locB.ActiveLoad.Identification)
                    {
                        LoadCycle        = Cycle.Double,
                        Flow             = TaskType.Infeed,
                        SourceLoadA      = locA.LocName,
                        SourceLoadB      = locB.LocName,
                        DestinationLoadA = destA,
                        DestinationLoadB = destB,
                        UnloadCycle      = Cycle.Single
                    };
                    if (et.DestinationLoadA == et.DestinationLoadB)
                    {
                        et.UnloadCycle = Cycle.Double;
                    }

                    UpDateLoadParameters(telegram, (Case_Load)locA.ActiveLoad, 1);
                    UpDateLoadParameters(telegram, (Case_Load)locB.ActiveLoad, 0);

                    ms.elevators.First(x => x.ElevatorName == side + aisle).ElevatorTasks.Add(et);
                    //ms.elevators[side+aisle].ElevatorTasks.Add(et);
                }
                else
                {
                    Log.Write("ERROR: Load ids from telegram do not match active load ids in TU Mission - Logically Grouped", Color.Red);
                    return;
                }
            }
            else
            {
                Log.Write("ERROR: Can't find locations or can't find loads on the locations named in TU Mission - Logically Grouped", Color.Red);
            }
        }
コード例 #17
0
 private void SetTaskFirst(ElevatorTask task)
 {
     elevatorTasks.Remove(task);
     elevatorTasks.Insert(0, task);
     currentTask = task;
 }
コード例 #18
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);
            }
        }
コード例 #19
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());
                }
            }
        }