/// <summary>
        /// 设备命令互发
        /// 基于网络
        /// </summary>
        /// <param name="index"></param>
        /// <param name="action"></param>
        /// <param name="paramter"></param>
        /// <returns></returns>
        public string SendEquipmentCmd(int index, string action, string paramter)
        {
            string    result = string.Empty;
            TcpClient client = new TcpClient();

            client.Connect(IPAddress.Parse(NetUtil.GetStationIp(index)), NetUtil.PORT_LITE_DATA_SERVER);
            using (NetworkStream stream = client.GetStream())
            {
                LiteData liteData = new LiteData();
                liteData.Name      = "RemoteEquipmentCmd";
                liteData.Paramters = new string[] { action, paramter };
                string request       = JsonConvert.SerializeObject(liteData);
                byte[] requestBuffer = System.Text.Encoding.UTF8.GetBytes(request);
                stream.Write(requestBuffer, 0, requestBuffer.Length);

                byte[] respBuffer = new byte[1024];
                int    len        = stream.Read(respBuffer, 0, respBuffer.Length);
                if (len > 0)
                {
                    result = System.Text.Encoding.UTF8.GetString(respBuffer, 0, len);
                }
            }
            client.Close();
            return(result);
        }
        private void ThreadProc(Object state)
        {
            TcpClient client = (TcpClient)state;

            NetworkStream stream = client.GetStream();

            Byte[] bytes = new Byte[1024];
            int    len   = stream.Read(bytes, 0, bytes.Length);

            if (len > 0)
            {
                String data = System.Text.Encoding.UTF8.GetString(bytes, 0, len);
                Log.Debug("LiteDataServer receive " + data);
                if (data.StartsWith("Inplace"))
                {
                    int pos = data.IndexOf(' ');
                    if (pos != -1)
                    {
                        String strIndex = data.Substring(pos + 1);
                        int    index    = Int32.Parse(strIndex);
                        if (InplaceEvent != null)
                        {
                            InplaceEvent(index);
                        }
                    }
                    byte[] response = new byte[4];
                    stream.Write(response, 0, response.Length);
                }
                else if (data.StartsWith("Complete"))
                {
                    int pos = data.IndexOf(' ');
                    if (pos != -1)
                    {
                        String strIndex = data.Substring(pos + 1);
                        int    index    = Int32.Parse(strIndex);
                        if (CompleteEvent != null)
                        {
                            CompleteEvent(index);
                        }
                    }
                    byte[] response = new byte[4];
                    stream.Write(response, 0, response.Length);
                }
                else if (data.StartsWith("PickPlace"))
                {
                    if (PickPlaceEvent != null)
                    {
                        PickPlaceEvent();
                    }
                    byte[] response = new byte[4];
                    stream.Write(response, 0, response.Length);
                }
                else if (data.StartsWith("TargetIp"))
                {
                    int pos = data.IndexOf(' ');
                    if (pos != -1)
                    {
                        String strIndex = data.Substring(pos + 1);
                        int    index    = Int32.Parse(strIndex);
                        string ip       = GetIp(index);
                        Log.Debug("phone ip = " + ip);
                        byte[] response = System.Text.Encoding.UTF8.GetBytes(ip);
                        stream.Write(response, 0, response.Length);
                    }
                }
                else
                {
                    LiteData liteData = JsonConvert.DeserializeObject <LiteData>(data);
                    if (liteData.Name == "RemoteEquipmentCmd")
                    {
                        if (liteData.Paramters != null && liteData.Paramters.Length >= 2)
                        {
                            string result;
                            EquipmentCmd.Instance.SendCommand(liteData.Paramters[0], liteData.Paramters[1], out result);

                            byte[] response = System.Text.Encoding.UTF8.GetBytes(result);
                            stream.Write(response, 0, response.Length);
                        }
                    }
                }
            }
            stream.Close();
            client.Close();
        }