| | |
| | |
|
| | | import java.io.BufferedReader;
|
| | | import java.io.InputStreamReader;
|
| | | import java.net.InetSocketAddress;
|
| | | import java.net.Socket;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Scheduled(fixedDelay = Long.MAX_VALUE)
|
| | | public void scanCodeTaskCopy()
|
| | | {
|
| | | log.info("扫描任务已启动");
|
| | | try {
|
| | | BarcodeReadThread brt=new BarcodeReadThread(scanIp,scanPort,this);
|
| | | brt.start();
|
| | |
|
| | | }catch (Exception exception) {
|
| | | log.info("扫描任务启动异常,原因为{}", exception.getMessage());
|
| | | }
|
| | |
|
| | | }
|
| | | //socket读取到消息后会调用这个函数
|
| | | public void barcodeCheckin(String response)
|
| | | {
|
| | | log.info("扫描到的玻璃id:{}", response);
|
| | | List<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("scanCode");
|
| | | if (CollectionUtils.isNotEmpty(sendwServer)) {
|
| | | //按照玻璃id获取玻璃信息返回给前端界面,具体需要哪些数据待确认
|
| | | GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>()
|
| | | .eq(GlassInfo::getGlassId, response).last("limit 1"));
|
| | | if (null == glassInfo) {
|
| | | log.info("按照玻璃id:{},无法找到玻璃信息", response);
|
| | | } else {
|
| | | sendwServer.get(0).sendMessage(glassInfo.toString());
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|