From 2aa37a30dd1468c8c489273c99ffcb33c6dff737 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 11 三月 2021 16:20:46 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/ioWorks/matQuery.js |   54 ++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 34 insertions(+), 20 deletions(-)

diff --git a/src/main/webapp/static/js/ioWorks/matQuery.js b/src/main/webapp/static/js/ioWorks/matQuery.js
index e0703ac..3721713 100644
--- a/src/main/webapp/static/js/ioWorks/matQuery.js
+++ b/src/main/webapp/static/js/ioWorks/matQuery.js
@@ -43,20 +43,30 @@
                 if (data.length === 0){
                     layer.msg('璇锋坊鍔犵墿鏂�');
                 } else {
-                    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('');
+                    var success = true;
+                    for (var i=0;i<matData.length;i++) {
+                        if (matData[i].count <= 0) {
+                            layer.msg(matData[i].matnr + '鐗╂枡鏁伴噺蹇呴』澶т簬闆讹紒', {icon: 2})
+                            success = false;
+                            return false;
                         }
-                    });
+                    }
+                    if (success) {
+                        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('');
+                            }
+                        });
+                    }
                 }
                 break;
         }
@@ -83,21 +93,26 @@
     form.on('submit(confirm)', function (data) {
         var matDetls = [];
         matData.forEach(function(elem) {
-            matDetls.push({matnr: elem.matnr, count: elem.count});
+            matDetls.push({matnr: elem.matnr
+                , count: elem.count
+
+            });
         });
+        var req = JSON.stringify({
+            number: data.field.orderNo
+            , customerTypeId: '1'
+            , list: matDetls
+        })
         $.ajax({
             url: baseUrl+"/work/order/init",
             headers: {'token': localStorage.getItem('token')},
-            data: JSON.stringify({
-                number: data.field.orderNo,
-                list: matDetls
-            }),
+            data: req,
             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});
+                    top.layui.layer.close(top.popupRight);
                 } else if (res.code === 403){
                     top.location.href = baseUrl+"/";
                 } else {
@@ -105,7 +120,6 @@
                 }
             }
         });
-
     })
 
     function updateMatData(locNo, matnr, count) {

--
Gitblit v1.9.1