Browse Source

打印

hella_online_20240829
zhang_li 2 months ago
parent
commit
d696ee447b
  1. 15
      src/common/utils/storage.js
  2. 41
      src/mycomponents/print/print.vue
  3. 105
      src/pages/package/job/overPackageJobDetail.vue
  4. 86
      src/pages/package/record/overPackageRecord.vue

15
src/common/utils/storage.js

@ -10,7 +10,22 @@ const setStorage = (key,value)=>{
// 清除全部本地存储
const clearStorage = ()=>{
const overPackageRecordPointParams = ''
if( uni.getStorageSync('overPackageRecordPointParams')){
overPackageRecordPointParams = uni.getStorageSync('overPackageRecordPointParams')
}
const overPackageJobDetailPointParams = ''
if( uni.getStorageSync('overPackageJobDetailPointParams')){
overPackageJobDetailPointParams = uni.getStorageSync('overPackageJobDetailPointParams')
}
uni.clearStorageSync();
if(overPackageRecordPointParams){
uni.setStorageSync('overPackageRecordPointParams',overPackageRecordPointParams)
}
if(overPackageJobDetailPointParams){
uni.setStorageSync('overPackageJobDetailPointParams',overPackageJobDetailPointParams)
}
}
// 清除指定key本地存储

41
src/mycomponents/print/print.vue

@ -86,10 +86,10 @@
},
methods: {
setDefaultData(printDeafult,templateDeafult){
this.templateName =printDeafult.name
this.printCode =printDeafult.code
this.templateName =templateDeafult.name
this.templateCode =templateDeafult.code
this.printName =printDeafult?.label || '请选择打印机'
this.printCode =printDeafult?.value || ''
this.templateName =templateDeafult?.label || '请选择打印模板'
this.templateCode =templateDeafult?.value || ''
},
showErrorMessage(message, type) {
@ -97,39 +97,44 @@
this.$refs.comMessage.showErrorMessage(message, res => {})
})
},
showSelectPrint(){
this.showPrintSelect =true
async showSelectPrint(){
uni.showLoading({
title:"加载中",
mask:true
})
getPrintList().then(res=>{
this.printList =[]
await getPrintList().then(res=>{
this.printList =res.data
uni.hideLoading()
}).catch(error=>{
})
this.showPrintSelect =true
},
confirmSelectPrint(){
this.printCode =""
this.$emit("printCode",this.printCode)
confirmSelectPrint(e){
console.log(e)
this.printCode =e[0].value
this.printName =e[0].label
this.$emit("printCode",e[0])
},
showSelectTemplate(){
this.showTemplateSelect =true
async showSelectTemplate(){
uni.showLoading({
title:"加载中",
mask:true
})
getPrintTemplateList().then(res=>{
this.templateList =[]
await getPrintTemplateList().then(res=>{
this.templateList =res.data
uni.hideLoading()
}).catch(error=>{
})
this.showTemplateSelect =true
},
confirmSelectTemplate(){
this.templateCode =""
this.$emit("templateCode",this.templateCode)
confirmSelectTemplate(e){
this.templateCode =e[0].value
this.templateName =e[0].label
this.$emit("templateCode",e[0])
}
}
}

105
src/pages/package/job/overPackageJobDetail.vue

@ -1,5 +1,8 @@
<template>
<view class="page-wraper">
<div style="background: white;">
<print ref="printService" @printCode="printCode" @templateCode="templateCode"></print>
</div>
<view class="page-header">
<view class="header_job_top">
<job-top :dataContent="jobContent"></job-top>
@ -96,6 +99,7 @@
import comScanPackagePack from '@/pages/package/coms/comScanPackagePack.vue'
import jobTop from '@/mycomponents/job/jobTop.vue'
import workStation from '@/mycomponents/workStation/workStation.vue'
import print from '@/mycomponents/print/print.vue'
export default {
name: 'issueDetail',
@ -106,6 +110,7 @@
comScanPackagePack,
jobTop,
workStation,
print
},
data() {
return {
@ -115,7 +120,10 @@
detailSource: [], //
detailOptions: [],
scanOptions: [],
jobStatus: ""
jobStatus: "",
printDeafult: {}, //
templateDeafult: {} //
};
},
@ -138,6 +146,7 @@
this.getDetail();
}
}
},
onNavigationBarButtonTap(e) {
@ -213,7 +222,18 @@
that.jobStatus = res.data.status
that.subList = res.data.subList;
that.detailSource = getDataSource(that.detailSource, that.subList)
this.$nextTick(() => {
if (uni.getStorageSync('overPackageJobDetailPointParams')) {
const overPackageJobDetailPointParams = uni.getStorageSync(
'overPackageJobDetailPointParams')
this.jobContent.printerUuid = overPackageJobDetailPointParams
.printDeafult.value;
this.jobContent.modelCode = overPackageJobDetailPointParams
.templateDeafult.value;
this.$refs.printService.setDefaultData(overPackageJobDetailPointParams
.printDeafult, overPackageJobDetailPointParams.templateDeafult)
}
})
setTimeout(r => {
that.resizeCollapse();
}, 100)
@ -327,34 +347,55 @@
mask: true
});
var params = this.setParams()
console.log("提交参数", JSON.stringify(params));
console.log(params);
overPageSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
let list = [];
res.data.forEach(item => {
list.push({
itemCode: item.itemCode, //
itemName: item.itemName, //
packName: item.packName, //
packageCode: item.number, //
batch: item.batch, //
parentNumber: item.parentNumber, //
itemType: item.itemType, //
asnNumber: item.asnNumber, //ASN
supplierCode: item.supplierCode, //
qty: item.qty, //
printTimes: getCurrDateTime(), //
productionLineCode: item.productionLineCode, //线
barcodeString: item.barcodeString, //
barcodeBase64: '',
})
})
this.showCommitSuccessMessage("提交成功<br>生成翻包记录<br>", list)
if (res.data == '打印任务已发送,等待打印机处理!') {
this.showCommitSuccessMessage(res.data)
const overPackageJobDetailPointParams = {
printDeafult: this.printDeafult,
templateDeafult: this.templateDeafult,
}
uni.setStorageSync('overPackageJobDetailPointParams', overPackageJobDetailPointParams)
} else {
this.showErrorMessage("提交失败[" + res.msg + "]")
this.showErrorMessage(res.data)
}
// if(res.data){
// this.showCommitSuccessMessage(res.data)
// const overPackageJobDetailPointParams = {
// printDeafult:this.printDeafult,
// templateDeafult:this.templateDeafult,
// }
// uni.setStorageSync('overPackageJobDetailPointParams',overPackageJobDetailPointParams)
// }else{
// this.showErrorMessage("[" + res.msg + "]")
// }
// if (res.data) {
// let list = [];
// res.data.forEach(item => {
// list.push({
// itemCode: item.itemCode, //
// itemName: item.itemName, //
// packName: item.packName, //
// packageCode: item.number, //
// batch: item.batch, //
// parentNumber: item.parentNumber, //
// itemType: item.itemType, //
// asnNumber: item.asnNumber, //ASN
// supplierCode: item.supplierCode, //
// qty: item.qty, //
// printTimes: getCurrDateTime(), //
// productionLineCode: item.productionLineCode, //线
// barcodeString: item.barcodeString, //
// barcodeBase64: '',
// })
// })
// this.showCommitSuccessMessage("<br><br>", list)
// } else {
// this.showErrorMessage("[" + res.msg + "]")
// }
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
@ -379,7 +420,8 @@
record.fromPackingNumber = r
.packingNumber;
record.fromParentPackingNumber =r.parentPackingNumber;
record.fromParentPackingNumber = r
.parentPackingNumber;
record.fromBatch = r.batch;
record.fromContainerNumber = r
.ContainerNumber;
@ -442,7 +484,14 @@
this.jobContent.creator = creator;
return this.jobContent;
},
printCode(e) {
this.jobContent.printerUuid = e.value;
this.printDeafult = e
},
templateCode(e) {
this.jobContent.modelCode = e.value;
this.templateDeafult = e
},
cancel() {
let that = this;
this.$refs.comMessage.showQuestionMessage('是否要清空已扫描的物料和目标库位信息?', res => {

86
src/pages/package/record/overPackageRecord.vue

@ -158,11 +158,20 @@
toPackUnitShow: "请选择",
toPackQty: "",
itemCode: "",
resultData: {}
resultData: {},
printDeafult:{},//
templateDeafult:{}//
};
},
onLoad() {
this.getBusinessType();
this.$nextTick(()=>{
const overPackageRecordPointParams = uni.getStorageSync('overPackageRecordPointParams')
console.log(233,uni.getStorageSync('overPackageRecordPointParams'))
this.$refs.printService.setDefaultData(overPackageRecordPointParams.printDeafult,overPackageRecordPointParams.templateDeafult)
})
},
//
onNavigationBarButtonTap(e) {
@ -238,12 +247,6 @@
},
getScanResult(result) {
this.setData(result);
setTimeout(res=>{
this.$res.printService.setDefaultData()
})
},
setData(result) {
@ -393,33 +396,45 @@
});
var params = this.setParams();
console.log("提交" + JSON.stringify(params))
console.log(params)
overPackageRecordSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
let list = []
res.data.forEach(item => {
list.push({
itemCode: item.itemCode, //
itemName: item.itemName, //
packName: item.packName, //
packageCode: item.toPackingNumber, //
batch: item.toBatch, //
parentNumber: item.parentNumber, //
itemType: item.itemType, //
asnNumber: item.asnNumber, //ASN
supplierCode: item.supplierCode, //
qty: item.qty, //
printTimes: getCurrDateTime(), //
productionLineCode: item.productionLineCode, //线
barcodeString: item.barcodeString, //
barcodeBase64: '',
})
})
this.showCommitSuccessMessage("提交成功<br>生成翻包记录<br>", list)
} else {
this.showErrorMessage("提交失败[" + res.msg + "]")
if (res.data == '打印任务已发送,等待打印机处理!') {
this.showCommitSuccessMessage(res.data)
const overPackageRecordPointParams = {
printDeafult:this.printDeafult,
templateDeafult:this.templateDeafult,
}
uni.setStorageSync('overPackageRecordPointParams',overPackageRecordPointParams)
this.detailSource = []
else {
this.showErrorMessage(res.data)
}
// if (res.data) {
// // let list = []
// // res.data.forEach(item => {
// // list.push({
// // itemCode: item.itemCode, //
// // itemName: item.itemName, //
// // packName: item.packName, //
// // packageCode: item.toPackingNumber, //
// // batch: item.toBatch, //
// // parentNumber: item.parentNumber, //
// // itemType: item.itemType, //
// // asnNumber: item.asnNumber, //ASN
// // supplierCode: item.supplierCode, //
// // qty: item.qty, //
// // printTimes: getCurrDateTime(), //
// // productionLineCode: item.productionLineCode, //线
// // barcodeString: item.barcodeString, //
// // barcodeBase64: '',
// // })
// // })
// this.showCommitSuccessMessage(res.msg)
// } else {
// this.showErrorMessage("[" + res.msg + "]")
// }
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
@ -460,7 +475,14 @@
this.dataContent.creator = creator;
return this.dataContent;
},
printCode(e){
this.dataContent.printerUuid = e.value;
this.printDeafult = e
},
templateCode(e){
this.dataContent.modelCode = e.value;
this.templateDeafult = e
},
showMessage(message) {
this.$refs.comMessage.showMessage(message, res => {
if (res) {}

Loading…
Cancel
Save