Beispiel #1
0
 public CasePhotocell GetMergePhotocell(string PhotocellName)
 {
     if (!string.IsNullOrEmpty(PhotocellName))
     {
         string[]             assemDev = PhotocellName.Split(',');
         StraightBeltConveyor conv     = Core.Assemblies.Assembly.Items[assemDev[0]] as StraightBeltConveyor;
         if (conv != null)
         {
             if (conv.Assemblies != null)
             {
                 foreach (Assembly device in conv.Assemblies)
                 {
                     if (device.Name == assemDev[1])
                     {
                         // MergePhotocell = device as Photocell;
                         return(device as CasePhotocell);
                         //break;
                     }
                 }
                 //Did not find the device as it has not been created on the conveyor yet wait until they are
             }
             else
             {
                 conv.OnDevicesCreated += conv_OnDevicesCreated;
             }
         }
     }
     return(null);
 }
Beispiel #2
0
        //If the devices on the found conveyor are created after this one then subscribe to the devices created
        //event and try and find it then
        void conv_OnDevicesCreated(object sender, EventArgs e)
        {
            StraightBeltConveyor conv = sender as StraightBeltConveyor;

            conv.OnDevicesCreated -= conv_OnDevicesCreated;

            string[] assemDev = beltSorterMergeInfo.MergePhotocellName.Split(',');

            foreach (Assembly device in ((StraightConveyor)sender).Assemblies)
            {
                if (device.Name == assemDev[1])
                {
                    MergePhotocell = device as CasePhotocell;
                    break;
                }
            }
        }
Beispiel #3
0
        public BeltSorterDivert(BeltSorterDivertInfo info) : base(info)
        {
            beltSorterDivertInfo = info;

            if (info.type == DivertType.PopUp)
            {
                arrow.Dispose();
            }

            StraightBeltConveyorInfo divertSectionInfo = new StraightBeltConveyorInfo()
            {
                Length    = info.divertConveyorLength,
                thickness = info.thickness,
                Width     = info.width,
                Speed     = info.Speed,
                color     = info.color
            };

            divertSection = new StraightBeltConveyor(divertSectionInfo);
            divertSection.startLine.Visible     = false;
            divertSection.StartFixPoint.Visible = false;
            divertSection.StartFixPoint.Enabled = false;

            Add(divertSection);

            TransportSection.Route.InsertActionPoint(apStraight);
            divertSection.TransportSection.Route.InsertActionPoint(apDivert, 0);

            apStraight.OnEnter += apStraight_OnEnter;

            if (beltControl.LineReleasePhotocell != null)
            {
                beltControl.LineReleasePhotocell.Dispose();
            }

            if (divertSection.beltControl.LineReleasePhotocell != null)
            {
                divertSection.beltControl.LineReleasePhotocell.Dispose();
            }

            DivertAngle          = info.divertAngle;
            Length               = info.length;
            DivertConveyorOffset = info.divertConveyorOffset;

            UpdateConveyor();
        }
Beispiel #4
0
        void photoCellPlacment_OnElapsed(Timer sender)
        {
            try
            {
                StraightBeltConveyor photocellBelt = photoCellCreator.Route.Parent.Parent as StraightBeltConveyor; //TODO what about other types --- really need a Dematic base conveyor
                CasePhotocellInfo    pcinfo        = new CasePhotocellInfo()
                {
                    name         = "Induct_" + ((KeyValuePair <string, float>)eSortedTeachTimes.Current).Key,
                    distance     = photoCellCreator.Distance,
                    distanceFrom = PositionPoint.Start,
                    type         = photocellBelt.beltControl.constructDevice.DeviceTypes["Add Photocell"].Item1
                };

                CasePhotocell pc = beltControl.constructDevice.InsertDevice(pcinfo, photocellBelt as IConstructDevice) as CasePhotocell;
                photocellBelt.DeviceInfos.Add(pcinfo); //Add the device info to the assembly that it was created on so that it will be saved when the user saves the model
                BeltSorterMerge bsm = Experior.Core.Assemblies.Assembly.Items[((KeyValuePair <string, float>)eSortedTeachTimes.Current).Key] as BeltSorterMerge;

                bsm.MergePhotocellName = string.Format("{0},{1}", photocellBelt.Name, pc.Name);

                if (eSortedTeachTimes.MoveNext()) //reset the timer ready for the next photocell
                {
                    KeyValuePair <string, float> photoCellInfo = (KeyValuePair <string, float>)eSortedTeachTimes.Current;
                    photoCellPlacment.Timeout = photoCellInfo.Value - previousTime;
                    previousTime += photoCellInfo.Value - previousTime;
                    photoCellPlacment.Reset();
                    photoCellPlacment.Start();
                }
                else //After all photocells have been created subcribe to there deleted event
                {
                    AssignMergePhotoCellDeleted();
                }
            }
            catch (Exception ex)
            {
                Log.Write("Error in photoCellPlacment_OnElapsed: " + ex.Message);
            }
        }