cnf
2 天以前 1ff3526312e320509b2522a0295e95169fafcd8f
Scripts/config.js
@@ -1,7 +1,10 @@
/*var APIURL = "http://192.168.1.187:8083/api/";*///后端发布测试地址
var APIURL = "http://localhost:5204/api/";
/*var APIURL_PC = "http://192.168.1.187:81/";*/ //PC后端的地址
var APIURL_PC = "http://192.168.1.187:8081/";//
//var APIURL = "http://192.168.1.187:8083/api/";//PDA后端发布测试地址(内网)
//var APIURL = "http://192.168.1.187:83/api/";//PDA后端发布正式地址(内网)
var APIURL = "http://localhost:5204/api/";//本地调试地址
//var APIURL_PC = "http://192.168.1.187:81/"; //PC后端的正式地址(内网)
var APIURL_PC = "http://116.148.211.203:8081/"; //PC后端的测试地址(外网)
var APIURL_IMAGE = APIURL_PC+"upload/";
var ISNEEDLOGIN = true;
String.prototype.trim = function () {
@@ -83,6 +86,8 @@
        url = (APIURL_PC + url);
    }
    let headers = { 'Content-Type': 'application/json', }
    var orgId = Cookies.get('orgId')
    headers['OrgId'] = orgId;
    if (isToken) {
        var timestamp = (new Date()).getTime();
        var token = Cookies.get('loginGuid')
@@ -165,31 +170,101 @@
}
// 新增全局打印方法
//// 新增全局打印方法
//Vue.prototype.sendPrintMessage = function (tbBillList) {
//    const cfDetails = tbBillList.cfBarInfo.map(item => {
//        return "! 0 200 200 210 1\r\n" +
//            "PAGE - WIDTH 700 \r\n" +
//            "GAP-SENSE \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";
//    });
Vue.prototype.sendPrintMessage = function (tbBillList) {
    const cfDetails = tbBillList.cfBarInfo.map(item => {
        return "! 0 200 200 210 1\r\n" +
            "PAGE - WIDTH 700 \r\n" +
            "GAP-SENSE \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";
        return "! 0 195 200 472 1\r\n" +  // 基础偏移量左移5像素
            "PAGE-WIDTH 545\r\n" +     // 页面宽度减少5像素
            "GAP-SENSE\r\n" +
            // 外框 - 整体左移5像素
            "BOX -3 2 543 470 2\r\n" +
            // ==================== 物料条码(第一行)====================
            "LINE -3 62 425 62 1\r\n" +
            "T 55 0 8 27 物料条码:\r\n" +
            `T 55 3 120 27 ${item.iteM_BARCODE}\r\n` +  // 物料条码值
            // ==================== 物料编码(第二行)====================
            "LINE -3 124 543 124 1\r\n" +
            "T 55 0 8 89 编码:\r\n" +
            `T 55 3 120 89 ${item.iteM_NO}\r\n` +  // 物料编码值
            // ==================== 供应商(第三行)====================
            "LINE -3 186 543 186 1\r\n" +     // 第3条分隔线(间隔62)
            "T 55 0 8 151 供应商:\r\n" +
            `T 55 3 120 151 ${item.supp_name || ''}\r\n` +  // 供应商值(假设字段名)
            // ==================== 物料名称(第四行)====================
            "LINE -3 248 543 248 1\r\n" +     // 第4条分隔线(间隔62)
            "T 55 0 8 213 名称:\r\n" +
            `T 55 3 120 213 ${item.item_name}\r\n` +  // 物料名称值
            // ==================== 规格型号(第五行)====================
            "LINE -3 310 543 310 1\r\n" +     // 第5条分隔线(间隔62)
            "T 55 0 8 275 规格:\r\n" +
            `T 55 3 120 275 ${item.item_model}\r\n` +  // 规格型号值
            // ==================== 仓库(第六行)====================
            "LINE -3 360 543 360 1\r\n" +     // 第6条分隔线(移至竖线顶端Y=360)
            "T 55 0 8 335 仓库:\r\n" +
            `T 55 3 120 335 ${item.depot_name || ''}\r\n` +  // 仓库值(假设字段名)
            // ==================== 数量和仓管员(第七行)====================
            "LINE -3 430 543 430 1\r\n" +     // 底部横线(与竖线底端对齐)
            "T 55 0 8 380 数量:\r\n" +        // 文本位置保持
            `T 55 3 120 380 ${item.quantity}\r\n` +  // 数量值
            "T 55 0 275 380 仓管员:\r\n" +    // 文本位置保持
            `T 55 3 395 380 ${item.cgy || ''}\r\n` +  // 仓管员值(假设字段名)
            // 中间竖线分隔(范围Y=360-430,与上下横线衔接)
            "LINE 265 430 265 360 1\r\n" +    // 竖线顶端对齐仓库行分隔线
            // ==================== 底部时间信息 ====================
            "T 55 0 395 440 打印时间\r\n" +  // 位置保持
            "T 55 0 8 440 " + new Date().toLocaleString('zh-CN', {  // 时间格式改为年月日时分秒
                year: 'numeric',
                month: '2-digit',
                day: '2-digit',
                hour: '2-digit',
                minute: '2-digit',
                second: '2-digit'
            }) + "\r\n" +
            // ==================== 二维码区域(左移5像素)====================
            "BOX 425 3 535 113 1\r\n" +       // 位置保持
            "B QR 430 8 M 2 U 5\r\n" +        // 位置保持
            `MA,${item.iteM_BARCODE}\r\n` +  // 使用物料条码生成二维码
            "ENDQR\r\n" +
            "FORM\r\n" +
            "PRINT\r\n";
    });
    let sendData = {
        Type: 'Bar',
@@ -209,8 +284,8 @@
Vue.prototype.$playSound = function(type = 'success') {
    try {
        const audioMap = {
            success: '/audio/OK.wav',
            error: '/audio/NG.wav'
            success: '/audio/YES.wav',
            error: '/audio/NO.wav'
        };
        const audio = new Audio(audioMap[type]);
        audio.play().catch(error => {