|  |  | 
 |  |  |                         crnProtocol.setLastIo("O"); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 // 库位移转 | 
 |  |  |                 this.locToLoc(crn, crnProtocol); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return false; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 库位移转 | 
 |  |  |      */ | 
 |  |  |     public void locToLoc(CrnSlave slave, CrnProtocol crnProtocol){ | 
 |  |  |         // 获取工作档信息 | 
 |  |  |         WrkMast wrkMast = wrkMastMapper.selectLocMove(slave.getId()); | 
 |  |  |         if (null == wrkMast) { | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |         // 获取源库位信息 | 
 |  |  |         LocMast sourceSta = locMastService.selectById(wrkMast.getSourceLocNo()); | 
 |  |  |         if (null == sourceSta) { | 
 |  |  |             log.error("工作档库位移转失败,原因:检索源库位失败!工作号={},源库位={}", wrkMast.getWrkNo(), wrkMast.getSourceLocNo()); | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |         // 源库位  库位状态判断 | 
 |  |  |         if (!sourceSta.getLocSts().equals("R") && !sourceSta.getLocSts().equals("S")) { | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |         // 获取目标库位信息 | 
 |  |  |         LocMast sta = locMastService.selectById(wrkMast.getLocNo()); | 
 |  |  |         if (null == sta) { | 
 |  |  |             log.error("工作档库位移转失败,原因:检索目标库位失败!工作号={},源库位={}", wrkMast.getWrkNo(), wrkMast.getLocNo()); | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |         // 获取堆垛机信息 并 判断是否可入出 | 
 |  |  |         BasCrnp basCrnp = basCrnpService.selectById(slave.getId()); | 
 |  |  |         if (!basCrnp.getInEnable().equals("Y") && !basCrnp.getOutEnable().equals("Y")) { | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         // 堆垛机控制过滤 | 
 |  |  |         if (!crnProtocol.getStatusType().equals(CrnStatusType.IDLE) || crnProtocol.getTaskNo() != 0) { | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         // 已经存在吊车执行任务时,则过滤 | 
 |  |  |         if (wrkMastMapper.selectWorking(slave.getId()) != null) { | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         // 源库位 ===>> 最外层库位 | 
 |  |  |         if (locMastService.isOutMost(wrkMast.getSourceLocNo())) { | 
 |  |  |             // 目标库位 ===>> 最外层库位 | 
 |  |  |             if (locMastService.isOutMost(wrkMast.getLocNo())) { | 
 |  |  |                 // 命令下发区 -------------------------------------------------------------------------- | 
 |  |  |                 CrnCommand crnCommand = new CrnCommand(); | 
 |  |  |                 crnCommand.setCrnNo(slave.getId()); // 堆垛机编号 | 
 |  |  |                 crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 工作号 | 
 |  |  |                 crnCommand.setAckFinish((short) 0);  // 任务完成确认位 | 
 |  |  |                 crnCommand.setTaskMode(CrnTaskModeType.LOC_MOVE); // 任务模式:  库位移转 | 
 |  |  |                 crnCommand.setSourcePosX(sourceSta.getRow1().shortValue());     // 源库位排 | 
 |  |  |                 crnCommand.setSourcePosY(sourceSta.getBay1().shortValue());     // 源库位列 | 
 |  |  |                 crnCommand.setSourcePosZ(sourceSta.getLev1().shortValue());     // 源库位层 | 
 |  |  |                 crnCommand.setDestinationPosX(sta.getRow1().shortValue());     // 目标库位排 | 
 |  |  |                 crnCommand.setDestinationPosY(sta.getBay1().shortValue());     // 目标库位列 | 
 |  |  |                 crnCommand.setDestinationPosZ(sta.getLev1().shortValue());     // 目标库位层 | 
 |  |  |                 if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) { | 
 |  |  |                     log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand)); | 
 |  |  |                 } else { | 
 |  |  |                     // 修改工作档状态 11.生成出库ID => 16.吊车出库中 | 
 |  |  |                     Date now = new Date(); | 
 |  |  |                     wrkMast.setWrkSts(16L); | 
 |  |  |                     wrkMast.setCrnStrTime(now); | 
 |  |  |                     wrkMast.setModiTime(now); | 
 |  |  |                     if (wrkMastMapper.updateById(wrkMast) == 0) { | 
 |  |  |                         log.error("【库位移转】 修改工作档状态 11.生成出库ID => 12.吊车出库中 失败!!,工作号={}", wrkMast.getWrkNo()); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } else { | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |         } else { | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } |