| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | |
| | | @ManagerAuth(memo = "堆垛机信息表") |
| | | public R crnStateTable() { |
| | | List<CrnStateTableVo> list = new ArrayList<>(); |
| | | List<BasCrnp> crnps = basCrnpService.selectList(new EntityWrapper<BasCrnp>().orderBy("crn_no")); |
| | | List<BasCrnp> crnps = basCrnpService.list(new QueryWrapper<BasCrnp>().orderBy(true, true, "crn_no")); |
| | | for (BasCrnp basCrnp : crnps) { |
| | | // 表格行 |
| | | CrnStateTableVo vo = new CrnStateTableVo(); |
| | |
| | | vo.setForkOffset(crnProtocol.getForkPosType().desc); // 货叉位置 |
| | | vo.setLiftPos(crnProtocol.getLiftPosType().desc); |
| | | vo.setWalkPos(crnProtocol.getWalkPos() == 1 ? "不在定位" : "在定位"); |
| | | vo.setXspeed(crnProtocol.getXSpeed()); // 走行速度(m/min) |
| | | vo.setYspeed(crnProtocol.getYSpeed()); // 升降速度(m/min) |
| | | vo.setZspeed(crnProtocol.getZSpeed()); // 叉牙速度(m/min) |
| | | vo.setXdistance(crnProtocol.getXDistance()); // 走行距离(Km) |
| | | vo.setYdistance(crnProtocol.getYDistance()); // 升降距离(Km) |
| | | vo.setXduration(crnProtocol.getXDuration()); // 走行时长(H) |
| | | vo.setYduration(crnProtocol.getYDuration()); // 升降时长(H) |
| | | vo.setXspeed(String.format("%.2f", crnProtocol.getXSpeed())); // 走行速度(m/min) |
| | | vo.setYspeed(String.format("%.2f", crnProtocol.getYSpeed())); // 升降速度(m/min) |
| | | vo.setZspeed(String.format("%.2f", crnProtocol.getZSpeed())); // 叉牙速度(m/min) |
| | | vo.setXdistance(String.format("%.2f", crnProtocol.getXDistance())); // 走行距离(Km) |
| | | vo.setYdistance(String.format("%.2f", crnProtocol.getYDistance())); // 升降距离(Km) |
| | | vo.setXduration(String.format("%.2f", crnProtocol.getXDuration())); // 走行时长(H) |
| | | vo.setYduration(String.format("%.2f", crnProtocol.getYDuration())); // 升降时长(H) |
| | | vo.setTaskReceive(crnProtocol.getTaskReceive()); |
| | | |
| | | if (crnProtocol.getModeType().equals(CrnModeType.AUTO)) { |
| | | vo.setDeviceStatus("AUTO"); |
| | | } |
| | | |
| | | if (crnProtocol.getTaskNo() > 0) { |
| | | WrkMast wrkMast = wrkMastService.selectById(crnProtocol.getTaskNo()); |
| | | WrkMast wrkMast = wrkMastService.getById(crnProtocol.getTaskNo()); |
| | | if (wrkMast != null) { |
| | | vo.setSourceStaNo(String.valueOf(wrkMast.getSourceStaNo())); // 源站 |
| | | vo.setStaNo(String.valueOf(wrkMast.getStaNo())); // 目标站 |
| | |
| | | |
| | | vo.setWarnCode(String.valueOf(crnProtocol.getAlarm())); |
| | | if (crnProtocol.getAlarm() > 0) { |
| | | BasCrnpErr crnError = basCrnpErrService.selectById(crnProtocol.getAlarm()); |
| | | BasCrnpErr crnError = basCrnpErrService.getById(crnProtocol.getAlarm()); |
| | | vo.setAlarm(crnError == null ? "未知异常" : crnError.getErrName()); |
| | | vo.setDeviceStatus("ERROR"); |
| | | } |
| | |
| | | return R.error("线程不存在"); |
| | | } |
| | | |
| | | CrnCommand command = crnThread.getResetCommand(crnNo); |
| | | CrnCommand command = crnThread.getResetCommand(9999, crnNo); |
| | | MessageQueue.offer(SlaveType.Crn, crnNo, new Task(2, command)); |
| | | return R.ok(); |
| | | } |