自动化立体仓库 - WMS系统
#
luxiaotao1123
2022-10-17 c56c5744f2fec4de83c88c2597566c1f5235bba0
#
3个文件已修改
149 ■■■■■ 已修改文件
src/main/webapp/static/js/order/out.js 140 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/orderTable.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/order/out.html 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/order/out.js
@@ -333,6 +333,146 @@
    window.pakoutPreview = pakoutPreview;
    // 合并出库
    form.on('submit(mergeOut)', function (data) {
        let checkStatus = layui.table.checkStatus('originTable').data;
        if (checkStatus.length < 2) {
            layer.msg("请至少选择两条以上合并数据", {icon: 7});
            return false;
        }
        showMerge(checkStatus.map(function (d) {
            return d.id;
        }));
    });
    // 订单合并窗口
    function showMerge(orderIds) {
        let loadIndex = layer.load(2);
        $.ajax({
            url: baseUrl+"/delivery/merge/preview/auth",
            headers: {'token': localStorage.getItem('token')},
            method: 'GET',
            data: {
                orderIds: orderIds
            },
            success: function (res) {
                layer.close(loadIndex);
                if (res.code === 200){
                    admin.open({
                        type: 1,
                        title: '订单合并 【 数量:' + orderIds.length + " 】",
                        content: $('#mergeDialog').html(),
                        area: '900px',
                        success: function (layero, dIndex) {
                            $('#newOrderNo').val(res.data.newOrderNo);
                            // 渲染客户列表
                            let cstmrVal = xmSelect.render({
                                el: '#cstmrSelect',
                                radio: true,
                                clickClose: true,
                                filterable: true,
                                create: function(val, arr){
                                    if(arr.length === 0){
                                        return {
                                            name:  val,
                                            value: val
                                        }
                                    }
                                },
                                model: {
                                    icon: 'hidden',
                                    label: {
                                        type: 'text',
                                    }
                                },
                                data: res.data.cstmrs
                            })
                            // 渲染明细
                            let xxDataList = res.data.orderDetls;
                            let tbOptions = {
                                elem: '#mergeTable',
                                headers: {token: localStorage.getItem('token')},
                                data: xxDataList,
                                limit: 9999,
                                height: '350px;',
                                cellMinWidth: 100,
                                cols: [[
                                    {type: 'numbers', title: '#'},
                                    {field: 'matnr', title: '商品编码', minWidth: 170},
                                    {field: 'maktx', title: '商品名称'},
                                    {field: 'batch', title: '批号'},
                                    {field: 'anfme', title: '数量', minWidth: 80, width: 80},
                                    {field: 'unitPrice', title: '单价(修改)', style: 'color: blue;font-weight: bold', edit: true, minWidth: 120, width: 120, fixed: 'right'},
                                    // {align: 'center', title: '操作', toolbar: '#formSSXMTableBar', minWidth: 80, width: 80}
                                ]],
                                done: function (res) {
                                    $(layero).find('.layui-table-view').css('margin', '0');
                                }
                            };
                            let insMergeTb = table.render(tbOptions);
                            // 价格修改
                            table.on('edit(mergeTable)', function (obj) {
                                let unitPrice = Number(obj.value);
                                if (isNaN(unitPrice)) {
                                    layer.msg("请输入数字", {icon: 2});
                                } else {
                                    if (unitPrice > 0) {
                                        for (let i=0;i<xxDataList.length;i++){
                                            if (xxDataList[i]["matnr"] === obj.data.matnr && xxDataList[i]["batch"] === obj.data.batch){
                                                xxDataList[i]["unitPrice"] = unitPrice;
                                                break;
                                            }
                                        }
                                    } else {
                                        layer.msg("数量必须大于零", {icon: 2});
                                    }
                                }
                                insMergeTb.reload({data: xxDataList});
                            });
                            // 合并表单提交事件
                            form.on('submit(mergeSubmit)', function (data) {
                                let nList = admin.util.deepClone(xxDataList);
                                data.field.cstmr = cstmrVal.getValue()[0] ? cstmrVal.getValue()[0].name : null;
                                layer.load(2);
                                $.ajax({
                                    url: baseUrl+"/delivery/merge/auth",
                                    headers: {'token': localStorage.getItem('token')},
                                    data: JSON.stringify({
                                        oldOrderIds: orderIds,
                                        orderNo: data.field.newOrderNo,
                                        cstmr: data.field.cstmr,
                                        orderDetls: nList
                                    }),
                                    contentType:'application/json;charset=UTF-8',
                                    method: 'POST',
                                    success: function (res) {
                                        layer.closeAll('loading');
                                        if (res.code === 200){
                                            layer.close(dIndex);
                                            $(".layui-laypage-btn")[0].click();
                                            layer.msg(res.msg, {icon: 1});
                                        } else if (res.code === 403){
                                            top.location.href = baseUrl+"/";
                                        }else {
                                            layer.msg(res.msg, {icon: 2});
                                        }
                                    }
                                })
                                return false;
                            });
                            $(layero).children('.layui-layer-content').css('overflow', 'visible');
                        }
                    });
                } else if (res.code === 403){
                    top.location.href = baseUrl+"/";
                } else {
                    layer.msg(res.msg, {icon: 2})
                }
            }
        })
    }
});
function tableReload(child) {
src/main/webapp/static/js/orderTable.js
@@ -39,7 +39,7 @@
        //     '</p>'].join(''),
        defaultToolbar: [],
        cols: [[
            // {type: 'numbers', title: '#'},
            {type: 'checkbox'},
            {field: 'orderTime', title: '日期'},
            {field: 'orderNo', title: '单据编号', align: 'center'}
        ]],
src/main/webapp/views/order/out.html
@@ -71,10 +71,10 @@
                <div class="layui-card-body" style="padding: 10px;">
                    <form class="layui-form toolbar">
                        <div class="layui-form-item">
                            <div class="layui-inline" style="max-width: 300px;">
                            <div class="layui-inline" style="max-width: 300px;margin-bottom: 5px">
                                <input name="orderNo" class="layui-input" placeholder="输入单据编号" autocomplete="off"/>
                            </div>
                            <div class="layui-inline">
                            <div class="layui-inline" style="margin-bottom: 5px">
                                <button class="layui-btn icon-btn" lay-filter="originTableSearch" lay-submit>
                                    <i class="layui-icon">&#xe615;</i>搜索
                                </button>
@@ -84,6 +84,9 @@
                            </div>
                        </div>
                    </form>
                    <button style="margin-bottom: 5px" class="layui-btn icon-btn layui-btn-danger" lay-filter="mergeOut" lay-submit>
                        <i class="layui-icon">&#xe656;</i>&nbsp;合并出库
                    </button>
                    <table id="originTable" lay-filter="originTable"></table>
                </div>
            </div>