From 064ef1fd2858c6185bd1b7d1e986fc08c7abd8aa Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 11 三月 2021 15:50:10 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/ioWorks/matQuery.js |   86 +++++++++++++++++++++++++++++++------------
 1 files changed, 62 insertions(+), 24 deletions(-)

diff --git a/src/main/webapp/static/js/ioWorks/matQuery.js b/src/main/webapp/static/js/ioWorks/matQuery.js
index 390e731..e0703ac 100644
--- a/src/main/webapp/static/js/ioWorks/matQuery.js
+++ b/src/main/webapp/static/js/ioWorks/matQuery.js
@@ -20,6 +20,7 @@
         elem: '#chooseData',
         headers: {token: localStorage.getItem('token')},
         data: [],
+        limit: 100,
         even: true,
         toolbar: '#toolbar',
         cellMinWidth: 50,
@@ -38,32 +39,22 @@
     table.on('toolbar(chooseData)', function (obj) {
         var data = matData;
         switch (obj.event) {
-            case 'outbound':
+            case 'createDoc':
                 if (data.length === 0){
-                    layer.msg('璇峰厛娣诲姞鐗╂枡');
+                    layer.msg('璇锋坊鍔犵墿鏂�');
                 } else {
-                    var locDetls = [];
-                    data.forEach(function(elem) {
-                        locDetls.push({nodeId: elem.nodeId, matnr: elem.matnr, count: elem.count});
-                    });
-                    $.ajax({
-                        url: baseUrl+"/work/pakout/init",
-                        headers: {'token': localStorage.getItem('token')},
-                        data: JSON.stringify(locDetls),
-                        contentType:'application/json;charset=UTF-8',
-                        method: 'POST',
-                        success: function (res) {
-                            if (res.code === 200){
-                                matData = [];
-                                tableIns.reload({data: matData,done:function (res) {
-                                    limit();
-                                }});
-                                layer.msg(res.msg, {icon: 1});
-                            } else if (res.code === 403){
-                                top.location.href = baseUrl+"/";
-                            } else {
-                                layer.msg(res.msg)
-                            }
+                    layer.open({
+                        type: 1,
+                        title: '瀹氫箟閿�鍞崟缂栧彿',
+                        offset: '100px',
+                        area: ['360px'],
+                        shade: 0.1,
+                        content: $('#getOrderNo'),
+                        success: function(layero, index){
+                            layer.iframeAuto(index)
+                        },
+                        cancel: function () {
+                            $('#orderNo').val('');
                         }
                     });
                 }
@@ -87,6 +78,35 @@
                 break;
         }
     });
+
+    // 寮�濮嬬敓鎴愭嫞璐у崟
+    form.on('submit(confirm)', function (data) {
+        var matDetls = [];
+        matData.forEach(function(elem) {
+            matDetls.push({matnr: elem.matnr, count: elem.count});
+        });
+        $.ajax({
+            url: baseUrl+"/work/order/init",
+            headers: {'token': localStorage.getItem('token')},
+            data: JSON.stringify({
+                number: data.field.orderNo,
+                list: matDetls
+            }),
+            contentType:'application/json;charset=UTF-8',
+            method: 'POST',
+            success: function (res) {
+                if (res.code === 200){
+                    top.layui.layer.close(top.popupRight);
+                    layer.msg(res.msg, {icon: 1});
+                } else if (res.code === 403){
+                    top.location.href = baseUrl+"/";
+                } else {
+                    layer.msg(res.msg, {icon: 2})
+                }
+            }
+        });
+
+    })
 
     function updateMatData(locNo, matnr, count) {
         if (isNaN(count)) {
@@ -149,4 +169,22 @@
     matData.push.apply(matData, data);
     tableIns.reload({data: matData});
     layer.close(matDetlLayerIdx);
+}
+
+function initOrderNo() {
+    $.ajax({
+        url: baseUrl+"/work/orderNo/init",
+        headers: {'token': localStorage.getItem('token')},
+        async: false,
+        method: 'GET',
+        success: function (res) {
+            if (res.code === 200){
+                $('#orderNo').val(res.data)
+            } else if (res.code === 403){
+                top.location.href = baseUrl+"/";
+            } else {
+                layer.msg(res.msg, {icon: 2})
+            }
+        }
+    });
 }
\ No newline at end of file

--
Gitblit v1.9.1