| | |
| | | public static final ArrayList<Integer> BarcodeList = new ArrayList<Integer>() {{ |
| | | add(0); add(1); add(2); |
| | | }}; |
| | | public static final ArrayList<Integer> BarcodeListMat = new ArrayList<Integer>() {{ |
| | | add(3); add(4); |
| | | }}; |
| | | public static final ArrayList<Integer> staNosErrList = new ArrayList<Integer>() {{ |
| | | add(106); add(107); add(159); |
| | | }}; |
| | |
| | | } |
| | | } |
| | | } |
| | | //条码扫描器 |
| | | ArrayList<Integer> barcodeListMat = BarcodeListMat; |
| | | OperateResultExOne<byte[]> result2Mat = siemensS7Net.Read("DB103.0", (short) (barcodeListMat.size() * 30)); |
| | | if (result2Mat.IsSuccess) { |
| | | for (int i = 0; i < barcodeListMat.size(); i++) { |
| | | Integer barcodeId = barcodeListMat.get(i); |
| | | String barcode = siemensS7Net.getByteTransform().TransString(result2Mat.Content,i*30,30, "UTF-8"); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId + 1); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | } |
| | | } |
| | | //外形检测 |
| | | ArrayList<Integer> staNoErrs = staNosErrList; |
| | | int staNoErrsSize = staNoErrs.size(); |
| | |
| | | Thread.sleep(200); |
| | | write1 = siemensS7Net.Write("DB100." + (index*6+4), staProtocol.getStaNo().shortValue()); // 目标站 |
| | | if(write.IsSuccess && write1.IsSuccess){ |
| | | log.error("写入输送线命令成功。输送线plc编号={},站点数据={},写入次数={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); |
| | | break; |
| | | } |
| | | else { |