|
|
|
@ -14,90 +14,190 @@ export const print_roll_label = (printList,printerName,hz = 0)=>{ |
|
|
|
LODOP.SET_PRINT_MODE('CUSTOM_TASK_NAME', '多条页') |
|
|
|
for (let i = 0; i < printList.length; i++) { |
|
|
|
let row = printList[i]; |
|
|
|
LODOP.NewPage(); |
|
|
|
LODOP.SET_PRINTER_INDEXA(printerName) |
|
|
|
LODOP.SET_PRINT_PAGESIZE(hz,450,250,""); |
|
|
|
LODOP.ADD_PRINT_IMAGE(3,4,"18mm","18mm",row.qrCode); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Stretch",1); |
|
|
|
LODOP.ADD_PRINT_IMAGE(7,120,30,8,"<img src=\"data:image/png;base64," + ckpLogo + "\"/>"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Stretch",2); |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(15,73,30,20,"REF"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",5); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(13,93,80,30,row.ref); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",8); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(24,73,25,20,"QTY"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",5); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(24,93,35,20,row.qty); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",5); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(24,122,25,20,"UOM"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",5); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(24,140,50,20,row.uom); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",5); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(32,73,30,20,"DESC"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",5); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(32,96,80,35,row.desc); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"LineSpacing",-3); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",5); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
if (row.rollLabelRequired === 'Y'){ |
|
|
|
LODOP.ADD_PRINT_TEXT(56,73,30,20,"ROLL"); |
|
|
|
}else if (row.serialNumberRequired === 'Y'){ |
|
|
|
LODOP.ADD_PRINT_TEXT(56,73,50,20,"SERIAL"); |
|
|
|
} |
|
|
|
if (row.rollLabelRequired === 'Y' || row.serialNumberRequired === 'Y'){ |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",5); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
console.log(row) |
|
|
|
if (row.rollLabelFlag === 'Y'){ |
|
|
|
prePrintLabel(LODOP,row) |
|
|
|
}else { |
|
|
|
printLabel(LODOP,row) |
|
|
|
} |
|
|
|
// LODOP.PRINT_DESIGN()
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (row.rollLabelRequired === 'Y'){ |
|
|
|
LODOP.ADD_PRINT_TEXT(56,95,80,20,row.rollNo); |
|
|
|
}else if (row.serialNumberRequired === 'Y'){ |
|
|
|
LODOP.ADD_PRINT_TEXT(56,95,80,20,row.serialNumber); |
|
|
|
} |
|
|
|
if (row.rollLabelRequired === 'Y' || row.serialNumberRequired === 'Y'){ |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",5); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(63,73,29,15,"DATE"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",5); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
function prePrintLabel(LODOP,row,hz=0){ |
|
|
|
LODOP.NewPage(); |
|
|
|
LODOP.SET_PRINT_PAGESIZE(hz,450,250,""); |
|
|
|
LODOP.ADD_PRINT_IMAGE(3,4,"18mm","18mm",row.qrCode); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Stretch",1); |
|
|
|
LODOP.ADD_PRINT_IMAGE(7,120,30,8,"<img src=\"data:image/png;base64," + ckpLogo + "\"/>"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Stretch",2); |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(15,73,30,20,"REF"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",5); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(13,93,80,30,row.ref); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",8); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(24,73,25,20,"QTY"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",5); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(24,93,35,20,row.qty); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",5); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(24,122,25,20,"UOM"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",5); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(24,140,50,20,row.uom); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",5); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(32,73,30,20,"DESC"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",5); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(32,96,80,35,row.desc); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"LineSpacing",-3); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",5); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
if (row.rollLabelRequired === 'Y'){ |
|
|
|
LODOP.ADD_PRINT_TEXT(56,73,30,20,"ROLL"); |
|
|
|
}else if (row.serialNumberRequired === 'Y'){ |
|
|
|
LODOP.ADD_PRINT_TEXT(56,73,50,20,"SERIAL"); |
|
|
|
} |
|
|
|
if (row.rollLabelRequired === 'Y' || row.serialNumberRequired === 'Y'){ |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",5); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
} |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(63,95,85,16,row.date); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",5); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
if (row.rollLabelRequired === 'Y'){ |
|
|
|
LODOP.ADD_PRINT_TEXT(56,95,80,20,row.rollNo); |
|
|
|
}else if (row.serialNumberRequired === 'Y'){ |
|
|
|
LODOP.ADD_PRINT_TEXT(56,95,80,20,row.serialNumber); |
|
|
|
} |
|
|
|
if (row.rollLabelRequired === 'Y' || row.serialNumberRequired === 'Y'){ |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",5); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
} |
|
|
|
|
|
|
|
LODOP.PRINT(); |
|
|
|
// LODOP.PRINT_DESIGN()
|
|
|
|
} |
|
|
|
LODOP.ADD_PRINT_TEXT(63,73,29,15,"DATE"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",5); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(63,95,85,16,row.date); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",5); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
LODOP.PRINT(); |
|
|
|
} |
|
|
|
|
|
|
|
function printLabel(LODOP,row){ |
|
|
|
LODOP.NewPage(); |
|
|
|
LODOP.SET_PRINT_PAGESIZE(0,565,252,""); |
|
|
|
LODOP.ADD_PRINT_IMAGE(-6,-5,"21.99mm","21.99mm",row.qrCode); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Stretch",2); |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_IMAGE(1,137,62,12,"<img src=\"data:image/png;base64," + ckpLogo + "\"/>"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Stretch",2); |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(14,70,25,13,"REF"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",6); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(27,70,25,13,"QTY"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",6); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(40,70,35,14,"DESC"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",6); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(13,94,76,18,row.ref); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",8); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"LetterSpacing",-1); |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(27,94,45,13,row.qty); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",6); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(40,94,110,31,row.desc); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",6); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"LineSpacing",-2); |
|
|
|
|
|
|
|
if (row.rollLabelRequired === 'Y'){ |
|
|
|
LODOP.ADD_PRINT_TEXT(69,4,96,13,"ROLL NUMBER"); |
|
|
|
}else if (row.serialNumberRequired === 'Y'){ |
|
|
|
LODOP.ADD_PRINT_TEXT(69,4,96,13,"SERIAL NUMBER"); |
|
|
|
} |
|
|
|
if (row.rollLabelRequired === 'Y' || row.serialNumberRequired === 'Y'){ |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",6); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
} |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(79,4,119,13,"MANUFACTURE DATE"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",6); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(79,94,105,13,row.date); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",6); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
if (row.rollLabelRequired === 'Y'){ |
|
|
|
LODOP.ADD_PRINT_TEXT(69,94,130,13,row.rollNo); |
|
|
|
}else if (row.serialNumberRequired === 'Y'){ |
|
|
|
LODOP.ADD_PRINT_TEXT(69,94,130,13,row.serialNumber); |
|
|
|
} |
|
|
|
if (row.rollLabelRequired === 'Y' || row.serialNumberRequired === 'Y'){ |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",6); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
} |
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(27,141,29,13,"UoM"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",6); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
|
|
|
|
LODOP.ADD_PRINT_TEXT(27,165,40,13,row.uom); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",6); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
|
|
|
|
//这个是固定的,在料号的后面
|
|
|
|
LODOP.ADD_PRINT_TEXT(14,141,66,13,"(Global P/N)"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"FontSize",6); |
|
|
|
LODOP.SET_PRINT_STYLEA(0,"Bold",1); |
|
|
|
LODOP.PRINT(); |
|
|
|
} |