printcode_see.html 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. {Template header}
  2. <body>
  3. <div class="warp">
  4. <div class="fixed">
  5. <ul class="search">
  6. <li>条码:<input value="" name="number" type="text"></li>
  7. <li>标签:<input value="" name="label" type="text" style="width:250px;"></li>
  8. <li>打印状态:<select name="print" class="select">
  9. <option value="">全部</option>
  10. <option value="0">未打印</option>
  11. <option value="1">已打印</option>
  12. </select></li>
  13. <li>
  14. 时间筛选:<select name="xztime" class="select">
  15. <option value="addtime">导入时间</option>
  16. <option value="time">打印时间</option>
  17. </select>
  18. </li>
  19. <li><input id="timetk" value="{date('Y-m-d',time()-30*24*3600)} 0:00" name="timetk" type="text" onClick="laydate({istime: true,format:'YYYY-MM-DD hh:mm'})" readonly>
  20. 至&nbsp;&nbsp;&nbsp;&nbsp; <input id="timetj" value="{date('Y-m-d',time()+24*3600)} 0:00" name="timetj" type="text" onClick="laydate({istime: true,format:'YYYY-MM-DD hh:mm'})" readonly></li>
  21. <li><span>确 定</span></li>
  22. </ul>
  23. <div class="control zjcz">
  24. <div class="tabprint">
  25. <select name="printer" class="select" style="width:220px;">
  26. <option value="">选择打印机</option>
  27. </select>
  28. </div>
  29. <!-- <a href="javascript:void(0);" class="bbprint">打 印</a>-->
  30. </div>
  31. <table class="datatitle data" border="0" style="border-collapse:collapse;">
  32. <tr>
  33. <td><label onClick="swapCheck()"><input name="checkbox" type="checkbox" class="regular-checkbox"></label></td>
  34. <td>产品名称</td>
  35. <td>条码</td>
  36. <td>标签</td>
  37. <td>标签2</td>
  38. <td>数量</td>
  39. <td>打印时间</td>
  40. <td>导入时间</td>
  41. <td>操作</td>
  42. </tr>
  43. </table>
  44. </div>
  45. <table class="datatext data" border="0" style="border-collapse:collapse;">
  46. </table>
  47. <div class="bomf"></div>
  48. </div>
  49. <div class="print none"></div>
  50. <div class="ts"><p class="tsn"></p></div>
  51. <div class="wigprintk">
  52. <div>
  53. <p></p>
  54. <p><font class="wigprintqd">确 定</font></p>
  55. </div>
  56. </div>
  57. <div class="tyrows"><div><p></p><p></p></div></div>
  58. <div class="list"><div><p>操作配置</p><ul class="fj"></ul><em></em></div></div>
  59. <audio id="music_d">
  60. <source src="{$theme}music/d.mp3" type="audio/mpeg">
  61. </audio>
  62. <audio id="music_c">
  63. <source src="{$theme}music/c.mp3" type="audio/mpeg">
  64. </audio>
  65. <audio id="music_print">
  66. <source src="{$theme}music/print.mp3" type="audio/mpeg">
  67. </audio>
  68. <audio id="music_print_error">
  69. <source src="{$theme}music/print_error.mp3" type="audio/mpeg">
  70. </audio>
  71. <audio id="music_print_ok">
  72. <source src="{$theme}music/print_ok.mp3" type="audio/mpeg">
  73. </audio>
  74. <span id="job" class="none"></span>
  75. <span id="site" class="none"></span>
  76. <span class="none">
  77. <input id="upload-file" name="files" accept="image/xls,image/xlsx" type="file">
  78. </span>
  79. <script>
  80. var dataurl = "/printcode/see";var fdataurl = "/printcode/see";var printurl = "/printcode/print/"; var jcprint = 1;//是否检测打印1检测2不检测
  81. function dyfs(data)
  82. {
  83. wprinter.printcode(data);//打印方式
  84. }
  85. var sysprint = 1;
  86. var customon = 1;
  87. function custom(){
  88. $(".data tr").each(function() {
  89. $(this).find('td:eq(0)').css("width","1%");
  90. $(this).find('td:eq(2)').css("width","8%");
  91. $(this).find('td:eq(5)').css("width","6%");
  92. $(this).find('td:eq(5)').css("width","4%");
  93. $(this).find('td:eq(6)').css("width","8%");
  94. $(this).find('td:eq(7)').css("width","8%");
  95. $(this).find('td:eq(8)').css("width","5%");
  96. });}
  97. window.onload = function() {
  98. if(typeof $("select[name='printer']").length < 1) return;
  99. setTimeout(function(){ wprinter.printer()},1000);};
  100. $(".amazondrexcel").click(function() {
  101. var dr = $(this);
  102. $("#upload-file").click();
  103. $("#upload-file").unbind("change");
  104. $("#upload-file").bind("change",function(){
  105. amazondrexcel(dr);
  106. layx.load('loadId','导入中,请稍后',{shadable:0.6});
  107. });
  108. });
  109. function amazondrexcel(dr){
  110. var file = document.getElementById("upload-file").files[0];
  111. var data = new FormData();
  112. data.append("userfile",file);
  113. $.ajax({
  114. data : data,
  115. type : "POST",
  116. url : "/printcode/addexcel/",
  117. cache : false,
  118. contentType : false,
  119. processData : false,
  120. dataType:"json",
  121. success: function(a) {
  122. layx.destroy('loadId');
  123. if (a && a.success) {
  124. if(a.error == 1)
  125. {
  126. errora(a);
  127. }
  128. else
  129. {
  130. errorb(a);
  131. }
  132. } else {
  133. errorc(a);
  134. }
  135. }
  136. });
  137. }
  138. $(".datatext").on('click', ".amazonbarprint", function() {
  139. if ($("select[name='printer']").children("option:selected").val() == "") {
  140. $(".ts p").html("请选择打印机!");
  141. $(".ts").show();
  142. setTimeout('$(".ts").fadeOut()', 1000);
  143. } else {
  144. var id = $(this).data("id");
  145. var num = $(this).data("num");
  146. $(".wigprintk div p:eq(0)").html('选择打印数量:<input value="'+num+'" name="sl" type="text" style="width:50px;height: 26px;color: #333;border: 1px #ccc solid;font-size: 13px;text-align: center;border-radius: 5px;">');
  147. $(".wigprintk div p:eq(1)").html("<p><font id='printcode' data-id='"+id+"'>确 定</font><font class='esc'>取 消</font></p>");
  148. $(".wigprintk").show();
  149. }
  150. });
  151. $(".wigprintk").on('click', "#printcode", function() {
  152. var sl = $(".wigprintk div p:eq(0) input").val();
  153. $(".wigprintk").hide();
  154. $(".wigprintk div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> &nbsp; 正在处理打印信息,请稍后...");
  155. $(".wigprintk div p:eq(1)").html("");
  156. $(".wigprintk").show();
  157. var tf = $("select[name='print']").children("option:selected").val();
  158. var list = $(this).data("id");
  159. $.ajax({
  160. url: printurl,
  161. data: "s=" + list + "&n=" + 0 + "&sl=" + sl,
  162. type: "POST",
  163. dataType: "json",
  164. timeout: 60001,
  165. success: function(c) {
  166. if (c.success) {
  167. dyfs(c.rows);
  168. if (c.rows['n'] > -1) {
  169. azsite(c.rows['n'],c.rows['data'], c.rows['number'], 1, 0);
  170. } else {
  171. azsite(1, 1, c.rows['number'], 0, 0);
  172. }
  173. } else {
  174. $(".wigprintk").hide();
  175. layx.alert('错误', c.msg, function(id, button) {
  176. $(".search span").click();
  177. }, { dialogIcon: 'error' });
  178. }
  179. },
  180. error: function(textStatus) {
  181. wprinter.sound("错误,请求数据超时!请重试")
  182. $(".wigprintk").hide();
  183. layx.alert('错误', '请求数据超时!请重试', function(id, button) {
  184. $(".search span").click();
  185. }, { dialogIcon: 'error' });
  186. },
  187. });
  188. });
  189. $(".wigprintk").on('click', ".esc", function() {
  190. $(".wigprintk").hide();
  191. });
  192. function azsite(num, list, number, data, i) {
  193. var jobsite = $("#site").html();
  194. if (jobsite == '0') {
  195. $("#job").html("");
  196. $("#site").html("");
  197. if (data == '1') {
  198. var tf = $("select[name='print']").children("option:selected").val();
  199. wpajax(num, list, tf);
  200. return;
  201. } else {
  202. //wprinter.sound("打印完成")
  203. $(".wigprintk div p:eq(0)").html("打印完成!");
  204. $(".wigprintk div p:eq(1)").html("<font class='esc'>确 定</font>");
  205. $(".wigprintk").show();
  206. return;
  207. }
  208. } else {
  209. if (i < '71') {
  210. if ($("#job").html() != '') {
  211. wprinter.getStatusValue();
  212. }
  213. setTimeout(function() {
  214. azsite(num, list, number, data, i + 1);
  215. }, 300);
  216. return;
  217. } else {
  218. wprinter.sound("打印机异常")
  219. $(".wigprintk div p:eq(0)").html("订单:" + number + " 打印失败!系统已停止打印,请检查打印机!如未出此单,请再次打印");
  220. $(".wigprintk div p:eq(1)").html("<font class='printok'>确 定</font>");
  221. $(".wigprintk").show();
  222. $("#job").html("");
  223. $("#site").html("");
  224. $(".tyrowsout").hide();
  225. $("#orderinfo").val("");
  226. $("#orderinfo").focus();
  227. return;
  228. }
  229. }
  230. }
  231. </script>
  232. <script type="text/javascript" src="{$theme}js/laydate.js"></script>
  233. <script type="text/javascript" src="{$theme}js/print.js?v=202208010002"></script>
  234. {Template footer}