| | |
| | | if (result2.IsSuccess) { |
| | | int[] staNosRgv = new int[]{281,292,173,214,120}; |
| | | if (slave.getId()==2){ |
| | | staNosRgv = new int[]{453,460,508,534,611}; |
| | | staNosRgv = new int[]{453,460,518,532,607}; |
| | | } |
| | | for (int i = 0; i < barcodeSize; i++) { |
| | | //1:281 2:292 3:174(173) 4:214 5:120 |
| | |
| | | } |
| | | staProtocol.setBarcode(barcode); |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (slave.getId()==2){ |
| | | OperateResultExOne<byte[]> result464 = siemensS7Net.Read("DB101.3720",(short)(8)); |
| | | if (result464.IsSuccess) { |
| | | String barcode = siemensS7Net.getByteTransform().TransString(result464.Content,0,8, "UTF-8"); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, 11); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | StaProtocol staProtocol = station.get(464); |
| | | if (null != staProtocol) { |
| | | staProtocol.setBarcode(barcode); |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | basDevps.add(staProtocol.toSqlModel()); |
| | | } |
| | | |
| | | BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class); |
| | | if (null != basDevpService && !basDevpService.updateBatchById(basDevps)) { |
| | | throw new Exception("更新数据库数据失败"); |
| | | try{ |
| | | BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class); |
| | | if (null != basDevpService && !basDevpService.updateBatchById(basDevps)) { |
| | | throw new Exception("更新数据库数据失败"); |
| | | } |
| | | } catch (Exception e){ |
| | | log.error("更新数据库数据失败 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |