From a6a9777ce5b1713180c1948b674950aee2eb3b1f Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期一, 29 六月 2020 16:41:45 +0800
Subject: [PATCH] #

---
 src/main/webapp/views/pda/stockOut.html                    |   24 ++++++++++--
 src/main/java/com/zy/asrs/controller/MobileController.java |   50 ++++++++++++++++--------
 2 files changed, 53 insertions(+), 21 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/MobileController.java b/src/main/java/com/zy/asrs/controller/MobileController.java
index 87906fc..b538a16 100644
--- a/src/main/java/com/zy/asrs/controller/MobileController.java
+++ b/src/main/java/com/zy/asrs/controller/MobileController.java
@@ -52,24 +52,40 @@
      */
     @RequestMapping("/locDetl")
     @ManagerAuth
-    public R getLocDetl(@RequestParam(required = false)String locNo){
-        if (Cools.isEmpty(locNo)) {
-            return R.parse(BaseRes.PARAM);
+    public R getLocDetl(@RequestParam(required = false)String locNo,
+                        @RequestParam(required = false)String matNo){
+        if (!Cools.isEmpty(locNo)) {
+            LocMast locMast = locMastService.selectById(locNo);
+            if (null == locMast || !"F".equals(locMast.getLocType())) {
+                return R.parse(BaseRes.EMPTY);
+            }
+            List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
+                    .eq("loc_no", locNo).orderBy("appe_time", false));
+            List<MobileLocDetlVo> res = new ArrayList<>();
+            locDetls.forEach(locDetl -> {
+                MobileLocDetlVo vo = new MobileLocDetlVo();
+                vo.setLocNo(locDetl.getLocNo());
+                vo.setMatNo(locDetl.getMatnr());
+                vo.setMatName(locDetl.getMaktx());
+                vo.setCount(locDetl.getAnfme());
+                res.add(vo);
+            });
+            return R.ok().add(res);
         }
-        LocMast locMast = locMastService.selectById(locNo);
-        if (null == locMast || !"F".equals(locMast.getLocType())) {
-            return R.parse(BaseRes.EMPTY);
+        if (!Cools.isEmpty(matNo)) {
+            List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
+                    .eq("matnr", matNo).orderBy("appe_time", false));
+            List<MobileLocDetlVo> res = new ArrayList<>();
+            locDetls.forEach(locDetl -> {
+                MobileLocDetlVo vo = new MobileLocDetlVo();
+                vo.setLocNo(locDetl.getLocNo());
+                vo.setMatNo(locDetl.getMatnr());
+                vo.setMatName(locDetl.getMaktx());
+                vo.setCount(locDetl.getAnfme());
+                res.add(vo);
+            });
+            return R.ok().add(res);
         }
-        List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", locNo));
-        List<MobileLocDetlVo> res = new ArrayList<>();
-        locDetls.forEach(locDetl -> {
-            MobileLocDetlVo vo = new MobileLocDetlVo();
-            vo.setLocNo(locNo);
-            vo.setMatNo(locDetl.getMatnr());
-            vo.setMatName(locDetl.getMaktx());
-            vo.setCount(locDetl.getAnfme());
-            res.add(vo);
-        });
-        return R.ok().add(res);
+        return R.parse(BaseRes.PARAM);
     }
 }
diff --git a/src/main/webapp/views/pda/stockOut.html b/src/main/webapp/views/pda/stockOut.html
index 14937cf..5ba0296 100644
--- a/src/main/webapp/views/pda/stockOut.html
+++ b/src/main/webapp/views/pda/stockOut.html
@@ -110,11 +110,11 @@
 <header>
     <div class="layui-input-inline">
         <label class="layui-form-label">搴撲綅</label>
-        <input class="layui-input" type="text" id="locNo" onkeyup="findLocDetl(this)" autocomplete="off">
+        <input class="layui-input" type="text" id="locNo" onkeyup="findByLocNo(this)" autocomplete="off">
     </div>
     <div class="layui-input-inline">
         <label class="layui-form-label">鐗╂枡</label>
-        <input class="layui-input" type="text" id="matNo" autocomplete="off">
+        <input class="layui-input" type="text" id="matNo" onkeyup="findByMatNo(this)" autocomplete="off">
     </div>
 </header>
 <!-- 涓讳綋 -->
@@ -144,15 +144,31 @@
     /**
      * 鏍规嵁搴撲綅鍙锋煡鎵惧簱瀛樻槑缁�
      */
-    function findLocDetl(el){
+    function findByLocNo(el){
         if (isEmpty(el.value)) {
             return;
         }
+        $("#matNo").val("");
+        find(el.value, null);
+    }
+
+    /**
+     * 鏍规嵁鐗╂枡鍙锋煡鎵惧簱瀛樻槑缁�
+     */
+    function findByMatNo(el){
+        if (isEmpty(el.value)) {
+            return;
+        }
+        $("#locNo").val("");
+        find(null, el.value);
+    }
+    function find(locNo, matNo) {
         $.ajax({
             url: baseUrl + "/mobile/locDetl",
             headers: {'token': localStorage.getItem('token')},
             data: {
-                locNo: el.value
+                locNo: locNo,
+                matNo: matNo
             },
             method: 'POST',
             success: function (res) {

--
Gitblit v1.9.1