| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.SpringUtils; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.domain.enums.TaskStatusType; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.TaskOverToWms; |
| | |
| | | /** |
| | | * 堆垛机站出库到出库站 |
| | | */ |
| | | @Async |
| | | public void crnStnToOutStn() { |
| | | for (CrnSlave crnSlave : slaveProperties.getCrn()) { |
| | | // 遍历堆垛机出库站 |
| | |
| | | && crnProtocol.forkPosType == CrnForkPosType.HOME) { |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | |
| | | //取出输送线命令 |
| | | List<CommandInfo> commandInfos = commandInfoService.selectByTaskNo(taskWrk.getTaskNo()); |
| | | if (commandInfos.isEmpty()) { |
| | | continue;//命令空 |
| | | } |
| | | try { |
| | | //取出输送线命令 |
| | | List<CommandInfo> commandInfos = commandInfoService.selectByTaskNo(taskWrk.getTaskNo()); |
| | | if (commandInfos.isEmpty()) { |
| | | continue;//命令空 |
| | | } |
| | | |
| | | // CommandPackage commandPackage = JSON.parseObject(commandInfo.getCommand(), CommandPackage.class);//取出命令报文 |
| | | // CrnCommand crnCommand = JSON.parseObject(commandPackage.getCommand().toString(), CrnCommand.class); |
| | | Integer commandStep = taskWrk.getCommandStep(); |
| | | CommandInfo commandInfo = commandInfos.get(commandStep); |
| | | CommandPackage commandPackage = JSON.parseObject(commandInfo.getCommand(), CommandPackage.class);//取出命令报文 |
| | | //StaProtocol staProtocol1 = JSON.parseObject(commandInfo.getCommand(), StaProtocol.class); |
| | | StaProtocol staProtocol1 = JSON.parseObject(commandPackage.getCommand().toString(), StaProtocol.class); |
| | | if (!MessageQueue.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(2, staProtocol1))) { |
| | | log.error("输送线命令下方失败!!! [工作号:{}]", taskWrk.getWrkNo()); |
| | | continue;//命令下发失败 |
| | | Integer commandStep = taskWrk.getCommandStep(); |
| | | CommandInfo commandInfo = commandInfos.get(commandStep); |
| | | CommandPackage commandPackage = JSON.parseObject(commandInfo.getCommand(), CommandPackage.class);//取出命令报文 |
| | | //StaProtocol staProtocol1 = JSON.parseObject(commandInfo.getCommand(), StaProtocol.class); |
| | | StaProtocol staProtocol1 = JSON.parseObject(commandPackage.getCommand().toString(), StaProtocol.class); |
| | | if (!MessageQueue.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(2, staProtocol1))) { |
| | | log.error("输送线命令下方失败!!! [工作号:{}]", taskWrk.getWrkNo()); |
| | | continue;//命令下发失败 |
| | | } |
| | | }catch (Exception e){ |
| | | throw new CoolException("取出输送线命令失败"); |
| | | } |
| | | |
| | | // 复位堆垛机 |
| | | crnThread.setResetFlag(true); |
| | | |
| | |
| | | if (!MessageQueue.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(2, crnCommand))) { |
| | | log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", taskWrk.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | } else { |
| | | //开始运行 |
| | | String response = CrnStartRunning(taskWrk); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | try { |
| | | //开始运行 |
| | | String response = CrnStartRunning(taskWrk); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | |
| | | }else { |
| | | log.error("入库开始运行通讯失败,"+jsonObject.get("msg")); |
| | | }else { |
| | | log.error("入库开始运行wms报错,"+jsonObject.get("msg")); |
| | | |
| | | } |
| | | }catch (Exception e) { |
| | | log.error("入库开始运行wms报错"); |
| | | } |
| | | |
| | | } |
| | | |
| | | // // 命令下发区 -------------------------------------------------------------------------- |
| | |
| | | }else { |
| | | log.error("修改工作档状态 11.生成出库ID => 12.吊车出库中!!,工作号={}", taskWrk.getWrkNo()); |
| | | } |
| | | //开始运行 |
| | | String response = CrnStartRunning(taskWrk); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | try { |
| | | //开始运行 |
| | | String response = CrnStartRunning(taskWrk); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | |
| | | }else { |
| | | log.error("出库开始运行通讯失败,"+jsonObject.get("msg")); |
| | | }else { |
| | | log.error("出库开始运行wms失败,"+jsonObject.get("msg")); |
| | | |
| | | } |
| | | }catch (Exception e){ |
| | | log.error("出库开始运行wms失败,"); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | /** |
| | | * 执行对工作档的完成操作 |
| | | */ |
| | | @Async |
| | | |
| | | public void storeFinished() { |
| | | for (CrnSlave crn : slaveProperties.getCrn()) { |
| | | // 获取堆垛机信息 |
| | |
| | | /** |
| | | * 堆垛机异常信息记录 |
| | | */ |
| | | @Async |
| | | |
| | | public void recCrnErr(){ |
| | | Date now = new Date(); |
| | | for (CrnSlave crn : slaveProperties.getCrn()) { |