From cfa2d1bf7847e5c982c68e0892f5d2ca64638934 Mon Sep 17 00:00:00 2001
From: lty <876263681@qq.com>
Date: 星期五, 20 三月 2026 16:20:24 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/controller/LocDetlController.java |   63 +++++++++++++------------------
 1 files changed, 27 insertions(+), 36 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/LocDetlController.java b/src/main/java/com/zy/asrs/controller/LocDetlController.java
index 619459d..e43ff55 100644
--- a/src/main/java/com/zy/asrs/controller/LocDetlController.java
+++ b/src/main/java/com/zy/asrs/controller/LocDetlController.java
@@ -189,6 +189,7 @@
 //            }
 //        }
         excludeTrash(param);
+        applyBeBatchFilter(param, wrapper);
         convert(param, wrapper);
         allLike(LocDetl.class, param.keySet(), wrapper, condition);
         if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
@@ -215,6 +216,29 @@
                 }
             }
         }
+    }
+
+    private <T> void applyBeBatchFilter(Map<String, Object> map, EntityWrapper<T> wrapper) {
+        Object beBatchObj = map.remove("beBatch");
+        if (beBatchObj == null) {
+            beBatchObj = map.remove("be_batch");
+        }
+        if (beBatchObj == null) {
+            return;
+        }
+        String beBatch = String.valueOf(beBatchObj).trim();
+        if (Cools.isEmpty(beBatch)) {
+            return;
+        }
+        if ("1".equals(beBatch)) {
+            wrapper.eq("be_batch", 1);
+            return;
+        }
+        if ("0".equals(beBatch)) {
+            wrapper.andNew().isNull("be_batch").or().eq("be_batch", 0);
+            return;
+        }
+        wrapper.eq("be_batch", beBatch);
     }
 
     @RequestMapping(value = "/locDetl/add/auth")
@@ -290,47 +314,14 @@
                 map.remove("row");
             }
         }
+        applyBeBatchFilter(map, wrapper);
         convert(map, wrapper);
         if (!row.equals("")) {
             wrapper.and()
-                    .where("loc_no like '" + row + "%'");
+                    .where("loc_no like {0}", row + "%");
         }
         List<LocDetl> list = locDetlService.selectList(wrapper);
-        List<AbnormalLocDetlParam> result = new ArrayList<>();
-
-        Page<LocDetl> groupLocDetl = locDetlService.getStockStatis2(toPage(1, 10000, param, LocDetl.class));
-        for (LocDetl locDetl : groupLocDetl.getRecords()) {
-            AbnormalLocDetlParam abnormalLocDetlParam = new AbnormalLocDetlParam();
-            Mat mat = matService.selectOne(new EntityWrapper<Mat>()
-                    .eq("matnr", locDetl.getMatnr()));
-            if (Cools.isEmpty(mat)) {
-                continue;
-            }
-            if (!Cools.isEmpty(mat                                                                          .getStoreMax()) || !Cools.isEmpty(mat.getStoreMin())) {
-                abnormalLocDetlParam.setStoreMax(mat.getStoreMax());
-                abnormalLocDetlParam.setStoreMaxDate(mat.getStoreMaxDate());
-                abnormalLocDetlParam.setStoreMin(mat.getStoreMin());
-                abnormalLocDetlParam.setAnfme(locDetl.getAnfme());
-                abnormalLocDetlParam.setMaktx(mat.getMaktx());
-                abnormalLocDetlParam.setMatnr(mat.getMatnr());
-                abnormalLocDetlParam.setSpecs(mat.getSpecs());
-                abnormalLocDetlParam.setBatch(locDetl.getBatch());
-
-//                SimpleDateFormat simple = new SimpleDateFormat("yyyyMMdd");
-//                Date maxDate = simple.parse(locDetl.getBatch());
-//                long time = maxDate.getTime();
-//                Date now = new Date();
-//                long time1 = now.getTime();
-//                abnormalLocDetlParam.setNowTime((int) ((time1 - time) / (1000 * 60 * 60 * 24)));
-
-                if (!Cools.isEmpty(mat.getStoreMax()) && locDetl.getAnfme() > mat.getStoreMax()) {
-                    result.add(abnormalLocDetlParam);
-                } else if (!Cools.isEmpty(mat.getStoreMin()) && locDetl.getAnfme() < mat.getStoreMin()) {
-                    result.add(abnormalLocDetlParam);
-                }
-            }
-        }
-        return R.ok(exportSupport(result, fields));
+        return R.ok(exportSupport(list, fields));
     }
 
     @RequestMapping(value = "/locDetl/selectOwner/list/auth")

--
Gitblit v1.9.1