From 2281e3ac9929818587d658c78741a8f5351cded6 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 09 七月 2020 17:02:06 +0800
Subject: [PATCH] #

---
 src/main/webapp/views/pdaCe/index.html |   90 +++++++++++++++++++++++++++++++++++++++------
 1 files changed, 78 insertions(+), 12 deletions(-)

diff --git a/src/main/webapp/views/pdaCe/index.html b/src/main/webapp/views/pdaCe/index.html
index d60fe6b..fce94cf 100644
--- a/src/main/webapp/views/pdaCe/index.html
+++ b/src/main/webapp/views/pdaCe/index.html
@@ -134,7 +134,7 @@
 
 <div id="btn-con">
     <button style="margin-right: 20px" onclick="reset()">閲嶇疆</button>
-    <button >缁勬墭</button>
+    <button onclick="comb()">缁勬墭</button>
     <span id="tips"></span>
 </div>
 
@@ -207,7 +207,68 @@
             } else {
                 alert(res.msg);
             }
+        })
+    }
 
+    // 缁勬墭
+    function comb() {
+        var barcode = code.value;
+        if (isEmpty(barcode)) {
+            tips("鎵樼洏鏉$爜涓虹┖", true);
+            // document.getElementById("code").focus();
+            return;
+        }
+        if (matData.length === 0) {
+            tips("璇锋彁鍙栫墿鏂�", true);
+            return;
+        }
+        httpRequest({
+            httpUrl: baseUrl+"/mobile/comb/auth",
+            type: 'post',
+            data: JSON.stringify({
+                barcode: barcode,
+                combMats: matData
+            }),
+        }, function (res) {
+            if (res.code === 200) {
+                if (res.data != null) {
+                    // 鏍峰紡
+                    matMsg.style.display = 'none';
+                    btnCon.style.display = 'none';
+                    matDetail.style.display = 'block';
+                    // 濉厖鏁版嵁
+                    matName.value = res.data.matName;
+                    str1.value = res.data.str1;
+                    count.value = initMatCount;
+                } else {
+                    matMsg.style.display = 'block';
+                    btnCon.style.display = 'block';
+                    matDetail.style.display = 'none';
+                }
+            } else {
+                alert(res.msg);
+            }
+        })
+        $.ajax({
+            url: baseUrl+"/mobile/comb/auth",
+            headers: {'token': localStorage.getItem('token')},
+            data: JSON.stringify({
+                barcode: barcode,
+                combMats: matData
+            }),
+            contentType:'application/json;charset=UTF-8',
+            method: 'POST',
+            async: false,
+            success: function (res) {
+                if (res.code === 200) {
+                    reset();
+                    tips("缁勬墭鎴愬姛")
+                } else if (res.code === 403) {
+                    top.location.href = baseUrl + "/pda";
+                } else {
+                    tips(res.msg, true)
+                }
+            }
         })
     }
 
@@ -251,24 +312,29 @@
         }
         if (toPush) {
             matData.push(data);
-            var html = "";
-            for (var i=0;i<matData.length;i++) {
-                html += " <div>\n" +
-                    "       <span>" + matData[i].matnr + "</span>\n" +
-                    "       <span>" + matData[i].matName + "</span>\n" +
-                    "       <span>" + matData[i].str1 + "</span>\n" +
-                    "       <span>" + matData[i].count + "</span>\n" +
-                    "     </div>\n";
-            }
-
-            ttbody.innerHTML = html;
         }
+        var html = "";
+        for (var i=0;i<matData.length;i++) {
+            html += " <div class='table-data'>\n" +
+                "       <span>" + matData[i].matnr + "</span>\n" +
+                "       <span>" + matData[i].matName + "</span>\n" +
+                "       <span>" + matData[i].str1 + "</span>\n" +
+                "       <span>" + matData[i].count + "</span>\n" +
+                "     </div>\n";
+        }
+
+        ttbody.innerHTML = html;
     }
 
     // 閲嶇疆
     function reset() {
         code.value = "";
         matnr.value = "";
+        cancel();
+        while(ttbody.hasChildNodes()) {
+            ttbody.removeChild(ttbody.firstChild);
+
+        }
     }
 
     /**

--
Gitblit v1.9.1