From 76316b73d94a202da32d7cc8305e25bd8b73fa31 Mon Sep 17 00:00:00 2001 From: fengyuan_yang <1976974459@qq.com> Date: Wed, 7 Jan 2026 11:51:39 +0800 Subject: [PATCH] =?UTF-8?q?2026-01-07=20=E9=94=80=E5=94=AE=E5=8F=91?= =?UTF-8?q?=E8=B4=A7=E8=A3=85=E7=AE=B1-=E3=80=8B=E6=89=AB=E6=8F=8F?= =?UTF-8?q?=E8=A3=85=E7=9B=92=E5=A2=9E=E5=8A=A0=E6=89=93=E5=8D=B0=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/boxManage/boxManage.js | 2 + src/views/modules/boxManage/saleBoxManage.vue | 115 ++++++++++++++++-- 2 files changed, 110 insertions(+), 7 deletions(-) diff --git a/src/api/boxManage/boxManage.js b/src/api/boxManage/boxManage.js index a3e3210..67e0f63 100644 --- a/src/api/boxManage/boxManage.js +++ b/src/api/boxManage/boxManage.js @@ -19,6 +19,8 @@ export const saveCaseRollList = data => createAPI('/boxForNotification/saveCaseR // 查询出库通知单主记录(关联明细) export const searchOutboundNotificationWithDetail = data => createAPI('/boxForNotification/searchOutboundNotificationWithDetail','post',data) +// 分页查询出库通知单主记录(关联明细) +export const searchOutboundNotificationWithDetailByPage = data => createAPI('/boxForNotification/searchOutboundNotificationWithDetailByPage','post',data) // 更新出库通知单状态 export const updateOrderStatus = data => createAPI('/boxForNotification/updateOrderStatus','post',data) diff --git a/src/views/modules/boxManage/saleBoxManage.vue b/src/views/modules/boxManage/saleBoxManage.vue index 600a4d2..6e7d11d 100644 --- a/src/views/modules/boxManage/saleBoxManage.vue +++ b/src/views/modules/boxManage/saleBoxManage.vue @@ -278,10 +278,18 @@ + + - 打印 + 打印 应用 保存 关闭 @@ -366,16 +374,23 @@ import { validateAndScanCaseRoll, saveCaseRollList, searchOutboundNotificationWithDetail, + searchOutboundNotificationWithDetailByPage, updateOrderStatus } from '../../../api/boxManage/boxManage' +import { callUspPartLabelTemplate } from '@/api/wms/wms' +import getLodop from '@/utils/LodopFuncs.js' +import labelPrintTemplates from '@/mixins/labelPrintTemplates.js' export default { + mixins: [labelPrintTemplates], data() { return { functionId: this.$route.meta.menuId, height: 200, currentRow: {}, + selectedCaseRolls: [], // 装盒对话框中选中的卷标签 + printLoading: false, // 打印loading searchData:{ orderNo:'', customerId:'', @@ -782,24 +797,26 @@ export default { methods: { getMainData(){ + this.dataListLoading = true this.searchData.limit = this.pageSize this.searchData.page = this.pageIndex this.searchData.orderStatus = this.searchData.orderStatusList.join(',') - searchOutboundNotificationWithDetail(this.searchData).then(({data}) => { + searchOutboundNotificationWithDetailByPage(this.searchData).then(({data}) => { if (data.code === 0) { - this.mainDataList = data.rows - this.totalPage = this.mainDataList.length + this.mainDataList = data.page.list + this.totalPage = data.page.totalCount //判断是否全部存在数据 - if (this.totalPage > 0) { + if (this.mainDataList && this.mainDataList.length > 0) { //设置选中行 this.$refs.mainTable.setCurrentRow(this.mainDataList[0]) this.changeData(this.mainDataList[0]) - - }else { + } else { this.changeData(null) } } this.dataListLoading = false + }).catch(() => { + this.dataListLoading = false }) }, tabClick(tab, event){ @@ -956,6 +973,7 @@ export default { partNo: '' } this.caseRollList = [] + this.selectedCaseRolls = [] this.updateCaseStatistics() }, @@ -1188,6 +1206,89 @@ export default { this.selectedCaseRecords = selection }, + // 装盒对话框中卷标签选择变化 + handleCaseRollSelectionChange(selection){ + this.selectedCaseRolls = selection + }, + + // 打印选中的卷标签 + async printCaseRolls(){ + if(this.selectedCaseRolls.length === 0){ + this.$message.warning('请先选择要打印的卷标签') + return + } + + this.printLoading = true + try { + // 1. 获取 LODOP 打印控件 + const LODOP = getLodop() + if (!LODOP) { + this.$message.error('无法连接到打印控件,请确保已安装并启动 CLodop!') + this.printLoading = false + return + } + + // 2. 获取默认打印机 + const printerCount = LODOP.GET_PRINTER_COUNT() + if (printerCount <= 0) { + this.$message.error('未检测到打印机,请确保已安装并连接打印机!') + this.printLoading = false + return + } + + // 3. 循环调用存储过程获取打印参数并打印 + for (const rollItem of this.selectedCaseRolls) { + 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: rollItem.partNo, + labelNo: '', + rollNo: rollItem.rollNo + } + + const {data: printData} = await callUspPartLabelTemplate(params) + if (printData && printData.code === 0 && printData.row) { + const labelData = printData.row + + // 初始化打印任务 + LODOP.PRINT_INIT('卷标签打印_' + rollItem.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(`标签已发送打印, 卷号: ${rollItem.rollNo}`) + } else { + console.warn(`获取卷号 ${rollItem.rollNo} 的打印参数失败`) + } + } + + this.$message.success('打印任务已发送!') + } catch (error) { + console.error('打印标签失败:', error) + this.$message.error('打印标签失败: ' + (error.message || '请重试')) + } finally { + this.printLoading = false + } + }, + async deleteCaseRecord(){ if(this.selectedCaseRecords.length === 0){ this.$message.warning('请先选择要删除的记录')