| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 | using System;using System.Collections.Generic;using System.Linq;using System.Text;using Aitex.Core.RT.SCCore;using Aitex.Sorter.Common;using MECF.Framework.Common.Equipment;namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.Robot.NX100{    public class ProtocolTag    {        public const string tag_end = "\r";        public const string tag_cmd_start = "$";        public const string cmd_token = ",";        public const string resp_tag_normal = "$";        public const string resp_tag_error = "?";        public const string resp_tag_excute = "!";        public const string resp_tag_event = ">";        public const string resp_evt_error = "100";    }    public class RobotConvertor    {        public static string chamber2staion(ModuleName chamber)        {            string st = "";            switch (chamber)            {                case ModuleName.LP1:                    st = "C1";                    break;                case ModuleName.LP2:                    st = "C2";                    break;                case ModuleName.LP3:                    st = "C3";                    break;                case ModuleName.LP4:                    st = "C4";                    break;                case ModuleName.LP5:                    st = "C5";                    break;                case ModuleName.LP6:                    st = "C6";                    break;                case ModuleName.LP7:                    st = "C7";                    break;                case ModuleName.LP8:                    st = "C8";                    break;                case ModuleName.LP9:                    st = "C9";                    break;                case ModuleName.LP10:                    st = "CA";                    break;                case ModuleName.Aligner:                    st = "P1";                    break;            }            return st;        }        public static string chamberSlot2Slot(ModuleName chamber, int slot)        {            string sslot = "";            switch (chamber)            {                case ModuleName.LP1:                case ModuleName.LP2:                case ModuleName.LP3:                case ModuleName.LP4:                case ModuleName.LP5:                case ModuleName.LP6:                case ModuleName.LP7:                case ModuleName.LP8:                case ModuleName.LP9:                case ModuleName.LP10:                    sslot = string.Format("{0:D2}", slot + 1);                    break;                case ModuleName.Aligner:                case ModuleName.Robot:                case ModuleName.PMA:                case ModuleName.PMB:                case ModuleName.PMC:                case ModuleName.PMD:                case ModuleName.PME:                case ModuleName.PMF:                     sslot = "00";                    break;            }            return sslot;        }        public static string hand2string(Hand hand)        {            string st = "";            if (SC.ContainsItem("Robot.BladeUpDownReverse") && SC.GetValue<bool>("Robot.BladeUpDownReverse"))            {                switch (hand)                {                    case Hand.Blade1:                        st = "A";      //单手臂 下                        break;                    case Hand.Blade2:                        st = "B";     //4手臂  上                        break;                    case Hand.Both:                        st = "W";                        break;                }            }            else            {                switch (hand)                {                    case Hand.Blade1:                        st = "B";      //单手臂 下                        break;                    case Hand.Blade2:                        st = "A";     //4手臂  上                        break;                    case Hand.Both:                        st = "W";                        break;                }            }            return st;        }        public static string NextMotion2String(Motion motion,Hand hand)        {            string st = "";            switch (motion)            {                case Motion.Pick:                    st = string.Format("G{0}", hand2string(hand));                    break;                case Motion.Place:                    st = string.Format("P{0}", hand2string(hand));                    break;                case Motion.Exchange:                    st = string.Format("E{0}", hand2string(hand));                    break;                default:                    st = "AL";                    break;            }            return st;        }        public static string Offset2String(int offset)        {            string st = "";            if (offset >= 0)            {                st = string.Format("{0:D5}", offset);            }            else            {                st = string.Format("{0:D4}", offset);            }            return st;        }    }}
 |