自动化立体仓库 - WMS系统
zhang
2025-08-01 b1cbb59d39cea44d35110d95e54fbd86d4a12e13
src/main/webapp/static/js/order/out.js
@@ -4,7 +4,7 @@
    base: baseUrl + "/static/layui/lay/modules/"
}).extend({
    notice: 'notice/notice',
}).use(['table','laydate', 'form', 'util', 'admin', 'notice', 'treeTable', 'xmSelect', 'tableMerge'], function(){
}).use(['table','laydate', 'form', 'util', 'admin', 'notice', 'treeTable', 'xmSelect', 'tableMerge', 'tableX'], function(){
    var table = layui.table;
    var $ = layui.jquery;
    var layer = layui.layer;
@@ -16,6 +16,7 @@
    var treeTable = layui.treeTable;
    var xmSelect = layui.xmSelect;
    var tableMerge = layui.tableMerge;
    var tableX = layui.tableX;
    insTb2 = table.render({
        elem: '#orderDetlTable',
@@ -26,21 +27,33 @@
        limits: [15, 30, 50, 100, 200, 500],
        toolbar: '#orderDetToolbar',
        height: 'full-120',
        where: {order_id: 9999999999},
        cols: [[
            {type: 'checkbox'}
            ,{type: 'numbers', title: '#'}
            ,{field: 'orderNo', align: 'center',title: '单据编号', templet: '#orderNoTpl', width: 160}
            ,{field: 'matnr', align: 'center',title: '商品编码', width: 160}
            ,{field: 'maktx', align: 'center',title: '商品名称', width: 200}
            ,{field: 'batch', align: 'center',title: '批号'}
            ,{field: 'specs', align: 'center',title: '规格'}
            // ,{field: 'matnr', align: 'center',title: '规格', width: 160}
            // ,{field: 'maktx', align: 'center',title: '商品名称', width: 200}
            // ,{field: 'batch', align: 'center',title: '箱号'}
            // ,{field: 'specs', align: 'center',title: '接头'}
            // ,{field: 'anfme', align: 'center',title: '数量'}
            // ,{field: 'qty', align: 'center',title: '作业数量', style: 'font-weight: bold'}
            ,{field: 'brand', align: 'center',title: '包装组号'}
            ,{field: 'supp', align: 'center',title: '客户名称', hide: false}
            ,{field: 'memo', align: 'center',title: '备注', hide: false}
            ,{field: 'qty', align: 'center',title: '作业数量', style: 'font-weight: bold'}
            ,{field: 'enableQty', align: 'center',title: '待出数量', style: 'font-weight: bold'}
            ,{field: 'finishStatus', align: 'center', title: '是否完成', templet: function(d){
                    if (d.qty === 0 && d.enableQty === 0) {
                        return '<span style="color:green;font-weight:bold;">完成</span>';
                    } else {
                        return '<span style="color:red;">未完成</span>';
                    }
                }}
            // ,{field: 'name', align: 'center',title: '名称'}
            // ,{field: 'model', align: 'center',title: '型号'}
            ,{field: 'unit', align: 'center',title: '单位', hide: true}
            ,{field: 'barcode', align: 'center',title: '商品条码', hide: true}
            // ,{field: 'unit', align: 'center',title: '单位', hide: true}
            // ,{field: 'barcode', align: 'center',title: '商品条码', hide: true}
            // ,{field: 'supplier', align: 'center',title: '供应商'}
            // ,{field: 'unitPrice', align: 'center',title: '单价'}
            // ,{field: 'itemNum', align: 'center',title: '品项数'}
@@ -77,6 +90,7 @@
            limit();
        }
    });
    /* 表格2搜索 */
    form.on('submit(sensorTbSearch)', function (data) {
        insTb2.reload({where: data.field, page: {curr: 1}});
@@ -85,6 +99,7 @@
    /* 表格2头工具栏点击事件 */
    table.on('toolbar(orderDetlTable)', function (obj) {
        var checkStatus = table.checkStatus(obj.config.id).data;
        if (obj.event === 'pakoutPreview') { // 添加
            if (checkStatus.length === 0) {
@@ -109,6 +124,7 @@
    /* 表格2工具条点击事件 */
    table.on('tool(orderDetlTable)', function (obj) {
        console.log(obj);
        var data = obj.data;
        switch (obj.event) {
            // 出库
@@ -135,7 +151,7 @@
                        ,title: false
                        ,closeBtn: false
                        ,offset: '50px'
                        ,area: ['1200px', '700px']
                        ,area: ['1500px', '700px']
                        ,shade: 0.5
                        ,shadeClose: false
                        ,btn: ['立即出库', '稍后处理']
@@ -151,14 +167,29 @@
                                limit: Number.MAX_VALUE,
                                cellMinWidth: 100,
                                cols: [[
                                    // {type: 'checkbox', merge: ['orderNo']},
                                    {field: 'orderNo', title: '单据编号', merge: true, align: 'center'},
                                    {field: 'title', title: '商品', merge: true, align: 'center', width: 350},
                                    {field: 'batch', title: '批号', align: 'center'},
                                    {field: 'anfme', title: '数量', align: 'center', width: 90, style: 'font-weight: bold'},
                                    // {type: 'checkbox', merge: ['brand'],width: 100},
                                    // {field: 'title', title: '商品', merge: true, align: 'center', width: 350},
                                    {field: 'unit', title: '箱号', align: 'center',hide:false},
                                    {field: 'model', title: '卷号', align: 'center', hide: false},
                                    {
                                        field: 'threeCode',
                                        align: 'center',
                                        title: '合格否',
                                        hide: false,
                                        templet: function(d) {
                                            return d.threeCode ? d.threeCode : '待判';
                                        }
                                    },
                                    // {field: 'specs', title: '接头', align: 'center'},
                                    {field: 'brand', align: 'center',title: '包装组号', merge: true, hide: false},
                                    // {field: 'brand$', align: 'center',title: '木箱类型', hide: false},
                                    // {field: 'zpallet', title: '托盘码', align: 'center'},
                                    // {field: 'anfme', title: '数量', align: 'center', width: 90, style: 'font-weight: bold'},
                                    // {field: 'count', title: '数量', align: 'center', width: 90, style: 'font-weight: bold'},
                                    {field: 'locNo', title: '货位', align: 'center', width: 100, templet: '#locNoTpl'},
                                    {field: 'staNos', align: 'center', title: '出库站', merge: ['locNo'], templet: '#tbBasicTbStaNos'},
                                    {type: 'checkbox', merge: ['locNo']},
                                    // {type: 'checkbox', merge: ['locNo']},
                                ]],
                                done: function (res) {
                                    tableMerge.render(this);
@@ -187,6 +218,52 @@
                                }
                                modifySta(stoPreTabData);
                            });
                            form.on('submit(checkModifySta)', function () {
                                if (!tableCache || tableCache.length === 0) {
                                    layer.msg("没有可处理的数据", {icon: 7});
                                    return false;
                                }
                                let updatedRows = [];
                                for (let i = 0; i < tableCache.length; i++) {
                                    let row = tableCache[i];
                                    let locNo = row.locNo;
                                    if (!locNo || locNo.length < 2) continue;
                                    let rowPrefix = parseInt(locNo.substring(0, 2), 10);
                                    let newStaNo;
                                    if (rowPrefix >= 17 && rowPrefix <= 24) {
                                        newStaNo = 3092;
                                    } else if (rowPrefix >= 9 && rowPrefix <= 16) {
                                        newStaNo = 3102;
                                    } else if (rowPrefix >= 1 && rowPrefix <= 8) {
                                        newStaNo = 3095;
                                    }
                                    if (newStaNo) {
                                        row.staNo = newStaNo;
                                        updatedRows.push({index: i, staNo: newStaNo});
                                    }
                                }
                                // 重载表格数据
                                stoPreTabIdx.reload({data: tableCache});
                                // 更新下拉框颜色和值
                                updatedRows.forEach(item => {
                                    $('div[lay-id=stoPreTab] tr[data-index="' + item.index + '"] .order-sta-select').val(item.staNo);
                                });
                                layui.form.render('select');
                                updatedRows.forEach(item => {
                                    $('div[lay-id=stoPreTab] tr[data-index="' + item.index + '"] .layui-select-title input').css("color", "blue");
                                });
                                layer.msg("出库站点均分已完成", {icon: 1});
                                return false;
                            });
                            // 批量修改出库站 - 站点选择
                            function modifySta(stoPreTabData) {
                                // 出库站取交集
@@ -338,6 +415,8 @@
        })
    })
    window.pakoutPreview = pakoutPreview;
});
function tableReload(child) {
@@ -353,3 +432,25 @@
    });
}
/**
 * 一键出库
 */
function autoOut(orderId) {
    let loadIndex = layer.msg('请求中...', {icon: 16, shade: 0.01, time: false});
    $.ajax({
        url: baseUrl + "/out/pakout/orderDetlIds/auth",
        headers: {'token': localStorage.getItem('token')},
        data: { orderId : orderId },
        method: 'POST',
        success: function (res) {
            layer.close(loadIndex);
            if (res.code === 200){
                pakoutPreview(res.data);
            } else if (res.code === 403){
                top.location.href = baseUrl+"/";
            } else {
                layer.msg(res.msg, {icon: 2});
            }
        }
    })
}