diff --git a/src/views/modules/production/reworkRecord.vue b/src/views/modules/production/reworkRecord.vue index 0a257f4..673140c 100644 --- a/src/views/modules/production/reworkRecord.vue +++ b/src/views/modules/production/reworkRecord.vue @@ -6,10 +6,11 @@ import { saveRework, getRework, removeRework, - cancelRework, queryOperator + cancelRework, queryOperator, getPackagePrintDataList, getSOScheduleRoutingDataPrint, checkIsPacking } from '../../../api/production/generateReport' import dayjs from 'dayjs' import decimal, {Decimal} from 'decimal.js' +import {printPackageLabelNoPreview} from "../print/print_package_label-NOOREVIEW"; export default { components:{ chooseList, @@ -40,6 +41,8 @@ export default { site:this.$store.state.user.site, type:undefined, }, + soScheduleRouting: {}, + printDataList: [], reportWorkDialog:false, saveType:undefined, numberOrWeight:undefined,//0数量,1重量 @@ -221,10 +224,111 @@ export default { }) }) }, + getSOScheduleRoutingData(seqNo) { + let params = { + seqNo: seqNo, + userId: this.$store.state.user.name + } + getSOScheduleRoutingDataPrint(params).then(({data}) => { + if (data && data.code === 0) { + if (data.total === 0) { + this.$message.warning("派工单不存在") + return + } else if (data.total === 1) { + this.soScheduleRouting = data.rows[0]; + this.checkIsPacking() + } else { + this.soScheduleRouting = data.rows.find((item) => item.site === this.$store.state.user.site && item.seqNo === this.searchData.seqNo) + this.checkIsPacking() + } + if (data.row) { + this.soScheduleRouting.qtyBag = data.row[0].qtyBag + this.soScheduleRouting.bag = data.row[0].bag + this.soScheduleRouting.qty = data.row[0].qty + this.soScheduleRouting.carton = data.row[0].carton + } + if (data.data) { + this.soScheduleRouting.sScheduledDate2 = data.data.sScheduledDate; + this.soScheduleRouting.operatorName2 = data.data.operatorName; + this.soScheduleRouting.approveQty2 = data.data.qtyApprove; + } + this.printLabel() + } else { + this.$message.warning(data.msg) + } + }).catch((error) => { + this.$message.error(error); + }) + }, + async checkIsPacking() { + let params = { + site: this.soScheduleRouting.site, + workCenterNo: this.soScheduleRouting.sWorkCenterNo, + } + await checkIsPacking(params).then(({data}) => { + if (!data || data.code != 0) { + this.soScheduleRouting = {} + this.$message.warning(data.msg) + } + }).catch((error) => { + this.$message.error(error) + this.soScheduleRouting = {} + }) + }, + printLabel() { + if (!this.saveRework.seqNo ||this.saveRework.seqNo=='' || this.saveRework.seqNo == null){ + this.$message.warning("请输入描派工单号"); + return; + } + 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, + seqNo: this.saveRework.seqNo + } + this.printPackageLabelNoPreview(params) + }, + printPackageLabelNoPreview(params) { + if (!params) { + this.$message.warning("参数为空") + return + } + // 发起请求 + getPackagePrintDataList(params).then(({data}) => { + + this.printDataList = data.rows + this.printDataList.forEach(item => { + item.receiveDate = this.saveRework.reworkEndDate + item.inspector = this.saveRework.operatorId + item.unitQty = this.saveRework.qtyApprove + }) + this.$message.success(this.printDataList) + if (data && data.code === 0) { + printPackageLabelNoPreview(this.printDataList); + } else { + this.$message.warning(data.msg) + } + }).catch((error) => { + this.$message.error(error) + }) + }, getRework(){ + if (!this.saveRework.seqNo ||this.saveRework.seqNo=='' || this.saveRework.seqNo == null) { + this.$message.warning("派工单号为空") + return + } let params = { seqNo: this.saveRework.seqNo } + let seqNo = this.saveRework.seqNo getRework(params).then(({data})=>{ if (data && data.code === 0){ this.seqNoReworkRecordDialog = false; @@ -235,6 +339,8 @@ export default { this.saveRework.productionTime = new Decimal(dayjs(new Date()).diff(this.saveRework.createTime,'hour',true)).toFixed(2, Decimal.ROUND_HALF_UP) this.saveRework.productionTime = new Decimal(this.saveRework.productionTime).toSignificantDigits() }) + //打印功能 + this.getSOScheduleRoutingData(seqNo) this.reportWorkDialog = true }else { this.$alert(data.msg, '错误信息', { @@ -546,6 +652,7 @@ export default { 取消 确定 + 打印