| | |
| | | import com.zy.asrs.wms.asrs.entity.*; |
| | | import com.zy.asrs.wms.asrs.entity.enums.LocStsType; |
| | | import com.zy.asrs.wms.asrs.entity.enums.LocTypeHeightType; |
| | | import com.zy.asrs.wms.asrs.entity.param.FieldParam; |
| | | import com.zy.asrs.wms.asrs.mapper.ViewLocDetlMapper; |
| | | import com.zy.asrs.wms.asrs.mapper.ViewTaskDetlMapper; |
| | | import com.zy.asrs.wms.asrs.service.*; |
| | |
| | | private ViewLocDetlMapper viewLocDetlMapper; |
| | | @Autowired |
| | | private ViewTaskDetlMapper viewTaskDetlMapper; |
| | | @Autowired |
| | | private MatService matService; |
| | | |
| | | //从库存或任务中匹配相邻库位(满托盘) |
| | | public Loc getNeighborLoc(Long taskType, OrderDetl orderDetl, Integer locTypeHeight) { |
| | | public Loc getNeighborLoc(Long taskType, Long matId, String batch, List<FieldParam> uniqueFields, Integer locTypeHeight) { |
| | | //满托盘 |
| | | Mat mat = matService.getById(matId); |
| | | if (mat == null) { |
| | | return null; |
| | | } |
| | | |
| | | //从任务中进行匹配 |
| | | List<Loc> locs = new ArrayList<>(); |
| | | List<Map<String, Object>> list = viewTaskDetlMapper.getList(orderDetl.getMat$().getMatnr(), orderDetl.getBatch(), orderDetl.getUniqueField()); |
| | | List<Map<String, Object>> list = viewTaskDetlMapper.getList(mat.getMatnr(), batch, uniqueFields); |
| | | for (Map<String, Object> map : list) { |
| | | Task task = taskService.getById(map.get("taskId").toString()); |
| | | if(task == null) { |
| | | if (task == null) { |
| | | continue; |
| | | } |
| | | |
| | | String targetLoc = task.getTargetLoc(); |
| | | Loc one = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, targetLoc)); |
| | | if(one == null) { |
| | | if (one == null) { |
| | | continue; |
| | | } |
| | | locs.add(one); |
| | |
| | | |
| | | //从库存中进行匹配 |
| | | List<Loc> locs2 = new ArrayList<>(); |
| | | List<Map<String, Object>> list2 = viewLocDetlMapper.getList(orderDetl.getMat$().getMatnr(), orderDetl.getBatch(), orderDetl.getUniqueField()); |
| | | List<Map<String, Object>> list2 = viewLocDetlMapper.getList(mat.getMatnr(), batch, uniqueFields, null); |
| | | for (Map<String, Object> map : list2) { |
| | | Loc one = locService.getById(map.get("locId").toString()); |
| | | if(one == null) { |
| | | if (one == null) { |
| | | continue; |
| | | } |
| | | locs2.add(one); |
| | |
| | | } |
| | | |
| | | //获取推荐库位(满托盘) |
| | | public List<Loc> getSuggestLoc(Long taskType, Long matId, String batch, Integer locTypeHeight, List<Integer> laneRowList) { |
| | | public List<Loc> getSuggestLoc(Long taskType, Long matId, String batch, Integer locTypeHeight, List<Integer> laneRowList, Integer currentLev) { |
| | | //满托盘 |
| | | List<Loc> locs = new ArrayList<>(); |
| | | LocTypeHeightType locTypeHeightType = LocTypeHeightType.get(locTypeHeight); |
| | |
| | | queryWrapper.in(Loc::getRow1, laneRowList); |
| | | } |
| | | |
| | | if (currentLev != null) { |
| | | queryWrapper.eq(Loc::getLev1, currentLev); |
| | | } |
| | | |
| | | List<Loc> list = locService.list(queryWrapper); |
| | | if (!list.isEmpty()) { |
| | | locs.addAll(list); |
| | |
| | | } |
| | | |
| | | //获取全局库位(完整巷道) |
| | | public List<Loc> getGlobalLoc(Long taskType, Integer locTypeHeight, List<Integer> laneRowList) { |
| | | public List<Loc> getGlobalLoc(Long taskType, Integer locTypeHeight, List<Integer> laneRowList, Integer currentLev) { |
| | | List<Loc> locs = new ArrayList<>(); |
| | | LocTypeHeightType locTypeHeightType = LocTypeHeightType.get(locTypeHeight); |
| | | if (locTypeHeightType == null) { |
| | |
| | | |
| | | if (laneRowList != null && !laneRowList.isEmpty()) { |
| | | queryWrapper.in(Loc::getRow1, laneRowList); |
| | | } |
| | | |
| | | if (currentLev != null) { |
| | | queryWrapper.eq(Loc::getLev1, currentLev); |
| | | } |
| | | |
| | | List<Loc> list = locService.list(queryWrapper); |
| | |
| | | } |
| | | |
| | | //获取推荐库位(空托盘) |
| | | public List<Loc> getSuggestEmptyLoc(Long taskType, Integer locTypeHeight, List<Integer> laneRowList) { |
| | | public List<Loc> getSuggestEmptyLoc(Long taskType, Integer locTypeHeight, List<Integer> laneRowList, Integer currentLev) { |
| | | List<Loc> locs = new ArrayList<>(); |
| | | //空托盘 |
| | | List<SuggestLocRule> suggestLocRules = suggestLocRuleService.list(new LambdaQueryWrapper<SuggestLocRule>().eq(SuggestLocRule::getLocType, 0)); |
| | |
| | | queryWrapper.in(Loc::getRow1, laneRowList); |
| | | } |
| | | |
| | | if (currentLev != null) { |
| | | queryWrapper.eq(Loc::getLev1, currentLev); |
| | | } |
| | | |
| | | List<Loc> list = locService.list(queryWrapper); |
| | | if (!list.isEmpty()) { |
| | | locs.addAll(list); |
| | |
| | | } |
| | | |
| | | //获取全局库位(完整巷道) |
| | | public List<Loc> getGlobalEmptyLoc(Long taskType, Integer locTypeHeight, List<Integer> laneRowList) { |
| | | public List<Loc> getGlobalEmptyLoc(Long taskType, Integer locTypeHeight, List<Integer> laneRowList, Integer currentLev) { |
| | | List<Loc> locs = new ArrayList<>(); |
| | | LocTypeHeightType locTypeHeightType = LocTypeHeightType.get(locTypeHeight); |
| | | if (locTypeHeightType == null) { |
| | |
| | | queryWrapper.in(Loc::getRow1, laneRowList); |
| | | } |
| | | |
| | | if (currentLev != null) { |
| | | queryWrapper.eq(Loc::getLev1, currentLev); |
| | | } |
| | | |
| | | List<Loc> list = locService.list(queryWrapper); |
| | | if (!list.isEmpty()) { |
| | | locs.addAll(list); |