|  |  |  | 
|---|
|  |  |  | import com.zy.asrs.common.wms.service.LocDetlService; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.service.MatService; | 
|---|
|  |  |  | import com.zy.asrs.framework.annotations.ManagerAuth; | 
|---|
|  |  |  | import com.zy.asrs.framework.common.BaseRes; | 
|---|
|  |  |  | import com.zy.asrs.framework.common.Cools; | 
|---|
|  |  |  | import com.zy.asrs.framework.common.R; | 
|---|
|  |  |  | import com.zy.asrs.framework.domain.KeyValueVo; | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok(detls); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/locDetl/forlocNo/auth/v1") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R forlocNoV1(@RequestParam String locNo) { | 
|---|
|  |  |  | LambdaQueryWrapper<LocDetl> locDetlLambdaQueryWrapper = new LambdaQueryWrapper<LocDetl>() | 
|---|
|  |  |  | .eq(LocDetl::getLocNo, locNo) | 
|---|
|  |  |  | .eq(LocDetl::getHostId, getHostId()); | 
|---|
|  |  |  | List<LocDetl> detls = locDetlService.list(locDetlLambdaQueryWrapper); | 
|---|
|  |  |  | if (Cools.isEmpty(detls)){ | 
|---|
|  |  |  | return R.error("未查询到库存数据"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(detls); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/locDetl/forlocNo/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R forlocNo(@RequestParam String orderNo,@RequestParam String locNo,@RequestParam String batch,@RequestParam String matnr) { | 
|---|
|  |  |  | 
|---|
|  |  |  | .eq(LocDetl::getLocNo, locNo) | 
|---|
|  |  |  | .eq(LocDetl::getHostId, getHostId()) | 
|---|
|  |  |  | .eq(LocDetl::getMatnr, matnr); | 
|---|
|  |  |  | if (!Cools.isEmpty(batch)){ | 
|---|
|  |  |  | locDetlLambdaQueryWrapper.eq(LocDetl::getBatch,batch); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //        if (!Cools.isEmpty(batch)){ | 
|---|
|  |  |  | //            locDetlLambdaQueryWrapper.eq(LocDetl::getBatch,batch); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | List<LocDetl> detls = locDetlService.list(locDetlLambdaQueryWrapper); | 
|---|
|  |  |  | if (Cools.isEmpty(detls)){ | 
|---|
|  |  |  | return R.error("未查询到库存数据"); | 
|---|
|  |  |  | 
|---|
|  |  |  | //                    .where("loc_no like '" +row +"%'"); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | List<LocDetl> list = locDetlService.list(wrapper); | 
|---|
|  |  |  | return R.ok(exportSupport(list, fields)); | 
|---|
|  |  |  | List<LocDetl> locDetls=new ArrayList<>(); | 
|---|
|  |  |  | for (LocDetl l:list | 
|---|
|  |  |  | ) { | 
|---|
|  |  |  | if(Cools.isEmpty(l.getMaktx())){ | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | String new_String = l.getMaktx().replace("\"",""); | 
|---|
|  |  |  | l.setMaktx(new_String); | 
|---|
|  |  |  | locDetls.add(l); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(exportSupport(locDetls, fields)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private <T> void convert(Map<String, Object> map, QueryWrapper<T> wrapper){ | 
|---|
|  |  |  | for (Map.Entry<String, Object> entry : map.entrySet()){ | 
|---|
|  |  |  | if(Cools.eq(entry.getKey(),"curr") | 
|---|
|  |  |  | || Cools.eq(entry.getKey(),"limit") | 
|---|
|  |  |  | || Cools.eq(entry.getKey(),"unreason") | 
|---|
|  |  |  | || Cools.eq(entry.getKey(),"orderByField") | 
|---|
|  |  |  | || Cools.eq(entry.getKey(),"orderByType") | 
|---|
|  |  |  | || Cools.eq(entry.getKey(),"row") | 
|---|
|  |  |  | || Cools.eq(entry.getKey(),"condition")){ | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(Cools.isEmpty(entry.getValue())){ | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String val = String.valueOf(entry.getValue()); | 
|---|
|  |  |  | if (val.contains(RANGE_TIME_LINK)){ | 
|---|
|  |  |  | String[] dates = val.split(RANGE_TIME_LINK); | 
|---|
|  |  |  | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R page(@RequestParam(defaultValue = "1") Integer curr, | 
|---|
|  |  |  | @RequestParam(defaultValue = "10") Integer limit, | 
|---|
|  |  |  | @RequestParam(required = false)String orderByField, | 
|---|
|  |  |  | @RequestParam(required = false)String orderByType, | 
|---|
|  |  |  | @RequestParam(required = false) String condition, | 
|---|
|  |  |  | @RequestParam(required = false) String timeRange, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param) { | 
|---|
|  |  |  | QueryWrapper<LocDetl> wrapper = new QueryWrapper<>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!Cools.isEmpty(param.get("decrees"))) { | 
|---|
|  |  |  | ArrayList<String> mats = new ArrayList<>(); | 
|---|
|  |  |  | List<Mat> decrees = matService.list(new LambdaQueryWrapper<Mat>().like(Mat::getDecrees, param.get("decrees"))); | 
|---|
|  |  |  | if (decrees.isEmpty()) { | 
|---|
|  |  |  | mats.add("-1"); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | for (Mat mat : decrees) { | 
|---|
|  |  |  | mats.add(mat.getMatnr()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | wrapper.in("matnr", mats); | 
|---|
|  |  |  | param.remove("decrees"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | convert(param,wrapper); | 
|---|
|  |  |  | wrapper.eq("host_id", getHostId()); | 
|---|
|  |  |  | //        if (!Cools.isEmpty(condition)) { | 
|---|
|  |  |  | //            wrapper.like(LocDetl::getLocNo, condition); | 
|---|
|  |  |  | 
|---|
|  |  |  | wrapper.le("appe_time", DateUtils.convert(range[1])); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!Cools.isEmpty(param.get("locNo"))) { | 
|---|
|  |  |  | wrapper.eq("loc_no", param.get("locNo")); | 
|---|
|  |  |  | wrapper.like("loc_no", param.get("locNo")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!Cools.isEmpty(param.get("zpallet"))) { | 
|---|
|  |  |  | wrapper.like("zpallet", param.get("zpallet")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!Cools.isEmpty(orderByField)){ | 
|---|
|  |  |  | wrapper.orderBy(true, "asc".equals(orderByType), humpToLine(orderByField)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | param.remove("locNo"); | 
|---|
|  |  |  | param.remove("owner"); | 
|---|
|  |  |  | param.remove("zpallet"); | 
|---|
|  |  |  | param.remove("matnr"); | 
|---|
|  |  |  | allLike(LocDetl.class, param.keySet(), wrapper, condition); | 
|---|
|  |  |  | return R.ok(locDetlService.page(new Page<>(curr, limit), wrapper)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/locDetl/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R stockOutList(@RequestParam(value = "locNos[]") List<String> locNos){ | 
|---|
|  |  |  | if (!locNos.isEmpty()) { | 
|---|
|  |  |  | List<LocDetl> res = new ArrayList<>(); | 
|---|
|  |  |  | for (String locNo : new HashSet<>(locNos)) { | 
|---|
|  |  |  | List<LocDetl> locDetls = locDetlService.list(new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getLocNo, locNo)); | 
|---|
|  |  |  | if (!locDetls.isEmpty()) { | 
|---|
|  |  |  | res.addAll(locDetls); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok().add(res); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.parse(BaseRes.EMPTY); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/locDetl/add/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|