| | |
| | | import com.zy.core.properties.SystemProperties; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 堆垛机接口 |
| | |
| | | vo.setStatus("等待确认"); |
| | | } else { |
| | | vo.setStatus(crnProtocol.getStatusType().desc); // 状态 |
| | | if (crnProtocol.getStatusType().equals(com.zy.core.enums.CrnStatusType.PUT_COMPLETE)) { |
| | | vo.setStatus("正在作业"); |
| | | } |
| | | } |
| | | vo.setLoading(crnProtocol.getLoaded()==1?"有物":"无物"); // 有物 |
| | | vo.setBay(crnProtocol.getBay()); // 列 |
| | |
| | | if (crnProtocol.getPlatformLow()) { |
| | | vo.setSitePos("站台高位"); |
| | | } |
| | | // vo.setXOrigin(crnProtocol.getBay()==1?"是":"否"); // 走行原点 |
| | | // vo.setYOrigin(crnProtocol.getLevel()==1?"是":"否"); // 升降原点 |
| | | vo.setForkOffset(crnProtocol.getForkPosType().desc); // 货叉位置 |
| | | vo.setXLocation(crnProtocol.getWalkPos() == 1?"是":"否"); // 走行定位 |
| | | vo.setYLocation(crnProtocol.getLiftPosType().equals(CrnLiftPosType.NONE)?"否":"是"); // 升降定位 |
| | | // vo.setStop(crnProtocol.getCrnError1().controlStop||crnProtocol.getCrnError1().mainStop||crnProtocol.getCrnError1().remoteStop?"是":"否"); // 急停 |
| | | vo.setAlarm1(String.valueOf(crnProtocol.getAlarm1())); |
| | | vo.setAlarm2(String.valueOf(crnProtocol.getAlarm2())); |
| | | vo.setAlarm3(String.valueOf(crnProtocol.getAlarm3())); |
| | | vo.setAlarm4(String.valueOf(crnProtocol.getAlarm4())); |
| | | // vo.setWarnCode(String.valueOf(crnProtocol.getAlarm1())); // 异常码 |
| | | if (crnProtocol.getAlarm1() > 0) { |
| | | BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm1()); |
| | | vo.setAlarm1(crnError==null?"未知异常":crnError.getErrName()); |
| | | } |
| | | if (crnProtocol.getAlarm2() > 0) { |
| | | BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm2()); |
| | | vo.setAlarm2(crnError==null?"未知异常":crnError.getErrName()); |
| | | } |
| | | if (crnProtocol.getAlarm3() > 0) { |
| | | BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm3()); |
| | | vo.setAlarm3(crnError==null?"未知异常":crnError.getErrName()); |
| | | } |
| | | if (crnProtocol.getAlarm4() > 0) { |
| | | BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm4()); |
| | | vo.setAlarm4(crnError==null?"未知异常":crnError.getErrName()); |
| | | } |
| | | // vo.setAlarm1(String.valueOf(crnProtocol.getAlarm1())); |
| | | // vo.setAlarm2(String.valueOf(crnProtocol.getAlarm2())); |
| | | // vo.setAlarm3(String.valueOf(crnProtocol.getAlarm3())); |
| | | // vo.setAlarm4(String.valueOf(crnProtocol.getAlarm4())); |
| | | |
| | | } |
| | | return R.ok().add(list); |
| | |
| | | } |
| | | |
| | | vo.setWorkNo(crnProtocol.getTaskNo()); // 任务号 |
| | | BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm1()); |
| | | if (null != crnError) { |
| | | vo.setError(crnError.getErrName()); |
| | | } |
| | | if (crnProtocol.getTaskNo()>0) { |
| | | WrkMast wrkMast = wrkMastService.selectById(crnProtocol.getTaskNo()); |
| | | if (wrkMast != null) { |
| | |
| | | return R.ok().add(str.toString()); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/demo/status") |
| | | public R demoStatus(){ |
| | | List<Map<String, Object>> res = new ArrayList<>(); |
| | | for (CrnSlave crnSlave : slaveProperties.getCrn()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("crnNo", crnSlave.getId()); |
| | | map.put("demo", crnSlave.getDemo()); |
| | | res.add(map); |
| | | } |
| | | return R.ok().add(res); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/demo/switch") |
| | | @ManagerAuth(memo = "堆垛机演示") |
| | | public R crnDemo(CrnDemoParam param) throws InterruptedException { |
| | |
| | | return R.error("口令错误"); |
| | | } |
| | | Thread.sleep(200L); |
| | | mainService.crnDemoOfLocMove(param.getCrnId()); |
| | | for (CrnSlave crnSlave : slaveProperties.getCrn()) { |
| | | if (crnSlave.getId().equals(param.getCrnId())) { |
| | | crnSlave.setDemo(param.getOpt()); |
| | | } |
| | | } |
| | | // mainService.crnDemoOfLocMove(param.getCrnId()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | /****************************************************************/ |
| | | /************************** 手动操作 ******************************/ |
| | | /****************************************************************/ |