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

125 lines
6.1 KiB

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