| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean writeWorkSta(int siteId, short staNo, short workNo) { |
| | | int index = findStaNosIndex(siteId); |
| | | |
| | | OperateResult write1 = siemensS7Net.Write("DB100." + index*6, workNo); // 工作号 |
| | | OperateResult write2 = siemensS7Net.Write("DB100." + (index*6+4), staNo); // 目标站 |
| | | |
| | | if (!(write1.IsSuccess && write2.IsSuccess)) { |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (staProtocol.getWorkNo() == 0 && staProtocol.getStaNo() ==0) { |
| | | staProtocol.setPakMk(true); |
| | | } |
| | | 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)); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public Map<Integer, StaProtocol> getStation() { |
| | | return this.station; |
| | | } |
| | |
| | | } |
| | | return index; |
| | | } |
| | | |
| | | /** |
| | | * 设置入库标记 |
| | | */ |
| | | @Override |
| | | public void setPakMk(Integer siteId, boolean pakMk) { |
| | | StaProtocol staProtocol = station.get(siteId); |
| | | if (null != staProtocol) { |
| | | staProtocol.setPakMk(pakMk); |
| | | } |
| | | } |
| | | } |