예제 #1
0
        private List <ReturnMessage> COGNEXCodeAnalysis(string Message)
        {
            List <ReturnMessage> result;

            string[] msgAry;

            try
            {
                result = new List <ReturnMessage>();
                msgAry = Message.Split(new string[] { "\r\n" }, StringSplitOptions.None);
                foreach (string Msg in msgAry)
                {
                    if (Msg.Trim().Equals(""))
                    {
                        continue;
                    }
                    ReturnMessage each = new ReturnMessage();
                    each.NodeAdr     = "1";
                    each.Command     = "";
                    each.OrgMsg      = Msg;
                    each.CommandType = "CMD";
                    switch (Msg)
                    {
                    default:
                        each.Type  = ReturnMessage.ReturnType.Finished;
                        each.Value = Msg;
                        break;
                    }
                    result.Add(each);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }

            return(result);
        }
예제 #2
0
        private List <ReturnMessage> SANWACodeAnalysis(string Message)
        {
            List <ReturnMessage> result;

            string[] msgAry;

            try
            {
                result = new List <ReturnMessage>();
                msgAry = Message.Split('\r');

                foreach (string Msg in msgAry)
                {
                    if (Msg.Trim().Equals(""))
                    {
                        continue;
                    }
                    ReturnMessage each = new ReturnMessage();

                    each.NodeAdr = Msg[1].ToString();
                    string[] content = Msg.Replace("\r", "").Replace("\n", "").Substring(2).Split(':');
                    for (int i = 0; i < content.Length; i++)
                    {
                        switch (i)
                        {
                        case 0:
                            switch (content[i])
                            {
                            case "ACK":
                                each.Type = ReturnMessage.ReturnType.Excuted;
                                break;

                            case "NAK":
                                each.Type = ReturnMessage.ReturnType.Error;
                                break;

                            case "FIN":
                                each.Type = ReturnMessage.ReturnType.Finished;
                                break;

                            case "EVT":
                                each.Type = ReturnMessage.ReturnType.Event;
                                break;
                            }
                            break;

                        case 1:

                            each.Command = content[i];
                            if (each.Command.Equals("PAUSE") || each.Command.Equals("STOP_"))
                            {
                                each.IsInterrupt = true;
                            }
                            break;

                        case 2:
                            each.Value = content[i];
                            break;
                        }
                    }
                    result.Add(each);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }

            return(result);
        }
예제 #3
0
        private List <ReturnMessage> TDKCodeAnalysis(string Msg)
        {
            List <ReturnMessage> result;

            try
            {
                result = new List <ReturnMessage>();

                if (Msg.Trim().Equals(""))
                {
                    return(result);
                }

                ReturnMessage each = new ReturnMessage();
                byte[]        t    = new byte[Encoding.ASCII.GetByteCount(Msg.ToString())];;
                int           c    = Encoding.ASCII.GetBytes(Msg.ToString(), 0, Encoding.ASCII.GetByteCount(Msg.ToString()), t, 0);


                each.NodeAdr = Encoding.Default.GetString(t, 3, 2);
                string contentStr = Encoding.Default.GetString(t, 5, t.Length - 5 - 3).Replace(";", "").Trim();

                string[] content = contentStr.Split(':', '/');

                for (int i = 0; i < content.Length; i++)
                {
                    switch (i)
                    {
                    case 0:
                        switch (content[i])
                        {
                        case "ACK":
                            each.Type = ReturnMessage.ReturnType.Excuted;
                            break;

                        case "NAK":
                            each.Type = ReturnMessage.ReturnType.Error;
                            break;

                        case "INF":
                            each.Type = ReturnMessage.ReturnType.Information;
                            break;

                        case "EVT":
                            each.Type = ReturnMessage.ReturnType.Event;
                            break;

                        case "ABS":
                            each.Type = ReturnMessage.ReturnType.Abnormal;
                            break;

                        case "RIF":
                            each.Type = ReturnMessage.ReturnType.ReInformation;
                            break;
                        }
                        break;

                    case 1:

                        each.Command = content[i];
                        if (each.Type == ReturnMessage.ReturnType.Information || each.Type == ReturnMessage.ReturnType.ReInformation)
                        {
                            each.FinCommand = TDKFinCommand(each.Command);
                        }
                        if (each.Command.Equals("PAUSE") || each.Command.Equals("STOP_"))
                        {
                            each.IsInterrupt = true;
                        }
                        break;

                    case 2:
                        each.Value = content[i];
                        break;
                    }
                }

                result.Add(each);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }

            return(result);
        }
예제 #4
0
        private List <ReturnMessage> ACDTCodeAnalysis(string Message)
        {
            List <ReturnMessage> result;

            byte[] msgAry;

            try
            {
                result = new List <ReturnMessage>();
                ReturnMessage each = new ReturnMessage();

                string hexString = Message.ToString().Replace("-", "");
                msgAry = new byte[hexString.Length / 2];
                for (int i = 0; i < hexString.Length; i = i + 2)
                {
                    //每2位16進位數字轉換為一個10進位整數
                    msgAry[i / 2] = Convert.ToByte(hexString.Substring(i, 2), 16);
                }


                //msgAry = Encoding.ASCII.GetBytes(Message);
                switch (msgAry[1])
                {
                case 21:    //ack
                    each.Type = ReturnMessage.ReturnType.Excuted;
                    break;

                case 22:    //nak
                    each.Type  = ReturnMessage.ReturnType.Error;
                    each.Value = "CheckSumError";
                    break;

                case 105:    //ack with value
                    switch (msgAry[5])
                    {
                    case 0:
                        each.Type  = ReturnMessage.ReturnType.Excuted;
                        each.Value = (Convert.ToInt32(msgAry[4]) * 10).ToString();
                        break;

                    case 1:
                        each.Type  = ReturnMessage.ReturnType.Error;
                        each.Value = "OverLoad";
                        break;

                    case 2:
                        each.Type  = ReturnMessage.ReturnType.Error;
                        each.Value = "HighTemperature";
                        break;
                    }

                    break;
                }
                if (msgAry[1] == 21 || msgAry[1] == 105)
                {
                    each.Type = ReturnMessage.ReturnType.Excuted;
                    if (msgAry[1] == 105 && msgAry.Length >= 8)
                    {
                        each.Value = (Convert.ToInt32(msgAry[4]) * 10).ToString();
                    }
                    each.NodeAdr = "1";
                }


                each.OrgMsg = Message;



                result.Add(each);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }

            return(result);
        }
예제 #5
0
        private List <ReturnMessage> ASYSTCodeAnalysis(string Message)
        {
            List <ReturnMessage> result;

            string[] msgAry;

            try
            {
                result = new List <ReturnMessage>();
                msgAry = Message.Split(new string[] { "\r\n" }, StringSplitOptions.None);

                foreach (string Msg in msgAry)
                {
                    if (Msg.Trim().Equals(""))
                    {
                        continue;
                    }
                    ReturnMessage each = new ReturnMessage();
                    each.OrgMsg  = Msg;
                    each.NodeAdr = "00";
                    string[] content = Msg.Replace("\r", "").Replace("\n", "").Split(' ');
                    for (int i = 0; i < content.Length; i++)
                    {
                        switch (each.CommandType)
                        {
                        case "FSD2":
                            switch (content[i].Substring(content[i].IndexOf("=") + 1))
                            {
                            case "F":
                                each.Value += "1";
                                break;

                            case "C":
                                each.Value += "2";
                                break;

                            case "E":
                                each.Value += "0";
                                break;

                            case "U":
                                each.Value += "?";
                                break;
                            }
                            each.Type = ReturnMessage.ReturnType.Excuted;
                            //each.CommandType = "GET";
                            break;

                        case "FSD0":
                            if (!each.Value.Equals(""))
                            {
                                each.Value += ",";
                            }
                            each.Value += content[i];
                            //each.CommandType = "GET";
                            each.Type = ReturnMessage.ReturnType.Excuted;
                            break;

                        default:

                            switch (i)
                            {
                            case 0:
                                each.CommandType = content[i];
                                break;

                            case 1:
                                if (each.CommandType.Equals("ECD"))
                                {
                                    each.CommandType = "ACK";
                                    each.Type        = ReturnMessage.ReturnType.Excuted;
                                    string[] param = content[i].Split('=');
                                    if (param.Length >= 2)
                                    {
                                        switch (param[0])
                                        {
                                        case "P30":
                                            each.Command = "GetSlotOffset";
                                            break;

                                        case "P31":
                                            each.Command = "GetWaferOffset";
                                            break;

                                        case "P35":
                                            each.Command = "GetSlotPitch";
                                            break;

                                        case "P36":
                                            each.Command = "GetTweekDistance";
                                            break;

                                        case "P39":
                                            each.Command = "GetCassetteSize";
                                            break;
                                        }
                                        each.Value = param[1];
                                    }
                                }
                                else
                                {
                                    switch (content[i])
                                    {
                                    case "ALARM":
                                    case "ABORT_CAL":
                                    case "ABORT_EMPTY_SLOT":
                                    case "ABORT_HOME":
                                    case "ABORT_LOCK":
                                    case "ABORT_MAP":
                                    case "ABORT_POS":
                                    case "ABORT_SLOT":
                                    case "ABORT_STAGE":
                                    case "ABORT_TWEEKDN":
                                    case "ABORT_TWEEKUP":
                                    case "ABORT_UNLOCK":
                                    case "ABORT_WAFER":
                                    case "WARNING":
                                    case "FATAL":
                                    case "FAILED_SELF-TEST":
                                        each.Type    = ReturnMessage.ReturnType.Error;
                                        each.Command = content[i];
                                        break;

                                    case "BUSY":
                                    case "DENIED":
                                    case "INVALID_ARG":
                                    case "NO_POD":
                                    case "NOT_READY":
                                        each.Type = ReturnMessage.ReturnType.Abnormal;
                                        break;

                                    case "OK":
                                        each.Type = ReturnMessage.ReturnType.Excuted;
                                        break;

                                    case "CMPL_CAL":
                                    case "CMPL_LOCK":
                                    case "CMPL_MAP":
                                    case "CMPL_SELF-TEST":
                                    case "CMPL_TWEEKDN":
                                    case "CMPL_TWEEKUP":
                                    case "CMPL_UNLOCK":
                                    case "REACH_EMPTY_SLOT":
                                    case "REACH_HOME":
                                    case "REACH_POS":
                                    case "REACH_SLOT":
                                    case "REACH_STAGE":
                                    case "REACH_WAFER":
                                        each.Type = ReturnMessage.ReturnType.Finished;
                                        break;

                                    case "POD_ARRIVED":
                                    case "POD_REMOVED":
                                    case "EXIT_HOME":
                                        each.Type    = ReturnMessage.ReturnType.Event;
                                        each.Command = content[i];
                                        break;

                                    default:

                                        each.Command = content[i];
                                        break;
                                    }
                                }
                                break;

                            case 2:
                                if (each.CommandType.Equals("ARS"))
                                {
                                    for (int p = 2; p < content.Length; p++)
                                    {
                                        if (!each.Value.Equals(""))
                                        {
                                            each.Value += " ";
                                        }
                                        each.Value += content[p];
                                    }
                                }
                                else
                                {
                                    each.Command = content[i];
                                }
                                break;
                            }
                            break;
                        }
                    }

                    result.Add(each);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }

            return(result);
        }
예제 #6
0
        private List <ReturnMessage> ATELCodeAnalysis(string Message)
        {
            List <ReturnMessage> result;
            string strMsg = string.Empty;

            string[]      msgAry;
            ReturnMessage each;

            try
            {
                result = new List <ReturnMessage>();

                strMsg = Message.Replace("\r", "").Replace("\n", "").Trim();

                if (strMsg.Equals(">") || strMsg.Equals(">*"))
                {
                    each         = new ReturnMessage();
                    each.OrgMsg  = strMsg;
                    each.NodeAdr = "1";
                    each.Type    = ReturnMessage.ReturnType.Excuted;
                    result.Add(each);
                }
                else if (strMsg.Length > 1)
                {
                    msgAry = Message.Split(new string[] { "\r\n" }, StringSplitOptions.None);

                    foreach (string Msg in msgAry)
                    {
                        if (Msg.Trim().Equals(""))
                        {
                            continue;
                        }

                        each         = new ReturnMessage();
                        each.OrgMsg  = Msg;
                        each.NodeAdr = Msg[1].ToString();
                        string[] content = Msg.Replace("\r", "").Replace("\n", "").Substring(2).Trim().Split('\r');
                        for (int i = 0; i < content.Length; i++)
                        {
                            switch (i)
                            {
                            case 0:
                                each.Type  = ReturnMessage.ReturnType.Finished;
                                each.Value = Msg;
                                break;

                            default:
                                each.Type  = ReturnMessage.ReturnType.Finished;
                                each.Value = Msg;
                                break;
                            }
                        }
                        result.Add(each);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }

            return(result);
        }
예제 #7
0
        private List <ReturnMessage> KAWASAKICodeAnalysis(string Message)
        {
            List <ReturnMessage> result;

            string[] msgAry;

            try
            {
                result = new List <ReturnMessage>();
                msgAry = Message.Replace("\r\n", "\r").Split('\r');

                foreach (string Msg in msgAry)
                {
                    if (Msg.Trim().Equals(""))
                    {
                        continue;
                    }
                    ReturnMessage each = new ReturnMessage();
                    each.OrgMsg  = Msg;
                    each.Command = Msg.Substring(Msg.IndexOf('<') + 1, Msg.IndexOf('>') - Msg.IndexOf('<') - 1);
                    string[] content = each.Command.Split(',');
                    for (int i = 0; i < content.Length; i++)
                    {
                        switch (i)
                        {
                        case 0:
                            each.Seq = content[0];
                            break;

                        case 1:

                            switch (content[i])
                            {
                            case "Ack":
                                each.Type = ReturnMessage.ReturnType.Excuted;
                                break;

                            case "Nak":
                                each.Type = ReturnMessage.ReturnType.Error;
                                if (content.Length > 2)
                                {
                                    each.Value = content[2];
                                }
                                break;

                            case "Success":
                                each.Type = ReturnMessage.ReturnType.Finished;
                                if (content.Length > 2)
                                {
                                    each.Value = content[2];
                                }
                                break;

                            case "Error":
                                each.Type = ReturnMessage.ReturnType.Error;
                                if (content.Length > 3)
                                {
                                    each.NodeAdr = content[3].ToString();
                                }
                                if (content.Length > 4)
                                {
                                    each.Value = content[2] + ":" + content[4];
                                }
                                break;

                            default:
                                each.CommandType = content[1];
                                break;
                            }
                            break;
                        }
                    }
                    result.Add(each);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }

            return(result);
        }