| | |
| | | /** |
| | | * 条码数量 |
| | | */ |
| | | private int barcodeSize = 8; |
| | | private int barcodeSize = 6; |
| | | |
| | | /** |
| | | * 入出库模式 |
| | |
| | | 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); |
| | | boolean[] status = siemensS7Net.getByteTransform().TransBool(result1.Content, i*2, 2); |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | staProtocol.setAutoing(status[0]); // 自动 |
| | | staProtocol.setLoading(status[1]); // 有物 |
| | |
| | | staProtocol.setOutEnable(status[3]);// 可出 |
| | | staProtocol.setEmptyMk(status[4]); // 空板信号 |
| | | staProtocol.setFullPlt(status[5]); // 满托盘 |
| | | staProtocol.setHigh(status[6]); // 高库位 捷丰长托盘 |
| | | staProtocol.setLow(status[7]); // 低库位 捷丰短 |
| | | // 托盘 |
| | | staProtocol.setHigh(status[6]); // 高库位 捷丰大托盘 |
| | | staProtocol.setLow(status[7]); // 低库位 捷丰小托盘 |
| | | staProtocol.setFull(status[8]); // 托盘是可否整垛 |
| | | |
| | | if (!staProtocol.isPakMk() && !staProtocol.isLoading()) { |
| | | staProtocol.setPakMk(true); |
| | |
| | | } |
| | | } |
| | | |
| | | //条码扫描器 |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> result2 = null; |
| | | result2 = siemensS7Net.Read("DB100.200",(short)(barcodeSize*16)); |
| | | if (result2.IsSuccess) { |
| | | for (int i = 0; i < barcodeSize; i++) { |
| | | String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,i*16,8, "UTF-8"); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, slave.getId() == 1 ? i + 1 : i + 3); |
| | | if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { |
| | | barcodeThread.setBarcode(barcode); |
| | | // 条码扫描器 |
| | | if(slave.getId() == 2) { |
| | | Thread.sleep(200); |
| | | OperateResultExOne<byte[]> result2 = null; |
| | | result2 = siemensS7Net.Read("DB100.200", (short) (barcodeSize * 16)); |
| | | if (result2.IsSuccess) { |
| | | for (int i = 0; i < barcodeSize; i++) { |
| | | String barcode = siemensS7Net.getByteTransform().TransString(result2.Content, i * 16, 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() == 2 && this.ioModeOf1F3 != IoModeType.NONE) { |
| | | if (!siemensS7Net.Write("DB100.300", this.ioModeOf1F3.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线1F3入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线1F3入出库模式失败。输送线plc编号={2}", slave.getId())); |
| | | log.error("写入输送线1F3入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | if (slave.getId() == 2 && this.ioModeOf1F4 != IoModeType.NONE) { |
| | | if (!siemensS7Net.Write("DB100.302", this.ioModeOf1F4.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线1F4入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线1F4入出库模式失败。输送线plc编号={2}", slave.getId())); |
| | | log.error("写入输送线1F4入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | if (slave.getId() == 2 && this.ioModeOf2F1 != IoModeType.NONE) { |
| | | if (!siemensS7Net.Write("DB100.304", this.ioModeOf2F1.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线2F1入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线2F1入出库模式失败。输送线plc编号={2}", slave.getId())); |
| | | log.error("写入输送线2F1入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | if (slave.getId() == 2 && this.ioModeOf2F2 != IoModeType.NONE) { |
| | | if (!siemensS7Net.Write("DB100.306", this.ioModeOf2F2.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线2F2入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线2F2入出库模式失败。输送线plc编号={2}", slave.getId())); |
| | | log.error("写入输送线2F2入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | if (slave.getId() == 2 && this.ioModeOf3F1 != IoModeType.NONE) { |
| | | if (!siemensS7Net.Write("DB100.308", this.ioModeOf3F1.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线3F1入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线3F1入出库模式失败。输送线plc编号={2}", slave.getId())); |
| | | log.error("写入输送线3F1入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |
| | | if (slave.getId() == 2 && this.ioModeOf3F2 != IoModeType.NONE) { |
| | | if (!siemensS7Net.Write("DB100.310", this.ioModeOf3F2.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线3F2入出库模式失败。输送线plc编号={1}", slave.getId())); |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线3F2入出库模式失败。输送线plc编号={2}", slave.getId())); |
| | | log.error("写入输送线3F2入出库模式失败。输送线plc编号={}", slave.getId()); |
| | | } |
| | | } |