You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

154 lines
5.6 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. var LODOP = getCLodop();
  2. //初始化
  3. function initPrintSetting(clodoplisence) {
  4. try{
  5. var LODOP= getCLodop();
  6. if (LODOP.VERSION) {
  7. if (LODOP.CVERSION){
  8. //alert("当前有WEB打印服务C-Lodop可用!\n C-Lodop版本:"+LODOP.CVERSION+"(内含Lodop"+LODOP.VERSION+")");
  9. //如果没有问题打印的信息
  10. //LODOP.SET_LICENSES("","646464550585055535859561289003","688858710010010811411756128900","");
  11. LODOP.SET_LICENSES("",clodoplisence,"","");
  12. //判断当前打印模式
  13. /* if(printerData.seq >= 0){
  14. LODOP.SET_PRINTER_INDEXA(printerData.printName);
  15. LODOP.PRINT();
  16. }else if(printerData.seq === -1){
  17. LODOP.PREVIEW();
  18. }else if(printerData.seq === -2){
  19. LODOP.PRINT_DESIGN();
  20. }*/
  21. }else {
  22. alert("本机已成功安装了Lodop控件!\n 版本号:"+LODOP.VERSION);
  23. }
  24. };
  25. }catch(err){
  26. }
  27. };
  28. //总调用打印的方法
  29. function printQcRollLabel(printRow, printerData){
  30. //初始化打印
  31. initPrintSetting(printerData.clodopLicense);
  32. //调用打印的方法
  33. printIndiaQcPage(printRow);
  34. //区分各种打印的模式
  35. let printerSeq = printerData.printerSeq;
  36. if (printerSeq >= 0){
  37. LODOP.SET_PRINTER_INDEXA(printerData.printerName);
  38. LODOP.PRINT();
  39. }else if (printerSeq == -1){
  40. LODOP.PREVIEW();
  41. }else if (printerSeq == -2){
  42. LODOP.PRINT_DESIGN();
  43. }
  44. }
  45. function printIndiaQcPage(printRow, printerData){
  46. LODOP.NewPage();
  47. LODOP.SET_PRINT_PAGESIZE(2,800,975,"");
  48. LODOP.ADD_PRINT_TEXT(3,3,135,15,"P/N:"+printRow.customerPartNo);
  49. LODOP.SET_PRINT_STYLEA(0,"FontSize",7);
  50. LODOP.ADD_PRINT_BARCODE(16,3,135,20,"128A",printRow.customerPartNo);
  51. LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
  52. LODOP.ADD_PRINT_TEXT(37,3,135,15,"QTY:"+printRow.standardRollQty);
  53. LODOP.SET_PRINT_STYLEA(0,"FontSize",7);
  54. LODOP.ADD_PRINT_BARCODE(50,3,65,20,"128A",printRow.standardRollQty);
  55. LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
  56. LODOP.ADD_PRINT_TEXT(71,3,135,15,"Mfr P/N:"+printRow.partNo);
  57. LODOP.SET_PRINT_STYLEA(0,"FontSize",6);
  58. LODOP.ADD_PRINT_BARCODE(84,3,65,20,"128A",printRow.partNo);
  59. LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
  60. LODOP.ADD_PRINT_TEXT(105,3,135,15,"Date Code:"+printRow.dateCode);
  61. LODOP.SET_PRINT_STYLEA(0,"FontSize",7);
  62. LODOP.ADD_PRINT_BARCODE(118,3,135,20,"128A",printRow.dateCode);
  63. LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
  64. LODOP.ADD_PRINT_TEXT(139,3,135,15,"Lot NO:"+printRow.finalRollNo);
  65. LODOP.SET_PRINT_STYLEA(0,"FontSize",6);
  66. LODOP.ADD_PRINT_BARCODE(152,3,130,20,"128A",printRow.finalRollNo);
  67. LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
  68. LODOP.ADD_PRINT_TEXT(173,3,135,15,"PKG ID:"+printRow.pkcId);
  69. LODOP.SET_PRINT_STYLEA(0,"FontSize",6);
  70. LODOP.ADD_PRINT_BARCODE(186,5,135,20,"128A",printRow.pkcId);
  71. LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
  72. //二维码以及下面的部分
  73. LODOP.ADD_PRINT_BARCODE(208,3,105,105,"QRCode",printRow.customerPartNo+","+printRow.standardRollQty+","+printRow.partNo +","+printRow.dateCode+","+printRow.finalRollNo+","+printRow.pkcId);
  74. LODOP.ADD_PRINT_TEXT(280,3,80,15,printRow.username);
  75. LODOP.SET_PRINT_STYLEA(0,"FontSize",7);
  76. LODOP.ADD_PRINT_TEXT(208,82,75,20,"Rev:"+printRow.revNo);
  77. LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
  78. LODOP.ADD_PRINT_IMAGE(225,75,55,20,"<img src='/img/cclimg.png'>");
  79. LODOP.SET_PRINT_STYLEA(0,"Stretch",1);
  80. LODOP.SET_PRINT_STYLEA(0,"ScalX",0.75);
  81. LODOP.SET_PRINT_STYLEA(0,"ScalY",0.75);
  82. LODOP.ADD_PRINT_TEXT(258,80,30,20,"HF");
  83. LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
  84. //第二部分的标签
  85. LODOP.ADD_PRINT_TEXT(3,130,188,21,"P/N:"+printRow.customerPartNo);
  86. LODOP.SET_PRINT_STYLEA(0,"FontSize",7);
  87. LODOP.ADD_PRINT_BARCODE(16,130,156,15,"128A",printRow.customerPartNo);
  88. LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
  89. LODOP.ADD_PRINT_TEXT(37,130,186,21,"QTY:"+printRow.standardRollQty);
  90. LODOP.SET_PRINT_STYLEA(0,"FontSize",7);
  91. LODOP.ADD_PRINT_BARCODE(50,130,65,15,"128A",printRow.standardRollQty);
  92. LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
  93. LODOP.ADD_PRINT_TEXT(71,130,189,20,"Mfr P/N:"+printRow.partNo);
  94. LODOP.ADD_PRINT_BARCODE(84,130,161,15,"128A",printRow.partNo);
  95. LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
  96. LODOP.ADD_PRINT_TEXT(105,125,190,20,"Date Code:"+printRow.dateCode);
  97. LODOP.ADD_PRINT_BARCODE(118,125,132,15,"128A",printRow.dateCode);
  98. LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
  99. LODOP.ADD_PRINT_TEXT(139,130,185,15,"Lot NO:"+printRow.finalRollNo);
  100. LODOP.SET_PRINT_STYLEA(0,"FontSize",7);
  101. LODOP.ADD_PRINT_BARCODE(152,130,185,20,"128A",printRow.finalRollNo);
  102. LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
  103. LODOP.ADD_PRINT_TEXT(173,130,192,20,"PKG ID:"+printRow.pkcId);
  104. LODOP.SET_PRINT_STYLEA(0,"FontSize",7);
  105. LODOP.ADD_PRINT_BARCODE(186,130,168,15,"128A",printRow.pkcId);
  106. LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
  107. LODOP.ADD_PRINT_BARCODE(208,141,105,105,"QRCode",printRow.customerPartNo+","+printRow.standardRollQty+","+printRow.partNo +","+printRow.dateCode+","+printRow.finalRollNo+","+printRow.pkcId);
  108. LODOP.ADD_PRINT_TEXT(280,141,117,15,printRow.username);
  109. LODOP.SET_PRINT_STYLEA(0,"FontSize",7);
  110. LODOP.ADD_PRINT_TEXT(208,220,75,20,"Rev:"+printRow.revNo);
  111. LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
  112. LODOP.ADD_PRINT_IMAGE(225,220,55,20,"<img src='/img/cclimg.png'>");
  113. LODOP.SET_PRINT_STYLEA(0,"Stretch",1);
  114. LODOP.ADD_PRINT_TEXT(258,220,30,20,"HF");
  115. LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
  116. //第二部分右侧的部分
  117. LODOP.ADD_PRINT_BARCODE(4,300,110,80,"QRCode",printRow.finalRollNo);
  118. LODOP.ADD_PRINT_TEXT(73,261,100,15,printRow.finalRollNo);
  119. LODOP.SET_PRINT_STYLEA(0,"FontSize",7);
  120. LODOP.SET_PRINT_STYLEA(0,"Alignment",3);
  121. LODOP.ADD_PRINT_TEXT(105,260,100,25,printRow.status);
  122. LODOP.SET_PRINT_STYLEA(0,"FontSize",11);
  123. LODOP.SET_PRINT_STYLEA(0,"Alignment",3);
  124. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  125. }