| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | |
| | | |
| | | } |
| | | |
| | | // 目标库位 ===>> 非最外层库位 |
| | | // 目标库位 ===>> 非最外层库位 |
| | | } else { |
| | | // 判断小车是否在当前组库位,如果是则将穿梭车移至最外层,等待堆垛机放货;如果不是,则堆垛机寻找穿梭车,并放置当前组最外层 |
| | | Integer steNo = this.hasCarOfIdle(wrkMast.getLocNo()); |
| | |
| | | } |
| | | } |
| | | } |
| | | // 没有小车 |
| | | // 没有小车 |
| | | } else { |
| | | if (wrkMast.getWrkSts() == 2L && wrkMast.getSteNo() == null) { |
| | | // 寻找当前堆垛机对应的小车 |
| | |
| | | log.error("{}库位异常,未检索到相应工作档!", shallowLocNo); |
| | | } else { |
| | | if(waitWrkMast.getWrkSts() == 11) { |
| | | waitWrkMast.setIoPri(15D); |
| | | waitWrkMast.setIoPri(20D); |
| | | waitWrkMast.setModiTime(new Date()); |
| | | if (wrkMastMapper.updateById(waitWrkMast) == 0) { |
| | | log.error("调整工作档优先级失败!工作号={}", waitWrkMast.getWrkNo()); |
| | | } |
| | | continue; |
| | | } else { |
| | | |
| | | } |
| | | continue; |
| | | } |
| | | } else if (shallowLoc.getLocSts().equals("F") || shallowLoc.getLocSts().equals("D")) { |
| | | // 此标记避免多次执行移库任务 |
| | |
| | | crnCommand.setSourcePosX(sourceSta.getRow1().shortValue()); // 源库位排 |
| | | crnCommand.setSourcePosY(sourceSta.getBay1().shortValue()); // 源库位列 |
| | | crnCommand.setSourcePosZ(sourceSta.getLev1().shortValue()); // 源库位层 |
| | | // crnCommand.setDestinationPosX(crnStn.getRow().shortValue()); // 目标库位排 |
| | | // crnCommand.setDestinationPosY(crnStn.getBay().shortValue()); // 目标库位列 |
| | | // crnCommand.setDestinationPosZ(crnStn.getLev().shortValue()); // 目标库位层 |
| | | crnCommand.setDestinationPosX(crnStn.getRow().shortValue()); // 目标库位排 |
| | | crnCommand.setDestinationPosY(crnStn.getBay().shortValue()); // 目标库位列 |
| | | crnCommand.setDestinationPosZ(crnStn.getLev().shortValue()); // 目标库位层 |
| | | if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) { |
| | | log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | } else { |
| | |
| | | } |
| | | return true; |
| | | } |
| | | // 不是最外层库位,需要使用穿梭车搬运后,再堆垛机出库 |
| | | // 不是最外层库位,需要使用穿梭车搬运后,再堆垛机出库 |
| | | } else { |
| | | // 当前组库位是否有穿梭车 |
| | | Integer steNo = this.hasCarOfIdle(wrkMast.getSourceLocNo()); |
| | |
| | | steCommand.setTaskNo(wrkMast.getWrkNo()); // 工作号 |
| | | steCommand.setTaskMode(SteTaskModeType.findOutByLoc(wrkMast.getSourceLocNo())); // 任务模式: 去近点 等待堆垛机叉取 |
| | | |
| | | steCommand.setRow(Utils.getGroupRow(steProtocol.getRow().intValue()).shortValue()); |
| | | steCommand.setRow(Utils.getGroupRow(steProtocol.getRow().intValue(), false).shortValue()); |
| | | steCommand.setBay(steProtocol.getBay()); |
| | | steCommand.setLev(steProtocol.getLev()); |
| | | |
| | |
| | | crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 工作号 |
| | | crnCommand.setAckFinish((short) 0); // 任务完成确认位 |
| | | crnCommand.setTaskMode(CrnTaskModeType.LOC_MOVE); // 任务模式: 库位移转 |
| | | crnCommand.setSourcePosX(Utils.getGroupRow(sourceSta.getRow1()).shortValue()); // 源库位排 |
| | | crnCommand.setSourcePosX(Utils.getGroupRow(sourceSta.getRow1(), false).shortValue()); // 源库位排 |
| | | crnCommand.setSourcePosY(sourceSta.getBay1().shortValue()); // 源库位列 |
| | | crnCommand.setSourcePosZ(sourceSta.getLev1().shortValue()); // 源库位层 |
| | | crnCommand.setDestinationPosX(crnStn.getRow().shortValue()); // 目标库位排 |
| | |
| | | } |
| | | } |
| | | |
| | | // 没有小车 |
| | | // 没有小车 |
| | | } else { |
| | | if (wrkMast.getWrkSts() == 11L && wrkMast.getSteNo() == null) { |
| | | // 寻找最近的小车 |
| | |
| | | SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, ste.getId()); |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | | if (steProtocol == null) { continue; } |
| | | if (Utils.getGroupRow(locNo).equals(Utils.getGroupRow(steProtocol.getRow().intValue())) && steProtocol.getBay() == Utils.getBay(locNo) && steProtocol.getLev() == Utils.getLev(locNo)) { |
| | | if (Utils.getGroupRow(locNo, true).equals(Utils.getGroupRow(steProtocol.getRow().intValue(), true)) |
| | | && steProtocol.getBay() == Utils.getBay(locNo) |
| | | && steProtocol.getLev() == Utils.getLev(locNo)) { |
| | | return steProtocol.getSteNo().intValue(); |
| | | } |
| | | } |
| | |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | | if (steProtocol == null) { continue; } |
| | | if (steProtocol.isIdle()) { |
| | | if (Utils.getGroupRow(locNo).equals(Utils.getGroupRow(steProtocol.getRow().intValue())) && steProtocol.getBay() == Utils.getBay(locNo) && steProtocol.getLev() == Utils.getLev(locNo)) { |
| | | if (Utils.getGroupRow(locNo, true).equals(Utils.getGroupRow(steProtocol.getRow().intValue(), true)) |
| | | && steProtocol.getBay() == Utils.getBay(locNo) |
| | | && steProtocol.getLev() == Utils.getLev(locNo)) { |
| | | return steProtocol.getSteNo().intValue(); |
| | | } |
| | | } |
| | |
| | | * 查找当前库位最适合的穿梭车来作业 |
| | | */ |
| | | public SteThread queryIdleCar(WrkMast wrkMast) { |
| | | Integer crnNo = wrkMast.getCrnNo(); |
| | | BasSte basSte = basSteService.findByCrnNo(crnNo); |
| | | // 获取穿梭车信息 |
| | | SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, basSte.getSteNo()); |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | | if (steProtocol != null) { |
| | | if (steProtocol.isIdle()) { |
| | | return steThread; |
| | | List<BasSte> basStes = basSteService.selectList(new EntityWrapper<>()); |
| | | int val = 0; |
| | | SteThread result = null; |
| | | for (BasSte basSte : basStes) { |
| | | // 获取穿梭车信息 |
| | | SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, basSte.getSteNo()); |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | | if (steProtocol == null) { continue; } |
| | | if (!steProtocol.isIdle()) { continue; } |
| | | String locNo = wrkMast.getWrkSts() < 10 ? wrkMast.getLocNo() : wrkMast.getSourceLocNo(); |
| | | LocMast locMast = locMastService.selectById(locNo); |
| | | int lev = locMast.getLev1(); |
| | | int bay = locMast.getBay1(); |
| | | int levAbs = Math.abs(lev - steProtocol.getLev()); |
| | | int bayAbs = Math.abs(bay - steProtocol.getBay()); |
| | | if (val == 0) { |
| | | val = levAbs + bayAbs; |
| | | result = steThread; |
| | | } else { |
| | | if ((levAbs + bayAbs) < val) { |
| | | val = levAbs + bayAbs; |
| | | result = steThread; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | |
| | | steCommand.setTaskNo(wrkMast.getWrkNo()); // 工作号 |
| | | steCommand.setTaskMode(SteTaskModeType.findWaiting(steProtocol.getRow().intValue())); // 任务模式: 去近点 等待堆垛机叉取 |
| | | |
| | | steCommand.setRow(Utils.getGroupRow(steProtocol.getRow().intValue()).shortValue()); |
| | | steCommand.setRow(Utils.getGroupRow(steProtocol.getRow().intValue(), true).shortValue()); |
| | | steCommand.setBay(steProtocol.getBay()); |
| | | steCommand.setLev(steProtocol.getLev()); |
| | | |
| | |
| | | SteCommand steCommand = new SteCommand(); |
| | | steCommand.setSteNo(steNo); // 穿梭车编号 |
| | | steCommand.setTaskNo(wrkCharge.getWrkNo()); // 工作号 |
| | | steCommand.setTaskMode(SteTaskModeType.findOriginByLoc(steProtocol.getRow())); // 任务模式: 去近点 等待堆垛机叉取 |
| | | steCommand.setTaskMode(SteTaskModeType.findOriginByLoc(steProtocol.getRow().intValue())); // 任务模式: 去近点 等待堆垛机叉取 |
| | | |
| | | steCommand.setRow(Utils.getGroupRow(steProtocol.getRow().intValue()).shortValue()); |
| | | steCommand.setBay(steProtocol.getBay()); |
| | |
| | | steCommand.setTaskNo(wrkMast.getWrkNo()); // 工作号 |
| | | steCommand.setTaskMode(SteTaskModeType.findOriginByLoc(steProtocol)); // 任务模式: 去近点 等待堆垛机叉取 |
| | | |
| | | steCommand.setRow(Utils.getGroupRow(steProtocol.getRow().intValue()).shortValue()); |
| | | steCommand.setRow(Utils.getGroupRow(steProtocol.getRow().intValue(), true).shortValue()); |
| | | steCommand.setBay(steProtocol.getBay()); |
| | | steCommand.setLev(steProtocol.getLev()); |
| | | |
| | |
| | | crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 工作号 |
| | | crnCommand.setAckFinish((short) 0); // 任务完成确认位 |
| | | crnCommand.setTaskMode(CrnTaskModeType.STE_MOVE); // 任务模式: 库位移转 |
| | | crnCommand.setSourcePosX(Utils.getGroupRow(steProtocol.getRow().intValue()).shortValue()); // 源库位排 |
| | | crnCommand.setSourcePosX(Utils.getGroupRow(steProtocol.getRow().intValue(), true).shortValue()); // 源库位排 |
| | | crnCommand.setSourcePosY(steProtocol.getBay()); // 源库位列 |
| | | crnCommand.setSourcePosZ(steProtocol.getLev()); // 源库位层 |
| | | crnCommand.setDestinationPosX(Utils.getGroupRow(locMast.getLocNo()).shortValue()); // 目标库位排 |
| | | crnCommand.setDestinationPosX(Utils.getGroupRow(locMast.getLocNo(), true).shortValue()); // 目标库位排 |
| | | crnCommand.setDestinationPosY(locMast.getBay1().shortValue()); // 目标库位列 |
| | | crnCommand.setDestinationPosZ(locMast.getLev1().shortValue()); // 目标库位层 |
| | | if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) { |
| | | log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | } else { |
| | | // 修改穿梭车运行中排列层 |
| | | steThread.modifyPos(Utils.getGroupRow(locMast.getLocNo()), locMast.getBay1(), locMast.getLev1()); |
| | | steThread.modifyPos(Utils.getGroupRow(locMast.getLocNo(), true), locMast.getBay1(), locMast.getLev1()); |
| | | // 修改工作档状态 3.小车待搬 => 4.迁入小车 |
| | | Date now = new Date(); |
| | | wrkMast.setWrkSts(4L); |
| | |
| | | crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 工作号 |
| | | crnCommand.setAckFinish((short) 0); // 任务完成确认位 |
| | | crnCommand.setTaskMode(CrnTaskModeType.STE_MOVE); // 任务模式: 库位移转 |
| | | crnCommand.setSourcePosX(Utils.getGroupRow(steProtocol.getRow().intValue()).shortValue()); // 源库位排 |
| | | crnCommand.setSourcePosX(Utils.getGroupRow(steProtocol.getRow().intValue(), true).shortValue()); // 源库位排 |
| | | crnCommand.setSourcePosY(steProtocol.getBay()); // 源库位列 |
| | | crnCommand.setSourcePosZ(steProtocol.getLev()); // 源库位层 |
| | | crnCommand.setDestinationPosX(Utils.getGroupRow(locMast.getLocNo()).shortValue()); // 目标库位排 |
| | | crnCommand.setDestinationPosX(Utils.getGroupRow(locMast.getLocNo(), true).shortValue()); // 目标库位排 |
| | | crnCommand.setDestinationPosY(locMast.getBay1().shortValue()); // 目标库位列 |
| | | crnCommand.setDestinationPosZ(locMast.getLev1().shortValue()); // 目标库位层 |
| | | if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) { |
| | | log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | } else { |
| | | // 修改穿梭车运行中排列层 |
| | | steThread.modifyPos(Utils.getGroupRow(locMast.getLocNo()), locMast.getBay1(), locMast.getLev1()); |
| | | steThread.modifyPos(Utils.getGroupRow(locMast.getLocNo(), true), locMast.getBay1(), locMast.getLev1()); |
| | | // 修改工作档状态 12.小车待搬 => 13.迁入小车 |
| | | Date now = new Date(); |
| | | wrkMast.setWrkSts(13L); |
| | |
| | | crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 工作号 |
| | | crnCommand.setAckFinish((short) 0); // 任务完成确认位 |
| | | crnCommand.setTaskMode(CrnTaskModeType.STE_MOVE); // 任务模式: 库位移转 |
| | | crnCommand.setSourcePosX(Utils.getGroupRow(steProtocol.getRow().intValue()).shortValue()); // 源库位排 |
| | | crnCommand.setSourcePosX(Utils.getGroupRow(steProtocol.getRow().intValue(), true).shortValue()); // 源库位排 |
| | | crnCommand.setSourcePosY(steProtocol.getBay()); // 源库位列 |
| | | crnCommand.setSourcePosZ(steProtocol.getLev()); // 源库位层 |
| | | crnCommand.setDestinationPosX(Utils.getGroupRow(idleLocNo).shortValue()); // 目标库位排 |
| | | crnCommand.setDestinationPosX(Utils.getGroupRow(idleLocNo, true).shortValue()); // 目标库位排 |
| | | crnCommand.setDestinationPosY((short) Utils.getBay(idleLocNo)); // 目标库位列 |
| | | crnCommand.setDestinationPosZ((short) Utils.getLev(idleLocNo)); // 目标库位层 |
| | | if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) { |
| | | log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand)); |
| | | } else { |
| | | // 修改穿梭车运行中排列层 |
| | | steThread.modifyPos(Utils.getGroupRow(idleLocNo), Utils.getBay(idleLocNo), Utils.getLev(idleLocNo)); |
| | | steThread.modifyPos(Utils.getGroupRow(idleLocNo, true), Utils.getBay(idleLocNo), Utils.getLev(idleLocNo)); |
| | | // 修改工作档状态 3.小车待搬 => 5.迁出小车 |
| | | Date now = new Date(); |
| | | wrkMast.setWrkSts(5L); |
| | |
| | | } |
| | | } else { |
| | | // 判断是否需要小车入库 |
| | | if (locMastService.isOutMost(wrkMast.getLocNo())) { |
| | | if (locMastService.isOutMost(wrkMast.getLocNo(), true)) { |
| | | // ==> 9.入库完成 |
| | | wrkMast.setWrkSts(9L); |
| | | Date now = new Date(); |
| | |
| | | } |
| | | // 库位移转 |
| | | } else { |
| | | if (wrkMast.getWrkSts() == 16) { |
| | | Date now = new Date(); |
| | | if (locMastService.isOutMost(wrkMast.getLocNo())) { |
| | | // 16.吊车出库中 ==> 9.入库完成 |
| | | wrkMast.setWrkSts(9L); |
| | | wrkMast.setCrnEndTime(now); |
| | | } else { |
| | | // 16.吊车出库中 ==> 9.入库完成 |
| | | wrkMast.setWrkSts(9L); |
| | | } |
| | | wrkMast.setModiTime(now); |
| | | // 修改成功后复位堆垛机 |
| | | if (wrkMastMapper.updateById(wrkMast) > 0) { |
| | | // 堆垛机复位 |
| | | crnThread.setResetFlag(true); |
| | | } else { |
| | | log.error("修改工作档状态 16.吊车出库中 失败!!,工作号={}", wrkMast.getWrkNo()); |
| | | } |
| | | } else if (wrkMast.getWrkSts() == 4) { |
| | | // 4.迁入小车 ==> 6.小车待入 |
| | | wrkMast.setWrkSts(6L); |
| | | Date now = new Date(); |
| | | wrkMast.setCrnEndTime(now); |
| | | wrkMast.setModiTime(now); |
| | | // 修改成功后复位堆垛机 |
| | | if (wrkMastMapper.updateById(wrkMast) > 0) { |
| | | // 堆垛机复位 |
| | | crnThread.setResetFlag(true); |
| | | // 穿梭车重新定位排列层 |
| | | SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, wrkMast.getSteNo()); |
| | | if (!steThread.confirmPos()) { |
| | | log.error("{}号穿梭车重新定位失败!作业工作档任务号:{}", wrkMast.getSteNo(), wrkMast.getWrkNo()); |
| | | } |
| | | // 穿梭车去待机位 |
| | | BasSte basSte = basSteService.selectById(wrkMast.getSteNo()); |
| | | SteCommand steCommand = new SteCommand(); |
| | | steCommand.setSteNo(wrkMast.getSteNo()); // 穿梭车编号 |
| | | steCommand.setTaskNo(9999); // 工作号 |
| | | steCommand.setTaskMode(SteTaskModeType.findWaiting(basSte.getRow())); // 任务模式: 去近点 等待堆垛机叉取 |
| | | // steCommand.setRow(Utils.getGroupRow(steProtocol.getRow().intValue()).shortValue()); |
| | | // steCommand.setBay(steProtocol.getBay()); |
| | | // steCommand.setLev(steProtocol.getLev()); |
| | | if (!MessageQueue.offer(SlaveType.Ste, wrkMast.getSteNo(), new Task(2, steCommand))) { |
| | | log.error("穿梭车待机位命令下发失败,穿梭车号={},任务数据={}", wrkMast.getSteNo(), JSON.toJSON(steCommand)); |
| | | } |
| | | } else { |
| | | log.error("修改工作档状态 4.迁入小车 => 6.小车待入 失败!!,工作号={}", wrkMast.getWrkNo()); |
| | | } |
| | | // 入库 ===>> 迁出小车 完成 |
| | | } else if (wrkMast.getWrkSts() == 7){ |
| | | // 判断是否需要小车入库 |
| | | if (locMastService.isOutMost(wrkMast.getLocNo())) { |
| | | // ==> 9.入库完成 |
| | | wrkMast.setWrkSts(9L); |
| | | Date now = new Date(); |
| | | wrkMast.setCrnEndTime(now); |
| | | wrkMast.setModiTime(now); |
| | | // 修改成功后复位堆垛机 |
| | | if (wrkMastMapper.updateById(wrkMast) > 0) { |
| | | // 堆垛机复位 |
| | | if (!locMastService.isShuttle(wrkMast.getLocNo())) { |
| | | if (wrkMast.getWrkSts() == 16 && wrkMast.getIoType() == 11){ |
| | | // 更新工作档状态为 17.出库完成 |
| | | wrkMast.setWrkSts(17L); |
| | | wrkMast.setCrnEndTime(new Date()); |
| | | if (wrkMastMapper.updateById(wrkMast) != 0) { |
| | | // 复位堆垛机 |
| | | crnThread.setResetFlag(true); |
| | | } else { |
| | | log.error("修改工作档状态 7.吊车入库中 => 9.入库完成 失败!!,工作号={}", wrkMast.getWrkNo()); |
| | | } |
| | | } else { |
| | | // 给穿梭车下发命令 |
| | | Integer steNo = wrkMast.getSteNo(); |
| | | SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo); |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | | if (steProtocol == null) { continue; } |
| | | if (steProtocol.isIdle()) { |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | SteCommand steCommand = new SteCommand(); |
| | | steCommand.setSteNo(steNo); // 穿梭车编号 |
| | | steCommand.setTaskNo(wrkMast.getWrkNo()); // 工作号 |
| | | steCommand.setTaskMode(SteTaskModeType.findInByLoc(wrkMast.getLocNo())); // 任务模式: 搬入库 |
| | | if (!MessageQueue.offer(SlaveType.Ste, steNo, new Task(2, steCommand))) { |
| | | log.error("穿梭车命令下发失败,穿梭车号={},任务数据={}", steNo, JSON.toJSON(steCommand)); |
| | | } else { |
| | | // 修改工作档状态 7.吊车入库中 => 8.小车搬入库 |
| | | wrkMast.setWrkSts(8L); |
| | | Date now = new Date(); |
| | | wrkMast.setCrnEndTime(now); |
| | | wrkMast.setModiTime(now); |
| | | if (wrkMastMapper.updateById(wrkMast) > 0) { |
| | | // 堆垛机复位 |
| | | crnThread.setResetFlag(true); |
| | | } else { |
| | | log.error("修改工作档状态 7.吊车入库中 => 8.小车搬入库 失败!!,工作号={}", wrkMast.getWrkNo()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } else if (wrkMast.getWrkSts() == 13) { |
| | | // 给穿梭车下发命令 |
| | | Integer steNo = wrkMast.getSteNo(); |
| | | SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo); |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | | if (steProtocol == null) { continue; } |
| | | // 穿梭车重新定位排列层 |
| | | if (!steThread.confirmPos()) { |
| | | log.error("{}号穿梭车重新定位失败!作业工作档任务号:{}", wrkMast.getSteNo(), wrkMast.getWrkNo()); |
| | | } |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | SteCommand steCommand = new SteCommand(); |
| | | steCommand.setSteNo(steNo); // 穿梭车编号 |
| | | steCommand.setTaskNo(wrkMast.getWrkNo()); // 工作号 |
| | | steCommand.setTaskMode(SteTaskModeType.findOutByLoc(wrkMast.getSourceLocNo())); // 任务模式: 搬出库 |
| | | if (!MessageQueue.offer(SlaveType.Ste, steNo, new Task(2, steCommand))) { |
| | | log.error("穿梭车命令下发失败,穿梭车号={},任务数据={}", steNo, JSON.toJSON(steCommand)); |
| | | } else { |
| | | // 13.迁入小车 ==> 14.小车搬出库 |
| | | wrkMast.setWrkSts(14L); |
| | | Date now = new Date(); |
| | | wrkMast.setCrnEndTime(now); |
| | | wrkMast.setModiTime(now); |
| | | // 修改成功后复位堆垛机 |
| | | if (wrkMastMapper.updateById(wrkMast) > 0) { |
| | | // 堆垛机复位 |
| | | crnThread.setResetFlag(true); |
| | | } else { |
| | | log.error("修改工作档状态 13.迁入小车 ==> 14.小车搬出库 失败!!,工作号={}", wrkMast.getWrkNo()); |
| | | log.error("更新工作档的工作状态为 17.出库完成 失败!!! [工作号:{}]", wrkMast.getWrkNo()); |
| | | } |
| | | } |
| | | } |
| | |
| | | } else { |
| | | if (wrkMast.getMk().equals("I")) { |
| | | String locNo = wrkMast.getLocNo(); |
| | | if (Utils.getGroupRow(locNo).equals(Utils.getGroupRow(steProtocol.getRow().intValue())) && steProtocol.getBay() == Utils.getBay(locNo) && steProtocol.getLev() == Utils.getLev(locNo)) { |
| | | if (Utils.getGroupRow(locNo, false).equals(Utils.getGroupRow(steProtocol.getRow().intValue(), false)) |
| | | && steProtocol.getBay() == Utils.getBay(locNo) |
| | | && steProtocol.getLev() == Utils.getLev(locNo)) { |
| | | // 修改工作档状态 11.生成出库ID => 6.小车待入 |
| | | wrkMast.setWrkSts(6L); |
| | | } else { |
| | |
| | | * 小车电量检测 ===>> 发起充电 |
| | | */ |
| | | public synchronized void loopSteCharge() { |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | SteChargeType steChargeType = SteChargeType.get(wrkCharge.getLocNo()); |
| | | |
| | | for (SteSlave ste : slaveProperties.getSte()) { |
| | | SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, ste.getId()); |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | |
| | | SteCommand steCommand = new SteCommand(); |
| | | steCommand.setSteNo(steNo); // 穿梭车编号 |
| | | steCommand.setTaskNo(wrkCharge.getWrkNo()); // 工作号 |
| | | SteTaskModeType originByLoc = SteTaskModeType.findOriginByLoc(steProtocol.getRow()); |
| | | SteTaskModeType originByLoc = SteTaskModeType.findOriginByLoc(steProtocol.getRow().intValue()); |
| | | if (originByLoc.equals(SteTaskModeType.GO_ORIGIN)) { |
| | | originByLoc = SteTaskModeType.BACK_ORIGIN; |
| | | } else if (originByLoc.equals(SteTaskModeType.BACK_ORIGIN)) { |