| | |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.2440",(short)(barcodeSize*8)); |
| | | if (result2.IsSuccess) { |
| | | for (int i = 0; i < barcodeSize; i++) { //1:281 2:292 3:174 4:214 5:120 |
| | | int[] staNosRgv = {281,292,173,214,120}; |
| | | |
| | | for (int i = 0; i < barcodeSize; i++) { //1:281 2:292 3:174(173) 4:214 5:120 |
| | | String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,i*8,8, "UTF-8"); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | Integer siteId = staNosRgv[i]; // 站点编号 |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null == staProtocol) { |
| | | staProtocol = new StaProtocol(); |
| | | staProtocol.setSiteId(siteId); |
| | | station.put(siteId, staProtocol); |
| | | } |
| | | staProtocol.setBarcode(barcode); |
| | | barcodeThread.setBarcode(barcode); |
| | | System.out.println(barcode+"读取到条码:"+i); |
| | | } |
| | | } |
| | | } |