| | |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.SpringUtils; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.BasShuttle; |
| | | import com.zy.asrs.entity.BasShuttleOpt; |
| | | import com.zy.asrs.mapper.BasShuttleMapper; |
| | | import com.zy.asrs.service.BasShuttleOptService; |
| | | import com.zy.asrs.service.BasShuttleService; |
| | | import com.zy.common.model.NavigateNode; |
| | | import com.zy.common.utils.CommonUtils; |
| | | import com.zy.common.utils.NavigatePositionConvert; |
| | |
| | | |
| | | ///读取四向穿梭车状态-end |
| | | |
| | | OutputQueue.SHUTTLE.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId())); |
| | | log.info(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId())); |
| | | |
| | | //小车处于忙碌状态,将标记置为true |
| | | if (shuttleProtocol.getBusyStatusType() == ShuttleStatusType.BUSY) { |
| | | shuttleProtocol.setPakMk(true); |
| | |
| | | executeWork(shuttleProtocol.getAssignCommand()); |
| | | } |
| | | |
| | | //将四向穿梭车状态保存至数据库 |
| | | BasShuttleService shuttleService = SpringUtils.getBean(BasShuttleService.class); |
| | | BasShuttle basShuttle = shuttleService.selectById(shuttleProtocol.getShuttleNo()); |
| | | if (basShuttle == null) { |
| | | basShuttle = new BasShuttle(); |
| | | //四向穿梭车号 |
| | | basShuttle.setShuttleNo(slave.getId()); |
| | | shuttleService.insert(basShuttle); |
| | | } |
| | | //小车忙状态位 |
| | | basShuttle.setBusyStatus(shuttleProtocol.getBusyStatus().intValue()); |
| | | //当前二维码 |
| | | basShuttle.setCurrentCode(shuttleProtocol.getCurrentCode().intValue()); |
| | | //电池电量百分比 |
| | | basShuttle.setBatteryPower(shuttleProtocol.getBatteryPower().intValue()); |
| | | //电池温度 |
| | | basShuttle.setBatteryTemp(shuttleProtocol.getBatteryTemp().intValue()); |
| | | //错误编号 |
| | | basShuttle.setErrorCode(shuttleProtocol.getErrorCode().intValue()); |
| | | //Plc输出状态IO |
| | | basShuttle.setPlcOutputStatusIo(shuttleProtocol.getPlcOutputStatusIO().intValue()); |
| | | //错误信息码 |
| | | basShuttle.setStatusErrorCode(shuttleProtocol.getStatusErrorCode().intValue()); |
| | | //PLC输入状态 |
| | | basShuttle.setPlcInputStatus(shuttleProtocol.getPlcInputStatus().intValue()); |
| | | //当前或者之前读到的二维码值 |
| | | basShuttle.setCurrentOrBeforeCode(shuttleProtocol.getCurrentOrBeforeCode().intValue()); |
| | | //读到的二维码X方向偏移量 |
| | | basShuttle.setCodeOffsetX(shuttleProtocol.getCodeOffsetX().intValue()); |
| | | //读到的二维码Y方向偏移量 |
| | | basShuttle.setCodeOffsetY(shuttleProtocol.getCodeOffsetY().intValue()); |
| | | //当前的电压值 |
| | | basShuttle.setCurrentVoltage(shuttleProtocol.getCurrentVoltage().intValue()); |
| | | //当前的模拟量值 |
| | | basShuttle.setCurrentAnalogValue(shuttleProtocol.getCurrentAnalogValue().intValue()); |
| | | //当前的升降伺服速度 |
| | | basShuttle.setCurrentLiftServoSpeed(shuttleProtocol.getCurrentLiftServoSpeed().intValue()); |
| | | //当前的行走伺服速度 |
| | | basShuttle.setCurrentMoveServoSpeed(shuttleProtocol.getCurrentMoveServoSpeed().intValue()); |
| | | //当前的升降伺服负载率 |
| | | basShuttle.setCurrentLiftServoLoad(shuttleProtocol.getCurrentLiftServoLoad().intValue()); |
| | | //当前的行走伺服负载率 |
| | | basShuttle.setCurrentMoveServoLoad(shuttleProtocol.getCurrentMoveServoLoad().intValue()); |
| | | //当前小车状态(内部自我维护) |
| | | basShuttle.setShuttleStatus(shuttleProtocol.getProtocolStatus()); |
| | | //任务号 |
| | | basShuttle.setWrkNo(shuttleProtocol.getTaskNo().intValue()); |
| | | //修改时间 |
| | | basShuttle.setUpdateTime(new Date()); |
| | | //作业标记 |
| | | basShuttle.setPakMk(shuttleProtocol.getPakMk()); |
| | | if (shuttleService.updateById(basShuttle)) { |
| | | OutputQueue.SHUTTLE.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId())); |
| | | log.info(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId())); |
| | | } |
| | | |
| | | }else { |
| | | OutputQueue.SHUTTLE.offer(MessageFormat.format("【{0}】{1}四向穿梭车plc状态信息失败", DateUtils.convert(new Date()), slave.getId())); |
| | | throw new CoolException(MessageFormat.format( "四向穿梭车plc状态信息失败 ===>> [id:{0}] [ip:{1}] [port:{2}]", slave.getId(), slave.getIp(), slave.getPort())); |