| | |
| | | public boolean writeWorkNo(int siteId, short workNo) { |
| | | int index = findStaNosIndex(siteId); |
| | | |
| | | OperateResult write = siemensS7Net.Write("DB100." + index*6, workNo); // 工作号 |
| | | OperateResult write = siemensS7Net.Write("DB1001." + (index * 20 + 100 + 2), workNo); // 工作号 |
| | | |
| | | if (!write.IsSuccess) { |
| | | StaProtocol staProtocol = station.get(siteId); |
| | |
| | | public boolean writeStaNo(int siteId,short staNo) { |
| | | int index = findStaNosIndex(siteId); |
| | | |
| | | OperateResult write = siemensS7Net.Write("DB100." + (index*6+4), staNo); // 目标站 |
| | | OperateResult write = siemensS7Net.Write("DB1001." + (index * 20 + 100 + 4), staNo); // 目标站 |
| | | |
| | | if (!write.IsSuccess) { |
| | | StaProtocol staProtocol = station.get(siteId); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean writeWorkSta(int siteId, short staNo, short workNo) { |
| | | public boolean writeWorkSta(int siteId, short workNo, short staNo) { |
| | | int index = findStaNosIndex(siteId); |
| | | |
| | | OperateResult write1 = siemensS7Net.Write("DB100." + index*6, workNo); // 工作号 |
| | | OperateResult write2 = siemensS7Net.Write("DB100." + (index*6+4), staNo); // 目标站 |
| | | String workNoAddress = "DB1001." + (index * 20 + 100 + 2); |
| | | String staNoAddress = "DB1001." + (index * 20 + 100 + 4); |
| | | OperateResult write1 = siemensS7Net.Write(workNoAddress, workNo); // 工作号 |
| | | OperateResult write2 = siemensS7Net.Write(staNoAddress, staNo); // 目标站 |
| | | |
| | | if (!(write1.IsSuccess && write2.IsSuccess)) { |
| | | StaProtocol staProtocol = station.get(siteId); |
| | |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线站点数据失败。输送线plc编号={1},站点数据={2}", device.getId(), JSON.toJSON(staProtocol))); |
| | | log.error("写入输送线站点数据失败。输送线plc编号={},站点数据={}", device.getId(), JSON.toJSON(staProtocol)); |
| | | } else { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】 输送线命令下发 [id:{1}] >>>>> {2}", DateUtils.convert(new Date()), device.getId(), JSON.toJSON(staNo))); |
| | | log.info("输送线命令下发 [id:{}] >>>>> 命令下发: {}", device.getId(), JSON.toJSON(staNo)); |
| | | OutputQueue.DEVP.offer(MessageFormat.format("【{0}】 输送线命令下发 [id:{1}] >>>>> {2},{3}", DateUtils.convert(new Date()), device.getId(), JSON.toJSON(workNo), JSON.toJSON(staNo))); |
| | | log.info("输送线命令下发 [id:{}] >>>>> 命令下发: {},{}", device.getId(), JSON.toJSON(workNo),JSON.toJSON(staNo)); |
| | | return true; |
| | | } |
| | | return false; |
| | |
| | | WorkModeType workModeType = workModeTypeDto.getWorkModeType(); |
| | | if (workModeType != WorkModeType.NONE) { |
| | | if (!siemensS7Net.Write(workModeTypeDto.getAddress(), workModeType.id).IsSuccess) { |
| | | OutputQueue.DEVP.offer(MessageFormat.format("写入输送线{1}入出库模式失败。输送线编号={0}", device.getId(), workModeTypeDto.getSiteId())); |
| | | log.error("写入输送线{1}入出库模式失败。输送线编号={0}", device.getId(), workModeTypeDto.getSiteId()); |
| | | OutputQueue.DEVP.offer(MessageFormat.format("写入输送线{}入出库模式失败。输送线编号={}", workModeTypeDto.getSiteId(), device.getId())); |
| | | log.error("写入输送线{}入出库模式失败。输送线编号={}", workModeTypeDto.getSiteId(), device.getId()); |
| | | } |
| | | } |
| | | } |