| | |
| | | } |
| | | } |
| | | |
| | | // //条码 |
| | | // Thread.sleep(200); |
| | | // OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB100.160",(short)4); |
| | | // if (result2.IsSuccess) { |
| | | // for (int i = 0; i < barcodeSize; i++) { |
| | | // 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)) { |
| | | // barcodeThread.setBarcode(barcode); |
| | | // } |
| | | // } |
| | | // |
| | | // } |
| | | //条码 |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.100",(short)31); |
| | | if (result2.IsSuccess) { |
| | | for (int i = 0; i < barcodeSize; i++) { |
| | | 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)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | } |
| | | |
| | | } |
| | | if (slave.getId() == 1){ |
| | | // 外形检测 - 102 |
| | | Thread.sleep(100); |
| | | OperateResultExOne<byte[]> result4 = siemensS7Net.Read("DB101.150", (short)1); |
| | | if (result4.IsSuccess) { |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(result4.Content, 0, 1); |
| | | StaProtocol staProtocol = station.get(103); |
| | | staProtocol.setFrontErr(status[0]); |
| | | staProtocol.setBackErr(status[1]); |
| | | staProtocol.setHighErr(status[2]); |
| | | staProtocol.setLeftErr(status[3]); |
| | | staProtocol.setRightErr(status[4]); |
| | | staProtocol.setWeightErr(status[5]); |
| | | staProtocol.setBarcodeErr(status[6]); |
| | | } |
| | | // 外形检测 - 107 |
| | | Thread.sleep(50); |
| | | OperateResultExOne<byte[]> result5 = siemensS7Net.Read("DB101.154", (short)1); |
| | | if (result5.IsSuccess) { |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(result5.Content, 0, 1); |
| | | StaProtocol staProtocol = station.get(107); |
| | | staProtocol.setFrontErr(status[0]); |
| | | staProtocol.setBackErr(status[1]); |
| | | staProtocol.setHighErr(status[2]); |
| | | staProtocol.setLeftErr(status[3]); |
| | | staProtocol.setRightErr(status[4]); |
| | | staProtocol.setWeightErr(status[5]); |
| | | staProtocol.setBarcodeErr(status[6]); |
| | | } |
| | | // 外形检测 - 111 |
| | | Thread.sleep(50); |
| | | OperateResultExOne<byte[]> result6 = siemensS7Net.Read("DB101.158", (short)1); |
| | | if (result6.IsSuccess) { |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(result6.Content, 0, 1); |
| | | StaProtocol staProtocol = station.get(111); |
| | | staProtocol.setFrontErr(status[0]); |
| | | staProtocol.setBackErr(status[1]); |
| | | staProtocol.setHighErr(status[2]); |
| | | staProtocol.setLeftErr(status[3]); |
| | | staProtocol.setRightErr(status[4]); |
| | | staProtocol.setWeightErr(status[5]); |
| | | staProtocol.setBarcodeErr(status[6]); |
| | | } |
| | | // 外形检测 - 115 |
| | | Thread.sleep(50); |
| | | OperateResultExOne<byte[]> result7 = siemensS7Net.Read("DB101.162", (short)1); |
| | | if (result7.IsSuccess) { |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(result7.Content, 0, 1); |
| | | StaProtocol staProtocol = station.get(115); |
| | | staProtocol.setFrontErr(status[0]); |
| | | staProtocol.setBackErr(status[1]); |
| | | staProtocol.setHighErr(status[2]); |
| | | staProtocol.setLeftErr(status[3]); |
| | | staProtocol.setRightErr(status[4]); |
| | | staProtocol.setWeightErr(status[5]); |
| | | staProtocol.setBarcodeErr(status[6]); |
| | | } |
| | | // 外形检测 - 119 |
| | | Thread.sleep(50); |
| | | OperateResultExOne<byte[]> result8 = siemensS7Net.Read("DB101.166", (short)1); |
| | | if (result8.IsSuccess) { |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(result8.Content, 0, 1); |
| | | StaProtocol staProtocol = station.get(119); |
| | | staProtocol.setFrontErr(status[0]); |
| | | staProtocol.setBackErr(status[1]); |
| | | staProtocol.setHighErr(status[2]); |
| | | staProtocol.setLeftErr(status[3]); |
| | | staProtocol.setRightErr(status[4]); |
| | | staProtocol.setWeightErr(status[5]); |
| | | staProtocol.setBarcodeErr(status[6]); |
| | | } |
| | | // 外形检测 - 123 |
| | | Thread.sleep(50); |
| | | OperateResultExOne<byte[]> result9 = siemensS7Net.Read("DB101.170", (short)1); |
| | | if (result9.IsSuccess) { |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(result9.Content, 0, 1); |
| | | StaProtocol staProtocol = station.get(123); |
| | | staProtocol.setFrontErr(status[0]); |
| | | staProtocol.setBackErr(status[1]); |
| | | staProtocol.setHighErr(status[2]); |
| | | staProtocol.setLeftErr(status[3]); |
| | | staProtocol.setRightErr(status[4]); |
| | | staProtocol.setWeightErr(status[5]); |
| | | staProtocol.setBarcodeErr(status[6]); |
| | | } |
| | | } else if (slave.getId() == 3) { |
| | | // 外形检测 - 111 |
| | | Thread.sleep(50); |
| | | OperateResultExOne<byte[]> result10 = siemensS7Net.Read("DB101.26", (short)1); |
| | | if (result10.IsSuccess) { |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(result10.Content, 0, 1); |
| | | StaProtocol staProtocol = station.get(301); |
| | | staProtocol.setFrontErr(status[0]); |
| | | staProtocol.setBackErr(status[1]); |
| | | staProtocol.setHighErr(status[2]); |
| | | staProtocol.setLeftErr(status[3]); |
| | | staProtocol.setRightErr(status[4]); |
| | | staProtocol.setWeightErr(status[5]); |
| | | staProtocol.setBarcodeErr(status[6]); |
| | | } |
| | | } |
| | | |
| | | |
| | | // //RGV台车位置 |
| | | // Thread.sleep(200); |