diff --git a/shkj-wms/src/main/java/com/shkj/wms/scheduled/ScheduledTasks.java b/shkj-wms/src/main/java/com/shkj/wms/scheduled/ScheduledTasks.java index f08aef9..ec438fa 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/scheduled/ScheduledTasks.java +++ b/shkj-wms/src/main/java/com/shkj/wms/scheduled/ScheduledTasks.java @@ -769,9 +769,27 @@ public class ScheduledTasks { .last("limit 1") ); if (businDataTaskIsnotDeep != null){ + //单深位有任务,优先下发单深位任务 log.info("查询到单深位的任务:"+taskVoid); businDataTask=businDataTaskIsnotDeep; location=one; + }else{ + //单深位无任务,再查询外面深位是否有库存,如果有,更新此任务的取货路径 + if ("1".equals(one.getLocationStatus()) || "2".equals(one.getLocationStatus())){ + //先把深位的货位状态改为有货或空托状态 + if(businDataTaskGoodsVos !=null && businDataTaskGoodsVos.size()>0){ + location.setLocationStatus("1"); + }else { + location.setLocationStatus("2"); + } + iBaseLocationService.updateById(location); + businDataTask.setFromColumn(one.getLocationColumn()); + businDataTask.setFromRow(one.getLocationRow()); + businDataTask.setFromLayer(one.getLayer()); + businDataTask.setLocationId(one.getId()); + + location=one; + } } } } @@ -787,6 +805,7 @@ public class ScheduledTasks { //给库存添加出货预占 iSysStockDetailService.updateBatchById(sysStockDetailList); + //给堆垛机下发任务 Result taskResult = outTask(businDataTask); if (taskResult.getCode() == HttpStatus.SUCCESS.getCode()) { @@ -825,6 +844,7 @@ public class ScheduledTasks { } businDataTask.setDistinction(businDataTaskVo.getDistinction()); iBusinDataTaskService.saveOrUpdate(businDataTask); + businDataTaskVo = BeanUtil.toBean(businDataTask, BusinDataTaskVo.class); } else { businDataTaskVo.setExceptionMsg("当前开放的货位已无当前库存"); diff --git a/shkj-wms/src/main/java/com/shkj/wms/service/impl/BaseLocationServiceImpl.java b/shkj-wms/src/main/java/com/shkj/wms/service/impl/BaseLocationServiceImpl.java index f3ea835..ef841ec 100644 --- a/shkj-wms/src/main/java/com/shkj/wms/service/impl/BaseLocationServiceImpl.java +++ b/shkj-wms/src/main/java/com/shkj/wms/service/impl/BaseLocationServiceImpl.java @@ -1442,11 +1442,39 @@ public class BaseLocationServiceImpl extends ServiceImpl locationVoResult; + AssingEmptyLocBo assingEmptyLocBo = null; + if (businDataTaskGoodsVos !=null && businDataTaskGoodsVos.size()>0){ + assingEmptyLocBo = new AssingEmptyLocBo(); + assingEmptyLocBo.setBusinDataTaskGoodsVos(businDataTaskGoodsVos); + assingEmptyLocBo.setBatch(DateUtils.getDate()); + assingEmptyLocBo.setGoodsNo(businDataTaskGoodsVos.get(0).getGoodsNo()); + assingEmptyLocBo.setVehicheModel(businDataTaskGoodsVos.get(0).getVehicheModel()); + assingEmptyLocBo.setTunnel(baseLocation.getTunnel()); + locationVoResult = this.assignEmptyLocationAll(assingEmptyLocBo, null); + }else { + locationVoResult = this.assignEmptyLocationAll(assingEmptyLocBo, tunnel); + } + if (Result.isOk(locationVoResult)){ + BaseLocationVo baseLocationVo = locationVoResult.getData(); + log.info("给堆垛机下发任务:" + businDataTask.getId() + " 原货位:" +baseLocation.getLocationCode()+" 新货位:"+baseLocationVo.getLocationCode()); + businDataTask.setToLayer(baseLocationVo.getLayer()); + businDataTask.setToColumn(baseLocationVo.getLocationColumn()); + businDataTask.setToRow(baseLocationVo.getLocationRow()); + businDataTask.setLocationId(baseLocationVo.getId()); + log.info("原货位已被占用,重新分配的货位:" + JsonUtil.toJSONString(baseLocationVo)); + iBusinDataTaskService.updateById(businDataTask); + } + return; + } + //如果是单深位,验证下双深位的是否有库存,如果有在判断车型颜色是否一致 if ("2".equals(locationRow) || "3".equals(locationRow) || "14".equals(locationRow)) { if (locationRow.equals("2")) { @@ -1500,7 +1528,8 @@ public class BaseLocationServiceImpl extends ServiceImpl 0) { @@ -1583,7 +1613,6 @@ public class BaseLocationServiceImpl extends ServiceImpl map : goods) { SysStockDetail sysStockDetail = new SysStockDetail(); -// sysStockDetail.setStorageId(storageCode); sysStockDetail.setContainerCode(DataTask.getContainerId()); sysStockDetail.setQty(BigDecimal.valueOf(goods.size())); sysStockDetail.setBatch(batch); @@ -420,8 +420,11 @@ public class BusinPickupServiceImpl extends ServiceImpl booleanResult = iBusinEnptyContainerService.emptyContainerFlowDir(point, bo.getContainerId(), agvno, null); + if (Result.isOk(booleanResult)){ + redisTemplate.opsForValue().set("xzz:"+DataTask.getId(),agvno,5, TimeUnit.MINUTES); + } + // 创建任务 //TODO 平库释放后直接去下挂逻辑,后续不需要可以删掉 // BusinDataTask task = new BusinDataTask(); @@ -750,7 +753,7 @@ public class BusinPickupServiceImpl extends ServiceImpl booleanResult = iBusinEnptyContainerService.emptyContainerFlowDir(point, businPickupAddBo.getContainerId(), agvno, null); if (Result.isOk(booleanResult)){ log.info("小组装放行完成:"+point+" AGV编号:"+agvno+" 任务号:"+businPickupAddBo.getTaskCode()); - redisTemplate.opsForValue().set("xzz:"+DataTask.getId(),agvno); + redisTemplate.opsForValue().set("xzz:"+DataTask.getId(),agvno,5,TimeUnit.MINUTES); DataTask.setTaskStatus("2"); businDataTaskService.updateById(DataTask);