自动化立体仓库 - WMS系统
pang.jiabao
21 小时以前 6cd08fe4de88df0a21851f96bdc4e617c5d92e36
src/main/webapp/static/js/orderPakin/order.js
@@ -17,7 +17,8 @@
        url: baseUrl+"/docType/list/auth",
        headers: {'token': localStorage.getItem('token')},
        data: {
            limit: 9999
            limit: 9999,
            pakin: 1
        },
        method: 'POST',
        success: function (res) {
@@ -122,8 +123,10 @@
                        cellMinWidth: 100,
                        cols: [[
                            {type: 'numbers'},
                            {field: 'matnr', title: '商品编码', width: 160},
                            {field: 'maktx', title: '商品名称', width: 160},
                            {field: 'sku', title: '行号'},
                            {field: 'standby1', title: '工单号'},
                            {field: 'matnr', title: '商品编码'},
                            {field: 'maktx', title: '商品名称'},
                            {field: 'batch', title: '批号'},
                            {field: 'anfme', title: '数量'},
                            {field: 'workQty', title: '作业数量'},
@@ -136,7 +139,7 @@
                            // },
                            // {field: 'inQty', title: '已入库量'},
                            // {field: 'color', title: '颜色'},
                            {field: 'specs', title: '规格'}
                            // {field: 'specs', title: '规格'}
                        ]],
                        request: {
                            pageName: 'curr',
@@ -229,7 +232,11 @@
                    elem: '#formSSXMTable',
                    headers: {token: localStorage.getItem('token')},
                    data: xxDataList,
                    page: true,
                    page: {
                        curr: 1,
                        limit: 10,
                        limits: [10, 20, 50, 100]
                    },
                    height: '350px;',
                    cellMinWidth: 100,
                    cols: [[
@@ -237,7 +244,8 @@
                        {field: 'matnr', title: '商品编码', width: 160},
                        {field: 'maktx', title: '商品名称', width: 200},
                        {field: 'batch', title: '批号', edit: true},
                        {field: 'specs', title: '规格'},
                        {field: 'standby1', title: '工单号', edit: true},
                        // {field: 'specs', title: '规格'},
                        {field: 'anfme', title: '数量(修改)', style: 'color: blue;font-weight: bold', edit: true, minWidth: 110, width: 110},
                        {field: 'workQty', title: '作业数量',  minWidth: 100, width: 100},
                        // {field: 'unit', title: '单位', width: 80},
@@ -296,30 +304,63 @@
                });
                // 明细数据修改
                table.on('edit(formSSXMTable)', function (obj) {
                    let index = obj.tr.attr("data-index");
                    let data = xxDataList[index];
                    // 从 DOM 中获取当前激活的页码按钮
                    var $pageView = $('#formSSXMTable').next('.layui-table-view');
                    var $currentPage = $pageView.find('.layui-laypage .layui-laypage-curr .layui-laypage-em').parent();
                    var currentPage = parseInt($currentPage.text()) || 1;
                    // 从表格配置获取每页条数
                    var pageSize = insTbSSXM.config.page.limit || 10;
                    // data-index 是当前页的显示索引(从0开始)
                    var displayIndex = parseInt(obj.tr.attr('data-index'));
                    // 计算在 xxDataList 中的真实索引
                    var realIndex = (currentPage - 1) * pageSize + displayIndex;
                    // 边界检查
                    if (realIndex < 0 || realIndex >= xxDataList.length) {
                        layer.msg("数据索引异常,请刷新后重试", {icon: 2});
                        return false;
                    }
                    let data = xxDataList[realIndex];
                    if (!data) {
                        layer.msg("数据异常,请刷新后重试", {icon: 2});
                        return false;
                    }
                    if (obj.field === 'anfme'){
                        let vle = Number(obj.value);
                        if (isNaN(vle)) {
                            layer.msg("请输入数字", {icon: 2});
                            obj.update(data.anfme); // 恢复原值
                            return false;
                        } else {
                            if (vle <= 0) {
                                layer.msg("数量必须大于零", {icon: 2});
                                // data[obj.field] = 0;
                                // insTbSSXM.reload({data: xxDataList});
                                obj.update(data.anfme); // 恢复原值
                                return false;
                            }
                            if(obj.value < data.workQty){
                            if(vle < data.workQty){
                                layer.msg("输入数量不能小于作业中数量", {icon: 2});
                                // data[obj.field] = 0;
                                // insTbSSXM.reload({data: xxDataList});
                                obj.update(data.anfme); // 恢复原值
                                return false;
                            }
                        }
                    }
                    // 更新数据
                    data[obj.field] = obj.value;
                    insTbSSXM.reload({data: xxDataList});
                    // 保持当前页码重新加载表格,确保页码不变
                    insTbSSXM.reload({
                        data: xxDataList,
                        page: {
                            curr: currentPage,
                            limit: pageSize
                        }
                    });
                });
                $('#matAddBtnComment').click(function () {