From b7e08df5a07b3fa832a46ecc31983e16f2bccc8c Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期一, 24 七月 2023 14:56:01 +0800
Subject: [PATCH] # 出库作业,和库存明细管理 排序

---
 src/main/webapp/static/js/waitMatin/waitMatin.js |  135 ++++++++++++++++++++++++++++++---------------
 1 files changed, 90 insertions(+), 45 deletions(-)

diff --git a/src/main/webapp/static/js/waitMatin/waitMatin.js b/src/main/webapp/static/js/waitMatin/waitMatin.js
index 91cf79f..48e11b9 100644
--- a/src/main/webapp/static/js/waitMatin/waitMatin.js
+++ b/src/main/webapp/static/js/waitMatin/waitMatin.js
@@ -20,9 +20,9 @@
         cols: [[
             {type: 'numbers'},
             {field: 'billNo', title: '鍗曟嵁缂栧彿', sort: true},
-            {field: 'billType$', align: 'center', title: '绫诲瀷',  minWidth: 140, width: 140},
-            {align: 'center', title: '鏄庣粏', toolbar: '#tbLook', minWidth: 140, width: 140},
-            {field: 'appeTime$', title: '鍒涘缓鏃堕棿', minWidth: 180, width: 180},
+            {field: 'billType$', align: 'center', title: '绫诲瀷',  minWidth: 160, width: 160},
+            {align: 'center', title: '鏄庣粏', toolbar: '#tbLook', minWidth: 160, width: 160},
+            {field: 'appeTime$', title: '鍒涘缓鏃堕棿', minWidth: 200, width: 200},
             {align: 'center', title: '鎿嶄綔', toolbar: '#operate', minWidth: 130, width: 130}
         ]],
         request: {
@@ -48,12 +48,12 @@
     });
 
     // 鎼滅储
-    form.on('submit(eCourseTbSearch)', function (data) {
+    form.on('submit(waitMatinSearch)', function (data) {
         insTb.reload({where: data.field, page: {curr: 1}});
     });
 
     // 娣诲姞
-    $("#eCourseAddBtn").click(function () {
+    $("#waitMatinAddBtn").click(function () {
         showEditModel();
     });
 
@@ -73,7 +73,7 @@
             layer.open({
                 type: 1,
                 title: false,
-                area: '630px',
+                area: '800px',
                 offset: [top + 'px', (left - 530 + $a.outerWidth()) + 'px'],
                 shade: .01,
                 shadeClose: true,
@@ -98,7 +98,10 @@
                                 field: 'createTime$', title: '鍒涘缓鏃堕棿', sort: true, templet: function (d) {
                                     return util.toDateString(d.createTime);
                                 },  width: 180
-                            }
+                            },
+                            {field: 'inQty', title: '宸插叆搴撻噺'},
+                            {field: 'color', title: '棰滆壊'},
+                            {field: 'specs', title: '瑙勬牸'}
                         ]],
                         request: {
                             pageName: 'curr',
@@ -127,17 +130,21 @@
 
     // 鏄剧ず琛ㄥ崟寮圭獥
     function showEditModel(expTpe) {
+        var mlist=null
+        var inQtys=[]
         admin.open({
             type: 1,
             title: (expTpe ? '淇敼' : '娣诲姞') + '鍗曟嵁',
             content: $('#editDialog').html(),
-            area: '700px',
+            area: '1300px',
             success: function (layero, dIndex) {
                 $(layero).children('.layui-layer-content').css('overflow', 'visible');
-                var url = expTpe ? '../../json/ok.json' : '../../json/ok.json';
                 var isExpAdd = !expTpe;
                 // 鍥炴樉鏁版嵁
                 form.val('editForm', expTpe);
+                if (expTpe) {
+                    $('#billNo').attr("disabled", "disabled");
+                }
                 // 琛ㄥ崟鎻愪氦浜嬩欢
                 form.on('submit(waitMatinEditSubmit)', function (data) {
                     // 缁勮鏁版嵁
@@ -148,42 +155,55 @@
                     var param = [];
                     var nList = admin.util.deepClone(xxDataList);
                     for (var xi = 0; xi < nList.length; xi++) {
-                        if (nList[xi].qty > 0) {
+                        // console.log('宸插叆搴擄細'+nList[xi].inQty)
+                        // console.log('鏃ф暟閲忥細'+inQtys[xi])
+                        // console.log('鏁伴噺锛�'+nList[xi].qty)
+                        if (nList[xi].inQty > 0 && inQtys[xi]!=nList[xi].qty) {
+                            layer.msg("宸插叆搴撴棤娉曚慨鏀�", {icon: 2})
+                            return false;
+                        } else  if (nList[xi].qty > 0) {
                             param.push({
                                 billNo: data.field.billNo,
                                 billType: data.field.billType,
                                 matNo: nList[xi].matNo,
                                 matName: nList[xi].matName,
+                                color: nList[xi].color,
+                                size: nList[xi].size,
+                                specs: nList[xi].specs,
+                                memo: nList[xi].memo,
+                                unit: nList[xi].unit,
                                 qty: nList[xi].qty,
+                                inQty: nList[xi].inQty,
                             })
+                        }else if (nList[xi].qty == 0){
+                            layer.msg('鏄庣粏淇敼鏁伴噺涓嶅悎娉�', {icon: 2});
+                            return false;
                         }
                     }
                     if (param.length === 0) {
                         layer.msg('鍗曟嵁鏄庣粏鏁伴噺涓嶅悎娉�', {icon: 2});
                         return false;
                     }
-                    if (isExpAdd) {
-                        layer.load(2);
-                        $.ajax({
-                            url: baseUrl+"/waitMatin/add/auth",
-                            headers: {'token': localStorage.getItem('token')},
-                            data: JSON.stringify(param),
-                            contentType:'application/json;charset=UTF-8',
-                            method: 'POST',
-                            success: function (res) {
-                                layer.closeAll('loading');
-                                if (res.code === 200){
-                                    layer.close(dIndex);
-                                    insTb.reload({page: {curr: 1}});
-                                    layer.msg(res.msg, {icon: 1});
-                                } else if (res.code === 403){
-                                    top.location.href = baseUrl+"/";
-                                }else {
-                                    layer.msg(res.msg, {icon: 2});
-                                }
+                    layer.load(2);
+                    $.ajax({
+                        url: baseUrl+"/waitMatin/" + (isExpAdd?"add":"modify") + "/auth",
+                        headers: {'token': localStorage.getItem('token')},
+                        data: JSON.stringify(param),
+                        contentType:'application/json;charset=UTF-8',
+                        method: 'POST',
+                        success: function (res) {
+                            layer.closeAll('loading');
+                            if (res.code === 200){
+                                layer.close(dIndex);
+                                insTb.reload({page: {curr: 1}});
+                                layer.msg(res.msg, {icon: 1});
+                            } else if (res.code === 403){
+                                top.location.href = baseUrl+"/";
+                            }else {
+                                layer.msg(res.msg, {icon: 2});
                             }
-                        })
-                    }
+                        }
+                    })
                     return false;
                 });
                 // 鏄庣粏琛ㄦ牸
@@ -199,10 +219,21 @@
                         {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},
-                        {align: 'center', title: '鎿嶄綔', toolbar: '#formSSXMTableBar', minWidth: 80, width: 80}
+                        {field: 'inQty', title: '宸插叆搴撻噺',  minWidth: 100, width: 100},
+                        {field: 'unit', title: '鍗曚綅', width: 160},
+                        {field: 'memo', title: '澶囨敞' , edit: true, width: 160},
+                        {align: 'center', title: '鎿嶄綔', toolbar: '#formSSXMTableBar', minWidth: 80, width: 80, fixed: 'right'}
                     ]],
                     done: function (res) {
+                        mlist= res.data
+                        for (let i = 0; i < mlist.length; i++) {
+                            var waitIn=mlist[i]
+                            inQtys.push(waitIn.qty)
+                        }
                         $(layero).find('.layui-table-view').css('margin', '0');
                     },
                     size: ''
@@ -250,19 +281,29 @@
                 });
                 // 鏁伴噺淇敼
                 table.on('edit(formSSXMTable)', function (obj) {
-                    let count = Number(obj.value);
-                    if (isNaN(count)) {
-                        layer.msg("璇疯緭鍏ユ暟瀛�");
-                    } else {
-                        if (count > 0) {
-                            for (var i=0;i<xxDataList.length;i++){
-                                if (xxDataList[i]["matNo"] === obj.data.matNo){
-                                    xxDataList[i]["qty"] = count;
-                                    break;
-                                }
+                    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;
+                                break;
                             }
+                        }
+                    }else if (obj.field=='qty'){
+                        let vle = Number(obj.value);
+                        if (isNaN(vle)) {
+                            layer.msg("璇疯緭鍏ユ暟瀛�");
                         } else {
-                            layer.msg("鏁伴噺蹇呴』澶т簬闆�");
+                            if (vle > 0) {
+                                for (var i=0;i<xxDataList.length;i++) {
+                                    if (xxDataList[i]["matNo"] === obj.data.matNo) {
+                                        xxDataList[i]["qty"] = vle;
+                                        break;
+                                    }
+                                }
+                            } else {
+                                layer.msg("鏁伴噺蹇呴』澶т簬闆�");
+                            }
                         }
                     }
                     insTbSSXM.reload({data: xxDataList});
@@ -282,7 +323,6 @@
                         content: $('#matEditDialog').html(),
                         success: function (layero, dIndex) {
                             $(layero).children('.layui-layer-content').css('overflow', 'visible');
-                            var url = exp ? '../../json/ok.json' : '../../json/ok.json';
                             // 鍥炴樉鏁版嵁
                             form.val('matEditForm', exp);
                             // 琛ㄥ崟鎻愪氦浜嬩欢
@@ -307,6 +347,11 @@
                                                     xxDataList.push({
                                                         matNo: mat.matNo,
                                                         matName: mat.matName,
+                                                        color:mat.color,
+                                                        size:mat.size,
+                                                        specs:mat.specs,
+                                                        memo: mat.memo,
+                                                        unit: mat.unit,
                                                         qty: 0.0
                                                     });
                                                     insTbSSXM.reload({data: xxDataList, page: {curr: 1}});
@@ -399,4 +444,4 @@
         ,type: 'datetime'
         ,range: true
     });
-});
\ No newline at end of file
+});

--
Gitblit v1.9.1