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

133 lines
6.5 KiB

1 year ago
5 months ago
1 year ago
  1. /*调用js打印标签*/
  2. import getLodop from '@/utils/LodopFuncs.js'
  3. import { buildPrintImageUrl, applyLodopLicenses } from '@/utils/runtimeSiteConfig.js'
  4. /*打印材料卷标签*/
  5. export function printPackageLabelNoPreview(printList) {
  6. const LODOP = getLodop()
  7. if (LODOP) {
  8. applyLodopLicenses(LODOP);
  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,123,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,63,76,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(115,141,146,26,"Job No:"+printData.seqNo);
  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,18,125,25,"MFG Lot:");
  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(175,141,142,25,printData.batchNo);
  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,18,121,25,"Product Desc:");
  54. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  55. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  56. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  57. LODOP.ADD_PRINT_TEXT(67,141,243,24,printData.partDesc);
  58. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  59. LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
  60. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  61. LODOP.SET_PRINT_STYLEA(0,"LineSpacing",-5);
  62. LODOP.ADD_PRINT_TEXT(197,18,128,25,"MFG Date:");
  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(197,141,144,25,printData.receiveDate);
  67. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  68. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  69. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  70. LODOP.ADD_PRINT_TEXT(216,18,191,19,"Manufactured by "+printData.keyInfoStr2);
  71. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  72. LODOP.SET_PRINT_STYLEA(0,"FontSize",7);
  73. LODOP.ADD_PRINT_TEXT(24,212,149,20,"IATF:16949 Certified");
  74. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  75. LODOP.SET_PRINT_STYLEA(0,"FontSize",7);
  76. LODOP.SET_PRINT_STYLEA(0,"Alignment",3);
  77. LODOP.ADD_PRINT_TEXT(135,18,58,25,"Q.T.Y:");
  78. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  79. LODOP.SET_PRINT_STYLEA(0,"FontSize",11);
  80. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  81. LODOP.ADD_PRINT_LINE(37,12,36,364,0,1);
  82. LODOP.ADD_PRINT_LINE(216,12,215,364,0,1);
  83. LODOP.ADD_PRINT_TEXT(135,141,120,25,printData.unitQty + printData.umid);
  84. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  85. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  86. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  87. LODOP.ADD_PRINT_TEXT(217,243,130,20,"Vendor I.D.:"+printData.siteName);
  88. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  89. LODOP.SET_PRINT_STYLEA(0,"FontSize",7);
  90. LODOP.ADD_PRINT_TEXT(228,18,348,30,printData.siteAdress);
  91. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  92. LODOP.SET_PRINT_STYLEA(0,"FontSize",7);
  93. LODOP.ADD_PRINT_TEXT(250,18,351,20,printData.sitePhone);
  94. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  95. LODOP.SET_PRINT_STYLEA(0,"FontSize",7);
  96. LODOP.ADD_PRINT_TEXT(41,18,143,25,"Product Code:");
  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(113,229,144,26,"Job No:"+printData.seqNo);
  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(113,229,144,26,"BAG:"+printData.tcpValue+"g");
  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. LODOP.ADD_PRINT_TEXT(92,257,99,25,"SN:"+printData.printId);
  111. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  112. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  113. LODOP.SET_PRINT_STYLEA(0,"Alignment",3);
  114. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  115. if(printData.code==='CODE128') {
  116. LODOP.ADD_PRINT_BARCODE(40,143,236,23, "128A",printData.partSpec);
  117. }else {
  118. LODOP.ADD_PRINT_BARCODE(40,143,236,23, "Code39",printData.partSpec);
  119. }
  120. LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
  121. // LODOP.ADD_PRINT_IMAGE(4,18,114,31,"<img src='http://192.168.1.83:81/upload/AMLogo.jpg'/>");
  122. LODOP.ADD_PRINT_IMAGE(4,18,114,31,`<img src='${buildPrintImageUrl(printData.keyInfoStr1)}'/>`);
  123. // LODOP.ADD_PRINT_IMAGE(4,18,114,31,`<img src='http://192.168.1.83:81/upload/${printData.keyInfoStr1}'/>`);
  124. LODOP.SET_PRINT_STYLEA(0,"Stretch",1);
  125. }
  126. // LODOP.PRINT_DESIGN();
  127. LODOP.PREVIEW();
  128. // LODOP.PRINT();
  129. // console.log("操作成功!")
  130. }
  131. }