rfid扫描出的数据成功的写入数据库

注掉code写文件的逻辑
nanjing-yancao-rfid
LAPTOP-S9HJSOEB\昊天 3 years ago
parent f88f2d128a
commit 4eb9ad1895

@ -632,10 +632,10 @@ public class PlcService {
Thread.sleep(1000*configProperties.getRfid().getScanTime());
Set<String> tags = RFIDStop(plcCmdInfo);
if(tags!= null && tags.size()>0 && tags.contains(wmsTrayCode)){
trayCode = "";
trayCode = wmsTrayCode;
trayCheck = Boolean.TRUE;
}else {
trayCode = "未识别";
trayCode = "";
trayCheck = Boolean.FALSE;
log.warn("sick ocr error:{}",trayCode);
}

@ -1,5 +1,6 @@
package com.zhehekeji.web.service.RFID;
import com.baomidou.mybatisplus.extension.api.R;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
@ -46,6 +47,7 @@ public class RFIDSocket {
return tags;
}
public RFIDSocket(String ip,int port){
socket = new Socket();
os = null;
@ -103,11 +105,13 @@ public class RFIDSocket {
while (buffer.size()> 0){
String code = readTag();
if(code != null){
if(!tags.contains(code))
// 写入log
/*if(!tags.contains(code))
{
fw.write(code+"\n");
fw.flush();
}
}*/
System.out.println(code);
tags.add(code);
}
}
@ -236,7 +240,8 @@ public class RFIDSocket {
public static void main(String[] args) throws IOException, InterruptedException {
RFIDSocket rfid = new RFIDSocket("10.43.26.124",4001);
file = new File("F:\\Leaper\\Programs\\Java\\backend-duoji-monitor\\logs\\code.txt");
file = new File("D:\\code.txt");
file.createNewFile();
fw = new FileWriter(file, true);
fw.write("\n");
rfid.startCheck();

Loading…
Cancel
Save