| | |
| | | import HslCommunication.Profinet.Siemens.SiemensPLCS; |
| | | import HslCommunication.Profinet.Siemens.SiemensS7Net; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.asrs.entity.*; |
| | |
| | | } |
| | | |
| | | command.setCrnNo(slave.getId()); |
| | | short[] array = new short[9]; |
| | | short[] array = new short[12]; |
| | | if (command.getAckFinish() == 0) { |
| | | array[0] = 5; |
| | | } else { |
| | |
| | | array[7] = command.getDestinationPosX(); |
| | | } |
| | | array[8] = command.getDestinationPosY(); |
| | | if (!Cools.isEmpty(command.getAuto())){ |
| | | array[10] = command.getAuto(); |
| | | } |
| | | |
| | | |
| | | // 作业信息 |
| | | OperateResult result = siemensNet.Write("DB100.0", array); |
| | | // 任务号 + 完成位 |
| | | short[] array2 = new short[2]; |
| | | array2[0] = command.getTaskNo(); |
| | | array2[1] = command.getAckFinish(); |
| | | OperateResult result1 = siemensNet.Write("DB10.24", array2); |
| | | |
| | | // 结束位 |
| | | if (command.getAckFinish() == 0) { |
| | | OperateResult result2 = siemensNet.Write("DB10.28.1", true); |
| | | } |
| | | // // 任务号 + 完成位 |
| | | // short[] array2 = new short[2]; |
| | | // array2[0] = command.getTaskNo(); |
| | | // array2[1] = command.getAckFinish(); |
| | | // OperateResult result1 = siemensNet.Write("DB10.24", array2); |
| | | // |
| | | // // 结束位 |
| | | // if (command.getAckFinish() == 0) { |
| | | // OperateResult result2 = siemensNet.Write("DB10.28.1", true); |
| | | // } |
| | | |
| | | // 日志记录 |
| | | try { |
| | |
| | | CommandInfoLog commandInfoLog = JSON.parseObject(JSON.toJSONString(commandInfo), CommandInfoLog.class); |
| | | commandInfoLog.setId(null); |
| | | |
| | | if (result.IsSuccess && result1.IsSuccess) { |
| | | if (result.IsSuccess) { |
| | | log.warn("堆垛机命令下发[id:{},时间:{}] >>>>> {}", slave.getId(), DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmsssss_F), JSON.toJSON(command)); |
| | | OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command))); |
| | | |