Browse Source

2026-02-10

销售发货装箱页面扫描装盒加【打印】
master
fengyuan_yang 2 weeks ago
parent
commit
614bbb5345
  1. 96
      src/views/modules/boxManage/saleBoxManage.vue

96
src/views/modules/boxManage/saleBoxManage.vue

@ -51,7 +51,7 @@
</el-col>
<el-col :span="4">
<el-form-item label="单据状态">
<el-select multiple collapse-tags v-model="searchData.orderStatusList" clearable placeholder="请选择" style="width: 100%">
<el-select multiple collapse-tags v-model="searchData.orderStatusList" clearable placeholder="请选择" style="width: 120%">
<el-option label="待包装" value="待包装"></el-option>
<el-option label="待检验" value="待检验"></el-option>
<el-option label="已出库" value="已出库"></el-option>
@ -170,6 +170,7 @@
<el-form v-if="currentRow.orderStatus === '待包装'" label-position="top" style="margin-left: 2px; display: flex; align-items: center;">
<el-button type="primary" size="small" @click="openCaseDialog">新增</el-button>
<el-button type="danger" size="small" @click="deleteCaseRecord">删除</el-button>
<el-button type="primary" size="small" :loading="printCasesLoading" @click="printSelectedCases">打印</el-button>
<span style="margin-left: auto; font-size: 14px; display: flex; align-items: center;">
<span style="margin-right: 20px;">
<span style="color: #606266;">盒标签张数</span>
@ -188,7 +189,7 @@
<el-table
ref="caseTable"
:data="casesList"
:height="height - 30"
:height="height"
border
@selection-change="handleCaseSelectionChange"
style="width: 100%;">
@ -254,7 +255,7 @@
<el-tab-pane label="装箱清单" name="rollDetail">
<el-table
:data="rollList"
:height="height - 20"
:height="height + 23"
border
style="width: 100%;">
<el-table-column
@ -474,6 +475,7 @@ export default {
currentRow: {},
selectedCaseRolls: [], //
printLoading: false, // loading
printCasesLoading: false, // loading
searchData:{
orderNo:'',
customerId:'',
@ -889,9 +891,9 @@ export default {
this.$nextTick(() => {
const windowHeight = window.innerHeight;
//
const headerHeight = this.searchExpanded ? 220 : 154;
this.tableHeight = (windowHeight - headerHeight - 178) / 2;
this.height = this.tableHeight;
const headerHeight = this.searchExpanded ? 220 : 152;
this.tableHeight = (windowHeight - headerHeight - 162) / 2;
this.height = this.tableHeight - 51;
});
},
// /
@ -992,7 +994,7 @@ export default {
orderNo: this.currentRow.orderNo,
saleOrderNo: this.currentRow.relatedOrderNo || '', //
boxType: this.currentRow.orderType,
height:Number(this.height)-25,
height: this.height,
orderStatus: this.currentRow.orderStatus
}
this.$refs.boxing.init(inData)
@ -1015,7 +1017,7 @@ export default {
buNo: this.currentRow ? this.currentRow.buNo : '',
orderNo: this.currentRow ? this.currentRow.orderNo : '',
palletType: this.currentRow ? this.currentRow.orderType : '',
height: Number(this.height)-25,
height: this.height,
orderStatus: this.currentRow ? this.currentRow.orderStatus : ''
}
this.$refs.pallet.init(inData)
@ -1394,6 +1396,84 @@ export default {
}
},
//
async printSelectedCases(){
if(this.selectedCaseRecords.length === 0){
this.$message.warning('请先选择要打印的记录')
return
}
this.printCasesLoading = true
try {
// 1. LODOP
const LODOP = getLodop()
if (!LODOP) {
this.$message.error('无法连接到打印控件,请确保已安装并启动 CLodop!')
this.printCasesLoading = false
return
}
// 2.
const printerCount = LODOP.GET_PRINTER_COUNT()
if (printerCount <= 0) {
this.$message.error('未检测到打印机,请确保已安装并连接打印机!')
this.printCasesLoading = false
return
}
// 3.
for (const caseRecord of this.selectedCaseRecords) {
const params = {
site: this.currentRow.site,
buNo: this.currentRow.buNo,
menuID: this.$route.meta.menuId,
relatedOrderNo: this.currentRow.orderNo,
relatedOrderLineNo: this.currentRow.relatedOrderLineNo || '',
documentNo: this.currentRow.orderNo,
partNo: caseRecord.partNo,
labelNo: '',
rollNo: caseRecord.rollNo
}
const {data: printData} = await callUspPartLabelTemplate(params)
if (printData && printData.code === 0 && printData.row) {
const labelData = printData.row
//
LODOP.PRINT_INIT('卷标签打印_' + caseRecord.rollNo)
LODOP.SET_PRINT_MODE("PRINT_NOCOLLATE", true)
// labelNo
if (labelData.labelNo === 'A001') {
await this.printLabelA001(LODOP, labelData, false)
} else if (labelData.labelNo === 'A002') {
this.printLabelA002(LODOP, labelData, false)
} else if (labelData.labelNo === 'A003') {
this.printLabelA003(LODOP, labelData, false)
} else if (labelData.labelNo === 'A004') {
this.printLabelA004(LODOP, labelData, false)
} else {
console.warn(`未知的标签模板:${labelData.labelNo},跳过该标签`)
continue
}
//
LODOP.PRINT()
console.log(`标签已发送打印, 卷号: ${caseRecord.rollNo}`)
} else {
console.warn(`获取卷号 ${caseRecord.rollNo} 的打印参数失败`)
}
}
this.$message.success('打印任务已发送!')
} catch (error) {
console.error('打印标签失败:', error)
this.$message.error('打印标签失败: ' + (error.message || '请重试'))
} finally {
this.printCasesLoading = false
}
},
async deleteCaseRecord(){
if(this.selectedCaseRecords.length === 0){
this.$message.warning('请先选择要删除的记录')

Loading…
Cancel
Save