| | |
| | | if (command.getTaskNo() == 0) { |
| | | command.setTaskNo((short) 9999); |
| | | } |
| | | // 代理 |
| | | switch (command.getSourcePosX()) { |
| | | case 1: |
| | | command.setSourcePosX((short) 4); |
| | | break; |
| | | case 2: |
| | | command.setSourcePosX((short) 3); |
| | | break; |
| | | case 3: |
| | | command.setSourcePosX((short) 2); |
| | | break; |
| | | case 4: |
| | | command.setSourcePosX((short) 1); |
| | | break; |
| | | case 5: |
| | | command.setSourcePosX((short) 4); |
| | | break; |
| | | case 6: |
| | | command.setSourcePosX((short) 3); |
| | | break; |
| | | case 7: |
| | | command.setSourcePosX((short) 2); |
| | | break; |
| | | case 8: |
| | | command.setSourcePosX((short) 1); |
| | | break; |
| | | default: |
| | | log.info("{}号堆垛机下方命令错误,源排:{}", command.getCrnNo(), command.getSourcePosX()); |
| | | } |
| | | switch (command.getDestinationPosX()) { |
| | | case 1: |
| | | command.setDestinationPosX((short) 4); |
| | | break; |
| | | case 2: |
| | | command.setDestinationPosX((short) 3); |
| | | break; |
| | | case 3: |
| | | command.setDestinationPosX((short) 2); |
| | | break; |
| | | case 4: |
| | | command.setDestinationPosX((short) 1); |
| | | break; |
| | | case 5: |
| | | command.setDestinationPosX((short) 4); |
| | | break; |
| | | case 6: |
| | | command.setDestinationPosX((short) 3); |
| | | break; |
| | | case 7: |
| | | command.setDestinationPosX((short) 2); |
| | | break; |
| | | case 8: |
| | | command.setDestinationPosX((short) 1); |
| | | break; |
| | | default: |
| | | log.info("{}号堆垛机下方命令错误,目标排:{}", command.getCrnNo(), command.getSourcePosX()); |
| | | } |
| | | command.setCrnNo(slave.getId()); |
| | | short[] array = new short[9]; |
| | | if (!command.getTaskModeType().equals(CrnTaskModeType.CLEAR)) { |
| | |
| | | array[7] = command.getSourceStaNo(); |
| | | array[8] = command.getDestinationStaNo(); |
| | | // 作业信息 |
| | | OperateResult result = siemensNet.Write("DB10.0", array); |
| | | OperateResult result = siemensNet.Write("DB1000.0", array); |
| | | // 任务号 |
| | | OperateResult result1 = siemensNet.Write("DB10.24", command.getTaskNo()); |
| | | OperateResult result1 = siemensNet.Write("DB1000.24", command.getTaskNo()); |
| | | // 结束位 |
| | | OperateResult result2 = siemensNet.Write("DB10.28.1", true); |
| | | if (result.IsSuccess && result1.IsSuccess && result2.IsSuccess) { |
| | | |
| | | try { |
| | | OperateResult result2 = siemensNet.Write("DB1000.28.1", true); |
| | | // 日志记录 |
| | | try { |
| | | if (command.getAckFinish() != 1) { |
| | | BasCrnOptService bean = SpringUtils.getBean(BasCrnOptService.class); |
| | | BasCrnOpt basCrnOpt = new BasCrnOpt( |
| | | command.getTaskNo().intValue(), // 任务号 |
| | |
| | | command.getSourcePosX().intValue(), // 源排 |
| | | command.getSourcePosY().intValue(), // 源列 |
| | | command.getSourcePosZ().intValue(), // 源层 |
| | | command.getSourceStaNo().intValue(), // 源站 |
| | | null, // 源站 |
| | | command.getDestinationPosX().intValue(), // 目标排 |
| | | command.getDestinationPosY().intValue(), // 目标列 |
| | | command.getDestinationPosZ().intValue(), // 目标层 |
| | | command.getDestinationStaNo().intValue(), // 目标站 |
| | | null, // 目标站 |
| | | null, // 响应结果 |
| | | null, // 修改时间 |
| | | null // 修改人员 |
| | | ); |
| | | bean.insert(basCrnOpt); |
| | | } |
| | | } catch (Exception ignore) {} |
| | | |
| | | if (result.IsSuccess && result1.IsSuccess && result2.IsSuccess) { |
| | | |
| | | log.info("堆垛机命令下发[id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command)); |
| | | OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command))); |
| | | return true; |