| | |
| | | import java.io.InputStreamReader; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | import com.example.springboot.mapper.AlarmMapper; |
| | |
| | | FileInputStream fileInputStream; |
| | | try { |
| | | // 从文件中读取字节数据存入 fileInputStream |
| | | fileInputStream = new FileInputStream("D:/canadames/Alarm.json"); |
| | | fileInputStream = new FileInputStream("D:/Code/Albania_Mes/Alarm.json"); |
| | | // 读取 fileInputStream 中字节并将其解码为字符 |
| | | InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "utf-8"); |
| | | // 提高读取效率,在 BufferedReader 内包装 InputStreamReader |
| | |
| | | Integer Plccount = this.count; |
| | | |
| | | // 根据地址读取PCL数据 |
| | | List<Boolean> plclist = S7control.getinstance().ReadBits("DB104.0.0", Plccount); |
| | | List<Boolean> plclist = S7control.getinstance().ReadBits("DB15.0.0", Plccount); |
| | | // List<Boolean> plclist = S7control.getinstance().ReadBits(PlcAddress, Plccount); |
| | | // System.out.println(plclist); |
| | | System.out.println(plclist); |
| | | // Boolean[] values = { false, false, true, false, true, false, true, false, |
| | | // true, false, true, false, true, false, |
| | | // true, false, true, false, true, false, true, false, true, false, true, false, |
| | |
| | | alarmMapper = WebSocketServer.applicationContext.getBean(AlarmMapper.class); |
| | | for (short i = 0; i < array1.length; i++) { |
| | | // 查询对应报警信息结束时间为null的条数 |
| | | if(i==48){ |
| | | short result = alarmMapper.selectnullti(array1[i]); |
| | | System.out.println(result+"-"+array1[i]); |
| | | } |
| | | short result = alarmMapper.selectnullti(array1[i]); |
| | | // 读取到PLC的值为1并且对应报警信息结束时间为null的条数的条数为0 |
| | | //System.out.println(result); |