From 12067f657bc3dc169a7a466e433374368e8daf73 Mon Sep 17 00:00:00 2001
From: chen.llin <1442464845@qq.comm>
Date: 星期日, 18 一月 2026 16:14:27 +0800
Subject: [PATCH] 越库订单逻辑调整

---
 src/main/webapp/static/js/locCache/locCache.js |  226 +++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 172 insertions(+), 54 deletions(-)

diff --git a/src/main/webapp/static/js/locCache/locCache.js b/src/main/webapp/static/js/locCache/locCache.js
index eeebfef..7158c29 100644
--- a/src/main/webapp/static/js/locCache/locCache.js
+++ b/src/main/webapp/static/js/locCache/locCache.js
@@ -12,50 +12,32 @@
     // 鏁版嵁娓叉煋
     tableIns = table.render({
         elem: '#locCache',
-        headers: {token: localStorage.getItem('token')},
+        headers: { token: localStorage.getItem('token') },
         url: baseUrl + '/locCache/list/auth',
         page: true,
         limit: 15,
         limits: [15, 30, 50, 100, 200, 500],
         toolbar: '#toolbar',
-        cellMinWidth: 50,
+        cellMinWidth: 80,
         height: 'full-120',
-        cols: [[{type: 'checkbox'}, {field: 'locNo', align: 'center', title: '搴撲綅鍙�'}, {
-            field: 'barcode',
-            align: 'center',
-            title: '鎵樼洏鐮�'
-        }, {field: 'areaName', align: 'center', title: '搴撳尯鍚嶇О'}, {
-            field: 'whsType$',
-            align: 'center',
-            title: '搴撲綅绫诲瀷'
-        }, {field: 'locSts', align: 'center', title: '搴撲綅鐘舵��'}, {
-            field: 'row1',
-            align: 'center',
-            title: '鎺�'
-        }, {field: 'bay1', align: 'center', title: '鍒�'}, {
-            field: 'lev1',
-            align: 'center',
-            title: '灞�'
-        }, {field: 'locType', align: 'center', title: '搴撲綅绫诲瀷'}, {
-            field: 'modiUser$',
-            align: 'center',
-            title: '淇敼浜哄憳'
-        }, {field: 'modiTime$', align: 'center', title: '淇敼鏃堕棿'}, {
-            field: 'appeUser$',
-            align: 'center',
-            title: '鍒涘缓鑰�'
-        }, {field: 'appeTime$', align: 'center', title: '娣诲姞鏃堕棿'}, {
-            field: 'frozen',
-            align: 'center',
-            title: '鏄惁鍐荤粨,0.鏈喕缁擄紝1.宸插喕缁�',
-            hide: true
-        }, {field: 'frozenMemo', align: 'center', title: '鍐荤粨澶囨敞', hide: true}, {
-            fixed: 'right',
-            title: '鎿嶄綔',
-            align: 'center',
-            toolbar: '#operate',
-            width: 120
-        }]],
+        cols: [[{ type: 'checkbox' }, { field: 'locNo', align: 'center', title: '搴撲綅鍙�', width: 120 }
+            , { field: 'barcode', align: 'center', title: '鎵樼洏鐮�' }
+            , { field: 'areaName', align: 'center', title: '搴撳尯鍚嶇О' }
+            // , {field: 'whsType$', align: 'center', title: '搴撲綅绫诲瀷'}
+            , { field: 'locSts', align: 'center', title: '搴撲綅鐘舵��' }
+            , { field: 'row1', align: 'center', title: '鎺�' }
+            , { field: 'bay1', align: 'center', title: '鍒�' }
+            , { field: 'lev1', align: 'center', title: '灞�' }
+            // , {field: 'locType', align: 'center', title: '搴撲綅绫诲瀷'}
+            , { field: 'sort', align: 'center', title: '浼樺厛绾�' }
+            , { field: 'modiUser$', align: 'center', title: '淇敼浜哄憳', hide: true }
+            , { field: 'modiTime$', align: 'center', title: '淇敼鏃堕棿' }
+            , { field: 'appeUser$', align: 'center', title: '鍒涘缓鑰�', hide: true }
+            , { field: 'appeTime$', align: 'center', title: '娣诲姞鏃堕棿', hide: true }
+            , { field: 'frozen', align: 'center', title: '鏄惁鍐荤粨', hide: true }
+            , { field: 'frozenMemo', align: 'center', title: '鍐荤粨澶囨敞', hide: true }
+            , { fixed: 'right', title: '鎿嶄綔', align: 'center', toolbar: '#operate', width: 350 }]
+        ],
         request: {
             pageName: 'curr', pageSize: 'limit'
         },
@@ -85,7 +67,7 @@
         searchData['orderByField'] = obj.field;
         searchData['orderByType'] = obj.type;
         tableIns.reload({
-            where: searchData, page: {curr: 1}
+            where: searchData, page: { curr: 1 }
         });
     });
 
@@ -96,9 +78,16 @@
             case 'addData':
                 showEditModel();
                 break;
+            case 'batchModifties':
+                if (checkStatus.length === 0) {
+                    layer.msg('璇烽�夋嫨闇�瑕佷慨鏀圭殑鏁版嵁淇℃伅', { icon: 2 });
+                    return;
+                }
+                batchModifies();
+                break;
             case 'deleteData':
                 if (checkStatus.length === 0) {
-                    layer.msg('璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁', {icon: 2});
+                    layer.msg('璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁', { icon: 2 });
                     return;
                 }
                 del(checkStatus.map(function (d) {
@@ -106,8 +95,8 @@
                 }));
                 break;
             case 'init':
-                layer.prompt({title: '璇疯緭鍏ュ彛浠わ紝骞堕噸缃簱浣�', formType: 1, shadeClose: true}, function (pass, idx) {
-                    http.get(baseUrl + "/locMast/init/pwd", {pwd: pass}, function (res) {
+                layer.prompt({ title: '璇疯緭鍏ュ彛浠わ紝骞堕噸缃簱浣�', formType: 1, shadeClose: true }, function (pass, idx) {
+                    http.get(baseUrl + "/locMast/init/pwd", { pwd: pass }, function (res) {
                         if (res.data) {
                             layer.open({
                                 type: 1,
@@ -130,15 +119,37 @@
         }
     });
 
+
+
     // 鐩戝惉琛屽伐鍏蜂簨浠�
     table.on('tool(locCache)', function (obj) {
         var data = obj.data;
         switch (obj.event) {
+            case 'showDetl':
+                locNo = data?.locNo;
+                // 寮瑰眰鏄剧ず
+                layer.open({
+                    type: 2,
+                    title: '搴撲綅鏄庣粏',
+                    maxmin: true,
+                    area: [top.detailWidth, top.detailHeight],
+                    shadeClose: true,
+                    content: 'locDetail.html',
+                    success: function (layero, index) {
+                    }
+                });
+                break;
             case 'edit':
                 showEditModel(data);
                 break;
             case "del":
                 del([data.id]);
+                break;
+            case "clearLoc":
+                clearLocation(data);
+                break;
+            case "setInStock":
+                setInStock(data);
                 break;
         }
     });
@@ -148,7 +159,7 @@
         console.log(data.field)
         $.ajax({
             url: baseUrl + "/locCache/init/auth",
-            headers: {'token': localStorage.getItem('token')},
+            headers: { 'token': localStorage.getItem('token') },
             data: data.field,
             method: 'POST',
             async: false,
@@ -166,34 +177,77 @@
         })
     });
 
+    function batchModifies() {
+        layer.open({
+            type: 1,
+            title: '鎵归噺淇敼',
+            maxmin: true,
+            area: ["400px"],
+            shadeClose: true,
+            content: $('#batchModify'),
+            success: function (layero, index) {
+
+            }
+        });
+    }
 
     /* 寮圭獥 - 鏂板銆佷慨鏀� */
     function showEditModel(mData) {
         admin.open({
             type: 1,
             area: '600px',
-            title: (mData ? '淇敼' : '娣诲姞') + '璁㈠崟鐘舵��',
+            title: (mData ? '淇敼' : '娣诲姞') + '搴撲綅缂撳瓨',
             content: $('#editDialog').html(),
             success: function (layero, dIndex) {
                 layDateRender(mData);
-                form.val('detail', mData);
+                // 鍔犺浇搴撳尯鍒楄〃
+                $.ajax({
+                    url: baseUrl + "/basAreasQuery/auth",
+                    headers: { 'token': localStorage.getItem('token') },
+                    data: { condition: '' },
+                    method: 'POST',
+                    success: function (res) {
+                        if (res.code === 200) {
+                            var areaSelect = $(layero).find('select[name="areaName"]');
+                            areaSelect.empty();
+                            areaSelect.append('<option value="">璇烽�夋嫨搴撳尯</option>');
+                            var list = res.data;
+                            for (var i = 0; i < list.length; i++) {
+                                areaSelect.append('<option value="' + list[i].value + '" data-id="' + list[i].id + '">' + list[i].value + '</option>');
+                            }
+                            // 璁剧疆琛ㄥ崟鍊�
+                            form.val('detail', mData);
+                            // 濡傛灉鏈夋暟鎹紝璁剧疆閫変腑鐨勫簱鍖�
+                            if (mData && mData.areaName) {
+                                areaSelect.val(mData.areaName);
+                            }
+                            form.render('select');
+                        }
+                    }
+                });
+                // 鐩戝惉搴撳尯閫夋嫨鍙樺寲锛屽悓姝reaId
+                form.on('select(editAreaName)', function (data) {
+                    var selectedOption = $(data.elem).find('option:selected');
+                    var areaId = selectedOption.attr('data-id') || '';
+                    $(layero).find('input[name="areaId"]').val(areaId);
+                });
                 form.on('submit(editSubmit)', function (data) {
                     var loadIndex = layer.load(2);
                     $.ajax({
                         url: baseUrl + "/locCache/" + (mData ? 'update' : 'add') + "/auth",
-                        headers: {'token': localStorage.getItem('token')},
+                        headers: { 'token': localStorage.getItem('token') },
                         data: data.field,
                         method: 'POST',
                         success: function (res) {
                             layer.close(loadIndex);
                             if (res.code === 200) {
                                 layer.close(dIndex);
-                                layer.msg(res.msg, {icon: 1});
+                                layer.msg(res.msg, { icon: 1 });
                                 tableReload();
                             } else if (res.code === 403) {
                                 top.location.href = baseUrl + "/";
                             } else {
-                                layer.msg(res.msg, {icon: 2});
+                                layer.msg(res.msg, { icon: 2 });
                             }
                         }
                     })
@@ -207,7 +261,6 @@
 
     /* 鍒犻櫎 */
     function del(ids) {
-        console.log(ids)
         layer.confirm('纭畾瑕佸垹闄ら�変腑鏁版嵁鍚楋紵', {
             skin: 'layui-layer-admin', shade: .1
         }, function (i) {
@@ -215,18 +268,18 @@
             var loadIndex = layer.load(2);
             $.ajax({
                 url: baseUrl + "/locCache/delete/auth",
-                headers: {'token': localStorage.getItem('token')},
-                data: {ids: ids},
+                headers: { 'token': localStorage.getItem('token') },
+                data: { ids: ids },
                 method: 'POST',
                 success: function (res) {
                     layer.close(loadIndex);
                     if (res.code === 200) {
-                        layer.msg(res.msg, {icon: 1});
+                        layer.msg(res.msg, { icon: 1 });
                         tableReload();
                     } else if (res.code === 403) {
                         top.location.href = baseUrl + "/";
                     } else {
-                        layer.msg(res.msg, {icon: 2});
+                        layer.msg(res.msg, { icon: 2 });
                     }
                 }
             })
@@ -273,6 +326,71 @@
 
     layDateRender();
 
+    // 娓呯┖搴撲綅
+    function clearLocation(data) {
+        layer.confirm('纭娓呯┖搴撲綅锛�' + data.locNo + '锛�', {
+            skin: 'layui-layer-admin', shade: .1
+        }, function (i) {
+            layer.close(i);
+            var loadIndex = layer.load(2);
+            $.ajax({
+                url: baseUrl + "/locCache/lockOrUnlock/auth",
+                headers: { 'token': localStorage.getItem('token') },
+                data: {
+                    locNo: data.locNo,
+                    lock: false  // false琛ㄧず瑙i攣/娓呯┖
+                },
+                method: 'POST',
+                success: function (res) {
+                    layer.close(loadIndex);
+                    if (res.code === 200) {
+                        layer.msg(res.msg || '娓呯┖搴撲綅鎴愬姛', { icon: 1 });
+                        tableReload();
+                    } else if (res.code === 403) {
+                        top.location.href = baseUrl + "/";
+                    } else {
+                        layer.msg(res.msg || '娓呯┖搴撲綅澶辫触', { icon: 2 });
+                    }
+                }
+            })
+        });
+    }
+
+    // 鏀逛负鏈夎揣鐘舵��
+    function setInStock(data) {
+        layer.prompt({
+            title: '璇烽�夋嫨婊℃墭/绌烘墭',
+            formType: 2,
+            content: '<div style="padding: 20px;"><label><input type="radio" name="fullPlt" value="true" checked> 婊℃墭</label><br><br><label><input type="radio" name="fullPlt" value="false"> 绌烘墭</label></div>',
+            area: ['300px', '200px']
+        }, function(value, index, elem){
+            var fullPlt = $(elem).find('input[name="fullPlt"]:checked').val() === 'true';
+            layer.close(index);
+            var loadIndex = layer.load(2);
+            $.ajax({
+                url: baseUrl + "/locCache/lockOrUnlock/auth",
+                headers: { 'token': localStorage.getItem('token') },
+                data: {
+                    locNo: data.locNo,
+                    lock: true,  // true琛ㄧず閿佸畾/鏀逛负鏈夎揣
+                    fullPlt: fullPlt
+                },
+                method: 'POST',
+                success: function (res) {
+                    layer.close(loadIndex);
+                    if (res.code === 200) {
+                        layer.msg(res.msg || '鏀逛负鏈夎揣鐘舵�佹垚鍔�', { icon: 1 });
+                        tableReload();
+                    } else if (res.code === 403) {
+                        top.location.href = baseUrl + "/";
+                    } else {
+                        layer.msg(res.msg || '鏀逛负鏈夎揣鐘舵�佸け璐�', { icon: 2 });
+                    }
+                }
+            })
+        });
+    }
+
 });
 
 // 鍏抽棴鍔ㄤ綔
@@ -286,6 +404,6 @@
         searchData[this.name] = this.value;
     });
     tableIns.reload({
-        where: searchData, page: {curr: pageCurr}
+        where: searchData, page: { curr: pageCurr }
     });
 }

--
Gitblit v1.9.1