| | |
| | | @PostMapping("/loc/areaNoUse/list") |
| | | public R areaNoUselist(@RequestBody Map<String, Object> map) { |
| | | String locCode = map.get("locCode").toString(); |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, locCode),false); |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, locCode) |
| | | .last("LIMIT 1")); |
| | | List<Loc> list = locService.list(new LambdaQueryWrapper<Loc>() |
| | | .eq(Loc::getAreaId, loc.getAreaId()) |
| | | .eq(!Objects.isNull(loc.getChannel()), Loc::getChannel,loc.getChannel()) |
| | | // .eq(!Objects.isNull(loc.getChannel()), Loc::getChannel,loc.getChannel())// |
| | | .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type) |
| | | ); |
| | | List<String> list1 = list.stream().map(obj -> obj.getCode()).collect(Collectors.toList()); |
| | | return R.ok(list1); |
| | | } |
| | | |
| | | /** 同库区空闲库位分页,支持按库位号前缀过滤;用于下拉滚动分页或输入前缀实时加载 */ |
| | | @PreAuthorize("hasAuthority('manager:loc:list')") |
| | | @PostMapping("/loc/areaNoUse/page") |
| | | public R areaNoUsePage(@RequestBody Map<String, Object> map) { |
| | | String locCode = (String) map.get("locCode"); |
| | | int current = map.get("current") != null ? Integer.parseInt(String.valueOf(map.get("current"))) : 1; |
| | | int pageSize = map.get("pageSize") != null ? Integer.parseInt(String.valueOf(map.get("pageSize"))) : 50; |
| | | if (Cools.isEmpty(locCode)) { |
| | | Page<String> emptyPage = new Page<>(current, pageSize); |
| | | emptyPage.setRecords(Collections.emptyList()); |
| | | emptyPage.setTotal(0L); |
| | | return R.ok().add(emptyPage); |
| | | } |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, locCode).last("LIMIT 1")); |
| | | if (loc == null) { |
| | | Page<String> emptyPage = new Page<>(current, pageSize); |
| | | emptyPage.setRecords(Collections.emptyList()); |
| | | emptyPage.setTotal(0L); |
| | | return R.ok().add(emptyPage); |
| | | } |
| | | String q = map.get("q") != null ? String.valueOf(map.get("q")).trim() : null; |
| | | if (StringUtils.isBlank(q) && map.get("condition") != null) { |
| | | q = String.valueOf(map.get("condition")).trim(); |
| | | } |
| | | LambdaQueryWrapper<Loc> wrapper = new LambdaQueryWrapper<Loc>() |
| | | .select(Loc::getCode) |
| | | .eq(Loc::getAreaId, loc.getAreaId()) |
| | | .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type) |
| | | .orderByAsc(Loc::getCode); |
| | | if (StringUtils.isNotBlank(q)) { |
| | | wrapper.likeRight(Loc::getCode, q); |
| | | } |
| | | Page<Loc> page = new Page<>(current, pageSize); |
| | | Page<Loc> result = locService.page(page, wrapper); |
| | | List<String> records = result.getRecords().stream().map(Loc::getCode).collect(Collectors.toList()); |
| | | Page<String> pageOut = new Page<>(current, pageSize); |
| | | pageOut.setRecords(records); |
| | | pageOut.setTotal(result.getTotal()); |
| | | return R.ok().add(pageOut); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:loc:list')") |
| | | @PostMapping({"/loc/many/{ids}", "/locs/many/{ids}"}) |
| | | public R many(@PathVariable Long[] ids) { |