| | |
| | | import com.zy.asrs.wcs.rcs.cache.OutputQueue; |
| | | import com.zy.asrs.wcs.rcs.entity.Device; |
| | | import com.zy.asrs.wcs.rcs.entity.DeviceDataLog; |
| | | import com.zy.asrs.wcs.rcs.model.CommandResponse; |
| | | import com.zy.asrs.wcs.rcs.model.enums.LiftProtocolStatusType; |
| | | import com.zy.asrs.wcs.rcs.model.protocol.LiftProtocol; |
| | | import com.zy.asrs.wcs.rcs.service.DeviceDataLogService; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean move(LiftCommand command) { |
| | | public CommandResponse move(LiftCommand command) { |
| | | return write(command); |
| | | } |
| | | |
| | | @Override |
| | | public boolean palletInOut(LiftCommand command) { |
| | | public CommandResponse palletInOut(LiftCommand command) { |
| | | return write(command); |
| | | } |
| | | |
| | | private boolean write(LiftCommand command) { |
| | | private CommandResponse write(LiftCommand command) { |
| | | CommandResponse response = new CommandResponse(false); |
| | | if (null == command) { |
| | | News.error("提升机写入命令为空"); |
| | | return false; |
| | | response.setMessage("提升机写入命令为空"); |
| | | return response; |
| | | } |
| | | |
| | | List<Short> shorts = JSON.parseArray(command.getBody(), Short.class); |
| | |
| | | liftProtocol.setSendTime(System.currentTimeMillis());//指令下发时间 |
| | | News.info("提升机命令下发[id:{}] >>>>> {}", device.getId(), JSON.toJSON(command)); |
| | | OutputQueue.LIFT.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2}", DateUtils.convert(new Date()), device.getId(), JSON.toJSON(command))); |
| | | return true; |
| | | response.setMessage(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2}", DateUtils.convert(new Date()), device.getId(), JSON.toJSON(command))); |
| | | response.setResult(true); |
| | | return response; |
| | | } else { |
| | | OutputQueue.LIFT.offer(MessageFormat.format("【{0}】写入提升机plc数据失败 ===>> [id:{1}] [ip:{2}] [port:{3}],次数:{}", DateUtils.convert(new Date()), device.getId(), device.getIp(), device.getPort())); |
| | | News.error("写入提升机plc数据失败 ===>> [id:{}] [ip:{}] [port:{}]", device.getId(), device.getIp(), device.getPort()); |
| | | return false; |
| | | response.setMessage(MessageFormat.format("【{0}】写入提升机plc数据失败 ===>> [id:{1}] [ip:{2}] [port:{3}],次数:{}", DateUtils.convert(new Date()), device.getId(), device.getIp(), device.getPort())); |
| | | return response; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public boolean lock(LiftCommand command) { |
| | | return true; |
| | | public CommandResponse lock(LiftCommand command) { |
| | | return new CommandResponse(true); |
| | | } |
| | | |
| | | @Override |
| | | public boolean unlock(LiftCommand command) { |
| | | return true; |
| | | public CommandResponse unlock(LiftCommand command) { |
| | | return new CommandResponse(true); |
| | | } |
| | | |
| | | @Override |
| | | public boolean reset(LiftCommand command) { |
| | | return false; |
| | | public CommandResponse reset(LiftCommand command) { |
| | | return new CommandResponse(false); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public int generateDeviceTaskNo(int taskNo, MotionCtgType motionCtgType) { |
| | | return taskNo; |
| | | } |
| | | |
| | | @Override |
| | | public List<LiftCommand> getMoveCommand(Integer taskNo, Integer sourceLev, Integer targetLev, LiftCommandModeType mode) { |
| | | /** |
| | | * 任务类型 |