|
|
|
@ -5,7 +5,10 @@ import {getExternalPartPictureList} from '../../../api/part/externalPartPicture' |
|
|
|
import ExternalPart from '../part/external.vue' |
|
|
|
import CustomerInfo from '../customer/info.vue' |
|
|
|
import {getExternalPartManufacturerList} from '../../../api/part/externalPartManufacturer' |
|
|
|
import {selectLabelFormatUserDefaultListByUserId} from '../../../api/label/labelFormatUserDefault' |
|
|
|
import { |
|
|
|
getLabelFormatUserDefaultList, |
|
|
|
selectLabelFormatUserDefaultListByUserId |
|
|
|
} from '../../../api/label/labelFormatUserDefault' |
|
|
|
import LinkedFormat from './format/linkedFormat.vue' |
|
|
|
import {Decimal} from 'decimal.js' |
|
|
|
import {savePrintLabelRecord} from '../../../api/label/printLabelRecord' |
|
|
|
@ -554,6 +557,8 @@ export default { |
|
|
|
}, |
|
|
|
logisticVisible:false, |
|
|
|
templateList:[], |
|
|
|
|
|
|
|
printTest:false, |
|
|
|
} |
|
|
|
}, |
|
|
|
watch:{ |
|
|
|
@ -582,6 +587,16 @@ export default { |
|
|
|
"printCurrentPart.qtyPerCarton"(newVal,oldVal){ |
|
|
|
this.printCurrentPart.totalShipQty = this.totalShipQty(); |
|
|
|
}, |
|
|
|
printVisible(newVal,oldVal){ |
|
|
|
if (newVal === false){ |
|
|
|
this.printTest = false; |
|
|
|
} |
|
|
|
}, |
|
|
|
logisticVisible(newVal,oldVal){ |
|
|
|
if (newVal === false){ |
|
|
|
this.printTest = false; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
methods:{ |
|
|
|
rowStyle({row}){ |
|
|
|
@ -798,73 +813,121 @@ export default { |
|
|
|
savePrintLabelRecord(){ |
|
|
|
let params = { |
|
|
|
...this.printCurrentPart, |
|
|
|
createBy: this.$store.state.user.name, |
|
|
|
createTime: dayjs().format('YYYY-MM-DD HH:mm:ss'), |
|
|
|
createBy: this.$store.state.user.name |
|
|
|
} |
|
|
|
this.printLoading = true; |
|
|
|
savePrintLabelRecord(params).then(({data})=>{ |
|
|
|
if (data && data.code === 0) { |
|
|
|
let notFound = []; |
|
|
|
// 打印机集合 |
|
|
|
let labelList = this.labelFormatList.filter((item)=> item.labelType === 'Shipment Carton') |
|
|
|
for (let label of labelList) { |
|
|
|
let prints = data.rows.map((item) => { |
|
|
|
let params = { |
|
|
|
qrCode: `(00)${item.partNo}(01)${item.qtyPerCarton}(02)${item.umName}(03)${item.manufacturerDate}(04)${item.serialNumber? item.serialNumber : ''}(05)${item.manufacturerNo? item.manufacturerNo : ''}(06)${item.moldCode? item.moldCode : ''}(07)${item.boxNo? item.boxNo : ''}(08)(09)(10)`, |
|
|
|
ref: item.partNo, |
|
|
|
productRev: item.rev, |
|
|
|
qty: item.qtyPerCarton, |
|
|
|
uom: item.umName, |
|
|
|
desc: item.partDesc, |
|
|
|
rollCount: item.qtyPerRoll, |
|
|
|
date: item.manufacturerDate, |
|
|
|
manufacturer: item.manufacturerNo, |
|
|
|
moldCode: item.moldCode, |
|
|
|
sn: item.serialNumber, |
|
|
|
freeInfo2: item.freeInfo2, |
|
|
|
tradingMark: item.tradingMark, |
|
|
|
weightUmName: item.weightUmName, |
|
|
|
pictureMap:item.pictureMap, |
|
|
|
printLabelType:item.printLabelType, |
|
|
|
templateNo:item.templateNo, |
|
|
|
dateStr:item.dateStr, |
|
|
|
printStr1:item.printStr1, |
|
|
|
printStr2:item.printStr2, |
|
|
|
printStr3:item.printStr3, |
|
|
|
} |
|
|
|
if (item.packingWeight){ |
|
|
|
params.weight = new Decimal(item.packingWeight).mul(item.qtyPerCarton).toNumber(); |
|
|
|
} |
|
|
|
return params |
|
|
|
}); |
|
|
|
let qrCodeList = this.$refs.qrCode.init(prints.map((item)=>{ |
|
|
|
return item.qrCode |
|
|
|
})) |
|
|
|
for (let i = 0; i < qrCodeList.length; i++) { |
|
|
|
prints[i].qrCode = qrCodeList[i] |
|
|
|
let labelList = data.rows |
|
|
|
let icons = this.base64List.map((item)=>{return{icon: item,}}) |
|
|
|
for (let i = 0; i < labelList.length; i++) { |
|
|
|
let item = labelList[i]; |
|
|
|
let params = { |
|
|
|
qrCode: `(00)${item.partNo}(01)${item.qtyPerCarton}(02)${item.umName}(03)${item.manufacturerDate}(04)${item.serialNumber? item.serialNumber : ''}(05)${item.manufacturerNo? item.manufacturerNo : ''}(06)${item.moldCode? item.moldCode : ''}(07)${item.boxNo? item.boxNo : ''}(08)(09)(10)`, |
|
|
|
ref: item.partNo, |
|
|
|
productRev: item.rev, |
|
|
|
qty: item.qtyPerCarton, |
|
|
|
uom: item.umName, |
|
|
|
desc: item.partDesc, |
|
|
|
rollCount: item.qtyPerRoll, |
|
|
|
date: item.manufacturerDate, |
|
|
|
manufacturer: item.manufacturerNo, |
|
|
|
moldCode: item.moldCode, |
|
|
|
sn: item.serialNumber, |
|
|
|
freeInfo2: item.freeInfo2, |
|
|
|
tradingMark: item.tradingMark, |
|
|
|
weightUmName: item.weightUmName, |
|
|
|
pictureMap:item.pictureMap, |
|
|
|
printLabelType:item.printLabelType, |
|
|
|
templateNo:item.templateNo, |
|
|
|
dateStr:item.dateStr, |
|
|
|
printStr1:item.printStr1, |
|
|
|
printStr2:item.printStr2, |
|
|
|
printStr3:item.printStr3, |
|
|
|
offsetX:item.offsetX, |
|
|
|
offsetY:item.offsetY, |
|
|
|
direction:item.direction, |
|
|
|
} |
|
|
|
let icons = this.base64List.map((item)=>{return{icon: item,}}) |
|
|
|
if (!this.printerSetupList.includes(label.defaultPrinterName)) { |
|
|
|
notFound.push(label.defaultPrinterName) |
|
|
|
continue |
|
|
|
if (item.packingWeight){ |
|
|
|
params.weight = new Decimal(item.packingWeight).mul(item.qtyPerCarton).toNumber(); |
|
|
|
} |
|
|
|
if (label.printType === 'Alpha/Hard Tag'){ |
|
|
|
printAlphaHardTagLabel(prints,icons,label.defaultPrinterName) |
|
|
|
}else if (label.printType === 'Hardware(Antenna)'){ |
|
|
|
let qrCodeList = this.$refs.qrCode.init([params.qrCode]) |
|
|
|
params.qrCode = qrCodeList[0] |
|
|
|
|
|
|
|
if (item.printType === 'Alpha/Hard Tag'){ |
|
|
|
printAlphaHardTagLabel([params],icons,item.printerName,this.printTest) |
|
|
|
}else if (item.printType === 'Hardware(Antenna)'){ |
|
|
|
if (this.printCurrentPart.category === 'Hardware(Antenna)-Serials'){ |
|
|
|
printAntennaLabel(prints,icons,label.defaultPrinterName,this.$store.state.user.autoSerialNumber) |
|
|
|
printAntennaLabel([params],icons,item.printerName,this.$store.state.user.autoSerialNumber,this.printTest) |
|
|
|
}else { |
|
|
|
printAntennaLabel(prints,icons,label.defaultPrinterName) |
|
|
|
printAntennaLabel([params],icons,item.printerName,'N',this.printTest) |
|
|
|
} |
|
|
|
}else if (label.printType === 'RF' || this.currentPart.category === 'RFID'){ |
|
|
|
printRF_RFIDLabel(prints,icons,label.defaultPrinterName) |
|
|
|
}else if (item.printType === 'RF' || this.currentPart.category === 'RFID'){ |
|
|
|
printRF_RFIDLabel([params],icons,item.printerName,this.printTest) |
|
|
|
} |
|
|
|
this.printTest = false |
|
|
|
} |
|
|
|
if (notFound.length > 0){ |
|
|
|
this.$message.warning(`The printer ${notFound.join(',')} is not found`) |
|
|
|
}else { |
|
|
|
this.$message.success("Print label success") |
|
|
|
} |
|
|
|
// let notFound = []; |
|
|
|
// // 打印机集合 |
|
|
|
// let labelList = this.labelFormatList.filter((item)=> item.labelType === 'Shipment Carton') |
|
|
|
// for (let label of labelList) { |
|
|
|
// let prints = data.rows.map((item) => { |
|
|
|
// let params = { |
|
|
|
// qrCode: `(00)${item.partNo}(01)${item.qtyPerCarton}(02)${item.umName}(03)${item.manufacturerDate}(04)${item.serialNumber? item.serialNumber : ''}(05)${item.manufacturerNo? item.manufacturerNo : ''}(06)${item.moldCode? item.moldCode : ''}(07)${item.boxNo? item.boxNo : ''}(08)(09)(10)`, |
|
|
|
// ref: item.partNo, |
|
|
|
// productRev: item.rev, |
|
|
|
// qty: item.qtyPerCarton, |
|
|
|
// uom: item.umName, |
|
|
|
// desc: item.partDesc, |
|
|
|
// rollCount: item.qtyPerRoll, |
|
|
|
// date: item.manufacturerDate, |
|
|
|
// manufacturer: item.manufacturerNo, |
|
|
|
// moldCode: item.moldCode, |
|
|
|
// sn: item.serialNumber, |
|
|
|
// freeInfo2: item.freeInfo2, |
|
|
|
// tradingMark: item.tradingMark, |
|
|
|
// weightUmName: item.weightUmName, |
|
|
|
// pictureMap:item.pictureMap, |
|
|
|
// printLabelType:item.printLabelType, |
|
|
|
// templateNo:item.templateNo, |
|
|
|
// dateStr:item.dateStr, |
|
|
|
// printStr1:item.printStr1, |
|
|
|
// printStr2:item.printStr2, |
|
|
|
// printStr3:item.printStr3, |
|
|
|
// } |
|
|
|
// if (item.packingWeight){ |
|
|
|
// params.weight = new Decimal(item.packingWeight).mul(item.qtyPerCarton).toNumber(); |
|
|
|
// } |
|
|
|
// return params |
|
|
|
// }); |
|
|
|
// let qrCodeList = this.$refs.qrCode.init(prints.map((item)=>{ |
|
|
|
// return item.qrCode |
|
|
|
// })) |
|
|
|
// for (let i = 0; i < qrCodeList.length; i++) { |
|
|
|
// prints[i].qrCode = qrCodeList[i] |
|
|
|
// } |
|
|
|
// let icons = this.base64List.map((item)=>{return{icon: item,}}) |
|
|
|
// if (!this.printerSetupList.includes(label.defaultPrinterName)) { |
|
|
|
// notFound.push(label.defaultPrinterName) |
|
|
|
// continue |
|
|
|
// } |
|
|
|
// if (label.printType === 'Alpha/Hard Tag'){ |
|
|
|
// printAlphaHardTagLabel(prints,icons,label.defaultPrinterName) |
|
|
|
// }else if (label.printType === 'Hardware(Antenna)'){ |
|
|
|
// if (this.printCurrentPart.category === 'Hardware(Antenna)-Serials'){ |
|
|
|
// printAntennaLabel(prints,icons,label.defaultPrinterName,this.$store.state.user.autoSerialNumber) |
|
|
|
// }else { |
|
|
|
// printAntennaLabel(prints,icons,label.defaultPrinterName) |
|
|
|
// } |
|
|
|
// }else if (label.printType === 'RF' || this.currentPart.category === 'RFID'){ |
|
|
|
// printRF_RFIDLabel(prints,icons,label.defaultPrinterName) |
|
|
|
// } |
|
|
|
// } |
|
|
|
// if (notFound.length > 0){ |
|
|
|
// this.$message.warning(`The printer ${notFound.join(',')} is not found`) |
|
|
|
// }else { |
|
|
|
// this.$message.success("Print label success") |
|
|
|
// } |
|
|
|
}else { |
|
|
|
this.$message.warning(data.msg) |
|
|
|
} |
|
|
|
@ -894,11 +957,10 @@ export default { |
|
|
|
let params = { |
|
|
|
site:this.currentPart.site, |
|
|
|
partNo:this.currentPart.partNo, |
|
|
|
customerNo:this.currentPart.customerNo, |
|
|
|
username:this.$store.state.user.name, |
|
|
|
category:this.currentPart.category, |
|
|
|
} |
|
|
|
selectLabelFormatUserDefaultListByUserId(params).then(({data})=>{ |
|
|
|
getLabelFormatUserDefaultList(params).then(({data})=>{ |
|
|
|
if (data && data.code === 0){ |
|
|
|
this.labelFormatList = data.rows; |
|
|
|
}else { |
|
|
|
@ -1032,6 +1094,9 @@ export default { |
|
|
|
serialNumberRequired: item.serialNumberRequired, |
|
|
|
serialNumber: item.serialNumber, |
|
|
|
rollLabelFlag: item.rollLabelFlag,// 判断标签类型 |
|
|
|
offsetX:item.offsetX, |
|
|
|
offsetY:item.offsetY, |
|
|
|
direction:item.direction, |
|
|
|
} |
|
|
|
}); |
|
|
|
let qrCodeList = this.$refs.qrCode.init(prints.map((item)=>{ |
|
|
|
@ -1046,8 +1111,9 @@ export default { |
|
|
|
notFound.push(label.defaultPrinterName) |
|
|
|
continue |
|
|
|
} |
|
|
|
print_roll_label(prints,label.defaultPrinterName) |
|
|
|
print_roll_label(prints,label.defaultPrinterName,this.printTest) |
|
|
|
} |
|
|
|
this.printTest = false |
|
|
|
if (notFound.length > 0){ |
|
|
|
this.$message.warning(`The printer ${notFound.join(',')} is not found`) |
|
|
|
return |
|
|
|
@ -1132,6 +1198,9 @@ export default { |
|
|
|
qty:this.currentPartLogistic.unitQtyPerPallet, |
|
|
|
umName:this.currentPartLogistic.umName, |
|
|
|
invoiceNo:this.currentPartLogistic.invoiceNo, |
|
|
|
offsetX:data.row.offsetX, |
|
|
|
offsetY:data.row.offsetY, |
|
|
|
direction:data.row.direction, |
|
|
|
} |
|
|
|
let qrCodeList = this.$refs.qrCode.init([row.qrCode]) |
|
|
|
row.qrCode = qrCodeList[0] |
|
|
|
@ -1141,8 +1210,9 @@ export default { |
|
|
|
notFound.push(label.defaultPrinterName) |
|
|
|
continue |
|
|
|
} |
|
|
|
printLogisticLabel([row],label.defaultPrinterName) |
|
|
|
printLogisticLabel([row],label.defaultPrinterName,this.printTest) |
|
|
|
} |
|
|
|
this.printTest = false |
|
|
|
if (notFound.length > 0){ |
|
|
|
this.$message.warning(`The printer ${notFound.join(',')} is not found`) |
|
|
|
return |
|
|
|
@ -1157,6 +1227,14 @@ export default { |
|
|
|
this.$message.error(error) |
|
|
|
this.printLoading = false; |
|
|
|
}) |
|
|
|
}, |
|
|
|
handlePrintTest(val){ |
|
|
|
this.printTest = true |
|
|
|
if (val === 0){ |
|
|
|
this.handlePrintOrSave(); |
|
|
|
}else { |
|
|
|
this.handlePrintLogistic(); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted () { |
|
|
|
@ -1389,6 +1467,7 @@ export default { |
|
|
|
</el-row> |
|
|
|
</el-form> |
|
|
|
<div slot="footer" style="text-align: center; margin-top: 10px"> |
|
|
|
<el-button type="primary" :loading="printLoading" style="width: 80px" @click="handlePrintTest(0)">Print Test</el-button> |
|
|
|
<el-button type="primary" :loading="printLoading" style="width: 60px" @click="handlePrintOrSave">Print</el-button> |
|
|
|
<el-button style="width: 60px" @click="printVisible = false">Cancel</el-button> |
|
|
|
</div> |
|
|
|
@ -1430,6 +1509,7 @@ export default { |
|
|
|
</el-row> |
|
|
|
</el-form> |
|
|
|
<div slot="footer" style="text-align: center; margin-top: 10px"> |
|
|
|
<el-button type="primary" :loading="printLoading" style="width: 80px" @click="handlePrintTest(1)">Print Test</el-button> |
|
|
|
<el-button type="primary" :loading="printLoading" style="width: 60px" @click="handlePrintLogistic">Print</el-button> |
|
|
|
<el-button style="width: 60px" @click="logisticVisible = false">Cancel</el-button> |
|
|
|
</div> |
|
|
|
|