예제 #1
0
        private void CreateTuTelegramReceived(string[] telegramFields)
        {
            if (telegramFields.GetFieldValue(TelegramFields.location) == null)
            {
                return; //Telegram ignored
            }

            if (Core.Assemblies.Assembly.Items.ContainsKey(telegramFields.GetFieldValue(TelegramFields.location)) &&
                Core.Assemblies.Assembly.Items[telegramFields.GetFieldValue(TelegramFields.location)] is StraightConveyor)
            {
                ATCTray caseTray = CreateCaseTray(TelegramTypes.CreateTuTelegram, telegramFields);

                StraightConveyor sourceConv = Core.Assemblies.Assembly.Items[telegramFields.GetFieldValue(TelegramFields.location)] as StraightConveyor;
                caseTray.SetYaw(sourceConv.Width, sourceConv.CaseOrientation);
                float position = 0;
                if (caseTray.Yaw == 0)
                {
                    position = position + (caseTray.Length / 2);
                }
                else
                {
                    position = position + (caseTray.Width / 2);
                }
                sourceConv.TransportSection.Route.Add(caseTray, position);
            }
            else
            {
                Log.Write(string.Format("ATC Error {0}: Cannot create load at location from CreateTuTelegram, location {1} does not exist, message ignored", Name, telegramFields.GetFieldValue(TelegramFields.location)), Color.Red);
            }
        }
예제 #2
0
        public ATCTray CreateCaseTray(TelegramTypes Type, string[] Telegram)
        {
            ATCTray newLoad = null;

            if (Type == TelegramTypes.CreateTuTelegram)
            {
                string length = Telegram.GetFieldValue(TelegramFields.length);
                string width  = Telegram.GetFieldValue(TelegramFields.width);
                string height = Telegram.GetFieldValue(TelegramFields.height);
                string weight = Telegram.GetFieldValue(TelegramFields.weight);
                string color  = Telegram.GetFieldValue(TelegramFields.color);

                length = (length == null) ? CaseLoadLength : length;
                width  = (width == null) ? CaseLoadWidth : width;
                height = (height == null) ? CaseLoadHeight : height;
                weight = (weight == null) ? CaseLoadWeight : weight;
                color  = (Color == null) ? DefaultLoadColor.ToString() : color;

                newLoad = CreateTray(
                    Telegram.GetFieldValue(TelegramFields.mts),
                    Telegram.GetFieldValue(TelegramFields.tuIdent),
                    Telegram.GetFieldValue(TelegramFields.tuType),
                    Telegram.GetFieldValue(TelegramFields.location), //Location
                    Telegram.GetFieldValue(TelegramFields.destination),
                    Telegram.GetFieldValue(TelegramFields.presetStateCode),
                    0.2f,
                    0.4f,
                    0.6f,
                    100,
                    color,
                    TrayStatus.Loaded,
                    5);
            }

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

            return(newLoad);
        }
예제 #3
0
        protected ATCTray CreateTray(string mts, string tuIdent, string tuType, string source, string destination, string presetStateCode, float height, float width, float length, float weight, string color, TrayStatus status, uint trayStacks)
        {
            TrayInfo trayInfo = new TrayInfo();

            trayInfo.LoadColor  = LoadColor(color);
            trayInfo.filename   = Tray.Mesh;
            trayInfo.Status     = status;
            trayInfo.TrayStacks = trayStacks;

            //LoadHeight includes the height of the tray (50mm)
            trayInfo.LoadHeight = height;
            trayInfo.LoadWidth  = width;
            trayInfo.LoadLength = length;
            //TODO: Weight

            //Set the dimensions of a tray
            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)

            ATCTray trayLoad = new ATCTray(trayInfo);

            trayLoad.TUIdent         = tuIdent;
            trayLoad.TUType          = tuType;
            trayLoad.Source          = source;
            trayLoad.Destination     = destination;
            trayLoad.PresetStateCode = presetStateCode;
            trayLoad.Weight          = weight;

            //Add project fields to load
            Load.Items.Add(trayLoad);

            if (ProjectFields.Count > 0)
            {
                foreach (string field in ProjectFields)
                {
                    trayLoad.ProjectFields.Add(field, "");
                }
            }

            return(trayLoad);
        }