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

212 lines
10 KiB

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