Exemplo n.º 1
0
        /// <summary>
        /// Method to return a Tray load
        /// </summary>
        /// <param name="transportSection">The transport section to add the load too</param>
        /// <param name="distance">The position distance along the transport section</param>
        /// <param name="trayData">Base tray data</param>
        /// <param name="trayStatus">Tray status (Empty, Loaded or Stacked)</param>
        /// <returns>Load of type Tray</returns>
        public static Tray FeedTrayLoad(ITransportSection transportSection, float distance, BaseCaseData trayData, TrayStatus trayStatus)
        {
            Tray trayLoad;
            IEmulationController controller = Core.Assemblies.Assembly.Items.Values.ToList().FirstOrDefault(x => x is IEmulationController) as IEmulationController;

            if (controller != null)
            {
                trayLoad = controller.GetTray(transportSection.Route, 0, trayStatus);
                if (trayLoad != null) //It is not necesary to implement this just return null case load from the controller and a standard load will be created
                {
                    return(trayLoad);
                }
            }
            try
            {
                TrayInfo trayInfo = new TrayInfo();
                trayInfo.color      = Color.Peru;
                trayInfo.filename   = Tray.Mesh;
                trayInfo.Status     = trayStatus;
                trayInfo.TrayStacks = 6;

                //LoadHeight includes the height of the tray (280mm)
                trayInfo.LoadHeight = 0.410f;
                trayInfo.LoadWidth  = 0.4f;
                trayInfo.LoadLength = 0.6f;

                //Set the dimensions of a tray (This is the standard size)
                trayInfo.length = 0.65f;
                trayInfo.width  = 0.45f;
                trayInfo.height = 0.058f; // Actual size is 0.063f but reduced so visible space can be added in stack (0.005f space)

                trayLoad = new Tray(trayInfo);

                trayLoad.Case_Data = trayData;
                transportSection.Route.Add(trayLoad, distance);
                Load.Items.Add(trayLoad);

                string SSCCBarcode = GetSSCCBarcode();
                if (SSCCBarcode != "")
                {
                    trayLoad.SSCCBarcode    = SSCCBarcode;
                    trayLoad.Identification = SSCCBarcode;
                }
                return(trayLoad);
            }
            catch (Exception se)
            {
                Core.Environment.Log.Write(se);
                Core.Environment.Scene.Pause();
                return(null);
            }
        }
Exemplo n.º 2
0
        private void StackTray()
        {
            var createdloads = 1;
            var loadYaw      = Trigonometry.PI(Trigonometry.Angle2Rad(Angle));

            IEmulationController controller = Core.Assemblies.Assembly.Items.Values.ToList().FirstOrDefault(x => x is IEmulationController) as IEmulationController;
            Tray load;

            while (createdloads < trayInfo.TrayStacks)
            {
                if (controller != null)
                {
                    load = controller.GetTray(null, 0, TrayStatus.Empty);
                }
                else
                {
                    TrayInfo info = new TrayInfo
                    {
                        length     = Length,
                        height     = Height,
                        width      = Width,
                        color      = Color,
                        InStack    = true,
                        Status     = TrayStatus.Empty,
                        filename   = Mesh,
                        TrayStacks = 1,
                    };
                    load = new Tray(info);
                }

                load.Deletable    = false;
                load.Yaw          = loadYaw;
                load.OnSelecting += trayLoad_OnSelecting;
                var stackY = (Height + 0.005f) * createdloads; // create empty space between loads
                Group(load, new Vector3(0, stackY, 0));
                createdloads++;
                stackedTrays.Add(load);
            }
        }