示例#1
0
        public string ReadPlcDbValue(string plcName, ref string errText)
        {
            lock (plcName)
            {
                try
                {
                    errText = string.Empty;
                    PLClock plcRead = plcClass(plcName, ref errText);
                    if (errText.Trim().Length > 0)
                    {
                        return("01aaa");
                    }

                    List <object> read = plcRead.ReadPlc();

                    if (read == null)
                    {
                        return("01bbb");
                    }
                    if (read.Count == 0)
                    {
                        return("01ccc");
                    }
                    return(read[0].ToString());
                }
                catch (Exception ex)
                {
                    errText = ex.Message.ToString();
                    return("01ddd");// throw ex;
                }
            }
        }