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('请先选择要删除的记录')