南骏 池
2025-05-07 1f2005541e2c5dbb6837bb96e9b7a141145fe94b
1.产品绑定送检优化
2.生产领料拆分无线打印机打条码自定义打印机
已修改6个文件
198 ■■■■ 文件已修改
H5/Config.aspx 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
H5/Cpdbsj.aspx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
H5/Js/Config.js 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
H5/Js/Cpbdsj.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
H5/Js/Scll.js 127 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
H5/Scll.aspx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
H5/Config.aspx
@@ -11,6 +11,12 @@
    <br />
    <br />
    <br />
        <van-nav-bar
  title="在库分料"
  left-text="返回"
  left-arrow
  @click-left="GoBack()"
></van-nav-bar>
    <div class="padding">
        <van-button plain type="info" @click="sendMessage">测试打印</van-button>
    </div>
@@ -52,6 +58,6 @@
            }, 200);
        }
    </script>
    <script src="Js/Config.js?<%=1511 %>"></script>
    <script src="Js/Config.js?<%=15111 %>"></script>
</asp:Content>
H5/Cpdbsj.aspx
@@ -219,5 +219,5 @@
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder4" Runat="Server">
    <script src="Js/Cpbdsj.js?<%=121111111 %>"></script>
    <script src="Js/Cpbdsj.js?<%=121111112 %>"></script>
</asp:Content>
H5/Js/Config.js
@@ -13,48 +13,37 @@
    },
    methods: {
        sendMessage(obj) {
            var detail = ["第一组指令"+
                "! 0 203 203 480 1\r\n" +
                "PREFEED 0\n\r" +
                "POSTFEED 0\n\r" +
                "PAGE - WIDTH 640\r\n" +
                // 右上角放置一个方型二维码(80*80),扫描后的值为“123456”
                "BOX 560 10 640 90 2\r\n" + // 绘制二维码的方框
                "TEXT 570 20 5 \"条码\"\r\n" + // 在方框中上方显示“条码”
                "QRCODE 570 40 M 4 U 0 \"" + obj.qrcode+"\"\r\n" + // 创建二维码
                // 右下角显示一个条形码,最左在320位置,长度为100,同时这个条形码将其扫描的值显示在条形码下侧,条形码的值为“987654”
                "BARCODE 320 350 100 50 1 \"987654\"\r\n" + // 显示条形码的位置和大小
                "TEXT 320 410 5 \"987654\"\r\n" + //
                "GAP-SENSE\r\n" +
            var detail = ["! 0 200 200 210 1\r\n" +
                "PAGE - WIDTH 700 \r\n" +
                "BOX 0 0 700 180 2 \r\n" +
                "T 16 0 200 10  条码1" + "\r\n" + // 添加字体名称
                "BARCODE 128 1 1 20 0 80 " + '123456' + "\r\n" +
                "TEXT 7 0 50 80 SIMSUN.GB2312 " + '123456' + "\r\n" + // 添加字体名称
                //"B QR 500 10 M 1 U 9 \r\n" +
                //"MA," + '001' + "\r\n" +
                "B QR 580 15 M 2 U 4" + "\r\n" +
                "MA,QR code ABC123" + "\r\n" +
                "ENDQR\r\n" +
                "FORM\r\n" +
                "PRINT\r\n",
                "第二组指令" + "! 0 400 400 480 1\r\n" +
                "PREFEED 0\n\r" +
                "POSTFEED 0\n\r" +
                "PAGE - WIDTH 640\r\n" +
                "GAP-SENSE\r\n" +
                "BOX 5 10 620 450 2\r\n" +
                "LINE 5 60 620 60 1\r\n" + // 横线1
                "LINE 5 110 620 110 1\r\n" + // 横线2
                "LINE 5 160 620 160 1\r\n" + // 横线3
                "LINE 5 210 620 210 1\r\n" + // 横线4
                "LINE 5 260 620 260 1\r\n" + // 横线5
                "LINE 120 10 120 260 1\r\n" + // 字段名称右侧竖线
                "LINE 240 260 240 450 1\r\n" + // 规格型号左侧竖线
                "LINE 285 210 285 450 1\r\n" + // 规格型号右侧竖线
                "LINE 410 210 410 260 1\r\n" + // 到货日期右侧竖线
                "ENDQR\r\n" +
                "FORM\r\n" +
                "PRINT\r\n" ];
                "! 0 200 200 210 1\r\n" +
                "PAGE - WIDTH 700 \r\n" +
                "BOX 0 0 700 180 2 \r\n" +
                "T 16 0 200 10 条码2" + "\r\n" + // 添加字体名称
                "BARCODE 128 1 1 20 0 80 " + '123456' + "\r\n" +
                "TEXT270 10 0 200 50 10#格式大小测试" + "\r\n" +
                "TEXT 7 0 50 80 SIMSUN.GB2312 " + '123456' + "\r\n" + // 添加字体名称
                "B QR 580 15 M 2 U 4" + "\r\n" +
                "MA,QR code ABC123" + "\r\n" +
                "ENDQR\r\n" +
                "FORM\r\n" +
                "PRINT\r\n" ];
            let sendData = {
                Type: 'Bar',
                Barcode: 'TM250304-000104-2',
                Detail: detail,
                Ip: '192.168.38.25',
                Ip: '192.168.38.135',
                Port: '9100',
            }
            console.log('sendMessage 开始1:')
H5/Js/Cpbdsj.js
@@ -258,7 +258,7 @@
                .then(function (res) {
                    var json = res;
                    if (json.status == 0) {
                        that.$notify({ type: 'success', message: json.tbBillList.message });
                        that.$notify({ type: 'success', message: json.message });
                        // 清空数据
                        that.KbBar = "";
                        that.XbarInfo = [];
H5/Js/Scll.js
@@ -10,6 +10,10 @@
            modeInfo: { daa001: "", planNo: "" },
            scanInfo: { barcodeNum: "", splitNum: "", barcode: "" },
            ItemDetail: [],
            ip: "",
            port: "",
            oldBarInfo: [],
            cfBarInfo: [],
            //isPrinterPopupVisible: false, // 控制弹窗显示/隐藏
            //selectedPrinter: '', // 当前选择的打印机编号
            //printerList: [
@@ -59,6 +63,11 @@
                });
        },
        getScan() {
            if (this.isLoading) {
                return;
            }
            var that = this;
            if (that.modeInfo.daa001.length <= 0) {
                that.$toast.fail("工单单号不能为空!");
@@ -80,6 +89,7 @@
                    if (json.status == 0) {
                        // that.scanInfo = json.data.tbBillList;
                        that.$notify({ type: 'success', message: json.message });
                        that.$playSound('success');
                        that.getModel();
                        that.$refs.barcode.focus();
                        that.scanInfo.barcode = null;
@@ -91,6 +101,7 @@
                    }
                    else {
                        that.$toast.fail(json.message);
                        that.$playSound('error');
                        that.$refs.barcode.focus();
                    }
                    
@@ -99,12 +110,16 @@
                .catch(function (error) {
                    that.isLoading = false;
                    that.$toast.fail("网络错误,请重试!");
                    console.log(error);
                    that.$playSound('error');
                    that.$refs.barcode.focus();
                });
        },
        getChaiFen() {
            //this.isPrinterPopupVisible = true; // 显示弹窗
            if (this.isLoading) {
                return;
            }
            var that = this;
            if (that.modeInfo.daa001.length <= 0) {
@@ -119,6 +134,16 @@
                that.$toast.fail("物料条码不能为空!");
                return;
            }
            //that.ip = "";
            //that.prot = "";
            //that.getPrintInfo();
            //if (that.ip.length <= 0 || that.prot.length <= 0) {
            //    alert(that.ip);
            //    alert(that.prot);
            //    return;
            //}
            that.isLoading = true;
            that.AxiosHttp("post", 'Womdaa/ScanCodeCF', {
                daa001: that.modeInfo.daa001,
@@ -134,21 +159,119 @@
                        that.scanInfo.barcodeNum = null;
                        that.scanInfo.barcode = null;
                        that.$notify({ type: 'success', message: json.message });
                        that.$playSound('success');
                        that.sendMessage(json.data.tbBillList);
                        that.$refs.barcode.focus();
                        that.getModel();
                    }
                    else {
                        that.$toast.fail(json.message);
                        that.$playSound('error');
                    }
                    that.isLoading = false;
                })
                .catch(function (error) {
                    that.isLoading = false;
                    that.$toast.fail("网络错误,请重试!");
                    console.log(error);
                    that.$playSound('error');
                });
        },
        sendMessage(tbBillList) {
            const cfDetails = tbBillList.cfBarInfo.map(item => {
                return "! 0 200 200 210 1\r\n" +
                    "PAGE - WIDTH 700 \r\n" +
                    "BOX 0 0 700 180 0 \r\n" +
                    `T 16 0 10 10 物料编码:\r\n` +
                    `T 55 3 120 10 ${item.iteM_NO}\r\n` +
                    `T 16 0 310 10 ${item.item_name}\r\n` +
                    "T 55 2 10 42 物料规格:\r\n" +
                    `T 55 2 110 42 ${item.item_model}\r\n` +
                    "T 16 0 10 78 数量:\r\n" +
                    `T 0 5 90 78 ${item.quantity}\r\n` +
                    `T 16 5 180 78 ${item.barType}\r\n` +
                    `BARCODE 128 1 25 35 350 130 ${item.iteM_BARCODE}\r\n` +
                    `T 0 1 350 130 ${item.iteM_BARCODE}\r\n` +
                    "T 55 0 10 125 创建时间:\r\n" +
                    `T 55 0 120 125 ${item.creatE_DATE}\r\n` +
                    "T 55 0 10 150 打印时间:\r\n" +
                    `T 55 0 120 150 ${item.print_date}\r\n` +
                    "B QR 580 12 M 2 U 4\r\n" +
                    `MA,${item.iteM_BARCODE}\r\n` +
                    "ENDQR\r\nFORM\r\nPRINT\r\n";
            });
            //alert(cfDetails);
            let sendData = {
                Type: 'Bar',
                Barcode: tbBillList.cfBarInfo[0].iteM_BARCODE,
                Detail: cfDetails,
                Ip: tbBillList.printInfo[0].ip,
                Port: tbBillList.printInfo[0].port,
            }
            console.log('sendMessage 开始1:')
            console.log('sendMessage 开始2:' + JSON.stringify(sendData))
            uni.webView.postMessage({
                data: JSON.stringify(sendData)
            })
        },
        //getPrintInfo() {
        //    var that = this;
        //    that.AxiosHttp("post", 'MesPrint/getPrintInfo', {
        //        userName: that.userInfo.loginAccount,
        //    }, false)
        //        .then(function (res) {
        //            var json = res;
        //            if (json.status == 0) {
        //                alert(json.data.tbBillList[0].port);
        //                alert(json.data.tbBillList[0].ip);
        //                that.port = json.data.tbBillList[0].port;
        //                that.ip = json.data.tbBillList[0].ip;
        //            }
        //            else {
        //                that.$toast.fail(json.message);
        //                that.$playSound('error');
        //            }
        //            that.isLoading = false;
        //        })
        //        .catch(function (error) {
        //            that.isLoading = false;
        //            that.$toast.fail("网络错误,请重试!");
        //        });
        //},
        //printCfBar(cfBar) {
        //    var that = this;
        //    that.AxiosHttp("post", 'MesPrint/getCfInfo', {
        //        userName: that.userInfo.loginAccount,
        //        cfBar: cfBar,
        //        oldBar: that.scanInfo.barcode
        //    }, false)
        //        .then(function (res) {
        //            var json = res;
        //            if (json.status == 0) {
        //                that.$notify({ type: 'success', message: '打印请求已发送' });
        //                that.$playSound('success');
        //            }
        //            else {
        //                that.$toast.fail(json.message);
        //                that.$playSound('error');
        //            }
        //            that.isLoading = false;
        //        })
        //        .catch(function (error) {
        //            that.isLoading = false;
        //            that.$toast.fail("打印服务异常:" + error.message);
        //            that.$playSound('error');
        //        });
        //},
        //打印机注释
        //selectPrinter(printer) {
        //    this.selectedPrinter = printer.printerId; // 更新选中的打印机编号
H5/Scll.aspx
@@ -125,5 +125,5 @@
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder4" Runat="Server">
    <script src="Js/Scll.js?<%=123336 %>"></script>
    <script src="Js/Scll.js?<%=123336153 %>"></script>
</asp:Content>