diff --git a/src/api/production/generateReport.js b/src/api/production/generateReport.js index 171372f..75bc1f3 100644 --- a/src/api/production/generateReport.js +++ b/src/api/production/generateReport.js @@ -77,3 +77,5 @@ export const scanLabel = data=>createAPI('/board/scanLabel','post',data); export const checkIsPacking = data=>createAPI('/board/checkIsPacking','get',data); export const searchOutboundLabelScanList = data=>createAPI('/outbound/label/list','post',data); + +export const getTCPPackagePrintDataList = data =>createAPI('/board/getTCPPackagePrintDataList','post',data) diff --git a/src/views/modules/print/print_package_TCPlabel-NOOREVIEW.js b/src/views/modules/print/print_package_TCPlabel-NOOREVIEW.js index ebce542..596f8df 100644 --- a/src/views/modules/print/print_package_TCPlabel-NOOREVIEW.js +++ b/src/views/modules/print/print_package_TCPlabel-NOOREVIEW.js @@ -30,11 +30,11 @@ export function printTCPPackageLabelNoPreview(printList) { LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); LODOP.SET_PRINT_STYLEA(0,"FontSize",12); LODOP.SET_PRINT_STYLEA(0,"Bold",1); - LODOP.ADD_PRINT_TEXT(115,18,123,25,"FQC:"); + LODOP.ADD_PRINT_TEXT(115,18,58,25,"FQC:"); LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); LODOP.SET_PRINT_STYLEA(0,"FontSize",12); LODOP.SET_PRINT_STYLEA(0,"Bold",1); - LODOP.ADD_PRINT_TEXT(115,141,111,25,printData.inspector); + LODOP.ADD_PRINT_TEXT(115,60,81,25,printData.inspector); LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); LODOP.SET_PRINT_STYLEA(0,"FontSize",12); LODOP.SET_PRINT_STYLEA(0,"Bold",1); @@ -93,10 +93,13 @@ export function printTCPPackageLabelNoPreview(printList) { LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); LODOP.SET_PRINT_STYLEA(0,"FontSize",12); LODOP.SET_PRINT_STYLEA(0,"Bold",1); - LODOP.ADD_PRINT_TEXT(113,229,144,26,"Job No:"+printData.seqNo); + LODOP.ADD_PRINT_TEXT(115,141,146,26,"Job No:"+printData.seqNo); + LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); + LODOP.SET_PRINT_STYLEA(0,"FontSize",12); + LODOP.SET_PRINT_STYLEA(0,"Bold",1); + LODOP.ADD_PRINT_TEXT(115,274,99,25,"MFG:"+printData.tcpValue); LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); LODOP.SET_PRINT_STYLEA(0,"FontSize",12); - LODOP.SET_PRINT_STYLEA(0,"Alignment",3); LODOP.SET_PRINT_STYLEA(0,"Bold",1); if(printData.code=='CODE128') { LODOP.ADD_PRINT_BARCODE(40,143,236,23, "128A",printData.partSpec); diff --git a/src/views/modules/production/bagLabelsTCP.vue b/src/views/modules/production/bagLabelsTCP.vue index 0271606..71026d4 100644 --- a/src/views/modules/production/bagLabelsTCP.vue +++ b/src/views/modules/production/bagLabelsTCP.vue @@ -6,11 +6,13 @@ import { linkWeighTPC, closeWeighTPC, reLinkWeighTPC, + getTCPPackagePrintDataList, } from "../../../api/production/generateReport"; import { getPhotoAddressData } from '@/api/pad.js' import {printTCPPackageLabelNoPreview} from "../print/print_package_TCPlabel-NOOREVIEW"; +import {printPackageLabelNoPreview} from '../print/print_package_label-NOOREVIEW' export default { data() { @@ -37,6 +39,7 @@ export default { photoUrl: '', scanTime:'', scheduleJob:'', + nowTime:'', } }, mounted() { @@ -49,6 +52,7 @@ export default { beforeDestroy(){ this.closeWeighTPC(); window.removeEventListener('beforeunload', this.handleBeforeUnload); + this.stopSchedule(); }, computed: { seqNo: function () { @@ -85,6 +89,8 @@ export default { this.soScheduleRouting = data.rows.find((item) => item.site === this.$store.state.user.site && item.seqNo === this.searchData.seqNo) this.checkIsPacking() } + // console.log(data.rows[0].nowTime) + this.nowTime= data.rows[0].nowTime if (data.row) { this.soScheduleRouting.qtyBag = data.row[0].qtyBag this.soScheduleRouting.bag = data.row[0].bag @@ -102,12 +108,17 @@ export default { } else { this.$message.error(data.msg) - this.cleanAll() + // this.cleanAll() } }).catch((error) => { this.$message.error(error) - this.cleanAll() + // this.cleanAll() }) + this.scheduleJob = setInterval(() => { + + this.printTCPLabel(); + }, 2000); + } else { this.$message.warning(data.msg) this.cleanAll() @@ -117,6 +128,64 @@ export default { this.$message.error(error); }) }, + linkTPC(){ + linkWeighTPC(params).then(({data}) => { + if (data && data.code === 0) { + this.$message.success("称重器连接成功!") + } else { + + this.$message.error(data.msg) + // this.cleanAll() + } + }).catch((error) => { + this.$message.error(error) + // this.cleanAll() + }) + }, + printTCPLabel(){ + console.log(this.soScheduleRouting.site) + if (!this.soScheduleRouting.site) { + return false + } + console.log(this.nowTime) + if (this.nowTime==''||this.nowTime==null) { + return false + } + console.log(this.soScheduleRouting.qtyBag) + if (this.soScheduleRouting.qtyBag === null || this.soScheduleRouting.qtyBag === undefined) { + return false + } + console.log('2') + let params = { + nowTime:this.nowTime, + previousSeqNo: this.soScheduleRouting.previousSeqNo, + site: this.soScheduleRouting.site, + orderNo: this.soScheduleRouting.orderNo, + } + if (!params) { + return + } + console.log('3') + getTCPPackagePrintDataList(params).then(({data}) => { + if (data && data.code === 0) { + if(data.rows.length>0){ + printTCPPackageLabelNoPreview(data.rows); + } + this.searchData.flag = ''; + } else { + this.$message.warning(data.msg) + } + }).catch((error) => { + this.$message.error(error) + }) + + }, + stopSchedule() { + if (this.scheduleJob) { + clearInterval(this.scheduleJob); // 使用 clearInterval 来清除定时任务 + this.scheduleJob = null; // 将 scheduleJob 置为 null,表示没有活动的定时任务 + } + }, cleanAll() { Object.keys(this.soScheduleRouting).forEach(key => { this.soScheduleRouting[key] = ''; @@ -129,6 +198,8 @@ export default { this.photoUrl = null; // this.scanTime= ''; this.closeWeighTPC(); + this.nowTime=''; + this.stopSchedule() }, closeWeighTPC(){ this.scanTime= ''; @@ -165,26 +236,7 @@ export default { this.soScheduleRouting = {}; }) }, - printLabel() { - if (!this.soScheduleRouting.site) { - this.$message.warning("请先扫描派工单号") - return - } - if (this.soScheduleRouting.qtyBag === null || this.soScheduleRouting.qtyBag === undefined) { - this.$message.warning("未维护每袋数量") - return; - } - let params = { - previousSeqNo: this.soScheduleRouting.previousSeqNo, - site: this.soScheduleRouting.site, - orderNo: this.soScheduleRouting.orderNo - } - if (this.searchData.flag === 'Y') { - this.flag = true; - return; - } - this.printPackageLabelNoPreview(params) - }, + printPackageLabelNoPreview(params) { if (!params) { this.$message.warning("参数为空") @@ -202,15 +254,7 @@ export default { this.$message.error(error) }) }, - printLabelEntity() { - let params = { - previousSeqNo: this.soScheduleRouting.previousSeqNo, - site: this.soScheduleRouting.site, - orderNo: this.soScheduleRouting.orderNo - } - params.number = this.number; - this.printPackageLabelNoPreview(params) - }, + getData(site, partNo) { this.picData.partNo = partNo; this.picData.site = site; @@ -273,21 +317,21 @@ export default {