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

211 lines
10 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
10 months ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. /*调用js打印标签*/
  2. import getLodop from '@/utils/LodopFuncs.js'
  3. /*打印材料卷标签*/
  4. export function printOutBoxLabel(printList) {
  5. const LODOP = getLodop()
  6. if (LODOP) {
  7. //LODOP.SET_LICENSES("", "AF8A5800B84BCC5218BCF67B92627BEA", "", "");
  8. LODOP.SET_LICENSES("", "AF8A5800B823CC8E18BCF67B925E7BF0", "", "");
  9. // LODOP.SET_PRINTER_INDEXA(printList[0].printerName);
  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,1500,"");
  15. LODOP.ADD_PRINT_RECT(60,5,551,270,0,1);
  16. LODOP.ADD_PRINT_TEXT(3,35,496,50,printData.siteName );
  17. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial Black");
  18. LODOP.SET_PRINT_STYLEA(0,"FontSize",22);
  19. LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
  20. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  21. LODOP.ADD_PRINT_TEXT(45,25,44,20,"Date:");
  22. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  23. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  24. LODOP.ADD_PRINT_TEXT(44,378,179,25,"IATF: 16949: 2016 CERTIFIED");
  25. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  26. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  27. LODOP.ADD_PRINT_LINE(91,5,90,556,0,1);
  28. LODOP.ADD_PRINT_LINE(121,5,120,556,0,1);
  29. LODOP.ADD_PRINT_LINE(151,5,150,556,0,1);
  30. LODOP.ADD_PRINT_LINE(181,5,180,556,0,1);
  31. LODOP.ADD_PRINT_LINE(241,5,240,556,0,1);
  32. LODOP.ADD_PRINT_LINE(301,5,300,556,0,1);
  33. LODOP.ADD_PRINT_LINE(120,207,60,208,0,1);
  34. LODOP.ADD_PRINT_LINE(330,368,150,369,0,1);
  35. LODOP.ADD_PRINT_LINE(120,57,60,58,0,1);
  36. LODOP.ADD_PRINT_LINE(120,255,60,256,0,1);
  37. LODOP.ADD_PRINT_LINE(120,323,60,324,0,1);
  38. LODOP.ADD_PRINT_LINE(330,234,240,235,0,1);
  39. LODOP.ADD_PRINT_LINE(240,136,120,137,0,1);
  40. LODOP.ADD_PRINT_LINE(90,438,60,439,0,1);
  41. LODOP.ADD_PRINT_LINE(120,438,90,439,0,1);
  42. LODOP.ADD_PRINT_LINE(180,469,150,470,0,1);
  43. LODOP.ADD_PRINT_LINE(330,57,300,58,0,1);
  44. LODOP.ADD_PRINT_LINE(330,290,300,291,0,1);
  45. LODOP.ADD_PRINT_LINE(330,435,300,436,0,1);
  46. LODOP.ADD_PRINT_TEXT(67,15,47,24,"P/N:");
  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,215,46,27,"REV");
  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,327,121,25,"Vendor Code");
  55. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  56. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  57. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  58. LODOP.ADD_PRINT_TEXT(97,15,46,24,"P/O:");
  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(97,210,51,25,"Q.T.Y");
  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(97,353,69,25,"Carton");
  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(97,488,36,25,"OF");
  71. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  72. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  73. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  74. LODOP.ADD_PRINT_TEXT(126,9,141,25,"Part Description");
  75. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  76. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  77. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  78. LODOP.ADD_PRINT_TEXT(157,9,118,25,"Material Cert.");
  79. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  80. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  81. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  82. LODOP.ADD_PRINT_TEXT(307,16,44,25,"P/N");
  83. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  84. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  85. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  86. LODOP.ADD_PRINT_TEXT(191,83,44,40,"P/ONo.");
  87. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  88. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  89. LODOP.SET_PRINT_STYLEA(0,"Alignment",3);
  90. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  91. LODOP.ADD_PRINT_TEXT(307,237,58,25,"Q.T.Y");
  92. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  93. LODOP.SET_PRINT_STYLEA(0,"FontSize",13);
  94. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  95. LODOP.ADD_PRINT_TEXT(307,369,82,26,"Batch No");
  96. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  97. LODOP.SET_PRINT_STYLEA(0,"FontSize",11);
  98. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  99. LODOP.ADD_PRINT_TEXT(69,63,149,25,printData.partSpec);
  100. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  101. LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
  102. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  103. LODOP.ADD_PRINT_TEXT(45,60,173,20,printData.receiveDate);
  104. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  105. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  106. LODOP.ADD_PRINT_TEXT(45,255,173,20,printData.keyInfoStr2);
  107. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  108. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  109. LODOP.ADD_PRINT_TEXT(67,253,76,25,printData.partRevNo);
  110. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  111. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  112. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  113. LODOP.ADD_PRINT_TEXT(67,443,115,25,printData.endCustVendorCode);
  114. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  115. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  116. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  117. LODOP.ADD_PRINT_TEXT(98,63,147,25,printData.customerPONo);
  118. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  119. LODOP.SET_PRINT_STYLEA(0,"FontSize",11);
  120. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  121. LODOP.ADD_PRINT_TEXT(98,252,70,25,printData.unitQty);
  122. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  123. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  124. LODOP.SET_PRINT_STYLEA(0,"Alignment",3);
  125. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  126. LODOP.ADD_PRINT_TEXT(126,137,421,25,printData.partDesc);
  127. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  128. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  129. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  130. LODOP.ADD_PRINT_TEXT(156,140,233,25,printData.mATERIALTYPE);
  131. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  132. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  133. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  134. LODOP.ADD_PRINT_TEXT(97,446,38,25,printData.keyInfoInt1);
  135. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  136. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  137. LODOP.SET_PRINT_STYLEA(0,"Alignment",3);
  138. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  139. LODOP.ADD_PRINT_TEXT(97,516,43,25,printData.keyInfoInt2);
  140. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  141. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  142. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  143. if(printData.iconInfo!=''&&printData.iconInfo!=null) {
  144. // LODOP.ADD_PRINT_IMAGE(185,425,99,50, "<img src='http://192.168.1.83:81/upload/A.jpg'/>");
  145. LODOP.ADD_PRINT_IMAGE(188,9,77,46, "<img src='http://192.168.2.172:80/print/" + printData.iconInfo + ".jpg'/>");
  146. LODOP.SET_PRINT_STYLEA(0,"Stretch",2);
  147. }
  148. if(printData.code=='CODE128') {
  149. LODOP.ADD_PRINT_BARCODE(189,146,224,46,"128A",printData.customerPONo);
  150. if(printData.contractNo!=''&&printData.contractNo!=null){
  151. LODOP.ADD_PRINT_BARCODE(189,373,180,46,"128A",printData.contractNo);
  152. }
  153. LODOP.ADD_PRINT_BARCODE(248,13,214,46,"128A",printData.partSpec);
  154. LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
  155. LODOP.ADD_PRINT_BARCODE(248,240,120,46,"128A",printData.unitQty);
  156. LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
  157. LODOP.ADD_PRINT_BARCODE(248,372,179,46,"128A",printData.batchNo);
  158. LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
  159. }else {
  160. LODOP.ADD_PRINT_BARCODE(189,146,219,46,"Code39",printData.customerPONo);
  161. if(printData.contractNo!=''&&printData.contractNo!=null){
  162. LODOP.ADD_PRINT_BARCODE(189,373,180,46,"Code39",printData.contractNo);
  163. }
  164. LODOP.ADD_PRINT_BARCODE(248,13,214,46,"Code39",printData.partSpec);
  165. LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
  166. LODOP.ADD_PRINT_BARCODE(248,240,120,46,"Code39",printData.unitQty);
  167. LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
  168. LODOP.ADD_PRINT_BARCODE(248,372,179,46,"Code39",printData.batchNo);
  169. LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
  170. }
  171. LODOP.ADD_PRINT_TEXT(307,64,170,25,printData.partSpec);
  172. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  173. LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
  174. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  175. LODOP.ADD_PRINT_TEXT(307,304,70,25,printData.unitQty);
  176. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  177. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  178. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  179. LODOP.ADD_PRINT_TEXT(308,439,121,25,printData.batchNo);
  180. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  181. LODOP.SET_PRINT_STYLEA(0,"FontSize",11);
  182. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  183. LODOP.ADD_PRINT_TEXT(333,11,540,20,"Manufactured by "+ printData.siteName);
  184. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  185. // LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  186. LODOP.ADD_PRINT_TEXT(348,11,548,35,printData.siteDetail);
  187. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  188. LODOP.SET_PRINT_STYLEA(0,"FontSize",7);
  189. LODOP.ADD_PRINT_TEXT(157,370,105,25,printData.hARDNESS);
  190. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  191. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  192. LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
  193. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  194. LODOP.ADD_PRINT_TEXT(157,471,121,25,printData.cOLOR);
  195. LODOP.SET_PRINT_STYLEA(0,"FontName","Arial");
  196. LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
  197. LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
  198. LODOP.SET_PRINT_STYLEA(0,"Bold",1);
  199. LODOP.ADD_PRINT_LINE(240,88,180,89,0,1);
  200. // LODOP.SET_PRINT_STYLEA(1,"AngleOfPageInside",-90);
  201. }
  202. // LODOP.PRINT_DESIGN();
  203. LODOP.PREVIEW();
  204. // LODOP.PRINT();
  205. console.log("操作成功!")
  206. }
  207. }