杨张扬
3 天以前 6f89acbf74c6838db518a9f2b6c83f0ab0d97e7f
device/TcpServer.cs
@@ -100,8 +100,6 @@
                    clients.Remove(remote_ip);
                    buffers.Remove(remote_ip);
                    isSend.Remove(remote_ip);
                    isCheck.Remove(remote_ip);
                    saoMa.Remove(remote_ip);
                    return;
                }
                else
@@ -144,18 +142,23 @@
                        {
                            saoMa.Add(remote_ip, 3);
                        }
                        if (messageBytes.Length <= 20 && messageBytes.Length > 0)
                        if (messageBytes.Length <= 20 && messageBytes.Length > 0)//长度不够时直接判断扫码失败
                        {
                            saoMa[remote_ip] = 3;//未扫到码
                        }
                        if (messageBytes.Length >= 21 && isCheck[remote_ip])
                        if (messageBytes.Length >= 21
                            && isCheck[remote_ip]
                            && messageBytes[0] == 0xCC
                            && messageBytes[1] == 0xFF
                            && messageBytes[2] == 0xFF)
                        {
                            byte[] rfid = new byte[12];
                            Array.Copy(messageBytes, 9, rfid, 0, 12);
                            string rfids16 = BitConverter.ToString(rfid);
                            string rfids = Encoding.ASCII.GetString(rfid);
                            string rfids16 = BitConverter.ToString(messageBytes);
                            string rfids = Encoding.ASCII.GetString(rfid);//截取字符串
                            LogHelper.Info($"读卡器校验对应容器号:{rfids},其16进制形式:{rfids16}");
                            if (ScanCodeHelper.Analysis(remote_ip, rfids))//校验RFID
                            {
@@ -183,7 +186,7 @@
                    {
                        //卷帘门开关
                        var plc = Settings.SafeDoorDevices.FirstOrDefault(a => a.IPAddress == remote_ip);
                        var log = string.Join(",", messageBytes.Select(x => x.ToString()));
                        var log = BitConverter.ToString(messageBytes);
                        if (plc != null &&
                            messageBytes[0] == 0x3F &&
                            messageBytes[1] == 0x00 &&
@@ -229,7 +232,7 @@
            }
            catch (Exception ex)
            {
               LogHelper.Error(ex.Message, ex);
            }
        }