From ccc693f973698fc6b0d333ccab8068114c53921b Mon Sep 17 00:00:00 2001
From: mrzhssss <pro6@qq.com>
Date: 星期五, 28 十月 2022 16:44:36 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/controller/LocDetlController.java | 87 ++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 85 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/LocDetlController.java b/src/main/java/com/zy/asrs/controller/LocDetlController.java
index 553be70..767f5a5 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
@@ -92,7 +93,7 @@
@RequestParam(required = false)String condition,
@RequestParam Map<String, Object> param,
@RequestParam(required = false)Boolean unreason){
- if (unreason) {
+ if (!Cools.isEmpty(unreason) && unreason) {
return R.ok(locDetlService.selectPage(new Page<>(curr, limit), new EntityWrapper<LocDetl>()
.where(" DATALENGTH( batch ) != 11 or\n" +
@@ -178,7 +179,7 @@
@RequestMapping(value = "/locDetl/export/auth")
@ManagerAuth(memo = "搴撲綅鏄庣粏瀵煎嚭")
- public R export(@RequestBody JSONObject param){
+ public synchronized R export(@RequestBody JSONObject param){
List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
EntityWrapper<LocDetl> wrapper = new EntityWrapper<>();
Map<String, Object> map = excludeTrash(param.getJSONObject("locDetl"));
@@ -276,4 +277,86 @@
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 (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