|  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONArray; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.entity.LocDetl; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.entity.WaitPakin; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.entity.WaitPakinLog; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.service.WaitPakinLogService; | 
|---|
|  |  |  | import com.zy.asrs.framework.annotations.ManagerAuth; | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok(waitPakinLogService.getById(String.valueOf(id))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/waitPakinLog/export/auth1") | 
|---|
|  |  |  | @ManagerAuth(memo = "库位明细导出") | 
|---|
|  |  |  | public synchronized R export(@RequestBody JSONObject param){ | 
|---|
|  |  |  | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); | 
|---|
|  |  |  | QueryWrapper<WaitPakinLog> wrapper = new QueryWrapper<>(); | 
|---|
|  |  |  | Map<String, Object> map = excludeTrash(param.getJSONObject("waitPakinLog")); | 
|---|
|  |  |  | String row = ""; | 
|---|
|  |  |  | if (map.get("row") != null) { | 
|---|
|  |  |  | String chooseRow = (String) map.get("row"); | 
|---|
|  |  |  | if (chooseRow.length() == 1) { | 
|---|
|  |  |  | row = "0" + chooseRow; | 
|---|
|  |  |  | map.remove("row"); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | row = chooseRow; | 
|---|
|  |  |  | map.remove("row"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | convert(map, wrapper); | 
|---|
|  |  |  | //        if (!row.equals("")){ | 
|---|
|  |  |  | //            wrapper.and() | 
|---|
|  |  |  | //                    .where("loc_no like '" +row +"%'"); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | List<WaitPakinLog> list = waitPakinLogService.list(wrapper); | 
|---|
|  |  |  | return R.ok(exportSupport(list, 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); | 
|---|
|  |  |  | wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); | 
|---|
|  |  |  | wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | if (entry.getKey().equals("locNo")) { | 
|---|
|  |  |  | wrapper.eq("loc_no", String.valueOf(entry.getValue())); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | wrapper.like(entry.getKey(), String.valueOf(entry.getValue())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/waitPakinLog/page/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R page(@RequestParam(defaultValue = "1") Integer curr, | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestParam(required = false) String timeRange, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param) { | 
|---|
|  |  |  | LambdaQueryWrapper<WaitPakinLog> wrapper = new LambdaQueryWrapper<>(); | 
|---|
|  |  |  | if (!Cools.isEmpty(condition)) { | 
|---|
|  |  |  | wrapper.like(WaitPakinLog::getId, condition); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | wrapper.eq(WaitPakinLog::getHostId, getHostId()); | 
|---|
|  |  |  | if (!Cools.isEmpty(timeRange)) { | 
|---|
|  |  |  | String[] range = timeRange.split(RANGE_TIME_LINK); | 
|---|
|  |  |  | wrapper.ge(WaitPakinLog::getAppeTime, DateUtils.convert(range[0])); | 
|---|
|  |  |  | wrapper.le(WaitPakinLog::getAppeTime, DateUtils.convert(range[1])); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!Cools.isEmpty(param.get("zpallet"))) { | 
|---|
|  |  |  | wrapper.like(WaitPakinLog::getZpallet, param.get("zpallet")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!Cools.isEmpty(param.get("matnr"))) { | 
|---|
|  |  |  | wrapper.like(WaitPakinLog::getMatnr, param.get("matnr")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(waitPakinLogService.page(new Page<>(curr, limit), wrapper)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|