From 638c4fabf3fc2413980dbe9f0939ee802ace1b0c Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期一, 17 五月 2021 14:21:09 +0800
Subject: [PATCH] #盘点

---
 src/main/webapp/views/pda/combPro.html |   84 ++++++++++++++++++++++++++----------------
 1 files changed, 52 insertions(+), 32 deletions(-)

diff --git a/src/main/webapp/views/pda/combPro.html b/src/main/webapp/views/pda/combPro.html
index 15435a7..7579b01 100644
--- a/src/main/webapp/views/pda/combPro.html
+++ b/src/main/webapp/views/pda/combPro.html
@@ -110,7 +110,7 @@
 <div id="modify" style="display: none; text-align: center;padding-top: 10px">
     <div class="form-box">
         <div class="form-item">
-            <table style="display: inline">
+            <table style="display: none">
                 <tr>
                     <td>
                         <span style="width: 35px; margin-right: 5px">鐗╂枡</span>
@@ -128,7 +128,7 @@
                         <span style="width: 35px; margin-right: 5px">鍚嶇О</span>
                     </td>
                     <td style="text-align: left">
-                    <textarea rows="3" style="resize: none; width: 165px" id="matName" type="text" disabled="disabled"
+                    <textarea rows="2" style="resize: none; width: 165px" id="matName" type="text" disabled="disabled"
                               readonly="readonly"></textarea>
                     </td>
                 </tr>
@@ -166,6 +166,8 @@
     }
     var tableIns;
     var countLayer;
+    var matData = [];
+    var sourceData = [];
     layui.use(['table', 'laydate', 'form'], function () {
         var table = layui.table;
         var $ = layui.jquery;
@@ -175,13 +177,13 @@
         tableIns = table.render({
             elem: '#chooseData',
             data: [],
+            width: 320,
             limit: 500,
             cellMinWidth: 50,
             cols: [[
-                {field: 'matNo', align: 'center', title: '鐗╂枡缂栫爜'},
-                {field: 'mnemonic', align: 'center', title: '鐢熶骇鍗曞彿'},
+                {field: 'matNo', align: 'center', title: '鐗╂枡缂栫爜', event: 'modify',},
+                {field: 'mnemonic', align: 'center', title: '鐢熶骇鍗曞彿', event: 'modify',},
                 {
-                    fixed: 'right',
                     align: 'center',
                     field: 'count',
                     title: '鏁伴噺',
@@ -189,7 +191,7 @@
                     style: 'cursor: pointer;color: blue',
                     width: 50
                 },
-//                {field: 'matName', align: 'center', title: '鐗╂枡鍚嶇О'}
+                {field: 'matName', align: 'center', title: '鐗╂枡鍚嶇О', event: 'modify',}
             ]],
             done: function (res, curr, count) {
             }
@@ -228,7 +230,7 @@
     }
 
     // 娣诲姞琛ㄦ牸鏁版嵁
-    var matData = [];
+    //    var matData = [];
 
     function addTableData(data) {
         for (var i = 0; i < data.length; i++) {
@@ -241,6 +243,12 @@
             }
             if (toPush) {
                 matData.push(data[i]);
+                sourceData.push({
+                    matNo: data[i].matNo,
+                    count: data[i].count,
+                    supplier: data[i].supplier,
+                    mnemonic: data[i].mnemonic,
+                });
             }
         }
         tableIns.reload({data: matData});
@@ -255,13 +263,15 @@
         if (isEmpty(el.value)) {
             return;
         }
-//        var billNo = el.value.split(",")[0].split("=")[1];
         var billNo = el.value;
+        if (billNo.indexOf('=') > -1) {
+            billNo = billNo.split(",")[0].split("=")[1];
+        }
         if (isEmpty(billNo)) {
             return;
         }
         // 璧嬪�煎墠娓呯┖琛ㄦ牸
-        matData = [];
+//        matData = [];
         tableIns.reload({data: matData});
 
         $.ajax({
@@ -275,6 +285,10 @@
                 if (res.code === 200) {
                     if (res.data != null) {
                         addTableData(res.data);
+                        // 寤惰繜1绉掑悗娓呯┖閫氱煡鍗曞彿
+                        setTimeout(function () {
+                            $('#billNo').val("");
+                        }, 500);
                     }
                 } else if (res.code === 403) {
                     top.location.href = baseUrl + "/pda";
@@ -343,6 +357,7 @@
         $('#code').val("");
         $('#billNo').val("");
         matData = [];
+        sourceData = [];
         tableIns.reload({data: matData});
     }
 
@@ -362,31 +377,36 @@
             tips("璇锋彁鍙栫墿鏂�", true);
             return;
         }
-        var billNo = $('#billNo').val();
-        var mnemonic = $('#mnemonic').val();
-        $.ajax({
-            url: baseUrl + "/mobile/comb/auth",
-            headers: {'token': localStorage.getItem('token')},
-            data: JSON.stringify({
-                barcode: barcode,
-                combMats: matData,
-                billNo: billNo,
-                mnemonic: mnemonic,
-            }),
-            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)
+        for (var i = 0; i < matData.length; i++) {
+            for (var j = 0; j < sourceData.length ; j++) {
+                if (matData[i].matNo == sourceData[j].matNo && matData[i].mnemonic == sourceData[j].mnemonic && matData[i].count == sourceData[j].count) {
+                    // 鏁伴噺鎻愰啋
+                    layer.confirm('鏁伴噺鍜屽墿浣欐暟閲忎竴鑷达紝纭畾缁х画缁勬墭鍚�?', function(){
+                        $.ajax({
+                            url: baseUrl + "/mobile/comb/auth/batch",
+                            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)
+                                }
+                            }
+                        })
+                    });
                 }
             }
-        })
+        }
     }
 
     /**

--
Gitblit v1.9.1