From 07ffc0fe86d8a81f9c94768c1e3dc5029f36273a Mon Sep 17 00:00:00 2001 From: fengyuan_yang <1976974459@qq.com> Date: Mon, 27 Jul 2026 09:40:30 +0800 Subject: [PATCH] =?UTF-8?q?2026-07-27=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mixins/labelPrintTemplates.js | 27 +++++----- .../production/productionInboundStorage.vue | 50 ++++++++++++++++++- 2 files changed, 62 insertions(+), 15 deletions(-) diff --git a/src/mixins/labelPrintTemplates.js b/src/mixins/labelPrintTemplates.js index 78b5ddf..ba80f82 100644 --- a/src/mixins/labelPrintTemplates.js +++ b/src/mixins/labelPrintTemplates.js @@ -170,20 +170,20 @@ export default { const startX = '20mm'; // 文字左边距 const fullTextWidth = '55mm'; // 单行完整文字区域宽度 const fontSize = 4; // 字体大小(缩小到2.5号,确保超长文本能显示) - const packingFontSize = 4; // Packing List 比主文本小一号 - const lineHeight = '3mm'; // 行高 + const packingFontSize = fontSize; // Packing List 与主文本同字号 + const lineHeight = '3.5mm'; // 行高(避免同字号时看起来偏小) // 第1行:编码(左) + Packing List(右) const packingList = printData.packingList || printData.PackingList || printData.packinglist || ''; - const text1 = LODOP.ADD_PRINT_TEXT('3mm', startX, '34mm', lineHeight, `No.:${printData.partNo || ''}`); + // 第一行总可用宽度约 48mm:No 区 36mm,Packing List 区 12mm + const text1 = LODOP.ADD_PRINT_TEXT('2.8mm', startX, '36mm', lineHeight, `No.:${printData.partNo || ''}`); LODOP.SET_PRINT_STYLEA(text1, "FontName", "Microsoft YaHei"); // 使用Arial,比微软雅黑窄 LODOP.SET_PRINT_STYLEA(text1, "FontSize", fontSize); - const text1Right = LODOP.ADD_PRINT_TEXT('3mm', '54mm', '14mm', lineHeight, `${packingList}`); - LODOP.SET_PRINT_STYLEA(0, "FontName", "Microsoft YaHei"); - LODOP.SET_PRINT_STYLEA(0, "FontSize", packingFontSize); - // 双保险:部分打印环境按对象索引设置更稳定 + // 右侧从56mm开始,宽12mm,结束于68mm,不会超出边框 + const text1Right = LODOP.ADD_PRINT_TEXT('2.8mm', '56mm', '12mm', lineHeight, `${packingList}`); LODOP.SET_PRINT_STYLEA(text1Right, "FontName", "Microsoft YaHei"); LODOP.SET_PRINT_STYLEA(text1Right, "FontSize", packingFontSize); + LODOP.SET_PRINT_STYLEA(text1Right, "Alignment", 1); // 第2行:卷号 - 关键字段,使用最宽区域和最紧凑设置 const text2 = LODOP.ADD_PRINT_TEXT('6.5mm', startX, fullTextWidth, lineHeight, `RN.:${printData.rollNo || ''}`); @@ -313,19 +313,20 @@ export default { const startX = '20mm'; // 文字左边距 const textWidth = '55mm'; // 文字区域宽度 const fontSize = 5; // 字体大小(比A002稍大,因为只有3行) - const packingFontSize = 5; // Packing List 比主文本小一号 + const packingFontSize = fontSize; // Packing List 与主文本同字号 + const lineHeight = '4mm'; // 行高 // 第1行:编码(左) + Packing List(右) const packingList = printData.packingList || printData.PackingList || printData.packinglist || ''; - const text1 = LODOP.ADD_PRINT_TEXT('3.5mm', startX, '34mm', '4mm', `No.:${printData.partNo || ''}`); + // 第一行总可用宽度约 48mm:No 区 36mm,Packing List 区 12mm + const text1 = LODOP.ADD_PRINT_TEXT('3.5mm', startX, '36mm', lineHeight, `No.:${printData.partNo || ''}`); LODOP.SET_PRINT_STYLEA(text1, "FontName", "Microsoft YaHei"); LODOP.SET_PRINT_STYLEA(text1, "FontSize", fontSize); - const text1Right = LODOP.ADD_PRINT_TEXT('3.5mm', '54mm', '14mm', '4mm', `${packingList}`); - LODOP.SET_PRINT_STYLEA(0, "FontName", "Microsoft YaHei"); - LODOP.SET_PRINT_STYLEA(0, "FontSize", packingFontSize); - // 双保险:部分打印环境按对象索引设置更稳定 + // 右侧从56mm开始,宽12mm,结束于68mm,不会超出边框 + const text1Right = LODOP.ADD_PRINT_TEXT('3.5mm', '56mm', '12mm', lineHeight, `${packingList}`); LODOP.SET_PRINT_STYLEA(text1Right, "FontName", "Microsoft YaHei"); LODOP.SET_PRINT_STYLEA(text1Right, "FontSize", packingFontSize); + LODOP.SET_PRINT_STYLEA(text1Right, "Alignment", 1); // 第2行:卷号 const text2 = LODOP.ADD_PRINT_TEXT('8mm', startX, textWidth, '4mm', `RN.:${printData.rollNo || ''}`); diff --git a/src/views/modules/production/productionInboundStorage.vue b/src/views/modules/production/productionInboundStorage.vue index 0031d7f..d3611ff 100644 --- a/src/views/modules/production/productionInboundStorage.vue +++ b/src/views/modules/production/productionInboundStorage.vue @@ -136,12 +136,18 @@ + +
+ + {{ locationErrorMsg }} +