| | |
| | | |
| | | import com.example.springboot.entity.GlassInfo; |
| | | import com.example.springboot.entity.MeasureSetting; |
| | | import com.example.springboot.entity.Queue; |
| | | import com.example.springboot.mapper.GlassInfoMapper; |
| | | import com.example.springboot.mapper.MeasureSettingMapper; |
| | | import com.example.springboot.mapper.QueueMapper; |
| | |
| | | |
| | | // 匹配逻辑 |
| | | public boolean Normal(double width, double height, String line) { |
| | | List<Queue> ErrowQueues= QueueMapper.selectErrorQueues(); |
| | | if (ErrowQueues.size()>0) { |
| | | //System.out.println("有匹配失败数据未去除"); |
| | | return false; |
| | | } |
| | | List<GlassInfo> Result = NormalGlassInfo(width, height, "1"); |
| | | if (Result.size() == 1) { |
| | | // 匹配成功 就一种类型 添加数据 |
| | |
| | | QueueMapper.insert(GlassInfo.getGlassid(), width, height, 1); |
| | | GlassInfoMapper.updatemeasurenumber(GlassInfo.getId()); |
| | | System.out.println("匹配成功"); |
| | | |
| | | // S7control.getinstance().WriteWord(plcmes.getPlcParameter("GaToMES").getAddress(), |
| | | // (short) 1); |
| | | System.out.println(GlassInfo.getGlassid()); |
| | | return true; |
| | | } else if (Result.size() > 1) { |
| | | // 匹配失败 匹配到多条符合的数据 添加数据 |
| | | QueueMapper.insert(null, width, height, 2); |
| | | QueueMapper.insertMatchFailure(width, height, 0); |
| | | System.out.println("匹配失败"); |
| | | return false; |
| | | |
| | | } else { |
| | | // 匹配失败 未找到符合的数据 添加数据 |
| | | QueueMapper.insert(null, width, height, 3); |
| | | QueueMapper.insertMatchFailure(width, height, -1); |
| | | System.out.println("未找到符合的数据"); |
| | | return false; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | // Execl表格 传入文件路径 |
| | |
| | | try { |
| | | // 创建文件对象 |
| | | File file = new File(filename); |
| | | if (!file.exists()) { |
| | | System.out.println("文件不存在! "+filename); |
| | | return new ArrayList<>(); |
| | | } |
| | | // 创建文件输入流对象 |
| | | FileInputStream inputStream = new FileInputStream(file); |
| | | // 创建工作簿对象 |