| | |
| | | clients.Remove(remote_ip); |
| | | buffers.Remove(remote_ip); |
| | | isSend.Remove(remote_ip); |
| | | isCheck.Remove(remote_ip); |
| | | saoMa.Remove(remote_ip); |
| | | return; |
| | | } |
| | | else |
| | |
| | | if (!buffers.Keys.Contains(remote_ip)) |
| | | { |
| | | buffers.Add(remote_ip, new byte[1024]); |
| | | |
| | | } |
| | | if (!isSend.Keys.Contains(remote_ip)) |
| | | { |
| | |
| | | { |
| | | 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 |
| | | { |
| | |
| | | { |
| | | //卷帘门开关 |
| | | 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 && |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | LogHelper.Error(ex.Message, ex); |
| | | } |
| | | } |
| | | |