Browse Source

2026-07-27

优化
master
fengyuan_yang 1 week ago
parent
commit
07ffc0fe86
  1. 27
      src/mixins/labelPrintTemplates.js
  2. 50
      src/views/modules/production/productionInboundStorage.vue

27
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 || ''}`);

50
src/views/modules/production/productionInboundStorage.vue

@ -136,12 +136,18 @@
<input
v-model="locationCode"
placeholder="请扫描库位号"
@input="clearLocationError"
@keyup.enter="submitInbound"
ref="locationInput"
class="location-input"
/>
</div>
</div>
<div v-if="locationErrorMsg" class="location-error-message">
<i class="el-icon-warning-outline"></i>
<span>{{ locationErrorMsg }}</span>
</div>
</div>
<div class="modal-footer">
@ -282,6 +288,7 @@ export default {
relatedOrderLineNo: '',
showLocationDialog: false,
locationCode: '',
locationErrorMsg: '',
showMaterialDialog: false,
materialList: [],
materialListLoading: false,
@ -377,6 +384,7 @@ export default {
//
this.showLocationDialog = true;
this.locationCode = '';
this.locationErrorMsg = '';
//
this.$nextTick(() => {
@ -391,6 +399,11 @@ export default {
cancelLocationInput() {
this.showLocationDialog = false;
this.locationCode = '';
this.locationErrorMsg = '';
},
clearLocationError() {
this.locationErrorMsg = '';
},
//
@ -409,14 +422,20 @@ export default {
confirmInboundStorage(params).then(({ data }) => {
if (data && data.code === 0) {
this.$message.success('操作成功');
this.locationErrorMsg = '';
this.showLocationDialog = false;
this.$router.back();
} else {
this.$message.error(data.msg || '操作失败');
this.locationErrorMsg = (data && data.msg && String(data.msg).trim()) || '操作失败';
this.$nextTick(() => {
if (this.$refs.locationInput) {
this.$refs.locationInput.focus();
}
});
}
}).catch(error => {
console.error('上架失败:', error);
this.$message.error('操作失败');
this.locationErrorMsg = '操作失败,请稍后重试';
});
},
@ -1179,6 +1198,33 @@ export default {
color: #c0c4cc;
}
.location-error-message {
display: flex;
align-items: flex-start;
gap: 8px;
margin-top: 12px;
padding: 10px 12px;
border: 1px solid #fde2e2;
border-radius: 8px;
background: #fef0f0;
color: #f56c6c;
font-size: 13px;
line-height: 1.45;
word-break: break-word;
}
.location-error-message i {
margin-top: 2px;
flex-shrink: 0;
font-size: 14px;
}
.location-error-message span {
flex: 1;
min-width: 0;
white-space: pre-wrap;
}
.location-info {
background: #f8f9fa;
border-radius: 8px;

Loading…
Cancel
Save