From 42b24af07f1ec2d1a375232d754128ba41d56f0a Mon Sep 17 00:00:00 2001
From: chen.lin <1442464845@qq.com>
Date: 星期四, 29 一月 2026 15:35:55 +0800
Subject: [PATCH] pda匹配单号

---
 src/main/java/com/zy/asrs/controller/MaterialReceiveController.java |   65 ++++++++++++++++-----
 src/main/webapp/views/pda/materialReceiveOut.html                   |   58 +++++++------------
 2 files changed, 70 insertions(+), 53 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/MaterialReceiveController.java b/src/main/java/com/zy/asrs/controller/MaterialReceiveController.java
index b8f8348..e9e612e 100644
--- a/src/main/java/com/zy/asrs/controller/MaterialReceiveController.java
+++ b/src/main/java/com/zy/asrs/controller/MaterialReceiveController.java
@@ -41,24 +41,55 @@
                   @RequestParam(required = false) String condition,
                   @RequestParam(required = false) Boolean pdaQuery,
                   @RequestParam Map<String, Object> param) {
-        EntityWrapper<MaterialReceive> wrapper = new EntityWrapper<>();
-        excludeTrash(param);
-        // 绉婚櫎pdaQuery鍙傛暟锛屽洜涓哄畠涓嶆槸鏁版嵁搴撳瓧娈碉紝鍙槸鎺у埗鍙傛暟
-        param.remove("pdaQuery");
-        convert(param, wrapper);
-        allLike(MaterialReceive.class, param.keySet(), wrapper, condition);
-        
-        // 鍙傝�冨叾浠栧嚭搴撴ā鍧楋紝PDA鍑哄簱鏌ヨ鏃惰繃婊ゆ帀宸插叏閮ㄥ嚭搴撶殑鐗╂枡锛堝彧鏄剧ず杩樻湁鍓╀綑鏁伴噺鐨勶級
-        // 閫氳繃 pdaQuery 鍙傛暟鍒ゆ柇鏄惁鏄疨DA鍑哄簱鏌ヨ
-        if (pdaQuery != null && pdaQuery) {
-            // PDA鍑哄簱鏌ヨ锛氬彧鏄剧ず鍓╀綑鏁伴噺澶т簬0鐨勮褰�
-            wrapper.gt("remain_qty", 0);
+        try {
+            EntityWrapper<MaterialReceive> wrapper = new EntityWrapper<>();
+            excludeTrash(param);
+            // 绉婚櫎pdaQuery鍙傛暟锛屽洜涓哄畠涓嶆槸鏁版嵁搴撳瓧娈碉紝鍙槸鎺у埗鍙傛暟
+            param.remove("pdaQuery");
+            
+            // 澶勭悊鐢熶骇鍗曞彿/浠诲姟鍗曞彿鐨勫涓�兼煡璇紙鐢▅鍒嗛殧锛�
+            if (param.containsKey("soCodeOrFbillno")) {
+                String soCodeOrFbillno = String.valueOf(param.get("soCodeOrFbillno"));
+                param.remove("soCodeOrFbillno");
+                
+                // 鍒嗗壊澶氫釜鍊�
+                String[] codeArray = soCodeOrFbillno.split("\\|");
+                List<String> validCodes = new ArrayList<>();
+                for (String codeStr : codeArray) {
+                    String code = codeStr.trim();
+                    if (code.length() > 0) {
+                        validCodes.add(code);
+                    }
+                }
+                
+                if (!validCodes.isEmpty()) {
+                    // 鏋勫缓OR鏌ヨ鏉′欢
+                    // 鏍煎紡锛歴o_code IN (value1, value2, ...) OR fbillno IN (value1, value2, ...)
+                    wrapper.andNew()
+                          .in("so_code", validCodes)
+                          .or()
+                          .in("fbillno", validCodes);
+                }
+            }
+            
+            convert(param, wrapper);
+            allLike(MaterialReceive.class, param.keySet(), wrapper, condition);
+            
+            // 鍙傝�冨叾浠栧嚭搴撴ā鍧楋紝PDA鍑哄簱鏌ヨ鏃惰繃婊ゆ帀宸插叏閮ㄥ嚭搴撶殑鐗╂枡锛堝彧鏄剧ず杩樻湁鍓╀綑鏁伴噺鐨勶級
+            // 閫氳繃 pdaQuery 鍙傛暟鍒ゆ柇鏄惁鏄疨DA鍑哄簱鏌ヨ
+            if (pdaQuery != null && pdaQuery) {
+                // PDA鍑哄簱鏌ヨ锛氬彧鏄剧ず鍓╀綑鏁伴噺澶т簬0鐨勮褰�
+                wrapper.gt("remain_qty", 0);
+            }
+            
+            if (!Cools.isEmpty(orderByField)) {
+                wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));
+            }
+            return R.ok(materialReceiveService.selectPage(new Page<>(curr, limit), wrapper));
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.error("鏌ヨ澶辫触: " + e.getMessage());
         }
-        
-        if (!Cools.isEmpty(orderByField)) {
-            wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));
-        }
-        return R.ok(materialReceiveService.selectPage(new Page<>(curr, limit), wrapper));
     }
 
     @RequestMapping(value = "/materialReceive/batchSave/auth", method = RequestMethod.POST)
diff --git a/src/main/webapp/views/pda/materialReceiveOut.html b/src/main/webapp/views/pda/materialReceiveOut.html
index 1f5f7c3..bb21722 100644
--- a/src/main/webapp/views/pda/materialReceiveOut.html
+++ b/src/main/webapp/views/pda/materialReceiveOut.html
@@ -61,17 +61,11 @@
 
 <header class="layui-form">
     <div class="layui-input-inline">
-        <label class="layui-form-label" >鐢熶骇鍗曞彿</label>
+        <label class="layui-form-label">鐢熶骇鍗曞彿/浠诲姟鍗曞彿</label>
         <div class="layui-input-inline">
-            <input id="soCode" class="layui-input" autocomplete="off" oninput="findCode(this, 'soCode')"
-                   placeholder="鎵爜 / 杈撳叆"   style="width: 175px">
+            <input id="soCodeOrFbillno" class="layui-input" autocomplete="off" oninput="findCode(this, 'soCodeOrFbillno')"
+                   placeholder="鎵爜/杈撳叆锛屽涓敤|鍒嗛殧" style="width: 200px">
         </div>
-    </div>
-    <div class="layui-input-inline">
-        <label class="layui-form-label">浠诲姟鍗曞彿</label>
-        <input class="layui-input" id="fbillno" onkeyup="findCode(this, 'fbillno')" placeholder="鎵爜 / 杈撳叆"
-               style="width: 175px"
-               autocomplete="off">
     </div>
     <div class="layui-input-inline">
         <label class="layui-form-label">鐗╂枡缂栫爜</label>
@@ -156,7 +150,7 @@
     // 琛ㄦ牸鏁版嵁
     var materialReceiveList = [];
     window.onload = function () {
-        document.getElementById("soCode").focus();
+        document.getElementById("soCodeOrFbillno").focus();
     }
 
     /**
@@ -269,24 +263,19 @@
         });
     });
 
-    var soCodeBar;
-    var fbillnoBar;
+    var soCodeOrFbillnoBar;
     var invCodeBar;
     var fplancommitdateBar;
 
-    /* 鎵爜銆佽緭鍏ョ敓浜у崟鍙枫�佷换鍔″崟鍙枫�佺墿鏂欑紪鐮佸拰寮�宸ユ棩鏈� */
+    /* 鎵爜銆佽緭鍏ョ敓浜у崟鍙�/浠诲姟鍗曞彿锛堟敮鎸佸涓紝鐢▅鍒嗛殧锛夈�佺墿鏂欑紪鐮佸拰寮�宸ユ棩鏈� */
     function findCode(el, type) {
-        soCodeBar = $('#soCode').val();
-        fbillnoBar = $("#fbillno").val();
+        soCodeOrFbillnoBar = $('#soCodeOrFbillno').val();
         invCodeBar = $("#invCode").val();
         fplancommitdateBar = $("#fplancommitdate").val();
         
         // 鍘婚櫎绌烘牸
-        if (soCodeBar) {
-            soCodeBar = soCodeBar.trim();
-        }
-        if (fbillnoBar) {
-            fbillnoBar = fbillnoBar.trim();
+        if (soCodeOrFbillnoBar) {
+            soCodeOrFbillnoBar = soCodeOrFbillnoBar.trim();
         }
         if (invCodeBar) {
             invCodeBar = invCodeBar.trim();
@@ -296,9 +285,7 @@
         }
         
         switch (type) {
-            case 'soCode':
-                break;
-            case 'fbillno':
+            case 'soCodeOrFbillno':
                 break;
             case 'invCode':
                 break;
@@ -308,8 +295,8 @@
                 break;
         }
 
-        // 濡傛灉鐢熶骇鍗曞彿鍜屼换鍔″崟鍙峰拰鐗╂枡缂栫爜閮戒负绌猴紝涓嶆墽琛屾煡璇�
-        if (!soCodeBar && !fbillnoBar&&!invCodeBar) {
+        // 濡傛灉鐢熶骇鍗曞彿/浠诲姟鍗曞彿鍜岀墿鏂欑紪鐮侀兘涓虹┖锛屼笉鎵ц鏌ヨ
+        if (!soCodeOrFbillnoBar && !invCodeBar) {
             // 娓呯┖琛ㄦ牸鏁版嵁
             tableIns.reload({
                 data: [],
@@ -320,12 +307,13 @@
 
         // 鏋勫缓鏌ヨ鍙傛暟
         var params = {};
-        if (soCodeBar) {
-            params.soCode = soCodeBar;
+        
+        // 澶勭悊鐢熶骇鍗曞彿/浠诲姟鍗曞彿锛堟敮鎸佸涓紝鐢▅鍒嗛殧锛�
+        if (soCodeOrFbillnoBar) {
+            // 鐩存帴浼犻�掑師濮嬪�硷紝鍚庣浼氬鐞嗗涓�肩殑OR鏌ヨ
+            params.soCodeOrFbillno = soCodeOrFbillnoBar;
         }
-        if (fbillnoBar) {
-            params.fbillno = fbillnoBar;
-        }
+        
         if (invCodeBar) {
             params.invCode = invCodeBar;
         }
@@ -507,13 +495,12 @@
             if (successCount > 0) {
                 tips("鎴愬姛鍑哄簱 " + successCount + " 鏉¤褰�");
                 // 娓呯┖杈撳叆妗嗗苟鍒锋柊鍒楄〃
-                $("#soCode").val("");
-                $("#fbillno").val("");
+                $("#soCodeOrFbillno").val("");
                 $("#invCode").val("");
                 $("#fplancommitdate").val("");
                 materialReceiveList = [];
                 tableIns.reload({data: materialReceiveList});
-                document.getElementById("soCode").focus();
+                document.getElementById("soCodeOrFbillno").focus();
             }
             if (failCount > 0) {
                 tips("鍑哄簱澶辫触 " + failCount + " 鏉¤褰�", true);
@@ -524,14 +511,13 @@
     }
 
     function reset() {
-        $("#soCode").val(null);
-        $("#fbillno").val(null);
+        $("#soCodeOrFbillno").val(null);
         $("#invCode").val(null);
         $("#fplancommitdate").val(null);
         materialReceiveList = [];
         tableIns.reload({data: materialReceiveList});
         layer.closeAll();
-        document.getElementById("soCode").focus();
+        document.getElementById("soCodeOrFbillno").focus();
     }
 </script>
 </html>

--
Gitblit v1.9.1