From 47cc646b1c55e905e4a73c80ac78abc77e88aeb7 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 23 三月 2022 10:57:10 +0800
Subject: [PATCH] #杰克缝纫机立库 【优化单据管理】

---
 src/main/webapp/static/js/order/order.js |   54 ++++++++++++++++++++++++++++--------------------------
 1 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/src/main/webapp/static/js/order/order.js b/src/main/webapp/static/js/order/order.js
index a06f4a9..69c6a85 100644
--- a/src/main/webapp/static/js/order/order.js
+++ b/src/main/webapp/static/js/order/order.js
@@ -97,6 +97,7 @@
                             {field: 'maktx', title: '鍟嗗搧鍚嶇О', width: 160},
                             {field: 'batch', title: '鎵瑰彿'},
                             {field: 'count', title: '鏁伴噺'},
+                            {field: 'unit', title: '鍗曚綅'},
                             // {
                             //     field: 'createTime$', title: '鍒涘缓鏃堕棿', sort: true, templet: function (d) {
                             //         return util.toDateString(d.createTime);
@@ -143,13 +144,14 @@
             success: function (layero, dIndex) {
                 $(layero).children('.layui-layer-content').css('overflow', 'visible');
                 var isExpAdd = !expTpe;
+                console.log(expTpe)
                 // 鍥炴樉鏁版嵁
                 form.val('editForm', expTpe);
                 if (expTpe) {
-                    $('#billNo').attr("disabled", "disabled");
+                    $('#orderNo').attr("disabled", "disabled");
                 }
                 // 琛ㄥ崟鎻愪氦浜嬩欢
-                form.on('submit(waitMatinEditSubmit)', function (data) {
+                form.on('submit(orderEditSubmit)', function (data) {
                     // 缁勮鏁版嵁
                     if (xxDataList.length <= 0) {
                         layer.tips('璇锋坊鍔犲崟鎹槑缁�', '#matAddBtnComment', {tips: [1, '#ff4c4c']});
@@ -219,16 +221,15 @@
                     height: '350px;',
                     cellMinWidth: 100,
                     cols: [[
-                        {type: 'numbers'},
-                        {field: 'matNo', title: '鐗╂枡缂栫爜'},
-                        {field: 'matName', title: '鐗╂枡鍚嶇О', width: 160},
-                        {field: 'specs', title: '瑙勬牸', width: 160},
-                        {field: 'color', title: '棰滆壊', width: 160},
-                        {field: 'size', title: '灏哄', width: 160},
-                        {field: 'qty', title: '淇敼鏁伴噺', style: 'color: blue;font-weight: bold', edit: true, minWidth: 100, width: 100},
-                        {field: 'inQty', title: '宸插叆搴撻噺',  minWidth: 100, width: 100},
-                        {field: 'unit', title: '鍗曚綅', width: 160},
-                        {field: 'memo', title: '澶囨敞' , edit: true, width: 160},
+                        {type: 'numbers', title: '#'},
+                        {field: 'matnr', title: '鍟嗗搧缂栫爜', width: 160},
+                        {field: 'maktx', title: '鍟嗗搧鍚嶇О', width: 200},
+                        {field: 'batch', title: '鎵瑰彿'},
+                        {field: 'specs', title: '瑙勬牸'},
+                        {field: 'count', title: '鏁伴噺(淇敼)', style: 'color: blue;font-weight: bold', edit: true, minWidth: 110, width: 110},
+                        // {field: 'inQty', title: '宸插叆搴撻噺',  minWidth: 100, width: 100},
+                        {field: 'unit', title: '鍗曚綅', width: 80},
+                        {field: 'memo', title: '澶囨敞' , edit: true},
                         {align: 'center', title: '鎿嶄綔', toolbar: '#formSSXMTableBar', minWidth: 80, width: 80, fixed: 'right'}
                     ]],
                     done: function (res) {
@@ -243,7 +244,7 @@
                 };
                 if (!isExpAdd) {
                     $.ajax({
-                        url: baseUrl+"/waitMatin/detl/list/auth?billNo=" + expTpe.billNo,
+                        url: baseUrl+"/order/detl/all/auth?orderId=" + expTpe.id,
                         headers: {'token': localStorage.getItem('token')},
                         method: 'GET',
                         async: false,
@@ -273,7 +274,7 @@
                         }, function (i) {
                             layer.close(i);
                             for (var j = 0; j < xxDataList.length; j++) {
-                                if (xxDataList[j].matNo === data.matNo) {
+                                if (xxDataList[j].matnr === data.matnr && xxDataList[j].batch === data.batch) {
                                     xxDataList.splice(j, 1);
                                     break;
                                 }
@@ -282,30 +283,31 @@
                         });
                     }
                 });
-                // 鏁伴噺淇敼
+                // 鏄庣粏鏁版嵁淇敼
                 table.on('edit(formSSXMTable)', function (obj) {
-                    if (obj.field=='memo'){
-                    let vle = obj.value;
-                        for (var i=0;i<xxDataList.length;i++) {
-                            if (xxDataList[i]["matNo"] === obj.data.matNo) {
-                                xxDataList[i]["memo"] = vle;
+                    if (obj.field === 'memo'){
+                        for (let i=0;i<xxDataList.length;i++) {
+                            if (xxDataList[i]["matnr"] === obj.data.matnr && xxDataList[i]["batch"] === obj.data.batch) {
+                                xxDataList[i]["memo"] = obj.value;
                                 break;
                             }
                         }
-                    }else if (obj.field=='qty'){
+                    } else if (obj.field==='count'){
                         let vle = Number(obj.value);
                         if (isNaN(vle)) {
-                            layer.msg("璇疯緭鍏ユ暟瀛�");
+                            layer.msg("璇疯緭鍏ユ暟瀛�", {icon: 2});
+                            return false;
                         } else {
                             if (vle > 0) {
-                                for (var i=0;i<xxDataList.length;i++) {
-                                    if (xxDataList[i]["matNo"] === obj.data.matNo) {
-                                        xxDataList[i]["qty"] = vle;
+                                for (let i=0;i<xxDataList.length;i++) {
+                                    if (xxDataList[i]["matnr"] === obj.data.matnr && xxDataList[i]["batch"] === obj.data.batch) {
+                                        xxDataList[i]["count"] = vle;
                                         break;
                                     }
                                 }
                             } else {
-                                layer.msg("鏁伴噺蹇呴』澶т簬闆�");
+                                layer.msg("鏁伴噺蹇呴』澶т簬闆�", {icon: 2});
+                                return false;
                             }
                         }
                     }

--
Gitblit v1.9.1