|  |  |  | 
|---|
|  |  |  | import com.core.common.DateUtils; | 
|---|
|  |  |  | import com.core.common.R; | 
|---|
|  |  |  | import com.zy.asrs.entity.LocDetl; | 
|---|
|  |  |  | import com.zy.asrs.entity.ManLocDetl; | 
|---|
|  |  |  | import com.zy.asrs.entity.Mat; | 
|---|
|  |  |  | import com.zy.asrs.mapper.LocDetlMapper; | 
|---|
|  |  |  | import com.zy.asrs.service.LocDetlService; | 
|---|
|  |  |  | import com.zy.asrs.service.ManLocDetlService; | 
|---|
|  |  |  | import com.zy.asrs.service.MatService; | 
|---|
|  |  |  | import com.zy.common.web.BaseController; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | 
|---|
|  |  |  | if (!locNos.isEmpty()) { | 
|---|
|  |  |  | List<LocDetl> res = new ArrayList<>(); | 
|---|
|  |  |  | for (String locNo : new HashSet<>(locNos)) { | 
|---|
|  |  |  | List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", locNo)); | 
|---|
|  |  |  | if (!locDetls.isEmpty()) { | 
|---|
|  |  |  | res.addAll(locDetls); | 
|---|
|  |  |  | List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", locNo)); | 
|---|
|  |  |  | if (!locDetls.isEmpty()) { | 
|---|
|  |  |  | res.addAll(locDetls); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok().add(res); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.parse(BaseRes.EMPTY); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/locDetlOut/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R stockOutListAll(@RequestParam(value = "locNos[]") List<String> locNos,@RequestParam(value = "matnrs[]",required = false) List<String> matnrs){ | 
|---|
|  |  |  | if (!locNos.isEmpty()&&!matnrs.isEmpty()) { | 
|---|
|  |  |  | List<LocDetl> res = new ArrayList<>(); | 
|---|
|  |  |  | for (String locNo : new HashSet<>(locNos)) { | 
|---|
|  |  |  | for (String matnr : new HashSet<>(matnrs)) { | 
|---|
|  |  |  | List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("matnr",matnr).eq("loc_no",locNo)); | 
|---|
|  |  |  | if (!locDetls.isEmpty()) { | 
|---|
|  |  |  | res.addAll(locDetls); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok().add(res); | 
|---|
|  |  |  | 
|---|
|  |  |  | //                param.remove("row"); | 
|---|
|  |  |  | //            } | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | Object query_date = param.get("query_date"); | 
|---|
|  |  |  | param.remove("query_date"); | 
|---|
|  |  |  | excludeTrash(param); | 
|---|
|  |  |  | convert(param, wrapper); | 
|---|
|  |  |  | allLike(LocDetl.class, param.keySet(), wrapper, condition); | 
|---|
|  |  |  | 
|---|
|  |  |  | //            wrapper.and() | 
|---|
|  |  |  | //                    .where("loc_no like '" +row +"%'"); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | if (query_date!=null){ | 
|---|
|  |  |  | if (query_date.toString().contains(" - ")) { | 
|---|
|  |  |  | String[] dates = query_date.toString().split(" - "); | 
|---|
|  |  |  | wrapper.ge("appe_time", dates[0]).le("appe_time",dates[1]); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(locDetlService.selectPage(new Page<>(curr, limit), wrapper)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestParam(defaultValue = "10")Integer limit, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param) { | 
|---|
|  |  |  | Page<LocDetl> stockStatis = locDetlService.getStockStatis(toPage(curr, limit, param, LocDetl.class)); | 
|---|
|  |  |  | for (LocDetl locDetl : stockStatis.getRecords()) { | 
|---|
|  |  |  | Mat mat = matService.selectByMatnr(locDetl.getMatnr()); | 
|---|
|  |  |  | if (mat != null) { | 
|---|
|  |  |  | locDetl.sync(mat); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok().add(stockStatis); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|