Browse Source

2025.06.09 标签维护功能

标签打印空白页、卷打印份数
master
jiayang yue 9 months ago
parent
commit
3657dff2ef
  1. 4
      src/printFormat/RF_RFID.js
  2. 4
      src/printFormat/alphaHardTagPrintFormat.js
  3. 4
      src/printFormat/antenna.js
  4. 4
      src/printFormat/hardwareAntennaAutoSN.js
  5. 4
      src/printFormat/logisticLabel.js
  6. 31
      src/printFormat/roll_label.js
  7. 8
      src/store/modules/user.js
  8. 18
      src/views/main.vue
  9. 83
      src/views/modules/factory/tblbasedata.vue
  10. 2
      src/views/modules/label/QrCode.vue
  11. 7
      src/views/modules/label/labelMaintenance.vue
  12. 157
      src/views/modules/label/printer.vue
  13. 72
      src/views/modules/label/roll.vue

4
src/printFormat/RF_RFID.js

@ -37,7 +37,7 @@ export const printRF_RFIDLabel = (printList, icons, printerName,testFlag = false
const printFun = (LODOP,row,icons)=>{ const printFun = (LODOP,row,icons)=>{
LODOP.SET_PRINT_PAGESIZE(0,1100,512,""); LODOP.SET_PRINT_PAGESIZE(0,1100,512,"");
LODOP.ADD_PRINT_IMAGE(-5,20,"26mm","26mm",row.qrCode);
LODOP.ADD_PRINT_IMAGE(7, 30 ,"20mm","20mm",row.qrCode);
LODOP.SET_PRINT_STYLEA(0,"Stretch",1); LODOP.SET_PRINT_STYLEA(0,"Stretch",1);
LODOP.ADD_PRINT_IMAGE(4,255,90,16,"<img src=\"data:image/png;base64," + ckpLogo + "\"/>"); LODOP.ADD_PRINT_IMAGE(4,255,90,16,"<img src=\"data:image/png;base64," + ckpLogo + "\"/>");
LODOP.SET_PRINT_STYLEA(0,"Stretch",2); LODOP.SET_PRINT_STYLEA(0,"Stretch",2);
@ -110,7 +110,7 @@ const printFun = (LODOP,row,icons)=>{
const printVerticalFun = (LODOP,row,icons)=>{ const printVerticalFun = (LODOP,row,icons)=>{
LODOP.SET_PRINT_PAGESIZE(0,512,1000,""); LODOP.SET_PRINT_PAGESIZE(0,512,1000,"");
LODOP.ADD_PRINT_IMAGE(257,1,"26mm","26mm",row.qrCode);
LODOP.ADD_PRINT_IMAGE(264,2,"20mm","20mm",row.qrCode);
LODOP.SET_PRINT_STYLEA(0,"Stretch",1); LODOP.SET_PRINT_STYLEA(0,"Stretch",1);
LODOP.ADD_PRINT_IMAGE(120,4,90,16,"<img src=\"data:image/png;base64," + ckpLogo + "\"/>"); LODOP.ADD_PRINT_IMAGE(120,4,90,16,"<img src=\"data:image/png;base64," + ckpLogo + "\"/>");
LODOP.SET_PRINT_STYLEA(0,"Stretch",2); LODOP.SET_PRINT_STYLEA(0,"Stretch",2);

4
src/printFormat/alphaHardTagPrintFormat.js

@ -70,7 +70,7 @@ export function printAlphaHardTagLabel (printList, icons, printerName, flag) {
const printCartonLabel = (LODOP,row,icons,hz) => { const printCartonLabel = (LODOP,row,icons,hz) => {
//如果打印正常的标签 //如果打印正常的标签
LODOP.SET_PRINT_PAGESIZE(hz, 1100, 512, '') LODOP.SET_PRINT_PAGESIZE(hz, 1100, 512, '')
LODOP.ADD_PRINT_IMAGE(-5, 20, '26mm', '26mm', row.qrCode)
LODOP.ADD_PRINT_IMAGE(7, 30, '20mm', '20mm', row.qrCode)
LODOP.SET_PRINT_STYLEA(0, 'Stretch', 1) LODOP.SET_PRINT_STYLEA(0, 'Stretch', 1)
LODOP.ADD_PRINT_IMAGE(4, 255, 90, 16, '<img src="data:image/png;base64,' + ckpLogo + '"/>') LODOP.ADD_PRINT_IMAGE(4, 255, 90, 16, '<img src="data:image/png;base64,' + ckpLogo + '"/>')
LODOP.SET_PRINT_STYLEA(0, 'Stretch', 2) LODOP.SET_PRINT_STYLEA(0, 'Stretch', 2)
@ -181,7 +181,7 @@ const printCartonLabel = (LODOP,row,icons,hz) => {
const printCartonVerticalLabel = (LODOP,row,icons) => { const printCartonVerticalLabel = (LODOP,row,icons) => {
//如果打印正常的标签 //如果打印正常的标签
LODOP.SET_PRINT_PAGESIZE(0, 512, 1020, '') LODOP.SET_PRINT_PAGESIZE(0, 512, 1020, '')
LODOP.ADD_PRINT_IMAGE(257,-6, '26mm', '26mm', row.qrCode)
LODOP.ADD_PRINT_IMAGE(264,2, '20mm', '20mm', row.qrCode)
LODOP.SET_PRINT_STYLEA(0, 'Stretch', 1) LODOP.SET_PRINT_STYLEA(0, 'Stretch', 1)
LODOP.ADD_PRINT_IMAGE(120,4, 90, 16, '<img src="data:image/png;base64,' + ckpLogo + '"/>') LODOP.ADD_PRINT_IMAGE(120,4, 90, 16, '<img src="data:image/png;base64,' + ckpLogo + '"/>')
LODOP.SET_PRINT_STYLEA(0, 'Stretch', 2) LODOP.SET_PRINT_STYLEA(0, 'Stretch', 2)

4
src/printFormat/antenna.js

@ -61,7 +61,7 @@ export const printAntennaLabel = (printList, icons, printerName,flag,testFlag =
const printLabel = (LODOP,row,icons,hz)=>{ const printLabel = (LODOP,row,icons,hz)=>{
LODOP.SET_PRINT_PAGESIZE(hz, 1100, 512, '') LODOP.SET_PRINT_PAGESIZE(hz, 1100, 512, '')
LODOP.ADD_PRINT_IMAGE(-5,20,"26mm","26mm",row.qrCode);
LODOP.ADD_PRINT_IMAGE(7, 30 ,"20mm","20mm",row.qrCode);
LODOP.SET_PRINT_STYLEA(0,"Stretch",1); LODOP.SET_PRINT_STYLEA(0,"Stretch",1);
LODOP.ADD_PRINT_IMAGE(4,255,90,16, '<img src="data:image/png;base64,' + ckpLogo + '"/>') LODOP.ADD_PRINT_IMAGE(4,255,90,16, '<img src="data:image/png;base64,' + ckpLogo + '"/>')
LODOP.SET_PRINT_STYLEA(0, 'Stretch', 2) LODOP.SET_PRINT_STYLEA(0, 'Stretch', 2)
@ -140,7 +140,7 @@ const printLabel = (LODOP,row,icons,hz)=>{
const printVerticalLabel = (LODOP,row,icons)=>{ const printVerticalLabel = (LODOP,row,icons)=>{
LODOP.SET_PRINT_PAGESIZE(0, 512,1020 , '') LODOP.SET_PRINT_PAGESIZE(0, 512,1020 , '')
LODOP.ADD_PRINT_IMAGE(257,-3,"26mm","26mm",row.qrCode);
LODOP.ADD_PRINT_IMAGE(264,2,"20mm","20mm",row.qrCode);
LODOP.SET_PRINT_STYLEA(0,"Stretch",1); LODOP.SET_PRINT_STYLEA(0,"Stretch",1);
LODOP.ADD_PRINT_IMAGE(120,4,90,16, '<img src="data:image/png;base64,' + ckpLogo + '"/>') LODOP.ADD_PRINT_IMAGE(120,4,90,16, '<img src="data:image/png;base64,' + ckpLogo + '"/>')
LODOP.SET_PRINT_STYLEA(0, 'Stretch', 2) LODOP.SET_PRINT_STYLEA(0, 'Stretch', 2)

4
src/printFormat/hardwareAntennaAutoSN.js

@ -17,7 +17,7 @@ export const printAntennaAutoSNLabel = (printList) => {
const LODOP = getLodop() const LODOP = getLodop()
if (LODOP) { if (LODOP) {
// LODOP.SET_LICENSES('', '13F0BF6589BB32F360918E33F9C10905', '', '') // LODOP.SET_LICENSES('', '13F0BF6589BB32F360918E33F9C10905', '', '')
LODOP.SET_LICENSES("","549DA0AD145DA11D8FC8654C58657B8EA09","","");
LODOP.SET_LICENSES("", "549DA0AD145DA11D8FC8654C58657B8EA09", "", "");
LODOP.SET_PRINT_MODE('CUSTOM_TASK_NAME', '多条页')//为每个打印单独设置任务名 LODOP.SET_PRINT_MODE('CUSTOM_TASK_NAME', '多条页')//为每个打印单独设置任务名
for (let i = 0; i < printList.length; i++) { for (let i = 0; i < printList.length; i++) {
@ -71,7 +71,7 @@ export const printAntennaAutoSNLabel = (printList) => {
} }
const printLabel = (LODOP,row,icons,sizeTop)=>{ const printLabel = (LODOP,row,icons,sizeTop)=>{
LODOP.ADD_PRINT_IMAGE((sizeTop)+(-5),20,"26mm","26mm",row.qrCode);
LODOP.ADD_PRINT_IMAGE((sizeTop)+8,22,"20mm","20mm",row.qrCode);
LODOP.SET_PRINT_STYLEA(0,"Stretch",1); LODOP.SET_PRINT_STYLEA(0,"Stretch",1);
LODOP.ADD_PRINT_IMAGE((sizeTop)+4,255,90,16, '<img src="data:image/png;base64,' + ckpLogo + '"/>') LODOP.ADD_PRINT_IMAGE((sizeTop)+4,255,90,16, '<img src="data:image/png;base64,' + ckpLogo + '"/>')
LODOP.SET_PRINT_STYLEA(0, 'Stretch', 2) LODOP.SET_PRINT_STYLEA(0, 'Stretch', 2)

4
src/printFormat/logisticLabel.js

@ -35,7 +35,7 @@ export const printLogisticLabel = (printList, printerName,testFlag = false) => {
const printFun = (LODOP,row)=>{ const printFun = (LODOP,row)=>{
LODOP.SET_PRINT_PAGESIZE(0,1100,512,""); LODOP.SET_PRINT_PAGESIZE(0,1100,512,"");
LODOP.ADD_PRINT_IMAGE(-5,20,"26mm","26mm",row.qrCode);
LODOP.ADD_PRINT_IMAGE(7, 30 ,"20mm","20mm",row.qrCode);
LODOP.SET_PRINT_STYLEA(0,"Stretch",1); LODOP.SET_PRINT_STYLEA(0,"Stretch",1);
LODOP.ADD_PRINT_IMAGE(4,255,90,16,"<img src=\"data:image/png;base64," + ckpLogo + "\"/>"); LODOP.ADD_PRINT_IMAGE(4,255,90,16,"<img src=\"data:image/png;base64," + ckpLogo + "\"/>");
LODOP.SET_PRINT_STYLEA(0,"Stretch",2); LODOP.SET_PRINT_STYLEA(0,"Stretch",2);
@ -101,7 +101,7 @@ const printFun = (LODOP,row)=>{
} }
const printVerticalFun = (LODOP,row)=>{ const printVerticalFun = (LODOP,row)=>{
LODOP.SET_PRINT_PAGESIZE(0,512,1020,""); LODOP.SET_PRINT_PAGESIZE(0,512,1020,"");
LODOP.ADD_PRINT_IMAGE(257,1,"26mm","26mm",row.qrCode);
LODOP.ADD_PRINT_IMAGE(264,2,"20mm","20mm",row.qrCode);
LODOP.SET_PRINT_STYLEA(0,"Stretch",1); LODOP.SET_PRINT_STYLEA(0,"Stretch",1);
LODOP.ADD_PRINT_IMAGE(120,4,90,16,"<img src=\"data:image/png;base64," + ckpLogo + "\"/>"); LODOP.ADD_PRINT_IMAGE(120,4,90,16,"<img src=\"data:image/png;base64," + ckpLogo + "\"/>");
LODOP.SET_PRINT_STYLEA(0,"Stretch",2); LODOP.SET_PRINT_STYLEA(0,"Stretch",2);

31
src/printFormat/roll_label.js
File diff suppressed because it is too large
View File

8
src/store/modules/user.js

@ -11,6 +11,8 @@ export default {
authControl: '', authControl: '',
userType: '', userType: '',
autoSerialNumber:'', autoSerialNumber:'',
copiesForRollLabelFlag: '',
copies: 1,
siteCode:'', siteCode:'',
showPound:'', showPound:'',
}, },
@ -42,6 +44,12 @@ export default {
updateAutoSerialNumber (state,autoSerialNumber){ updateAutoSerialNumber (state,autoSerialNumber){
state.autoSerialNumber = autoSerialNumber state.autoSerialNumber = autoSerialNumber
}, },
updateCopiesForRollLabelFlag (state,copiesForRollLabelFlag){
state.copiesForRollLabelFlag = copiesForRollLabelFlag
},
updateCopies (state, copies) {
state.copies = copies
},
updateSiteCode (state,siteCode){ updateSiteCode (state,siteCode){
state.siteCode = siteCode state.siteCode = siteCode
}, },

18
src/views/main.vue

@ -112,6 +112,22 @@
this.$store.commit('user/updateAutoSerialNumber', val) this.$store.commit('user/updateAutoSerialNumber', val)
} }
}, },
copiesForRollLabelFlag: {
get() {
return this.$store.state.user.copiesForRollLabelFlag
},
set(val) {
this.$store.commit('user/updateCopiesForRollLabelFlag', val)
}
},
copies: {
get() {
return this.$store.state.user.copies
},
set(val) {
this.$store.commit('user/updateCopies', val)
}
},
siteCode:{ siteCode:{
get() { get() {
return this.$store.state.user.siteCode return this.$store.state.user.siteCode
@ -160,6 +176,8 @@
this.userDisplay = data.user.userDisplay this.userDisplay = data.user.userDisplay
this.userType = data.user.userTypeDesc this.userType = data.user.userTypeDesc
this.autoSerialNumber = data.user.autoSerialNumber this.autoSerialNumber = data.user.autoSerialNumber
this.copiesForRollLabelFlag = data.user.copiesForRollLabelFlag
this.copies = data.user.copies
this.siteCode = data.user.siteCode this.siteCode = data.user.siteCode
this.showPound = data.user.showPound this.showPound = data.user.showPound
} }

83
src/views/modules/factory/tblbasedata.vue

@ -28,6 +28,8 @@ let site = {
buNo: '', buNo: '',
defaultCountry:'', defaultCountry:'',
autoSerialNumber: '', autoSerialNumber: '',
copiesForRollLabelFlag: 'N',
copies: 1,
siteCode: '', siteCode: '',
factoryCode:'00', factoryCode:'00',
showPound: '', showPound: '',
@ -54,6 +56,8 @@ export default {
...site, ...site,
active: 'Y', active: 'Y',
autoSerialNumber: 'N', autoSerialNumber: 'N',
copies: 1,
copiesForRollLabelFlag: 'N',
showPound: 'N', showPound: 'N',
}, },
saveFormRules:{ saveFormRules:{
@ -276,6 +280,8 @@ export default {
this.getCountryList(); this.getCountryList();
this.siteForm = { this.siteForm = {
...row, ...row,
copiesForRollLabelFlag: row.copiesForRollLabelFlag ? row.copiesForRollLabelFlag : 'N',
copies: row.copies ? row.copies : 1,
} }
this.saveVisible = true; this.saveVisible = true;
} }
@ -305,56 +311,84 @@ export default {
this.$message.error(error) this.$message.error(error)
}) })
}, },
// copies
async checkCopies(copies) {
if (copies > 5 && this.siteForm.copiesForRollLabelFlag === 'Y') {
try {
await this.$confirm(
'The copies is greater than 5, are you sure to continue?',
'Warning',
{
confirmButtonText: 'OK',
cancelButtonText: 'Cancel',
type: 'warning'
}
);
//
return true;
} catch (e) {
//
return false;
}
}
return true;
},
saveSite(){ saveSite(){
this.$refs.siteForm.validate((valid,obj) => {
if (valid){
if (this.siteForm.factoryCode.length !== 2 || isNaN(this.siteForm.factoryCode)){
this.$refs.siteForm.validate(async (valid, obj) => {
if (valid) {
if (this.siteForm.factoryCode.length !== 2 || isNaN(this.siteForm.factoryCode)) {
this.$message.warning("The Factory Code must be a number of length 2") this.$message.warning("The Factory Code must be a number of length 2")
return return
} }
// copies
const pass = await this.checkCopies(this.siteForm.copies);
if (!pass) return;
let params = { let params = {
...this.siteForm, ...this.siteForm,
createBy: this.$store.state.user.name, createBy: this.$store.state.user.name,
createTime: dayjs().format('YYYY-MM-DD HH:mm:ss'), createTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
} }
saveSite(params).then(({data})=>{
if (data && data.code === 0){
saveSite(params).then(({data}) => {
if (data && data.code === 0) {
this.getSiteList(); this.getSiteList();
this.saveVisible = false; this.saveVisible = false;
this.$message.success(data.msg) this.$message.success(data.msg)
}else {
} else {
this.$message.warning(data.msg) this.$message.warning(data.msg)
} }
}).catch((error)=>{
}).catch((error) => {
this.$message.error(error) this.$message.error(error)
}) })
}else {
} else {
this.getSaveFormErrorMessage(obj) this.getSaveFormErrorMessage(obj)
} }
}) })
}, },
updateSite(){ updateSite(){
this.$refs.siteForm.validate((valid,obj) => {
if (valid){
if (this.siteForm.factoryCode.length !== 2 || isNaN(this.siteForm.factoryCode)){
this.$refs.siteForm.validate(async (valid, obj) => {
if (valid) {
if (this.siteForm.factoryCode.length !== 2 || isNaN(this.siteForm.factoryCode)) {
this.$message.warning("The Factory Code must be a number of length 2") this.$message.warning("The Factory Code must be a number of length 2")
return return
} }
updateSite(this.siteForm).then(({data})=>{
if (data && data.code === 0){
if (this.siteForm.siteId === this.$store.state.user.site){
this.$store.commit('user/updateShowPound',this.siteForm.showPound)
// copies
const pass = await this.checkCopies(this.siteForm.copies);
if (!pass) return;
updateSite(this.siteForm).then(({data}) => {
if (data && data.code === 0) {
if (this.siteForm.siteId === this.$store.state.user.site) {
this.$store.commit('user/updateShowPound', this.siteForm.showPound)
} }
this.getSiteList(); this.getSiteList();
this.saveVisible = false; this.saveVisible = false;
this.$message.success(data.msg) this.$message.success(data.msg)
}else {
} else {
this.$message.warning(data.msg) this.$message.warning(data.msg)
} }
}).catch((error)=>{
}).catch((error) => {
this.$message.error(error) this.$message.error(error)
}) })
}else {
} else {
this.getSaveFormErrorMessage(obj) this.getSaveFormErrorMessage(obj)
} }
}) })
@ -369,6 +403,8 @@ export default {
this.siteForm = { this.siteForm = {
...site, ...site,
autoSerialNumber: 'N', autoSerialNumber: 'N',
copiesForRollLabelFlag: 'N',
copies: 1,
showPound: 'N', showPound: 'N',
active: 'Y' active: 'Y'
} }
@ -624,6 +660,17 @@ export default {
<el-checkbox v-model="siteForm.active" true-label="Y" false-label="N">Active</el-checkbox> <el-checkbox v-model="siteForm.active" true-label="Y" false-label="N">Active</el-checkbox>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8">
<el-form-item label="Default Copies for Roll Label" prop="email" :show-message="false">
<el-input-number :disabled="siteForm.copiesForRollLabelFlag === 'N'" :min="1" v-model="siteForm.copies"
:controls="false"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label=" " :show-message="false">
<el-checkbox v-model="siteForm.copiesForRollLabelFlag" true-label="Y" false-label="N">Allow Specify Copies for Roll Label</el-checkbox>
</el-form-item>
</el-col>
</el-row> </el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">

2
src/views/modules/label/QrCode.vue

@ -27,7 +27,7 @@ export default {
}, },
generateQRCodeSync(text) { generateQRCodeSync(text) {
let base64 = '' let base64 = ''
QRCode.toDataURL(text, { errorCorrectionLevel: 'M' }, (err, url) => {
QRCode.toDataURL(text, { errorCorrectionLevel: 'M',margin: 0 }, (err, url) => {
if (err) { if (err) {
console.error(err) console.error(err)
return return

7
src/views/modules/label/labelMaintenance.vue

@ -225,6 +225,13 @@ export default {
this.$message.error("请上传图片文件"); this.$message.error("请上传图片文件");
return; return;
} }
// jpg png jpeg
const fileType = this.modalData.file.type;
const validImageTypes = ["image/jpeg", "image/png", "image/jpg"];
if (!validImageTypes.includes(fileType)) {
this.$message.error("请上传有效的图片文件");
return;
}
this.$refs.formRef.validate(valid => { this.$refs.formRef.validate(valid => {
if (!valid) return; if (!valid) return;
let formData = new FormData(); let formData = new FormData();

157
src/views/modules/label/printer.vue

@ -53,6 +53,7 @@ const printer = {
orderNo: '', orderNo: '',
templateNo:'', templateNo:'',
printLabelType:0, printLabelType:0,
copies:1,
} }
export default { export default {
name: 'printer', name: 'printer',
@ -705,8 +706,14 @@ export default {
if (status === 1){ if (status === 1){
labelList = this.labelFormatList.filter((item)=> item.labelType === 'Roll Label') labelList = this.labelFormatList.filter((item)=> item.labelType === 'Roll Label')
this.printCurrentPart.rollsPerCarton = 1; this.printCurrentPart.rollsPerCarton = 1;
if (this.$store.state.user.copiesForRollLabelFlag === 'Y'){
this.printCurrentPart.copies = this.$store.state.user.copies ? this.$store.state.user.copies : 1;
} else {
this.printCurrentPart.copies = 1;
}
this.$set(this.printCurrentPart,'orderNo','') this.$set(this.printCurrentPart,'orderNo','')
}else if (status === 0){ }else if (status === 0){
this.$store.state.user.copiesForRollLabelFlag = 'N';
labelList = this.labelFormatList.filter((item)=> item.labelType === 'Shipment Carton') labelList = this.labelFormatList.filter((item)=> item.labelType === 'Shipment Carton')
} }
if (labelList.length === 0){ if (labelList.length === 0){
@ -1126,6 +1133,56 @@ export default {
this.$message.error(error) this.$message.error(error)
}) })
}, },
doPrintRollLabel(data, params) {
if (data && data.code === 0) {
let labelList = this.labelFormatList.filter(item => item.labelType === 'Roll Label');
let prints = data.rows.map((item) => {
return {
qrCode: `(00)${item.partNo}(01)${item.qtyPerRoll}(02)${item.umName}(03)${item.manufacturerDate}(04)${item.serialNumber ? item.serialNumber : ''}(05)${item.manufacturerNo ? item.manufacturerNo : ''}(06)${item.moldCode ? item.moldCode : ''}(07)(08)${item.rollNo}(09)(10)`,
ref: item.partNo,
rev: item.rev,
qty: item.qtyPerRoll,
uom: item.umName,
desc: item.partDesc,
date: item.manufacturerDate,
manufacturer: item.manufacturerNo,
moldCode: item.moldCode,
rollNo: item.rollNo,
sn: item.serialNumber,
rollLabelRequired: item.rollLabelRequired,
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) => {
return item.qrCode
}));
for (let i = 0; i < qrCodeList.length; i++) {
prints[i].qrCode = qrCodeList[i];
}
let notFound = [];
for (let label of labelList) {
if (!this.printerSetupList.includes(label.defaultPrinterName)) {
notFound.push(label.defaultPrinterName);
continue;
}
print_roll_label(prints, label.defaultPrinterName, params.copies, true);
}
this.printTest = false;
if (notFound.length > 0) {
this.$message.warning(`The printer ${notFound.join(',')} is not found`);
return;
}
this.$message.success(data.msg);
} else {
this.$message.warning(data.msg);
}
this.printLoading = false;
},
savePrintRollLabelRecord(){ savePrintRollLabelRecord(){
// //
let params = { let params = {
@ -1136,59 +1193,34 @@ export default {
} }
this.printLoading = true; this.printLoading = true;
// //
savePrintRollLabelRecord(params).then(({data})=>{
if (data && data.code === 0) {
let labelList = this.labelFormatList.filter((item)=> item.labelType === 'Roll Label')
let prints = data.rows.map((item) => {
return {
qrCode: `(00)${item.partNo}(01)${item.qtyPerRoll}(02)${item.umName}(03)${item.manufacturerDate}(04)${item.serialNumber? item.serialNumber : ''}(05)${item.manufacturerNo? item.manufacturerNo : ''}(06)${item.moldCode? item.moldCode : ''}(07)(08)${item.rollNo}(09)(10)`,
ref: item.partNo,
rev: item.rev,
qty: item.qtyPerRoll,
uom: item.umName,
desc: item.partDesc,
date: item.manufacturerDate,
manufacturer: item.manufacturerNo,
moldCode: item.moldCode,
rollNo: item.rollNo,
sn: item.serialNumber,
rollLabelRequired: item.rollLabelRequired,
serialNumberRequired: item.serialNumberRequired,
serialNumber: item.serialNumber,
rollLabelFlag: item.rollLabelFlag,//
offsetX:item.offsetX,
offsetY:item.offsetY,
direction:item.direction,
savePrintRollLabelRecord(params).then(async ({data}) => {
await this.onCopiesInput(params.copies);
// copies
if (params.copies > 5) {
this.$confirm(
'The copies is greater than 5, are you sure to continue?',
'Warning',
{
confirmButtonText: 'OK',
cancelButtonText: 'Cancel',
type: 'warning'
} }
).then(() => {
//
this.doPrintRollLabel(data, params);
}).catch(() => {
//
this.printLoading = false;
}); });
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 notFound = [];
for (let label of labelList) {
if (!this.printerSetupList.includes(label.defaultPrinterName)) {
notFound.push(label.defaultPrinterName)
continue
}
print_roll_label(prints,label.defaultPrinterName,true)
}
this.printTest = false
if (notFound.length > 0){
this.$message.warning(`The printer ${notFound.join(',')} is not found`)
return
}
this.$message.success(data.msg)
}else {
this.$message.warning(data.msg)
return; //
} }
// copies5
this.doPrintRollLabel(data, params);
}).catch((error) => {
this.$message.error(error);
this.printLoading = false; this.printLoading = false;
}).catch((error)=>{
this.$message.error(error)
this.printLoading = false;
})
});
}, },
loadQrCode(){ loadQrCode(){
let arr = ['2','4','6','8'] let arr = ['2','4','6','8']
@ -1416,7 +1448,15 @@ export default {
handleScanSerialNumber(){ handleScanSerialNumber(){
this.scanSerialNumberList = [...this.serialNumberList] this.scanSerialNumberList = [...this.serialNumberList]
this.serialNumberVisible = true this.serialNumberVisible = true
}
},
onCopiesInput(val) {
//
let newVal = String(val).replace(/[^0-9]/g, '');
if (newVal === '' || Number(newVal) < 1) {
newVal = '1';
}
this.printCurrentPart.copies = parseInt(newVal, 10);
},
}, },
mounted () { mounted () {
this.getLodopPrinterName(); this.getLodopPrinterName();
@ -1684,7 +1724,22 @@ export default {
<!-- </el-col>--> <!-- </el-col>-->
<!-- </el-row>--> <!-- </el-row>-->
<!-- </div>--> <!-- </div>-->
<div slot="footer">
<div slot="footer" v-if="this.$store.state.user.copiesForRollLabelFlag === 'Y'">
<label for="copies-input" style="float:left;line-height:32px;margin-right:4px;margin-top: -5px">Copies</label>
<el-input-number
id="copies-input"
v-model.number="printCurrentPart.copies"
style="width: 60px; float: left; margin-right: 10px"
:min="1"
:controls="false"
@input="onCopiesInput"
></el-input-number>
<el-button type="primary" :loading="printLoading" style="width: 60px;margin-left: -110px"
@click="handlePrintOrSave">Print
</el-button>
<el-button style="width: 60px" @click="printVisible = false">Cancel</el-button>
</div>
<div slot="footer" v-else>
<el-button type="primary" :loading="printLoading" style="width: 60px" @click="handlePrintOrSave">Print</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> <el-button style="width: 60px" @click="printVisible = false">Cancel</el-button>
</div> </div>

72
src/views/modules/label/roll.vue

@ -23,7 +23,8 @@ const printRecord = {
partNo: '', partNo: '',
partDesc: '', partDesc: '',
startDate: '', startDate: '',
endDate: ''
endDate: '',
copies: 1,
} }
export default { export default {
name: 'roll', name: 'roll',
@ -335,15 +336,37 @@ export default {
let ids = this.selectionPrintLabelRecordList.map((item) => { let ids = this.selectionPrintLabelRecordList.map((item) => {
return item.id return item.id
}) })
getPrintRollLabelRecord(ids).then(({data})=>{
if (data && data.code === 0){
this.handlePrint(data.rows)
}else {
this.$message.warning(data.msg)
// copies
if (Number(this.printRecord.copies) > 5) {
try {
await this.$confirm(
'The copies is greater than 5, are you sure to continue?',
'Warning',
{
confirmButtonText: 'OK',
cancelButtonText: 'Cancel',
type: 'warning'
}
);
// OK
} catch (e) {
//
return;
} }
}).catch((error)=>{
this.$message.error(error.message)
})
}
//
try {
const { data } = await getPrintRollLabelRecord(ids);
if (data && data.code === 0) {
this.handlePrint(data.rows);
} else {
this.$message.warning(data.msg);
}
} catch (error) {
this.$message.error(error.message);
}
}, },
handlePrint(list){ handlePrint(list){
let params = list.map((item) => { let params = list.map((item) => {
@ -392,7 +415,7 @@ export default {
for (let i = 0; i < qrCodeList.length; i++) { for (let i = 0; i < qrCodeList.length; i++) {
arr[i].qrCode = qrCodeList[i] arr[i].qrCode = qrCodeList[i]
} }
print_roll_label(arr,printerNameList[j].defaultPrinterName,true)
print_roll_label(arr,printerNameList[j].defaultPrinterName,this.printRecord.copies,true)
} }
} }
this.printTest = false this.printTest = false
@ -508,7 +531,15 @@ export default {
handlePrintTest(){ handlePrintTest(){
this.printTest = true this.printTest = true
this.handlePrintLabel(); this.handlePrintLabel();
}
},
onCopiesInput(val) {
//
let newVal = String(val).replace(/[^0-9]/g, '');
if (newVal === '' || Number(newVal) < 1) {
newVal = '1';
}
this.printRecord.copies = parseInt(newVal, 10);
},
}, },
mounted () { mounted () {
const lodop = getLodop() const lodop = getLodop()
@ -519,6 +550,11 @@ export default {
created () { created () {
// this.getPrintLabelRecordList() // this.getPrintLabelRecordList()
this.getTableUserColumn('30006Table',1) this.getTableUserColumn('30006Table',1)
if (this.$store.state.user.copiesForRollLabelFlag === 'Y') {
this.printRecord.copies = this.$store.state.user.copies ? this.$store.state.user.copies : 1
} else {
this.printRecord.copies = 1
}
}, },
} }
</script> </script>
@ -582,13 +618,25 @@ export default {
<el-input v-model="printRecord.partDesc" clearable></el-input> <el-input v-model="printRecord.partDesc" clearable></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6">
<el-col :span="4">
<el-form-item label=" "> <el-form-item label=" ">
<el-button type="primary" style="width: 60px" @click="getPrintLabelRecordList">Query</el-button> <el-button type="primary" style="width: 60px" @click="getPrintLabelRecordList">Query</el-button>
<el-button type="primary" style="width: 60px" @click="handlePrintLabel">Print</el-button> <el-button type="primary" style="width: 60px" @click="handlePrintLabel">Print</el-button>
<!-- <el-button type="primary" style="width: 80px" @click="handlePrintTest">Print Test</el-button>--> <!-- <el-button type="primary" style="width: 80px" @click="handlePrintTest">Print Test</el-button>-->
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="2" v-if="this.$store.state.user.copiesForRollLabelFlag === 'Y'">
<el-form-item label="Copies">
<el-input-number
id="copies-input"
v-model.number="printRecord.copies"
style="width: 60px; float: left; margin-right: 10px"
:min="1"
:controls="false"
@input="onCopiesInput"
></el-input-number>
</el-form-item>
</el-col>
</el-row> </el-row>
</el-form> </el-form>
</div> </div>

Loading…
Cancel
Save