Browse Source

内部返工返修报工针对返工返修增加一个打印标签功能

master
赵宏斌 5 months ago
parent
commit
9bb79138c7
  1. 109
      src/views/modules/production/reworkRecord.vue

109
src/views/modules/production/reworkRecord.vue

@ -6,10 +6,11 @@ import {
saveRework, saveRework,
getRework, getRework,
removeRework, removeRework,
cancelRework, queryOperator
cancelRework, queryOperator, getPackagePrintDataList, getSOScheduleRoutingDataPrint, checkIsPacking
} from '../../../api/production/generateReport' } from '../../../api/production/generateReport'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import decimal, {Decimal} from 'decimal.js' import decimal, {Decimal} from 'decimal.js'
import {printPackageLabelNoPreview} from "../print/print_package_label-NOOREVIEW";
export default { export default {
components:{ components:{
chooseList, chooseList,
@ -40,6 +41,8 @@ export default {
site:this.$store.state.user.site, site:this.$store.state.user.site,
type:undefined, type:undefined,
}, },
soScheduleRouting: {},
printDataList: [],
reportWorkDialog:false, reportWorkDialog:false,
saveType:undefined, saveType:undefined,
numberOrWeight:undefined,//01 numberOrWeight:undefined,//01
@ -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(){ getRework(){
if (!this.saveRework.seqNo ||this.saveRework.seqNo=='' || this.saveRework.seqNo == null) {
this.$message.warning("派工单号为空")
return
}
let params = { let params = {
seqNo: this.saveRework.seqNo seqNo: this.saveRework.seqNo
} }
let seqNo = this.saveRework.seqNo
getRework(params).then(({data})=>{ getRework(params).then(({data})=>{
if (data && data.code === 0){ if (data && data.code === 0){
this.seqNoReworkRecordDialog = false; 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(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.saveRework.productionTime = new Decimal(this.saveRework.productionTime).toSignificantDigits()
}) })
//
this.getSOScheduleRoutingData(seqNo)
this.reportWorkDialog = true this.reportWorkDialog = true
}else { }else {
this.$alert(data.msg, '错误信息', { this.$alert(data.msg, '错误信息', {
@ -546,6 +652,7 @@ export default {
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="reportWorkDialog = false">取消</el-button> <el-button @click="reportWorkDialog = false">取消</el-button>
<el-button type="primary" @click="saveOrUpdateRework">确定</el-button> <el-button type="primary" @click="saveOrUpdateRework">确定</el-button>
<el-button type="primary" @click="printLabel">打印</el-button>
</span> </span>
</el-dialog> </el-dialog>

Loading…
Cancel
Save