|
|
|
@ -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 { |
|
|
|
|
|
|
|
<template> |
|
|
|
<div style="padding: 5px"> |
|
|
|
<el-form size="medium" class="title" :model="seqNo" label-position="top" :inline="true"> |
|
|
|
<el-form size="medium" class="title" :model="seqNo" label-position="top" :inline="true" @submit.native.prevent> |
|
|
|
<el-form-item label="派工单号"> |
|
|
|
<el-input-number size="medium" style="width: 100%;margin-top: -5px;" :controls="false" ref="focusInput" :min="0" |
|
|
|
v-model="searchData.seqNo" @keyup.enter.native="selectBySeqNo"></el-input-number> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label=" "> |
|
|
|
<el-select v-model="searchData.flag" clearable> |
|
|
|
<el-option value="" label="标准袋数"></el-option> |
|
|
|
<el-option value="Y" label="零数袋"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<!-- <el-form-item label=" ">--> |
|
|
|
<!-- <el-select v-model="searchData.flag" clearable>--> |
|
|
|
<!-- <el-option value="" label="标准袋数"></el-option>--> |
|
|
|
<!-- <el-option value="Y" label="零数袋"></el-option>--> |
|
|
|
<!-- </el-select>--> |
|
|
|
<!-- </el-form-item>--> |
|
|
|
<el-form-item label=" "> |
|
|
|
<!-- <el-button type="primary" @click="printLabel">打印标签</el-button>--> |
|
|
|
<el-button type="primary" @click="">重连设备</el-button> |
|
|
|
<el-button type="primary" @click="">取消连接</el-button> |
|
|
|
<el-button type="primary" @click="linkTPC()">重连设备</el-button> |
|
|
|
<el-button type="primary" @click="closeWeighTPC()">取消连接</el-button> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<div class="content"> |
|
|
|
@ -441,25 +485,25 @@ export default { |
|
|
|
</div> |
|
|
|
</el-card> |
|
|
|
</div> |
|
|
|
<el-dialog title="提示" :visible.sync="flag" @open="()=>{ |
|
|
|
this.$nextTick(()=>{ |
|
|
|
this.$refs.dialogInput.focus(); |
|
|
|
}) |
|
|
|
}" @close="()=>{ |
|
|
|
this.number = 1 |
|
|
|
}" width="15vw" top="30vh"> |
|
|
|
<el-form label-position="top" class="title"> |
|
|
|
<el-form-item label="零数量"> |
|
|
|
<el-input-number size="medium" style="width: 100%;text-align: left" :controls="false" ref="dialogInput" |
|
|
|
:min="1" v-model="number" @keyup.enter.native="selectBySeqNo"></el-input-number> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<div style="height: 20px;width: 100%"></div> |
|
|
|
<div style="text-align: center;margin-bottom: 5px"> |
|
|
|
<el-button type="primary" @click="printLabelEntity">确定</el-button> |
|
|
|
</div> |
|
|
|
<div style="height: 5px;width: 100%"></div> |
|
|
|
</el-dialog> |
|
|
|
<!-- <el-dialog title="提示" :visible.sync="flag" @open="()=>{--> |
|
|
|
<!-- this.$nextTick(()=>{--> |
|
|
|
<!-- this.$refs.dialogInput.focus();--> |
|
|
|
<!-- })--> |
|
|
|
<!-- }" @close="()=>{--> |
|
|
|
<!-- this.number = 1--> |
|
|
|
<!-- }" width="15vw" top="30vh">--> |
|
|
|
<!-- <el-form label-position="top" class="title">--> |
|
|
|
<!-- <el-form-item label="零数量">--> |
|
|
|
<!-- <el-input-number size="medium" style="width: 100%;text-align: left" :controls="false" ref="dialogInput"--> |
|
|
|
<!-- :min="1" v-model="number" @keyup.enter.native="selectBySeqNo"></el-input-number>--> |
|
|
|
<!-- </el-form-item>--> |
|
|
|
<!-- </el-form>--> |
|
|
|
<!-- <div style="height: 20px;width: 100%"></div>--> |
|
|
|
<!-- <div style="text-align: center;margin-bottom: 5px">--> |
|
|
|
<!-- <el-button type="primary" @click="printLabelEntity">确定</el-button>--> |
|
|
|
<!-- </div>--> |
|
|
|
<!-- <div style="height: 5px;width: 100%"></div>--> |
|
|
|
<!-- </el-dialog>--> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
|