| | |
| | | @Autowired |
| | | private WrkMastMapper wrkMastMapper; |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | @Autowired |
| | | private WrkDetlService wrkDetlService; |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | |
| | | |
| | | // 更新工作档状态为 17.出库完成 |
| | | wrkMast.setWrkSts(17L); |
| | | wrkMast.setSteNo(0); |
| | | wrkMast.setCrnEndTime(new Date()); |
| | | if (wrkMastMapper.updateById(wrkMast) != 0) { |
| | | // 复位堆垛机 |
| | |
| | | // log.error("{}站点查询无待入库数据 工作号={}", crnStn.getStaNo(), staProtocol.getWorkNo()); |
| | | continue; |
| | | } |
| | | |
| | | // 判断是否已存在小车绑定任务 |
| | | BasSte basSte = basSteService.findByCrnNo(wrkMast.getCrnNo()); |
| | | if(basSte == null) continue; |
| | | WrkMast one1 = wrkMastService.selectOne(new EntityWrapper<WrkMast>() |
| | | .eq("ste_no",basSte.getSteNo()) |
| | | .last(" and wrk_sts > 10")); |
| | | if(one1 != null){ |
| | | log.error("{}入库任务无法作业,因出库任务已绑定小车!", wrkMast.getWrkNo()); |
| | | continue; |
| | | } |
| | | |
| | | if (wrkMast.getWrkSts() < 3) { |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() > 0 && staProtocol.isInEnable() |
| | | && staDetl.getCanining()!=null && staDetl.getCanining().equals("Y")) { |
| | |
| | | } |
| | | // 没有小车 |
| | | } else { |
| | | if (wrkMast.getWrkSts() == 2L && wrkMast.getSteNo() == null) { |
| | | if (wrkMast.getWrkSts() == 2L && (wrkMast.getSteNo() == null || wrkMast.getSteNo() == 0)) { |
| | | // 寻找当前堆垛机对应的小车 |
| | | SteThread steThread = queryIdleCar(wrkMast); |
| | | if (steThread != null) { |
| | |
| | | continue; |
| | | } |
| | | |
| | | // 判断是否已存在小车绑定任务 |
| | | BasSte basSte = basSteService.findByCrnNo(wrkMast.getCrnNo()); |
| | | if(basSte == null) continue; |
| | | WrkMast one1 = wrkMastService.selectOne(new EntityWrapper<WrkMast>() |
| | | .eq("ste_no",basSte.getSteNo()) |
| | | .last(" and wrk_sts < 10")); |
| | | if(one1 != null){ |
| | | log.error("{}出库任务无法作业,因入库任务已绑定小车!", wrkMast.getWrkNo()); |
| | | continue; |
| | | } |
| | | |
| | | //加强判断,确保因出库导致的移库整套任务全部结束后,才能执行下一笔出库任务。只有库位完成移库回去全部任务后,才认为当组出库任务完成 |
| | | WrkMast one = wrkMastMapper.selectLocMoveData(slave.getId()); |
| | | if(!Cools.isEmpty(one)){ |
| | | //存在移库任务,且在移出中,且移库源库位与待出库库位不在同一库位组,时跳出,确保移库/出库全套任务完成后,再执行下一笔 |
| | | if(one.getWrkSts() > 10 && (Utils.getGroupRow(wrkMast.getSourceLocNo()) != Utils.getGroupRow(one.getSourceLocNo()) |
| | | if(wrkMast.getWrkNo() ==11 && one.getWrkSts() > 10 && (Utils.getGroupRow(wrkMast.getSourceLocNo()) != Utils.getGroupRow(one.getSourceLocNo()) |
| | | || Utils.getBay(wrkMast.getSourceLocNo()) != Utils.getBay(one.getSourceLocNo()) |
| | | || Utils.getLev(wrkMast.getSourceLocNo()) != Utils.getLev(one.getSourceLocNo()))){ |
| | | continue; |
| | | } |
| | | //存在移库任务,且在移回中,且移库目标库位与待出库库位不在同一库位组,时跳出,确保移库/出库全套任务完成后,再执行下一笔 |
| | | if(one.getWrkSts() < 11 && (Utils.getGroupRow(wrkMast.getSourceLocNo()) != Utils.getGroupRow(one.getLocNo()) |
| | | if(wrkMast.getWrkNo() ==11 && one.getWrkSts() < 11 && (Utils.getGroupRow(wrkMast.getSourceLocNo()) != Utils.getGroupRow(one.getLocNo()) |
| | | || Utils.getBay(wrkMast.getSourceLocNo()) != Utils.getBay(one.getLocNo()) |
| | | || Utils.getLev(wrkMast.getSourceLocNo()) != Utils.getLev(one.getLocNo()))){ |
| | | continue; |
| | | } |
| | | log.info(""); |
| | | } |
| | | |
| | | //出库库位不是最外层库位,判断浅库位组是否都为空,或存在库位移转任务 |
| | |
| | | if (null == wrkMast) { |
| | | return; |
| | | } |
| | | // 过滤 |
| | | if (null != wrkMastMapper.selectPakin(slave.getId(), null)) { |
| | | log.error("{}出库任务无法作业,因存在入库中任务!", wrkMast.getWrkNo()); |
| | | return; |
| | | } |
| | | |
| | | // 判断是否已存在小车绑定任务 |
| | | BasSte basSte = basSteService.findByCrnNo(wrkMast.getCrnNo()); |
| | | if(basSte == null) return; |
| | | WrkMast one = wrkMastService.selectOne(new EntityWrapper<WrkMast>() |
| | | .eq("ste_no",basSte.getSteNo()) |
| | | .last(" and io_type != 11 and wrk_sts < 10")); |
| | | if(one != null){ |
| | | log.error("{}移库任务无法作业,因入库任务已绑定小车!", wrkMast.getWrkNo()); |
| | | return; |
| | | } |
| | | |
| | | // 获取源库位信息 |
| | | LocMast sourceLoc = locMastService.selectById(wrkMast.getSourceLocNo()); |
| | | if (null == sourceLoc) { |
| | |
| | | if (wrkMast.getWrkSts() == 17) { |
| | | //查找库位 |
| | | boolean flag = false; |
| | | String[] deeplocs = Utils.getDeepLocs(wrkMast.getSourceLocNo()); |
| | | // append |
| | | Integer row = Utils.getGroupRow(wrkMast.getSourceLocNo()); |
| | | Integer bay = Utils.getBay(wrkMast.getSourceLocNo()); |
| | | Integer lev = Utils.getLev(wrkMast.getSourceLocNo()); |
| | | |
| | | String locNo = Utils.append(row, bay, lev); |
| | | String[] deeplocs = Utils.getDeepLocs(locNo); |
| | | if(!Cools.isEmpty(deeplocs)){ |
| | | for(String deepLocNo : deeplocs) { |
| | | LocMast deepLoc = locMastService.selectById(deepLocNo); |
| | |
| | | wrkMast.setIoPri((double)9999); |
| | | wrkMast.setWrkSts(2L); |
| | | wrkMast.setLocNo(deepLocNo); |
| | | wrkMast.setSteNo(null); |
| | | wrkMast.setSteNo(0); |
| | | wrkMast.setModiTime(new Date()); |
| | | if (wrkMastMapper.updateById(wrkMast) == 0) { |
| | | log.error("修改工作档状态 17.移库完成 => 2.移库再入库中 失败!!,工作号={}", wrkMast.getWrkNo()); |
| | |
| | | // 有小车 |
| | | if (steNo != null) { |
| | | // 小车行走到堆垛机待搬移点 |
| | | if (wrkMast.getWrkSts() == 2L && wrkMast.getSteNo() == null) { |
| | | if (wrkMast.getWrkSts() == 2L && (wrkMast.getSteNo() == null || wrkMast.getSteNo() == 0)) { |
| | | // 没有其他任务 |
| | | if (null == wrkMastMapper.selectPakin(slave.getId(), steNo)) { |
| | | this.letCarBeWaiting(wrkMast, steNo, wrkMast.getLocNo()); |
| | | SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo); |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | | if (steProtocol == null) { return; } |
| | | if(steProtocol.getLoca()==3 || steProtocol.getLoca()==4){ |
| | | //小车已经在待机位时,无需下发到待机位任务,直接更新状态微3,同时绑定小车 |
| | | wrkMast.setWrkSts(3L); |
| | | wrkMast.setSteNo(steNo); |
| | | wrkMast.setModiTime(new Date()); |
| | | if (wrkMastMapper.updateById(wrkMast) == 0) { |
| | | log.error("修改工作档状态 绑定穿梭车 失败!!,工作号={}", wrkMast.getWrkNo()); |
| | | } |
| | | } else { |
| | | this.letCarBeWaiting(wrkMast, steNo, wrkMast.getLocNo()); |
| | | } |
| | | } |
| | | } |
| | | // 堆垛机将货放至小车上 3.小车待搬(小车不用搬运,已经在当前组库位) / 6.小车待入 ===>> 7.吊车入库中 |
| | |
| | | } |
| | | // 没有小车 |
| | | } else { |
| | | if (wrkMast.getWrkSts() == 2L && wrkMast.getSteNo() == null) { |
| | | if (wrkMast.getWrkSts() == 2L && (wrkMast.getSteNo() == null || wrkMast.getSteNo() == 0)) { |
| | | // 寻找当前堆垛机对应的小车 |
| | | SteThread steThread = queryIdleCar(wrkMast); |
| | | if (steThread != null) { |
| | |
| | | // } |
| | | if (locMastService.isOutMost(wrkMast.getLocNo())) { |
| | | wrkMast.setWrkSts(17L); |
| | | wrkMast.setSteNo(0); |
| | | // 默认目标库位是空板 |
| | | String locSts = "D"; |
| | | String locSts = ""; |
| | | // 库位移转判断是否为空板移转 |
| | | if (wrkMast.getEmptyMk().equals("N")) { |
| | | locSts = "F"; |
| | |
| | | continue; |
| | | } |
| | | } |
| | | if(Cools.isEmpty(locSts)){ |
| | | log.error("库位移转 ===>> 库存状态为空;[源库位={}],[目标库位={}]", wrkMast.getSourceLocNo(), wrkMast.getLocNo()); |
| | | continue; |
| | | } |
| | | |
| | | // 修改源库位状态 ==> O |
| | | LocMast sourceLoc = locMastService.selectById(wrkMast.getSourceLocNo()); |
| | | if (null != sourceLoc) { |
| | |
| | | rows = "18,19"; |
| | | break; |
| | | } |
| | | LocMast loc = locMastService.selectOne(new EntityWrapper<LocMast>().eq("crn_no",crn.getId()) |
| | | LocMast loc = null; |
| | | List<LocMast> locs = locMastService.selectList(new EntityWrapper<LocMast>().eq("crn_no",crn.getId()) |
| | | .eq("loc_type1",shallowLoc.getLocType1()) |
| | | .eq("loc_sts","O") |
| | | .last(" and row1 in (" + rows + ") order by bay1,lev1")); |
| | | for (LocMast one : locs){ |
| | | if(Utils.getGroupRow(one.getLocNo()) != Utils.getGroupRow(shallowLoc.getLocNo()) |
| | | || Utils.getBay(one.getLocNo()) != Utils.getBay(shallowLoc.getLocNo()) |
| | | || Utils.getLev(one.getLocNo()) != Utils.getLev(shallowLoc.getLocNo())){ |
| | | loc = one; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (null == loc) { |
| | | log.error("深库位出库 --- 浅库位阻塞异常! 待移转浅库位:" + shallowLoc.getLocNo()); |