| | |
| | | }}; |
| | | public static final ArrayList<Integer> staNos2 = new ArrayList<Integer>() {{ |
| | | add(300);add(301);add(302);add(303);add(304); |
| | | add(311);add(312);add(313);add(314);add(315); |
| | | }}; |
| | | |
| | | |
| | | |
| | | public static final ArrayList<Integer> barcode1 = new ArrayList<Integer>() {{ |
| | | add(1); add(2); |
| | |
| | | |
| | | public static final ArrayList<Integer> barcode2 = new ArrayList<Integer>() {{ |
| | | add(3); |
| | | }}; |
| | | |
| | | public static final ArrayList<Integer> barcode3 = new ArrayList<Integer>() {{ |
| | | add(4); |
| | | }}; |
| | | |
| | | private Integer count=0; |
| | |
| | | return barcode1; |
| | | case 2: |
| | | return barcode2; |
| | | case 3: |
| | | return barcode3; |
| | | default: |
| | | throw new CoolException("获取条码扫描器失败!"); |
| | | } |
| | |
| | | } |
| | | } else { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】读取输送线plc状态信息失败 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); |
| | | log.error("读取输送线plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}] ", slave.getId(), slave.getIp(), slave.getPort()); |
| | | // log.error("读取输送线plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}] ", slave.getId(), slave.getIp(), slave.getPort()); |
| | | } |
| | | |
| | | //条码扫描器 |
| | |
| | | } |
| | | } else { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】读取输送线plc状态信息失败 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort())); |
| | | log.error("读取输送线plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}] ", slave.getId(), slave.getIp(), slave.getPort()); |
| | | // log.error("读取输送线plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}] ", slave.getId(), slave.getIp(), slave.getPort()); |
| | | } |
| | | |
| | | //外形检测 |
| | | OperateResultExOne<byte[]> resultErr = siemensS7Net.Read("DB101.42", (short) 8); |
| | | if (resultErr.IsSuccess) { |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr.Content, 0, 1); |
| | | StaProtocol staProtocol = station.get(303); |
| | | StaProtocol staProtocol = station.get(304); |
| | | staProtocol.setFrontErr(status[0]); |
| | | staProtocol.setBackErr(status[1]); |
| | | staProtocol.setHighErr(status[2]); |
| | |
| | | } |
| | | // 根据实时信息更新数据库 |
| | | try { |
| | | if (!station.isEmpty()) { |
| | | List<BasDevp> basDevps = new ArrayList<>(); |
| | | for (Integer siteId : staNos) { |
| | | StaProtocol staProtocol = station.get(siteId); |
| | |
| | | if (null != basDevpService && !basDevpService.updateBatchById(basDevps)) { |
| | | throw new Exception("更新数据库数据失败"); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】更新数据库数据失败 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); |