自动化立体仓库 - WMS系统
zyx
2024-01-15 5247e6823d70874067ab3d9e63e7d261ebe05b18
# 新增库位打印功能
2个文件已修改
231 ■■■■■ 已修改文件
src/main/webapp/static/js/nodeLoc/nodeLoc.js 103 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/nodeLoc/nodeLoc.html 128 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/nodeLoc/nodeLoc.js
@@ -194,29 +194,39 @@
                });
                break;
            // 批量打印
            case "btnPrintBatch":
                printMatCodeNos = [];
                var data = checkStatus.data;
                if (data.length === 0){
                    layer.msg('请选择打印数据');
                } else {
                    layer.open({
                        type: 1,
                        title: '批量打印 [数量'+ data.length +']',
                        area: ['500px'],
                        shadeClose: true,
                        content: $('#printDataDiv'),
                        success: function(layero, index){
                            for (var i = 0; i<data.length;i++) {
                                printMatCodeNos.push(data[i].matnr);
                            }
                        },
                        end: function () {
                        }
                    });
            case "printBatch":
                var checkRows = checkStatus.data;
                printContent = [];
                if (checkRows.length === 0) {
                    layer.msg('请选择要打印的数据');
                    return;
                }
                printContent = checkRows.map(function (d) {
                    if (!d.LAY_INDETERMINATE && d.type === 3) {
                        return d.name;
                    } else {
                        return null;
                    }
                });
                layer.open({
                    type: 1,
                    title: '批量打印 [数量'+ printContent.length +']',
                    area: ['500px'],
                    shadeClose: true,
                    content: $('#printDataDiv'),
                    success: function(layero, index){
                    },
                    end: function () {
                    }
                });
                break;
        }
    });
    // 模板选择
    form.on('radio(selectTemplateRadio)', function (data) {
        $('.template-preview').hide();
        $('#template-preview-'+data.value).show();
    });
    // 监听行工具事件
@@ -328,38 +338,31 @@
    // 开始打印
    form.on('submit(doPrint)', function (data) {
        var templateNo = data.field.selectTemplate;
        $.ajax({
            url: baseUrl+"/node/print/auth",
            headers: {'token': localStorage.getItem('token')},
            data: {param: printMatCodeNos},
            method: 'POST',
            async: false,
            success: function (res) {
                if (res.code === 200){
                    layer.closeAll();
                    for (let i=0;i<res.data.length;i++){
                        var templateDom = $("#templatePreview"+templateNo);
                        var className = templateDom.attr("class");
                        if (className === 'template-barcode') {
                            res.data[i]["barcodeUrl"]=baseUrl+"/mac/code/auth?type=1&param="+res.data[i].matnr;
                        } else {
                            res.data[i]["barcodeUrl"]=baseUrl+"/mac/code/auth?type=2&param="+res.data[i].matnr;
                        }
                    }
                    var tpl = templateDom.html();
                    var template = Handlebars.compile(tpl);
                    var html = template(res);
                    var box = $("#box");
                    box.html(html);box.show();
                    box.print({mediaPrint:true});
                    box.hide();
                } else if (res.code === 403){
                    top.location.href = baseUrl+"/";
                }else {
                    layer.msg(res.msg)
        var data = [];
        var type = 1;
        for (var i = 0; i<printContent.length; i ++) {
            if (printContent[i] != null && printContent[i] !== '') {
                var barcodeUrl;
                if (type === 1) {
                    barcodeUrl = baseUrl+"/mac/code/auth?type="+type+"&param="+printContent[i]+"&width="+200+"&height="+70;
                } else {
                    barcodeUrl = baseUrl+"/mac/code/auth?type="+type+"&param="+printContent[i]+"&width="+400+"&height="+180;
                }
                data.push({
                    item: printContent[i],
                    barcodeUrl: barcodeUrl
                })
            }
        })
        }
        var templateDom = $("#templatePreview"+templateNo);
        var tpl = templateDom.html();
        var template = Handlebars.compile(tpl);
        var html = template({data: data});
        var box = $("#box");
        box.html(html);
        box.show();
        box.print({mediaPrint:true});
        box.hide();
    });
    // 搜索栏搜索事件
src/main/webapp/views/nodeLoc/nodeLoc.html
@@ -116,6 +116,7 @@
<script type="text/html" id="toolbar">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm layui-btn-danger" id="btn-delete" lay-event="deleteData">删除</button>
        <button class="layui-btn layui-btn-sm" id="btn-print-batch" lay-event="printBatch">批量打印</button>
        <!-- 商品/物料 数据中心 -->
<!--        <div class="dropdown-menu" style="float: right">-->
<!--            <button class="layui-btn layui-btn-primary layui-border-black icon-btn layui-btn-sm">&nbsp;数据同步 <i class="layui-icon layui-icon-drop"></i></button>-->
@@ -265,9 +266,8 @@
        <hr>
        <!--单选框-->
        <div class="layui-form-item" style="display: inline-block; margin-bottom: 10px">
            <input type="radio" name="selectTemplate" value="1" title="模板一"  lay-filter="selectTemplateRadio" checked="">
            <input type="radio" name="selectTemplate" value="2" title="模板二" lay-filter="selectTemplateRadio">
            <input type="radio" name="selectTemplate" value="3" title="模板三" lay-filter="selectTemplateRadio">
            <input type="radio" name="selectTemplate" value="1" title="模板一"  lay-filter="selectTemplateRadio" checked="checked">
<!--            <input type="radio" name="selectTemplate" value="2" title="模板二" lay-filter="selectTemplateRadio">-->
        </div>
        <fieldset class="layui-elem-field site-demo-button" style="margin-top: 30px;text-align: left;">
            <legend>打印预览</legend>
@@ -276,62 +276,27 @@
                <!-- 预览图 1 -->
                <div id="template-preview-1" class="template-preview" style="display: inline-block">
                    <table class="contain" width="280" style="overflow: hidden;font-size: xx-small;table-layout: fixed;">
                        <tr style="height: 74px">
                            <td colspan="3" align="center" scope="col">商品编码</td>
                            <td class="barcode" colspan="9" align="center" scope="col">
                        <tr style="height: 74px; border: none">
                            <td class="barcode" colspan="12" align="center" scope="col" style=" border: none">
                                <img class="template-code template-barcode" src="" width="90%;">
                                <div style="letter-spacing: 2px;margin-top: 1px; text-align: center;">
                                    <span>xxxxxx</span>
                                </div>
                            </td>
                        </tr>
                        <tr style="height: 74px">
                            <td align="center" colspan="3">商品</td>
                            <td align="center" colspan="5">xxxxxx-xx/xx</td>
                            <td align="center" colspan="2">备注</td>
                            <td align="center" colspan="2">xx</td>
                        </tr>
                    </table>
                </div>
                <!-- 预览图 2 -->
                <div id="template-preview-2" class="template-preview" style="display: none">
                    <table class="contain" width="280" style="overflow: hidden;font-size: xx-small;table-layout: fixed;">
                        <tr style="height: 30px">
                            <td align="center" width="20%">商品</td>
                            <td align="center" width="80%" style="overflow:hidden; white-space:nowrap; text-overflow:ellipsis;">xxxxxxx</td>
                        </tr>
                        <tr style="height: 30px">
                            <td align="center" width="20%">备注</td>
                            <td align="center" width="80%">xxxxxxxx</td>
                        </tr>
                        <tr style="height: 75px;">
                            <td align="center" colspan="2" width="100%" style="border: none">
                                <img class="template-code template-barcode" src="" width="80%">
                                <div style="letter-spacing: 2px;margin-top: 1px; text-align: center">
                    <table class="contain" width="280" style="overflow: hidden;table-layout: fixed; border: none; font-size: xx-large">
                        <tr style="height: 74px">
                            <td class="barcode" colspan="9" align="center" scope="col" style="border: none">
                                <img class="template-code template-barcode" src="" width="90%;"> ↓
                                <div style="letter-spacing: 2px;margin-top: 1px; text-align: center; font-size: xx-small">
                                    <span>xxxxxx</span>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
                <!-- 预览图 3 -->
                <div id="template-preview-3" class="template-preview" style="display: none">
                    <table class="contain" width="280" style="overflow: hidden;font-size: xx-small;table-layout: fixed;">
                        <tr style="height: 74px">
                            <td align="center" scope="col" colspan="1">商品</td>
                            <td align="center" scope="col" colspan="1" style="">xxxxxx-xx/xx</td>
                            <td align="center" scope="col" colspan="2" rowspan="2">
                                <img class="template-code template-qrcode" src="" width="80%">
                                <div style="letter-spacing: 1px;margin-top: 1px; text-align: center">
                                    <span>xxxxxx</span>
                                </div>
                            </td>
                        </tr>
                        <tr style="height: 74px">
                            <td align="center" colspan="1">备注</td>
                            <td align="center" colspan="1" style="overflow:hidden; white-space:nowrap; text-overflow:ellipsis;">xxxxxxx</td>
                        </tr>
                    </table>
                </div>
@@ -354,21 +319,14 @@
<!-- 模板1 -->
<script type="text/template" id="templatePreview1" class="template-barcode">
    {{#each data}}
    <table class="contain" width="280" style="overflow: hidden;font-size: small;table-layout: fixed;">
        <tr style="height: 74px">
            <td align="center" colspan="3" scope="col">商品编码</td>
            <td align="center" class="barcode" colspan="9" scope="col">
                <img class="template-code" src="{{this.barcodeUrl}}" width="90%">
                <div style="letter-spacing: 2px;margin-top: 1px; text-align: center">
                    <span>{{this.matnr}}</span>
    <table class="contain" width="400px" style="overflow: hidden;font-size: xx-large;table-layout: fixed; color:#000;">
        <tr style="height: 150px; border: none">
            <td class="barcode" colspan="12" align="center" scope="col" style=" border: none">
                <img class="template-code template-barcode" src="{{this.barcodeUrl}}" width="90%;">
                <div style="letter-spacing: 2px;margin-top: 1px; text-align: center;">
                    <span>{{this.item}}</span>
                </div>
            </td>
        </tr>
        <tr style="height: 74px">
            <td align="center" colspan="3">商品</td>
            <td align="center" colspan="5" style="overflow: hidden; white-space: nowrap;text-overflow: ellipsis;">{{this.maktx}}</td>
            <td align="center" colspan="2">备注</td>
            <td align="center" colspan="2">{{this.memo}}</td>
        </tr>
    </table>
    {{/each}}
@@ -376,56 +334,14 @@
<!-- 模板2 -->
<script type="text/template" id="templatePreview2" class="template-barcode">
    {{#each data}}
    <table class="contain" width="280" style="overflow: hidden;font-size: xx-small;table-layout: fixed;">
        <tr style="height: 35px">
            <td align="center" width="20%">商品</td>
            <td align="center" width="80%" style="overflow:hidden; white-space:nowrap; text-overflow:ellipsis;">{{this.maktx}}</td>
        </tr>
        <tr style="height: 35px">
            <td align="center" width="20%">备注</td>
            <td align="center" width="80%">{{this.memo}}</td>
        </tr>
        <tr style="height: 79px;">
            <td align="center" colspan="2" width="100%" style="border: none">
                <img class="template-code" src="{{this.barcodeUrl}}" width="80%">
                <div style="letter-spacing: 2px;margin-top: 1px; text-align: center">
                    <span>{{this.matnr}}</span>
    <table class="contain" width="400px" style="overflow: hidden;table-layout: fixed; border: none; font-size: xxx-large; color:#000;">
        <tr style="height: 150px">
            <td class="barcode" colspan="9" align="center" scope="col" style="border: none">
                <img class="template-code template-barcode" src="{{this.barcodeUrl}}" width="90%;"> ↓
                <div style="letter-spacing: 2px;margin-top: 1px; text-align: center; font-size: xx-large">
                    <span>{{this.item}}</span>
                </div>
            </td>
        </tr>
    </table>
    {{/each}}
</script>
<!-- 模板3 -->
<script type="text/template" id="templatePreview3" class="template-qrcode">
    {{#each data}}
    <table class="contain" width="280" style="overflow: hidden;font-size: xx-small;table-layout: fixed;">
        <tr style="height: 74px" >
            <td align="center" scope="col" colspan="1">商品</td>
            <td align="center" scope="col" colspan="1" style="
                display: inline-block;
                line-height: 20px;
                vertical-align: middle;
                border: none;
                border-top: 1px solid #000;
                overflow: hidden;
                text-overflow: ellipsis;
                display: -webkit-box;
                -webkit-line-clamp: 3;
                -webkit-box-orient: vertical;
                    ">
                {{this.maktx}}
            </td>
            <td align="center" scope="col" colspan="2" rowspan="2">
                <img class="template-code template-qrcode" src="{{this.barcodeUrl}}" width="80%">
                <div style="letter-spacing: 1px;margin-top: 1px; text-align: center">
                    <span>{{this.matnr}}</span>
                </div>
            </td>
        </tr>
        <tr style="height: 74px">
            <td align="center" colspan="1">备注</td>
            <td align="center" colspan="1" style="overflow:hidden; white-space:nowrap; text-overflow:ellipsis;">{{this.memo}}</td>
        </tr>
    </table>
    {{/each}}