|  |  | 
 |  |  | import com.alibaba.fastjson.JSONArray; | 
 |  |  | import com.alibaba.fastjson.JSONObject; | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
 |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
 |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
 |  |  | import com.zy.asrs.common.wms.entity.LocDetl; | 
 |  |  | import com.zy.asrs.common.wms.entity.Mat; | 
 |  |  | 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.Cools; | 
 |  |  | import com.zy.asrs.framework.common.R; | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private LocDetlService locDetlService; | 
 |  |  |     @Autowired | 
 |  |  |     private MatService matService; | 
 |  |  |  | 
 |  |  |     @RequestMapping(value = "/locDetl/{id}/auth") | 
 |  |  |     @ManagerAuth | 
 |  |  | 
 |  |  |             wrapper.ge(LocDetl::getAppeTime, DateUtils.convert(range[0])); | 
 |  |  |             wrapper.le(LocDetl::getAppeTime, DateUtils.convert(range[1])); | 
 |  |  |         } | 
 |  |  |         if (!Cools.isEmpty(param.get("loc_no"))) { | 
 |  |  |             wrapper.eq(LocDetl::getLocNo, param.get("loc_no")); | 
 |  |  |         if (!Cools.isEmpty(param.get("locNo"))) { | 
 |  |  |             wrapper.eq(LocDetl::getLocNo, param.get("locNo")); | 
 |  |  |         } | 
 |  |  |         return R.ok(locDetlService.page(new Page<>(curr, limit), wrapper)); | 
 |  |  |     } | 
 |  |  | 
 |  |  |         return R.ok().add(vos); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @RequestMapping(value = "/locDetl/statis/auth") | 
 |  |  |     @ManagerAuth | 
 |  |  |     public R statis(@RequestParam(defaultValue = "1")Integer curr, | 
 |  |  |                     @RequestParam(defaultValue = "10")Integer limit, | 
 |  |  |                     @RequestParam Map<String, Object> param) { | 
 |  |  |         IPage<LocDetl> stockStatis = locDetlService.getStockStatis(curr, limit, param); | 
 |  |  |         for (LocDetl locDetl : stockStatis.getRecords()) { | 
 |  |  |             Mat mat = matService.getOne(new LambdaQueryWrapper<Mat>() | 
 |  |  |                     .eq(Mat::getMatnr, locDetl.getMatnr()) | 
 |  |  |                     .eq(Mat::getHostId, getHostId())); | 
 |  |  |             if (mat != null) { | 
 |  |  |                 locDetl.sync(mat); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         return R.ok().add(stockStatis); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 获取库存总数 | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     @RequestMapping("/locDetl/count") | 
 |  |  |     public R getAllCount(){ | 
 |  |  |         Integer sum = locDetlService.sum(); | 
 |  |  |         return R.ok(sum); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @RequestMapping(value = "/stock/out/list/auth") | 
 |  |  |     @ManagerAuth | 
 |  |  |     public R stockOutList(@RequestParam(defaultValue = "1")Integer curr, | 
 |  |  |                           @RequestParam(defaultValue = "10")Integer limit, | 
 |  |  |                           @RequestParam Map<String, Object> param){ | 
 |  |  |         if (!Cools.isEmpty(param.get("modi_time"))){ | 
 |  |  |             String val = String.valueOf(param.get("modi_time")); | 
 |  |  |             if (val.contains(RANGE_TIME_LINK)) { | 
 |  |  |                 String[] dates = val.split(RANGE_TIME_LINK); | 
 |  |  |                 param.put("startTime", DateUtils.convert(dates[0])); | 
 |  |  |                 param.put("endTime", DateUtils.convert(dates[1])); | 
 |  |  |                 param.remove("modi_time"); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         param.put("hostId", getHostId()); | 
 |  |  |         return R.ok(locDetlService.getStockOut(curr, limit, param)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } |