export default function printTemplate(printData){ try { var str1 = printData.STRP1 var str2 = printData.STRP2 var str3 = printData.STRP3 var str4 = printData.STRP4 var str5 = printData.STRP5 var str6 = printData.STRP6 var str9 = printData.STRP9 var str10 = printData.STRP10 var str11 = printData.STRP11 var str12 = printData.STRP12 var str13 = printData.STRP13 var str9 = "" //规格型号第一行 var str10 = "" //规格型号第二行 var str11 = "" //规格型号第三行 var str12 = "" //规格型号第四行 var str7_1 = "" //规格型号第一行 var str7_2 = "" //规格型号第二行 var str7_3 = "" //规格型号第三行 var str7_4 = "" //规格型号第四行 if (printData.STRP7.length > 16) { str7_1 = printData.STRP7.substring(0, 16) if (printData.STRP7.length > 32) { str7_2 = printData.STRP7.substring(16, 32) if (printData.STRP7.length > 48) { str7_3 = printData.STRP7.substring(32, 48) str7_4 = printData.STRP7.substring(48, 64) } else { str7_3 = printData.STRP7.substring(32, printData.STRP7.length) } } else { str7_2 = printData.STRP7.substring(16, printData.STRP7.length) } } else { str7_1 = printData.STRP7 } var str8 = printData.STRP8 //条码 var printCmd = "! 0 203 203 490 1\r\n" + //"PREFEED 8\n\r"+//打印之前走纸距离指令 //"POSTFEED 19.5\n\r" + //打印之后走纸距离指令 "PAGE - WIDTH 640\r\n" + "BOX 10 10 610 460 2\r\n" + //打印的大小 "GAP-SENSE\r\n" + "LINE 10 60 450 60 1\r\n" + //第二条 横线 "LINE 10 110 450 110 1\r\n" + //第三条 横线 "LINE 10 160 610 160 1\r\n" + //第四条 横线 "LINE 10 210 610 210 1\r\n" + //第五条 横线 "LINE 10 260 610 260 1\r\n" + //第六条 横线 "LINE 10 310 610 310 1\r\n" + ////第七条 横线 "LINE 130 10 130 460 1\r\n" + //第二条竖 "LINE 190 310 190 460 1\r\n" + //第三条竖 "LINE 320 260 320 310 1\r\n" + //第四条竖 "LINE 440 260 440 310 1\r\n" + //第五条竖 "LINE 450 10 450 160 1\r\n" + //第六条竖 "TEXT 24 0 15 25 物料条码 " + str1 + "\r\n" + "TEXT 24 0 15 75 需求单据 " + str13 + "\r\n" + "TEXT 24 0 15 125 供应商 " + str2 + "\r\n" + "TEXT 24 0 15 175 物料编码 " + str3 + "\r\n" + "TEXT 24 0 15 225 物料名称 " + str4 + "\r\n" + "TEXT 24 0 15 275 条码数量 " + str5 + "\r\n" + "TEXT 24 0 330 275 到货日期 " + str6 + "\r\n" + "TEXT 24 0 200 325 " + str7_1 + "\r\n" + "TEXT 24 0 200 357 " + str7_2 + "\r\n" + "TEXT 24 0 200 385 " + str7_3 + "\r\n" + "TEXT 24 0 200 413 " + str7_4 + "\r\n" + "TEXT 24 0 145 323 规\r\n" + "TEXT 24 0 145 351 格\r\n" + "TEXT 24 0 145 379 型\r\n" + "TEXT 24 0 145 407 号\r\n" + "B QR 480 30 M 2 U 5\r\n" + "MA," + str8 + "\r\n" + "ENDQR\r\n" + "B QR 25 345 M 2 U 4\r\n" + "MA," + str8 + "\r\n" + "ENDQR\r\n" + "FORM\r\n" + "PRINT\r\n"; //"PREFEED 8\n\r"+//打印之前走纸距离指令 //"POSTFEED 35\n\r" + //打印之后走纸距离指令 // "PAGE - WIDTH 630\r\n" + // "BOX 5 10 620 620 2\r\n" + // "LINE 5 60 470 60 1\r\n" + // "LINE 5 110 470 110 1\r\n" + // "LINE 5 160 620 160 1\r\n" + // "LINE 5 210 620 210 1\r\n" + // "LINE 5 260 620 260 1\r\n" + // "LINE 5 310 620 310 1\r\n" + // "LINE 5 360 620 360 1\r\n" + // "LINE 130 10 130 620 1\r\n" + //1 // "LINE 190 360 190 620 1\r\n" + //2 // "LINE 320 210 320 360 1\r\n" + // // "LINE 440 210 440 360 1\r\n" + // "LINE 470 10 470 160 1\r\n" + // "TEXT 24 0 15 25 物料条码 " + str1 + "\r\n" + // "TEXT 24 0 15 75 供应商 " + str2 + "\r\n" + // "TEXT 24 0 15 125 物料编码 " + str3 + "\r\n" + // "TEXT 24 0 15 175 物料名称 " + str4 + "\r\n" + // "TEXT 24 0 15 225 条码数量 " + str5 + "\r\n" + // "TEXT 24 0 330 225 到货日期 " + str6 + "\r\n" + // "TEXT 24 0 15 275 厂商 " + str9 + "\r\n" + // "TEXT 24 0 330 275 脚型 " + str10 + "\r\n" + // "TEXT 24 0 15 325 组织 " + str11 + "\r\n" + // "TEXT 24 0 330 325 货主 " + str12 + "\r\n" + // "TEXT 24 0 200 373 " + str7_1 + "\r\n" + // "TEXT 24 0 200 401 " + str7_2 + "\r\n" + // "TEXT 24 0 200 429 " + str7_3 + "\r\n" + // "TEXT 24 0 200 457 " + str7_4 + "\r\n" + // "TEXT 24 0 145 373 规\r\n" + // "TEXT 24 0 145 401 格\r\n" + // "TEXT 24 0 145 429 型\r\n" + // "TEXT 24 0 145 457 号\r\n" + // "B QR 480 30 M 2 U 5\r\n" + // "MA," + str8 + "\r\n" + // "ENDQR\r\n" + // "B QR 25 385 M 2 U 4\r\n" + // "MA," + str8 + "\r\n" + // "ENDQR\r\n" + // "FORM\r\n" + // "PRINT\r\n"; //doPrint(printCmd) return printCmd; } catch (err) { console.log("printErr:" + err) mui.msg("printErr: " + err) var printCmd = ""; return printCmd; } }