amazonbarcode_see.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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>标签2</td>
  37. <td>数量</td>
  38. <td>打印时间</td>
  39. <td>导入时间</td>
  40. <td>操作</td>
  41. </tr>
  42. </table>
  43. </div>
  44. <table class="datatext data" border="0" style="border-collapse:collapse;">
  45. </table>
  46. <div class="bomf"></div>
  47. </div>
  48. <div class="print none"></div>
  49. <div class="ts"><p class="tsn"></p></div>
  50. <div class="wigprintk">
  51. <div>
  52. <p></p>
  53. <p><font class="wigprintqd">确 定</font></p>
  54. </div>
  55. </div>
  56. <div class="tyrows"><div><p></p><p></p></div></div>
  57. <div class="list"><div><p>操作配置</p><ul class="fj"></ul><em></em></div></div>
  58. <audio id="music_d">
  59. <source src="{$theme}music/d.mp3" type="audio/mpeg">
  60. </audio>
  61. <audio id="music_c">
  62. <source src="{$theme}music/c.mp3" type="audio/mpeg">
  63. </audio>
  64. <audio id="music_print">
  65. <source src="{$theme}music/print.mp3" type="audio/mpeg">
  66. </audio>
  67. <audio id="music_print_error">
  68. <source src="{$theme}music/print_error.mp3" type="audio/mpeg">
  69. </audio>
  70. <audio id="music_print_ok">
  71. <source src="{$theme}music/print_ok.mp3" type="audio/mpeg">
  72. </audio>
  73. <span id="job" class="none"></span>
  74. <span id="site" class="none"></span>
  75. <span class="none">
  76. <input id="upload-file" name="files" accept="image/xls,image/xlsx" type="file">
  77. </span>
  78. <script>
  79. var dataurl = "/amazonbarcode/see";var fdataurl = "/amazonbarcode/see";var printurl = "/amazonbarcode/print/"; var jcprint = 1;//是否检测打印1检测2不检测
  80. function dyfs(data)
  81. {
  82. wprinter.amazonbarcode(data);//打印方式
  83. }
  84. var sysprint = 1;
  85. var customon = 1;
  86. function custom(){
  87. $(".data tr").each(function() {
  88. $(this).find('td:eq(0)').css("width","1%");
  89. $(this).find('td:eq(2)').css("width","8%");
  90. $(this).find('td:eq(4)').css("width","4%");
  91. $(this).find('td:eq(5)').css("width","8%");
  92. $(this).find('td:eq(6)').css("width","8%");
  93. $(this).find('td:eq(7)').css("width","8%");
  94. $(this).find('td:eq(8)').css("width","5%");
  95. });}
  96. window.onload = function() {
  97. if(typeof $("select[name='printer']").length < 1) return;
  98. setTimeout(function(){ wprinter.printer()},1000);};
  99. $(".amazondrexcel").click(function() {
  100. var dr = $(this);
  101. $("#upload-file").click();
  102. $("#upload-file").unbind("change");
  103. $("#upload-file").bind("change",function(){
  104. amazondrexcel(dr);
  105. layx.load('loadId','导入中,请稍后',{shadable:0.6});
  106. });
  107. });
  108. function amazondrexcel(dr){
  109. var file = document.getElementById("upload-file").files[0];
  110. var data = new FormData();
  111. data.append("userfile",file);
  112. $.ajax({
  113. data : data,
  114. type : "POST",
  115. url : "/amazonbarcode/addexcel/",
  116. cache : false,
  117. contentType : false,
  118. processData : false,
  119. dataType:"json",
  120. success: function(a) {
  121. layx.destroy('loadId');
  122. if (a && a.success) {
  123. if(a.error == 1)
  124. {
  125. errora(a);
  126. }
  127. else
  128. {
  129. errorb(a);
  130. }
  131. } else {
  132. errorc(a);
  133. }
  134. }
  135. });
  136. }
  137. $(".datatext").on('click', ".amazonbarprint", function() {
  138. if ($("select[name='printer']").children("option:selected").val() == "") {
  139. $(".ts p").html("请选择打印机!");
  140. $(".ts").show();
  141. setTimeout('$(".ts").fadeOut()', 1000);
  142. } else {
  143. var id = $(this).data("id");
  144. var num = $(this).data("num");
  145. $(".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;">');
  146. $(".wigprintk div p:eq(1)").html("<p><font id='amazonbarprinton' data-id='"+id+"'>确 定</font><font class='esc'>取 消</font></p>");
  147. $(".wigprintk").show();
  148. }
  149. });
  150. $(".wigprintk").on('click', "#amazonbarprinton", function() {
  151. var sl = $(".wigprintk div p:eq(0) input").val();
  152. $(".wigprintk").hide();
  153. $(".wigprintk div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> &nbsp; 正在处理打印信息,请稍后...");
  154. $(".wigprintk div p:eq(1)").html("");
  155. $(".wigprintk").show();
  156. var tf = $("select[name='print']").children("option:selected").val();
  157. var list = $(this).data("id");
  158. $.ajax({
  159. url: printurl,
  160. data: "s=" + list + "&n=" + 0 + "&sl=" + sl,
  161. type: "POST",
  162. dataType: "json",
  163. timeout: 60001,
  164. success: function(c) {
  165. if (c.success) {
  166. dyfs(c.rows);
  167. if (c.rows['n'] > -1) {
  168. azsite(c.rows['n'],c.rows['data'], c.rows['number'], 1, 0);
  169. } else {
  170. azsite(1, 1, c.rows['number'], 0, 0);
  171. }
  172. } else {
  173. $(".wigprintk").hide();
  174. layx.alert('错误', c.msg, function(id, button) {
  175. $(".search span").click();
  176. }, { dialogIcon: 'error' });
  177. }
  178. },
  179. error: function(textStatus) {
  180. wprinter.sound("错误,请求数据超时!请重试")
  181. $(".wigprintk").hide();
  182. layx.alert('错误', '请求数据超时!请重试', function(id, button) {
  183. $(".search span").click();
  184. }, { dialogIcon: 'error' });
  185. },
  186. });
  187. });
  188. // 美仓打印
  189. $(".datatext").on('click', ".usaamazonbarprint", function() {
  190. if ($("select[name='printer']").children("option:selected").val() == "") {
  191. $(".ts p").html("请选择打印机!");
  192. $(".ts").show();
  193. setTimeout('$(".ts").fadeOut()', 1000);
  194. } else {
  195. var id = $(this).data("id");
  196. var num = $(this).data("num");
  197. $(".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;">');
  198. $(".wigprintk div p:eq(1)").html("<p><font id='usaamazonbarprinton' data-id='"+id+"'>确 定</font><font class='esc'>取 消</font></p>");
  199. $(".wigprintk").show();
  200. }
  201. });
  202. $(".wigprintk").on('click', "#usaamazonbarprinton", function() {
  203. var sl = $(".wigprintk div p:eq(0) input").val();
  204. $(".wigprintk").hide();
  205. $(".wigprintk div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> &nbsp; 正在处理打印信息,请稍后...");
  206. $(".wigprintk div p:eq(1)").html("");
  207. $(".wigprintk").show();
  208. var tf = $("select[name='print']").children("option:selected").val();
  209. var list = $(this).data("id");
  210. $.ajax({
  211. url: '/amazonbarcode/usaprint/',
  212. data: "s=" + list + "&n=" + 0 + "&sl=" + sl,
  213. type: "POST",
  214. dataType: "json",
  215. timeout: 60001,
  216. success: function(c) {
  217. if (c.success) {
  218. wprinter.usaamazonbarcode(c.rows);
  219. if (c.rows['n'] > -1) {
  220. azsite(c.rows['n'],c.rows['data'], c.rows['number'], 1, 0);
  221. } else {
  222. azsite(1, 1, c.rows['number'], 0, 0);
  223. }
  224. } else {
  225. $(".wigprintk").hide();
  226. layx.alert('错误', c.msg, function(id, button) {
  227. $(".search span").click();
  228. }, { dialogIcon: 'error' });
  229. }
  230. },
  231. error: function(textStatus) {
  232. wprinter.sound("错误,请求数据超时!请重试")
  233. $(".wigprintk").hide();
  234. layx.alert('错误', '请求数据超时!请重试', function(id, button) {
  235. $(".search span").click();
  236. }, { dialogIcon: 'error' });
  237. },
  238. });
  239. });
  240. //美仓打印结束
  241. $(".wigprintk").on('click', ".esc", function() {
  242. $(".wigprintk").hide();
  243. });
  244. function azsite(num, list, number, data, i) {
  245. var jobsite = $("#site").html();
  246. if (jobsite == '0') {
  247. $("#job").html("");
  248. $("#site").html("");
  249. if (data == '1') {
  250. var tf = $("select[name='print']").children("option:selected").val();
  251. wpajax(num, list, tf);
  252. return;
  253. } else {
  254. //wprinter.sound("打印完成")
  255. $(".wigprintk div p:eq(0)").html("打印完成!");
  256. $(".wigprintk div p:eq(1)").html("<font class='esc'>确 定</font>");
  257. $(".wigprintk").show();
  258. return;
  259. }
  260. } else {
  261. if (i < '71') {
  262. if ($("#job").html() != '') {
  263. wprinter.getStatusValue();
  264. }
  265. setTimeout(function() {
  266. azsite(num, list, number, data, i + 1);
  267. }, 300);
  268. return;
  269. } else {
  270. wprinter.sound("打印机异常")
  271. $(".wigprintk div p:eq(0)").html("订单:" + number + " 打印失败!系统已停止打印,请检查打印机!如未出此单,请再次打印");
  272. $(".wigprintk div p:eq(1)").html("<font class='printok'>确 定</font>");
  273. $(".wigprintk").show();
  274. $("#job").html("");
  275. $("#site").html("");
  276. $(".tyrowsout").hide();
  277. $("#orderinfo").val("");
  278. $("#orderinfo").focus();
  279. return;
  280. }
  281. }
  282. }
  283. </script>
  284. <script type="text/javascript" src="{$theme}js/laydate.js"></script>
  285. <script type="text/javascript" src="{$theme}js/print.js?v=202208010002"></script>
  286. {Template footer}