| | |
| | | package com.zy.core.thread.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.asrs.entity.*; |
| | |
| | | try { |
| | | deviceLogCollectTime = Utils.getDeviceLogCollectTime(); |
| | | readStatus(); |
| | | Thread.sleep(100); |
| | | Thread.sleep(50); |
| | | } catch (Exception e) { |
| | | log.error("CrnThread Fail", e); |
| | | } |
| | |
| | | |
| | | } |
| | | if (basCrnpService != null) { |
| | | BasCrnp basCrnp = basCrnpService.selectOne(new EntityWrapper<BasCrnp>().eq("crn_no", deviceConfig.getDeviceNo())); |
| | | BasCrnp basCrnp = basCrnpService.getOne(new QueryWrapper<BasCrnp>().eq("crn_no", deviceConfig.getDeviceNo())); |
| | | if(basCrnp == null) { |
| | | basCrnp = new BasCrnp(); |
| | | basCrnp.setCrnNo(deviceConfig.getDeviceNo()); |
| | |
| | | basCrnp.setMaxInTask(5); |
| | | basCrnp.setMaxOutTask(5); |
| | | basCrnp.setCreateTime(new Date()); |
| | | basCrnpService.insert(basCrnp); |
| | | basCrnpService.save(basCrnp); |
| | | } |
| | | } |
| | | } |
| | |
| | | crnProtocol.setYDistance(crnStatus.getYDistance()); |
| | | crnProtocol.setXDuration(crnStatus.getXDuration()); |
| | | crnProtocol.setYDuration(crnStatus.getYDuration()); |
| | | crnProtocol.setTaskReceive(crnStatus.getTaskReceive()); |
| | | |
| | | OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), deviceConfig.getDeviceNo())); |
| | | |
| | |
| | | log.setStatus(1); |
| | | log.setCreateTime(new Date()); |
| | | log.setSystemStatus(JSON.toJSONString(crnProtocol)); |
| | | errLogService.insert(log); |
| | | errLogService.save(log); |
| | | if (log.getId() != null) { |
| | | redisUtil.set(errFlagKey, log.getId(), 60 * 60 * 24); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public CrnCommand getResetCommand(Integer crnNo) { |
| | | public CrnCommand getResetCommand(Integer taskNo, Integer crnNo) { |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | | crnCommand.setCrnNo(crnNo); // 堆垛机编号 |
| | | crnCommand.setTaskNo(0); // 工作号 |
| | | crnCommand.setTaskNo(taskNo); // 工作号 |
| | | crnCommand.setAckFinish(1); // 任务完成确认位 |
| | | crnCommand.setTaskMode(CrnTaskModeType.NONE.id); // 任务模式 |
| | | crnCommand.setTaskMode(CrnTaskModeType.RESET.id); // 任务模式 |
| | | crnCommand.setSourcePosX(0); // 源库位排 |
| | | crnCommand.setSourcePosY(0); // 源库位列 |
| | | crnCommand.setSourcePosZ(0); // 源库位层 |
| | |
| | | JSON.toJSONString(response) |
| | | ); |
| | | if (bean != null) { |
| | | bean.insert(basCrnpOpt); |
| | | bean.save(basCrnpOpt); |
| | | } |
| | | } |
| | | } |