From d941e5d091243af46052a2bb46f705b46a92d914 Mon Sep 17 00:00:00 2001 From: mrzhssss <pro6@qq.com> Date: 星期四, 27 十月 2022 12:33:47 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/controller/LocDetlController.java | 86 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 86 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/LocDetlController.java b/src/main/java/com/zy/asrs/controller/LocDetlController.java index 30ec08b..4344a5d 100644 --- a/src/main/java/com/zy/asrs/controller/LocDetlController.java +++ b/src/main/java/com/zy/asrs/controller/LocDetlController.java @@ -24,6 +24,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.net.URLEncoder; +import java.text.SimpleDateFormat; import java.util.*; @RestController @@ -276,4 +277,89 @@ return R.ok(sum); } + + /**********************************************************寮傚父搴撳瓨鐩稿叧controller**********************************************************/ + + @RequestMapping(value = "/locDetl/grouplist/auth") + @ManagerAuth + public R groupList(@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 Map<String, Object> param){ + + List<LocDetl> result = new ArrayList<>(); +// excludeTrash(param); + param.put("curr",curr); + param.put("limit",limit); + List<LocDetl> groupLocDetl = locDetlService.selectGroupPage(param,curr,limit); + for (LocDetl locDetl : groupLocDetl) { + Mat mat = matService.selectOne(new EntityWrapper<Mat>() + .eq("matnr", locDetl.getMatnr())); + if (Cools.isEmpty(mat) + || Cools.isEmpty(mat.getStoreMax()) + || Cools.isEmpty(mat.getStoreMaxDate()) + || Cools.isEmpty(mat.getStoreMin())) { + continue; + } + if (mat.getMatnr().equals("LPJ.JSJ.QFS.017")){ + System.out.println("\"LPJ.JSJ.QFS.017\" = " + "LPJ.JSJ.QFS.017"); + } + if (locDetl.getAnfme() > mat.getStoreMax()){ + result.add(locDetl); + continue; + } + if (locDetl.getAnfme() < mat.getStoreMin()){ + result.add(locDetl); + continue; + } + + + if (Cools.isEmpty(locDetl.getBatch())) { + continue; + } + if (locDetl.getBatch().length() != 8){ + continue; + } + try{ + SimpleDateFormat simple = new SimpleDateFormat("yyyyMMdd"); + Date maxDate = simple.parse(locDetl.getBatch()); + Calendar calendar = new GregorianCalendar(); + calendar.setTime(maxDate); + // 鎶婃棩鏈熷線鍚庡鍔犱竴澶�,鏁存暟 寰�鍚庢帹,璐熸暟寰�鍓嶇Щ鍔� + calendar.add(Calendar.DATE, mat.getStoreMaxDate()); + // 杩欎釜鏃堕棿灏辨槸鏃ユ湡寰�鍚庢帹涓�澶╃殑缁撴灉 + maxDate = calendar.getTime(); + Date now = new Date(); + if (now.compareTo(maxDate) > 0) { + result.add(locDetl); + } + + }catch (Exception e){ + continue; + } + } + + Page<LocDetl> locDetlPage = new Page<>(); + locDetlPage.setRecords(paging(result,curr,limit)); + locDetlPage.setTotal(result.size()); + locDetlPage.setCurrent(curr); + locDetlPage.setSize(limit); + return R.ok(locDetlPage); + } + + private List<LocDetl> paging(List<LocDetl> result, Integer curr, Integer limit) { + List<LocDetl> pageRecord = new ArrayList<LocDetl>(); + int minIndex = (curr - 1) * limit; + int maxIndex = (curr * limit) - 1; + if (result.size() < maxIndex){ + maxIndex = result.size(); + } + for (int i = minIndex; i < maxIndex; i++){ + pageRecord.add(result.get(i)); + } + return pageRecord; + } + } -- Gitblit v1.9.1