| | |
| | | } |
| | | } |
| | | |
| | | if (slave.getId()==2){ |
| | | Thread.sleep(200); |
| | | int[] staNosRgv = {623,624,625,626}; |
| | | for (int i = 0; i < staNosRgv.length; i++) { |
| | | OperateResultExOne<byte[]> resultRgv = siemensS7Net.Read("DB100."+(1800+i*6), (short) 5); |
| | | OperateResultExOne<byte[]> resultRgv2 = siemensS7Net.Read("DB100."+(1824+i*12), (short) 8); |
| | | if (resultRgv.IsSuccess) { |
| | | Integer siteId = staNosRgv[i]; // 站点编号 |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null == staProtocol) { |
| | | continue; |
| | | } |
| | | try{ |
| | | staProtocol.setEndRow(siemensS7Net.getByteTransform().TransInt16(resultRgv2.Content, 0)); // 小车目标位 |
| | | |
| | | staProtocol.setNowRow(siemensS7Net.getByteTransform().TransInt16(resultRgv.Content, 2)); // 当前位置 |
| | | // staProtocol.setNowRow((short)2); // 当前位置 |
| | | |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(resultRgv.Content, 4, 1); |
| | | staProtocol.setRGV1(status[0]); // 小车无货空闲 |
| | | staProtocol.setRGV2(status[1]); // 小车输送线取货到位 |
| | | staProtocol.setRGV3(status[2]); // 小车运行中 |
| | | |
| | | // staProtocol.setRGV1(false); // 小车无货空闲 |
| | | // staProtocol.setRGV2(true); // 小车输送线取货到位 |
| | | // staProtocol.setRGV3(false); // 小车运行中 |
| | | |
| | | staProtocol.setRGV44(siemensS7Net.getByteTransform().TransInt16(resultRgv2.Content, 2));//小车改左侧货物目标站 |
| | | staProtocol.setRGV55(siemensS7Net.getByteTransform().TransInt16(resultRgv2.Content, 4)); //小车改右侧货物目标站 |
| | | staProtocol.setRGV66(siemensS7Net.getByteTransform().TransInt16(resultRgv2.Content, 6)); // 上位机清除平移车资料 |
| | | // |
| | | // staProtocol.setRGV44((short) 0);//小车改左侧货物目标站 |
| | | // staProtocol.setRGV55((short) 0); //小车改右侧货物目标站 |
| | | // staProtocol.setRGV66((short) 0); // 上位机清除平移车资料 |
| | | |
| | | staProtocol.setRGV4(staProtocol.getRGV44() != 0 && staProtocol.getRGV44() != 2);//小车改左侧货物目标站 |
| | | staProtocol.setRGV5(staProtocol.getRGV55() != 0 && staProtocol.getRGV55() != 2); //小车改右侧货物目标站 |
| | | staProtocol.setRGV6(staProtocol.getRGV66() != 0 && staProtocol.getRGV66() != 2); // 上位机清除平移车资料 |
| | | |
| | | |
| | | }catch (Exception e){ |
| | | log.error("读取RGV信息失败"+e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //条码扫描器 |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.2440",(short)(barcodeSize*8)); |
| | | if (result2.IsSuccess) { |
| | | int[] staNosRgv = new int[]{281,292,173,214,120}; |
| | | if (slave.getId()==2){ |
| | | staNosRgv = new int[]{453,460,508,534,611}; |
| | | } |
| | | for (int i = 0; i < barcodeSize; i++) { |
| | | //1:281 2:292 3:174(173) 4:214 5:120 |
| | | //6:453 7:460 8:508 9:534 10:611 |
| | | String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,i*8,8, "UTF-8"); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, (i + 1+((slave.getId()-1)*5))); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | Integer siteId = staNosRgv[i]; // 站点编号 |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null == staProtocol) { |
| | | continue; |
| | | } |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // //RGV小车 |
| | | // Thread.sleep(200); |
| | | // OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB100.160",(short)2); |
| | | // if (result3.IsSuccess) { |
| | | // Integer siteId = 2000; |
| | | // StaProtocol staProtocol = station.get(siteId); |
| | | // if (null == staProtocol) { |
| | | // staProtocol = new StaProtocol(); |
| | | // staProtocol.setSiteId(siteId); |
| | | // station.put(siteId, staProtocol); |
| | | // } |
| | | // staProtocol.setNearbySta(String.valueOf(siemensS7Net.getByteTransform().TransInt16(result3.Content, 0))); |
| | | // } |
| | | |
| | | if (result.IsSuccess) { |
| | | |