赫艾前端
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.

128 lines
6.2 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. /*调用js打印标签*/
  2. import getLodop from '@/utils/LodopFuncs.js'
  3. /*打印材料卷标签*/
  4. export function printTCPPackageLabelNoPreview(printList) {
  5. const LODOP = getLodop()
  6. if (LODOP) {
  7. //LODOP.SET_LICENSES("", "AF8A5800B84BCC5218BCF67B92627BEA", "", "");
  8. LODOP.SET_LICENSES("", "AF8A5800B823CC8E18BCF67B925E7BF0", "", "");
  9. // LODOP.SET_PRINTER_INDEXA("小标签打印机");
  10. //循环调用打印机
  11. for(let i = 0; i < printList.length; i++){
  12. let printData = printList[i];
  13. LODOP.NewPage();
  14. LODOP.SET_PRINT_PAGESIZE(0,1000,700,"");
  15. // LODOP.ADD_PRINT_BARCODE(133,286,130,88,"QRCode",printData.partSpec);
  16. LODOP.ADD_PRINT_BARCODE(133,286,130,88,"QRCode",`${printData.site};${printData.partNo};${printData.unitQty};${printData.seqNo};${printData.printId};${isNaN(printData.tcpValue)?'':printData.tcpValue}`);
  17. LODOP.ADD_PRINT_TEXT(93,18,123,25,"Product No:");
  18. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  19. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  20. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  21. LODOP.ADD_PRINT_TEXT(94,141,241,25,printData.partSpec);
  22. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  23. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  24. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  25. LODOP.ADD_PRINT_TEXT(153,18,128,24,"Cust.P/O:");
  26. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  27. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  28. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  29. LODOP.ADD_PRINT_TEXT(153,141,145,25,printData.orderRef4);
  30. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  31. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  32. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  33. LODOP.ADD_PRINT_TEXT(115,18,58,25,"FQC:");
  34. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  35. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  36. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  37. LODOP.ADD_PRINT_TEXT(115,60,81,25,printData.inspector);
  38. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  39. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  40. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  41. LODOP.ADD_PRINT_TEXT(175,18,125,25,"MFG Lot:");
  42. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  43. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  44. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  45. LODOP.ADD_PRINT_TEXT(175,141,142,25,printData.batchNo);
  46. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  47. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  48. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  49. LODOP.ADD_PRINT_TEXT(67,18,121,25,"Product Desc:");
  50. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  51. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  52. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  53. LODOP.ADD_PRINT_TEXT(67,141,243,24,printData.partDesc);
  54. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  55. LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
  56. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  57. LODOP.SET_PRINT_STYLEA(0,"LineSpacing",-5);
  58. LODOP.ADD_PRINT_TEXT(197,18,128,25,"MFG Date:");
  59. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  60. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  61. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  62. LODOP.ADD_PRINT_TEXT(197,141,144,25,printData.receiveDate);
  63. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  64. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  65. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  66. LODOP.ADD_PRINT_TEXT(216,18,191,19,"Manufactured by "+printData.keyInfoStr2);
  67. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  68. LODOP.SET_PRINT_STYLEA(0,"FontSize",7);
  69. LODOP.ADD_PRINT_TEXT(24,212,149,20,"IATF:16949 Certified");
  70. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  71. LODOP.SET_PRINT_STYLEA(0,"FontSize",7);
  72. LODOP.SET_PRINT_STYLEA(0,"Alignment",3);
  73. LODOP.ADD_PRINT_TEXT(135,18,58,25,"Q.T.Y:");
  74. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  75. LODOP.SET_PRINT_STYLEA(0,"FontSize",11);
  76. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  77. LODOP.ADD_PRINT_LINE(37,12,36,364,0,1);
  78. LODOP.ADD_PRINT_LINE(216,12,215,364,0,1);
  79. LODOP.ADD_PRINT_TEXT(135,141,120,25,printData.unitQty + printData.umid);
  80. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  81. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  82. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  83. LODOP.ADD_PRINT_TEXT(217,243,130,20,"Vendor I.D.:"+printData.siteName);
  84. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  85. LODOP.SET_PRINT_STYLEA(0,"FontSize",7);
  86. LODOP.ADD_PRINT_TEXT(228,18,348,30,printData.siteAdress);
  87. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  88. LODOP.SET_PRINT_STYLEA(0,"FontSize",7);
  89. LODOP.ADD_PRINT_TEXT(250,18,351,20,printData.sitePhone);
  90. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  91. LODOP.SET_PRINT_STYLEA(0,"FontSize",7);
  92. LODOP.ADD_PRINT_TEXT(41,18,143,25,"Product Code:");
  93. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  94. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  95. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  96. LODOP.ADD_PRINT_TEXT(115,141,146,26,"Job No:"+printData.seqNo);
  97. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  98. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  99. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  100. LODOP.ADD_PRINT_TEXT(115,274,99,25,"BAG:"+printData.tcpValue+"g");
  101. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  102. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  103. LODOP.SET_PRINT_STYLEA(0,"Alignment",3);
  104. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  105. LODOP.ADD_PRINT_TEXT(92,274,99,25,"SN:"+printData.printId);
  106. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  107. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  108. LODOP.SET_PRINT_STYLEA(0,"Alignment",3);
  109. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  110. if(printData.code=='CODE128') {
  111. LODOP.ADD_PRINT_BARCODE(40,143,236,23, "128A",printData.partSpec);
  112. }else {
  113. LODOP.ADD_PRINT_BARCODE(40,143,236,23, "Code39",printData.partSpec);
  114. }
  115. LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
  116. // LODOP.ADD_PRINT_IMAGE(4,18,114,31,"<img src='http://192.168.1.83:81/upload/AMLogo.jpg'/>");
  117. LODOP.ADD_PRINT_IMAGE(4,18,114,31,`<img src='http://192.168.2.172:80/print/${printData.keyInfoStr1}'/>`);
  118. // LODOP.ADD_PRINT_IMAGE(4,18,114,31,`<img src='http://192.168.1.83:81/upload/${printData.keyInfoStr1}'/>`);
  119. LODOP.SET_PRINT_STYLEA(0,"Stretch",1);
  120. }
  121. // LODOP.PRINT_DESIGN();
  122. // LODOP.PREVIEW();
  123. LODOP.PRINT();
  124. console.log("操作成功!")
  125. }
  126. }