Browse Source

2026-01-07

销售发货装箱-》扫描装盒增加打印功能
master
fengyuan_yang 5 days ago
parent
commit
76316b73d9
  1. 2
      src/api/boxManage/boxManage.js
  2. 113
      src/views/modules/boxManage/saleBoxManage.vue

2
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 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) export const updateOrderStatus = data => createAPI('/boxForNotification/updateOrderStatus','post',data)

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

@ -278,10 +278,18 @@
</el-form> </el-form>
<!-- 中部分扫描列表 --> <!-- 中部分扫描列表 -->
<el-table <el-table
ref="caseRollTable"
:data="caseRollList" :data="caseRollList"
border border
height="300" height="300"
@selection-change="handleCaseRollSelectionChange"
style="width: 100%; margin-top: 10px;"> style="width: 100%; margin-top: 10px;">
<el-table-column
type="selection"
width="55"
header-align="center"
align="center">
</el-table-column>
<el-table-column <el-table-column
type="index" type="index"
label="序号" label="序号"
@ -342,7 +350,7 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-footer style="height:35px;margin-top: 15px;text-align:center"> <el-footer style="height:35px;margin-top: 15px;text-align:center">
<el-button type="primary" @click="">打印</el-button>
<el-button type="primary" :loading="printLoading" @click="printCaseRolls">打印</el-button>
<el-button type="primary" @click="applyCaseScan">应用</el-button> <el-button type="primary" @click="applyCaseScan">应用</el-button>
<el-button type="success" @click="saveCaseScan">保存</el-button> <el-button type="success" @click="saveCaseScan">保存</el-button>
<el-button @click="closeCaseDialog">关闭</el-button> <el-button @click="closeCaseDialog">关闭</el-button>
@ -366,16 +374,23 @@ import {
validateAndScanCaseRoll, validateAndScanCaseRoll,
saveCaseRollList, saveCaseRollList,
searchOutboundNotificationWithDetail, searchOutboundNotificationWithDetail,
searchOutboundNotificationWithDetailByPage,
updateOrderStatus updateOrderStatus
} from '../../../api/boxManage/boxManage' } from '../../../api/boxManage/boxManage'
import { callUspPartLabelTemplate } from '@/api/wms/wms'
import getLodop from '@/utils/LodopFuncs.js'
import labelPrintTemplates from '@/mixins/labelPrintTemplates.js'
export default { export default {
mixins: [labelPrintTemplates],
data() { data() {
return { return {
functionId: this.$route.meta.menuId, functionId: this.$route.meta.menuId,
height: 200, height: 200,
currentRow: {}, currentRow: {},
selectedCaseRolls: [], //
printLoading: false, // loading
searchData:{ searchData:{
orderNo:'', orderNo:'',
customerId:'', customerId:'',
@ -782,24 +797,26 @@ export default {
methods: { methods: {
getMainData(){ getMainData(){
this.dataListLoading = true
this.searchData.limit = this.pageSize this.searchData.limit = this.pageSize
this.searchData.page = this.pageIndex this.searchData.page = this.pageIndex
this.searchData.orderStatus = this.searchData.orderStatusList.join(',') this.searchData.orderStatus = this.searchData.orderStatusList.join(',')
searchOutboundNotificationWithDetail(this.searchData).then(({data}) => {
searchOutboundNotificationWithDetailByPage(this.searchData).then(({data}) => {
if (data.code === 0) { 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.$refs.mainTable.setCurrentRow(this.mainDataList[0])
this.changeData(this.mainDataList[0]) this.changeData(this.mainDataList[0])
} else { } else {
this.changeData(null) this.changeData(null)
} }
} }
this.dataListLoading = false this.dataListLoading = false
}).catch(() => {
this.dataListLoading = false
}) })
}, },
tabClick(tab, event){ tabClick(tab, event){
@ -956,6 +973,7 @@ export default {
partNo: '' partNo: ''
} }
this.caseRollList = [] this.caseRollList = []
this.selectedCaseRolls = []
this.updateCaseStatistics() this.updateCaseStatistics()
}, },
@ -1188,6 +1206,89 @@ export default {
this.selectedCaseRecords = selection 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(){ async deleteCaseRecord(){
if(this.selectedCaseRecords.length === 0){ if(this.selectedCaseRecords.length === 0){
this.$message.warning('请先选择要删除的记录') this.$message.warning('请先选择要删除的记录')

Loading…
Cancel
Save