| | |
| | | staProtocol.setSiteId(siteId); |
| | | station.put(siteId, staProtocol); |
| | | } |
| | | staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i*8)); // 工作号 |
| | | staProtocol.setWorkNo((short)siemensS7Net.getByteTransform().TransInt32(result.Content, i*8)); // 工作号 |
| | | |
| | | staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i*8 + 4)); // 目标站 |
| | | } |
| | | } |
| | | |
| | | //Thread.sleep(200); |
| | | OperateResultExOne<byte[]> result1 = siemensS7Net.Read("DB101.0", (short) (staNoSize*2)); |
| | | if (result1.IsSuccess) { |
| | | for (int i = 0; i < staNoSize; i++) { |
| | | Integer siteId = staNos.get(i); // 站点编号 |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(result1.Content, i*2, 1); |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(result.Content, i*8 + 6, 2); |
| | | staProtocol.setAutoing(status[0]); // 自动 |
| | | staProtocol.setLoading(status[1]); // 有物 |
| | | staProtocol.setInEnable(status[2]); // 可入 |
| | | staProtocol.setOutEnable(status[3]);// 可出 |
| | | staProtocol.setEmptyMk(status[4]); // 空板信号 |
| | | staProtocol.setFullPlt(status[5]); // 满托盘 |
| | | staProtocol.setCar(status[6]); // 是否有车 |
| | | staProtocol.setHigh(status[6]); // 高库位 |
| | | staProtocol.setLow(status[7]); // 低库位 |
| | | |
| | | if (!staProtocol.isPakMk() && !staProtocol.isLoading()) { |
| | |
| | | //Thread.sleep(200); |
| | | OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.840.0",(short)60); |
| | | if (result2.IsSuccess) { |
| | | for (int i = 0; i < 6; i++) { |
| | | for (int i = 0; i < 4; i++) { |
| | | String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,i*10,8, "UTF-8"); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 外形检测 - 102 |
| | | //Thread.sleep(100); |
| | | OperateResultExOne<byte[]> result4 = siemensS7Net.Read("DB101.160", (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.164", (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.168", (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.172", (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.176", (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.180", (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) { |
| | | |
| | | //条码 |
| | | //Thread.sleep(200); |
| | | OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.18",(short)10); |
| | | if (result2.IsSuccess) { |
| | | |
| | | String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,0,8, "UTF-8"); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, 7); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | } |
| | | |
| | | } |
| | | // 外形检测 - 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台车位置 |
| | |
| | | // this.ioMode = IoModeType.get(result2.Content); |
| | | // } |
| | | |
| | | if (result.IsSuccess && result1.IsSuccess) { |
| | | if (result.IsSuccess ) { |
| | | |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId())); |
| | | |