print.js 62 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716
  1. /* 批量打印提示 */
  2. $(".printing").click(function() {
  3. var a = "";
  4. $(".datatext input[name='check']:checked").each(function() {
  5. a = a + $(this).val() + ",";
  6. });
  7. if (a) {
  8. if ($("select[name='printer']").children("option:selected").val() == "") {
  9. $(".ts p").html("请选择打印机!");
  10. $(".ts").show();
  11. setTimeout('$(".ts").fadeOut()', 1000);
  12. } else {
  13. $(".systemwindow div p:eq(0)").text("是否确认批量打印所选内容?");
  14. $(".systemwindow div p:eq(1)").html("<p><font id='printingon'>确 定</font><font class='esc'>取 消</font></p>");
  15. $(".systemwindow").show();
  16. }
  17. } else {
  18. $(".ts p").html("请勾选需要打印的内容");
  19. $(".ts").show();
  20. setTimeout('$(".ts").fadeOut()', 1000);
  21. }
  22. });
  23. /* 批量打印开始 */
  24. $(".systemwindow").on('click', "#printingon", function() {
  25. $(".systemwindow").hide();
  26. $(".systemwindow div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> &nbsp; 正在处理打印信息,请稍后...");
  27. $(".systemwindow div p:eq(1)").html("");
  28. $(".systemwindow").show();
  29. var a = "";
  30. var i = 0;
  31. $(".datatext input[name='check']:checked").each(function() {
  32. a = a + $(this).val() + ',';
  33. i++;
  34. });
  35. var tf = $("select[name='print']").children("option:selected").val();
  36. ajax(i - 1, a , tf);
  37. });
  38. function site(num, list, number, data, i) {
  39. var jobsite = $("#site").html();
  40. if (jobsite == '0') {
  41. $("#job").html("");
  42. $("#site").html("");
  43. if (data == '1') {
  44. var tf = $("select[name='print']").children("option:selected").val();
  45. ajax(num, list, tf);
  46. return;
  47. } else if (data == '2') {
  48. $("#music_print_ok")[0].play();
  49. $(".tyrows").hide();
  50. $(".systemwindow").hide();
  51. $("#music_d")[0].play();
  52. $(".systemwindow div p:eq(0)").html('运单打印完成,请更换为新运单后再次操作出库');
  53. $(".systemwindow div p:eq(1)").html("<font class='wcsj'>确 定</font>");
  54. $(".systemwindow").show();
  55. $("#orderinfo").val("");
  56. $("#orderinfo").focus();
  57. } else {
  58. wprinter.sound("打印完成")
  59. $(".systemwindow div p:eq(0)").html("打印完成!");
  60. $(".systemwindow div p:eq(1)").html("<font class='printok'>确 定</font>");
  61. $(".systemwindow").show();
  62. return;
  63. }
  64. } else {
  65. if (i < '71') {
  66. if ($("#job").html() != '') {
  67. wprinter.getStatusValue();
  68. }
  69. setTimeout(function() {
  70. site(num, list, number, data, i + 1);
  71. }, 1500);
  72. return;
  73. } else {
  74. wprinter.sound("打印机异常")
  75. $(".systemwindow div p:eq(0)").html("订单:" + number + " 打印失败!系统已停止打印,请检查打印机!如未出此单,请再次打印");
  76. $(".systemwindow div p:eq(1)").html("<font class='printok'>确 定</font>");
  77. $(".systemwindow").show();
  78. $("#job").html("");
  79. $("#site").html("");
  80. $(".tyrowsout").hide();
  81. $("#orderinfo").val("");
  82. $("#orderinfo").focus();
  83. return;
  84. }
  85. }
  86. }
  87. function ajax(num, list, tf) {
  88. $.ajax({
  89. url: "/systemprint/printing/",
  90. data: "tf=" + tf + "&s=" + list + "&n=" + num,
  91. type: "POST",
  92. dataType: "json",
  93. timeout: 60001,
  94. success: function(c) {
  95. if (c.success) {
  96. if (c.rows['type'] == 1) {
  97. wprinter.pdffhd(c.rows);
  98. } else if (c.rows['type'] == 2) {
  99. wprinter.fhd(c.rows);
  100. }
  101. else if (c.rows['type'] == 4) {
  102. wprinter.thd(c.rows);
  103. }
  104. else if (c.rows['type'] == 5) {
  105. wprinter.pdf2fhd(c.rows);
  106. }else if (c.rows['type'] == 7) {
  107. //alert("获取同时操作以2部打印机的数据"+JSON.stringify(c))
  108. //同时两台打印机 一台打印快递单 一台打打印发票
  109. wprinter.pdffhd(c.rows);
  110. wprinter.fppdf(c.rows);
  111. }
  112. else if (c.rows['type'] == 8) {
  113. wprinter.pdffhdk5(c.rows);
  114. }
  115. if (c.rows['n'] > -1) {
  116. //ajax(c.rows['n'],c.rows['data']);
  117. site(c.rows['n'], c.rows['data'], c.rows['text']['number'], 1, 0);
  118. } else {
  119. if (c.rows['type'] == 3) {
  120. wprinter.sound("有错误订单")
  121. $(".systemwindow div p:eq(0)").html(c.rows['text']['number'] + "资料错误未成功打印,已移交给店员处理");
  122. $(".systemwindow div p:eq(1)").html("<font class='printok'>确 定</font>");
  123. $(".systemwindow").show();
  124. } else {
  125. site(1, 1, c.rows['text']['number'], 0, 0);
  126. }
  127. }
  128. } else {
  129. $(".systemwindow").hide();
  130. layx.alert('错误', c.msg, function(id, button) {
  131. $(".search span").click();
  132. }, { dialogIcon: 'error' });
  133. }
  134. },
  135. error: function(textStatus) {
  136. wprinter.sound("错误,请求数据超时!请重试")
  137. $(".systemwindow").hide();
  138. layx.alert('错误', '请求数据超时!请重试', function(id, button) {
  139. $(".search span").click();
  140. }, { dialogIcon: 'error' });
  141. },
  142. });
  143. }
  144. function outbound(data) {
  145. $(".search .number").val("");
  146. $(".search .waybill").val("");
  147. $.ajax({
  148. url: url + "outbound/",
  149. data: "number=" + $("input[name='outbound']").val() + "&id=" + LYlink + "&type=" + $("select[name='type']").children("option:selected").val() + "&express=" + $("select[name='express']").children("option:selected").val(),
  150. type: "POST",
  151. dataType: "json",
  152. success: function(b) {
  153. searchspan(1);
  154. $(".systemwindow").hide();
  155. if (b && b.success) {
  156. if (b.music == '1') {
  157. $("#music_d")[0].play();
  158. }
  159. $(".outbound").html(b.msg);
  160. $("#outbound").val("");
  161. $("#outbound").focus();
  162. } else {
  163. $("#outbound").blur();
  164. $("#music_c")[0].play();
  165. $(".systemwindow div p:eq(0)").html(b.msg);
  166. $(".systemwindow div p:eq(1)").html("<font class='wcoutbound'>确 定</font>");
  167. $(".systemwindow").show();
  168. $("#outbound").val("");
  169. }
  170. }
  171. });
  172. }
  173. function systembox() {
  174. $.ajax({
  175. url: dataurl + "out/",
  176. data: "number=" + $("input[name='systembox']").val() + "&warehouse=" + $("select[name='warehouse']").children("option:selected").val() + "&systemboxclassid=" + $("select[name='systemboxclassid']").children("option:selected").val(),
  177. type: "POST",
  178. dataType: "json",
  179. success: function(b) {
  180. $(".systemwindow").hide();
  181. if (b && b.success) {
  182. if (b.music == '1') {
  183. $("#music_d")[0].play();
  184. }
  185. $(".systembox").html(b.msg);
  186. $("#systembox").val("");
  187. $("#systembox").focus();
  188. } else {
  189. $("#systembox").blur();
  190. $("#music_c")[0].play();
  191. $(".systemwindow div p:eq(0)").html(b.msg);
  192. $(".systemwindow div p:eq(1)").html("<font class='wcoutboundbox'>确 定</font>");
  193. $(".systemwindow").show();
  194. $("#systembox").val("");
  195. }
  196. }
  197. });
  198. }
  199. function systemboxsh() {
  200. $(".datatext").html("");
  201. if($("input[name='class']").val() == '0')
  202. {
  203. $.ajax({
  204. url: "/systembox/classid/",
  205. data: "systemboxclassid=" + $("input[name='systemboxclassid']").val(),
  206. type: "POST",
  207. dataType: "json",
  208. success: function(b) {
  209. $(".systemwindow").hide();
  210. if (b && b.success) {
  211. if (b.music == '1') {
  212. $("#music_d")[0].play();
  213. }
  214. $("select[name='classid']").find('option[value="'+$("input[name='systemboxclassid']").val()+'"]').prop('selected',true);
  215. $("input[name='class']").val(1);
  216. searchspan(1);
  217. $(".exdata").html("<li style='font-size: 16px;'>"+b.sl+"</li>");
  218. $(".systemboxsh").html(b.msg);
  219. $("#systemboxsh").val("");
  220. $("#systemboxsh").focus();
  221. } else {
  222. $("#systemboxclassid").blur();
  223. $("#music_c")[0].play();
  224. $(".systemwindow div p:eq(0)").html(b.msg);
  225. $(".systemwindow div p:eq(1)").html("<font class='wcoutboundboxclassid'>确 定</font>");
  226. $(".systemwindow").show();
  227. $("#systemboxclassid").val("");
  228. }
  229. }
  230. });
  231. }
  232. else
  233. {
  234. $.ajax({
  235. url: "/systembox/rk/",
  236. data: "number=" + $("input[name='systemboxsh']").val() + "&warehouse=" + $("select[name='warehouse']").children("option:selected").val() + "&systemboxclassid=" + $("input[name='systemboxclassid']").val(),
  237. type: "POST",
  238. dataType: "json",
  239. success: function(b) {
  240. $(".systemwindow").hide();
  241. if (b && b.success) {
  242. if (b.music == '1') {
  243. $("#music_d")[0].play();
  244. }
  245. $(".exdata").html("<li style='font-size: 16px;'>"+b.sl+"</li>");
  246. $(".systemboxsh").html(b.msg);
  247. $("#systemboxsh").val("");
  248. $("#systemboxsh").focus();
  249. } else {
  250. $("#systemboxsh").blur();
  251. $("#music_c")[0].play();
  252. $(".systemwindow div p:eq(0)").html(b.msg);
  253. $(".systemwindow div p:eq(1)").html("<font class='wcoutboundboxsh'>确 定</font>");
  254. $(".systemwindow").show();
  255. $("#systemboxsh").val("");
  256. }
  257. }
  258. });
  259. }
  260. }
  261. $(".obdel").click(function() {
  262. var a = "";
  263. $(".datatext input[name='check']:checked").each(function() {
  264. a = a + $(this).val() + ",";
  265. });
  266. if (a) {
  267. $(".systemwindow div p:eq(0)").text("是否确认删除所选内容?");
  268. $(".systemwindow div p:eq(1)").html("<p><font id='obdelgo'>确 定</font><font class='esc'>取 消</font></p>");
  269. $(".systemwindow").show();
  270. } else {
  271. $(".ts p").html("请勾选需要删除的内容");
  272. $(".ts").show();
  273. setTimeout('$(".ts").fadeOut()', 1000);
  274. }
  275. });
  276. $(".systemwindow").on('click', "#obdelgo", function() {
  277. $(".systemwindow").hide();
  278. $(".systemwindow div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> &nbsp; 删除中,请稍后...");
  279. $(".systemwindow div p:eq(1)").html("");
  280. $(".systemwindow").show();
  281. var a = "";
  282. var i = 0;
  283. $(".datatext input[name='check']:checked").each(function() {
  284. a = a + $(this).val() + ',';
  285. i++;
  286. });
  287. $.ajax({
  288. url: dataurl+"del",
  289. data: "delarr=" + a,
  290. type: "POST",
  291. dataType: "json",
  292. success: function(b) {
  293. $(".systemwindow").hide();
  294. if (b && b.success) {
  295. searchspan(1);
  296. $(".outbound").html(b.data);
  297. $("#outbound").blur();
  298. $(".systemwindow div p:eq(0)").html("删除成功!");
  299. $(".systemwindow div p:eq(1)").html("<font class='wcoutbound'>确 定</font>");
  300. $(".systemwindow").show();
  301. } else {
  302. $("#outbound").blur();
  303. $(".systemwindow div p:eq(0)").html(b.msg);
  304. $(".systemwindow div p:eq(1)").html("<font class='wcoutbound'>确 定</font>");
  305. $(".systemwindow").show();
  306. }
  307. }
  308. });
  309. });
  310. /* 清空并聚焦出库input */
  311. $(".systemwindow").on('click', ".wcsj", function() {
  312. $("#orderinfo").val("");
  313. $("#weight").val("");
  314. $(".systemwindow").find(".gth").remove();
  315. $("#orderinfo").focus();
  316. $(".systemwindow").hide();
  317. });
  318. $(".systemwindow").on('click', ".wcoutbound", function() {
  319. $("#outbound").focus();
  320. $(".systemwindow").hide();
  321. });
  322. $(".systemwindow").on('click', ".wcoutboundbox", function() {
  323. $("#systembox").focus();
  324. $(".systemwindow").hide();
  325. });
  326. $(".systemwindow").on('click', ".wcoutboundboxsh", function() {
  327. $("#systemboxsh").focus();
  328. $(".systemwindow").hide();
  329. });
  330. $(".systemwindow").on('click', ".wcoutboundboxclassid", function() {
  331. $("#systemboxclassid").focus();
  332. $(".systemwindow").hide();
  333. });
  334. $(".systemwindow").on('click', ".printok", function() {
  335. $(".search span").click();
  336. $(".systemwindow").hide();
  337. });
  338. /* 更改出库信息 */
  339. function win() {
  340. if (typeof editurl != "undefined") {
  341. $(".datatext tr").each(function() {
  342. $(this).find("td:eq(" + editdj + ")").html("<h9 class='window' data-h='" + editurl + $(this).attr('id') + "' data-t='" + editt + "'>" + $(this).find("td:eq(" + editdj + ")").text() + "</h9>");
  343. });
  344. }
  345. }
  346. $(document).keyup(function(event) {
  347. if (event.keyCode == 13) {
  348. if (typeof systemfout != "undefined") {
  349. if ($("select[name='printer']").children("option:selected").val() == "") {
  350. $("#music_c")[0].play();
  351. $(".systemwindow div p:eq(0)").html('需要先选择打印机!');
  352. $(".systemwindow div p:eq(1)").html("<font class='wcsj'>确 定</font>");
  353. $(".systemwindow").show();
  354. $("#orderinfo").val("");
  355. $("#orderinfo").focus();
  356. return;
  357. }
  358. $("#orderinfo").blur();
  359. $(".systemwindow div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> &nbsp; 处理中,请稍后...");
  360. $(".systemwindow div p:eq(1)").html("");
  361. $(".systemwindow").show();
  362. $.ajax({
  363. url: "/systemfout/fout/",
  364. data: "order=" + $("#orderinfo").val() + "&weight=" + $("#weight").val(),
  365. type: "POST",
  366. dataType: "json",
  367. success: function(a) {
  368. $(".systemwindow").hide();
  369. if (a && a.success) {
  370. if (typeof a.yd != "undefined") {
  371. $("#orderinfo").blur();
  372. $("#music_c")[0].play();
  373. $("#music_print")[0].play();
  374. $(".tyrowsout p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> &nbsp; 此运单已过期,系统打印处理中,请勿关闭!");
  375. $(".tyrowsout p:eq(1)").html("");
  376. $(".tyrowsout").show();
  377. $.ajax({
  378. url: "/systemfout/fedexhz/",
  379. data: "id=" + a.id + "&name=" + a.name + "&express=" + a.express,
  380. type: "POST",
  381. dataType: "json",
  382. success: function(b) {
  383. $(".systemwindow").hide();
  384. if (b && b.success) {
  385. wprinter.pdf(b.rows)
  386. site(1, 1, b.rows['text']['number'], 2, 0);
  387. } else {
  388. $(".tyrows").hide();
  389. $("#music_c")[0].play();
  390. wprinter.sound(b.msg);
  391. $(".systemwindow div p:eq(0)").html(b.msg);
  392. $(".systemwindow div p:eq(1)").html("<font class='wcsj'>确 定</font>");
  393. $(".systemwindow").show();
  394. $("#orderinfo").val("");
  395. $("#orderinfo").focus();
  396. }
  397. }
  398. });
  399. } else {
  400. $("#music_d")[0].play();
  401. $("#orderinfo").val("");
  402. $("#weight").val("");
  403. $(".search span").click();
  404. $("#orderinfo").focus();
  405. }
  406. } else {
  407. if (typeof a.outnumber != "undefined")
  408. {
  409. $("#music_c")[0].play();
  410. layx.confirm('警告',a.msg,null,{
  411. buttons:[
  412. {
  413. label:'确认出库',
  414. callback:function(id, button, event){
  415. $.ajax({
  416. url: "/systemfout/outnumber/",
  417. data: "outnumber=" + a.outnumber+"&post=" + a.post+"&fullorder_name=" + a.fullorder_name,
  418. type: "POST",
  419. dataType: "json",
  420. success: function(a) {
  421. $(".systemwindow").hide();
  422. $("#orderinfo").focus();
  423. if (a && a.success) {
  424. }
  425. }
  426. });
  427. $("#orderinfo").val("");
  428. layx.destroy(id);
  429. }
  430. },
  431. {
  432. label:'取消出库',
  433. callback:function(id, button, event){
  434. layx.destroy(id);
  435. }
  436. }
  437. ]
  438. });
  439. }
  440. else
  441. {
  442. $("#music_c")[0].play();
  443. wprinter.sound(a.msg);
  444. $(".systemwindow div p:eq(0)").html(a.msg);
  445. $(".systemwindow div p:eq(1)").html("<font class='wcsj'>确 定</font>");
  446. $(".systemwindow").prepend("<p class='gth' style='font-size: 200px;color: #F00;font-weight: bolder;text-align: center;'>X</p>");
  447. $(".systemwindow").show();
  448. $("#orderinfo").val("");
  449. //$("#orderinfo").focus();
  450. }
  451. }
  452. }
  453. });
  454. }
  455. if (typeof systembound != "undefined") {
  456. $(".search .number").val("");
  457. $(".search .waybill").val("");
  458. $.ajax({
  459. url: "/systembound/out",
  460. data: "number=" + $("input[name='outbound']").val() + "&type=" + $("select[name='type']").children("option:selected").val() + "&express=" + $("select[name='express']").children("option:selected").val(),
  461. type: "POST",
  462. dataType: "json",
  463. success: function(b) {
  464. searchspan(1);
  465. $(".systemwindow").hide();
  466. if (b && b.success) {
  467. if (b.music == '1') {
  468. $("#music_d")[0].play();
  469. }
  470. $(".outbound").html(b.msg);
  471. $("#outbound").val("");
  472. $("#outbound").focus();
  473. } else {
  474. $("#outbound").blur();
  475. $("#music_c")[0].play();
  476. wprinter.sound(b.msg);
  477. $(".systemwindow div p:eq(0)").html(b.msg);
  478. $(".systemwindow div p:eq(1)").html("<font class='wcoutbound'>确 定</font>");
  479. $(".systemwindow").show();
  480. $("#outbound").val("");
  481. }
  482. }
  483. });
  484. }
  485. if (typeof systemboxck != "undefined") {
  486. systembox();
  487. }
  488. if (typeof systemclassidsh != "undefined") {
  489. systemboxsh();
  490. }
  491. if (typeof systemwigsout != "undefined") {
  492. $(".search .number").val("");
  493. $(".search .waybill").val("");
  494. $.ajax({
  495. url: "/systemwigsout/out",
  496. data: "number=" + $("input[name='wigsout']").val() + "&type=" + $("select[name='type']").children("option:selected").val() + "&ly=" + $("select[name='ly']").children("option:selected").val() + "&cz=" + $("select[name='cz']").children("option:selected").val() + "&lx=" + $("select[name='lx']").children("option:selected").val() + "&timetk=" + $("input[name='timetk']").val() + "&timetj=" + $("input[name='timetj']").val() + "&czwarehouse=" + $("select[name='czwarehouse']").children("option:selected").val(),
  497. type: "POST",
  498. dataType: "json",
  499. success: function(b) {
  500. searchspan(1);
  501. $(".systemwindow").hide();
  502. if (b && b.success) {
  503. $("#music_d")[0].play();
  504. $(".outbound").html(b.msg);
  505. $("#wigsout").val("");
  506. $("#wigsout").focus();
  507. } else {
  508. $("#wigsout").blur();
  509. $("#music_c")[0].play();
  510. wprinter.sound(b.msg);
  511. $(".systemwindow div p:eq(0)").html(b.msg);
  512. $(".systemwindow div p:eq(1)").html("<font class='wcoutbound'>确 定</font>");
  513. $(".systemwindow").show();
  514. $("#wigsout").val("");
  515. }
  516. }
  517. });
  518. }
  519. if (typeof systemwigscw != "undefined") {
  520. $(".search .number").val("");
  521. $(".search .waybill").val("");
  522. $.ajax({
  523. url: "/systemwigscw/out",
  524. data: "number=" + $("input[name='wigscwout']").val() + "&type=" + $("select[name='type']").children("option:selected").val() + "&timetk=" + $("input[name='timetk']").val(),
  525. type: "POST",
  526. dataType: "json",
  527. success: function(b) {
  528. searchspan(1);
  529. $(".systemwindow").hide();
  530. if (b && b.success) {
  531. if (b.music == '1') {
  532. $("#music_d")[0].play();
  533. }
  534. $(".outbound").html(b.msg);
  535. $("#wigsout").val("");
  536. $("#wigsout").focus();
  537. } else {
  538. $("#wigsout").blur();
  539. $("#music_c")[0].play();
  540. wprinter.sound(b.msg);
  541. $(".systemwindow div p:eq(0)").html(b.msg);
  542. $(".systemwindow div p:eq(1)").html("<font class='wcoutbound'>确 定</font>");
  543. $(".systemwindow").show();
  544. $("#wigsout").val("");
  545. }
  546. }
  547. });
  548. }
  549. if (typeof ckty != "undefined") {
  550. $.ajax({
  551. url: ckty,
  552. data: "barcode=" + $("input[name='barcode']").val(),
  553. type: "POST",
  554. dataType: "json",
  555. success: function(b) {
  556. searchspan(1);
  557. $(".systemwindow").hide();
  558. if (b && b.success) {
  559. if (b.music == '1') {
  560. $("#music_d")[0].play();
  561. }
  562. $(".outbound").html(b.msg);
  563. $("#barcode").val("");
  564. $("#barcode").focus();
  565. } else {
  566. $("#barcode").blur();
  567. $("#music_c")[0].play();
  568. $(".wigprintk div p:eq(0)").html(b.msg);
  569. $(".wigprintk").show();
  570. $("#barcode").val("");
  571. }
  572. }
  573. });
  574. }
  575. if (typeof systemretreat != "undefined") {
  576. if ($("select[name='printer']").children("option:selected").val() == "") {
  577. $("#music_c")[0].play();
  578. $(".systemwindow div p:eq(0)").html('需要先选择打印机!');
  579. $(".systemwindow div p:eq(1)").html("<font class='wcsj'>确 定</font>");
  580. $(".systemwindow").show();
  581. $("#orderinfo").val("");
  582. $("#orderinfo").focus();
  583. return;
  584. }
  585. $("#orderinfo").blur();
  586. $(".systemwindow div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> &nbsp; 处理中,请稍后...");
  587. $(".systemwindow div p:eq(1)").html("");
  588. $(".systemwindow").show();
  589. $.ajax({
  590. url: "/systemretreat/out/",
  591. data: "order=" + $("#orderinfo").val() + "&weight=" + $("#weight").val(),
  592. type: "POST",
  593. dataType: "json",
  594. success: function(a) {
  595. $(".systemwindow").hide();
  596. if (a && a.success) {
  597. $("#music_d")[0].play();
  598. $("#orderinfo").val("");
  599. $("#weight").val("");
  600. $(".search span").click();
  601. $("#orderinfo").focus();
  602. } else {
  603. $("#music_c")[0].play();
  604. wprinter.sound(a.msg);
  605. $(".systemwindow div p:eq(0)").html(a.msg);
  606. $(".systemwindow div p:eq(1)").html("<font class='wcsj'>确 定</font>");
  607. $(".systemwindow").prepend("<p class='gth' style='font-size: 200px;color: #F00;font-weight: bolder;text-align: center;'>X</p>");
  608. $(".systemwindow").show();
  609. $("#orderinfo").val("");
  610. //$("#orderinfo").focus();
  611. }
  612. }
  613. });
  614. }
  615. }
  616. });
  617. $(".wigprintk .wigprintqd").click(function() {
  618. $(".wigprintk").hide();
  619. $("#barcode").focus();
  620. });
  621. $(".wigprintk").on('click', ".printok", function() {
  622. $(".search span").click();
  623. $(".wigprintk").hide();
  624. $("#barcode").focus();
  625. });
  626. $(".excel").click(function() {
  627. var f = "";
  628. $(".select").each(function() {
  629. f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
  630. });
  631. $("input:text").each(function() {
  632. var text = $(this).val().replace(/&/g,"%26");
  633. text = text.replace(/#/g,"%23");
  634. text = text.replace(/\+/g,"%2B");
  635. f = f + $(this).attr("name") + "=" + text + "&";
  636. });
  637. $("input:hidden").each(function() {
  638. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  639. });
  640. var t = "";
  641. var i = 0;
  642. $(".datatitle td").each(function() {
  643. if (i > 0) {
  644. t = t + "<td>" + $(this).text() + "</td>";
  645. }
  646. i++;
  647. });
  648. var a = "";
  649. $(".datatext input[name='check']:checked").each(function() {
  650. a = a + $(this).val() + ",";
  651. });
  652. f = f + "excel=1&a=" + a + "&t=" + t;
  653. window.location.href = "/systemfout/excel?fexcel=" + $("select[name=fexcel]").find("option:selected").val() + "&" + f;
  654. $("select[name=fexcel] option:eq(0)").prop('selected', 'selected');
  655. });
  656. $(".cpexcel").click(function() {
  657. var f = "";
  658. $(".select").each(function() {
  659. f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
  660. });
  661. $("input:text").each(function() {
  662. var text = $(this).val().replace(/&/g,"%26");
  663. text = text.replace(/#/g,"%23");
  664. text = text.replace(/\+/g,"%2B");
  665. f = f + $(this).attr("name") + "=" + text + "&";
  666. });
  667. $("input:hidden").each(function() {
  668. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  669. });
  670. var t = "";
  671. var i = 0;
  672. $(".datatitle td").each(function() {
  673. if (i > 0) {
  674. t = t + "<td>" + $(this).text() + "</td>";
  675. }
  676. i++;
  677. });
  678. var a = "";
  679. $(".datatext input[name='check']:checked").each(function() {
  680. a = a + $(this).val() + ",";
  681. });
  682. f = f + "excel=1&a=" + a + "&t=" + t;
  683. window.location.href = "/systemfout/cpexcel?fexcel=" + $("select[name=fexcel]").find("option:selected").val() + "&" + f;
  684. $("select[name=fexcel] option:eq(0)").prop('selected', 'selected');
  685. });
  686. $(".exceldy").click(function() {
  687. var f = "";
  688. $(".select").each(function() {
  689. f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
  690. });
  691. $("input:text").each(function() {
  692. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  693. });
  694. $("input:hidden").each(function() {
  695. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  696. });
  697. var t = "";
  698. var i = 0;
  699. $(".datatitle td").each(function() {
  700. if (i > 0) {
  701. t = t + "<td>" + $(this).text() + "</td>";
  702. }
  703. i++;
  704. });
  705. var a = "";
  706. $(".datatext input[name='check']:checked").each(function() {
  707. a = a + $(this).val() + ",";
  708. });
  709. f = f + "excel=1&a=" + a + "&t=" + t;
  710. window.location.href = "/systemprint//exceldy?fexcel=1&" + f;
  711. $("select[name=fexcel] option:eq(0)").prop('selected', 'selected');
  712. });
  713. $(".dowot").click(function() {
  714. var f = "";
  715. $(".select").each(function() {
  716. f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
  717. });
  718. $("input:text").each(function() {
  719. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  720. });
  721. $("input:hidden").each(function() {
  722. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  723. });
  724. if($("input[name=systembox]").length > 0)
  725. {
  726. if($("select[name='warehouse']").children("option:selected").val() == '')
  727. {
  728. $(".ts p").text("请选择仓库!");
  729. $(".ts").show();
  730. setTimeout('$(".ts").fadeOut()', 800);
  731. return false;
  732. }
  733. }
  734. window.location.href = dataurl+"excel?fexcel=1&" + f;
  735. $("select[name=fexcel] option:eq(0)").prop('selected', 'selected');
  736. });
  737. $(".downloadexcel").click(function() {
  738. var f = "";
  739. var cb = "";
  740. $(".download .ckrows input:checked").each(function(){
  741. cb = cb + $(this).val() + "|";
  742. });
  743. if(cb == "")
  744. {
  745. $(".ts p").text("请选择产品类型!");
  746. $(".ts").show();
  747. setTimeout('$(".ts").fadeOut()', 800);
  748. return false;
  749. }
  750. f = "category=" + cb + "&";
  751. $(".select").each(function() {
  752. f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
  753. });
  754. $("input:text").each(function() {
  755. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  756. });
  757. $("input:hidden").each(function() {
  758. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  759. });
  760. for(j=0;j<$(".datalist .checkbox").length;j++)
  761. {
  762. var pcheckid = ""; var pcheckname = "";
  763. $(".checkbox:eq("+j+") .ckrows input:checked").each(function(){
  764. pcheckname = $(this).attr("name");
  765. pcheckid = pcheckid + $(this).val()+",";
  766. });
  767. f = f + pcheckname + "=" + pcheckid + "&";
  768. }
  769. window.location.href = "/systemdownload/data?fexcel=1&" + f;
  770. $("select[name=fexcel] option:eq(0)").prop('selected', 'selected');
  771. });
  772. $(".downloadexcellist").click(function() {
  773. var f = "";
  774. var cb = "";
  775. $(".download .ckrows input:checked").each(function(){
  776. cb = cb + $(this).val() + "|";
  777. });
  778. if(cb == "")
  779. {
  780. $(".ts p").text("请选择产品类型!");
  781. $(".ts").show();
  782. setTimeout('$(".ts").fadeOut()', 800);
  783. return false;
  784. }
  785. f = "category=" + cb + "&";
  786. $(".select").each(function() {
  787. f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
  788. });
  789. $("input:text").each(function() {
  790. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  791. });
  792. $("input:hidden").each(function() {
  793. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  794. });
  795. window.location.href = "/systemdownload/listread?fexcel=1&" + f;
  796. $("select[name=fexcel] option:eq(0)").prop('selected', 'selected');
  797. });
  798. /* 时间计算 */
  799. function getBeforeDate() { //n为你要传入的参数,当前为0,前一天为-1,后一天为1
  800. var myDate = new Date;
  801. var year = myDate.getFullYear(); //获取当前年
  802. var mon = myDate.getMonth() + 1; //获取当前月
  803. var date = myDate.getDate(); //获取当前日
  804. var h = myDate.getHours(); //获取当前小时数(0-23)
  805. var m = myDate.getMinutes(); //获取当前分钟数(0-59)
  806. var s = myDate.getSeconds(); //获取当前秒
  807. var week = myDate.getDay();
  808. var weeks = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
  809. s = year + '-' + mon + '-' + date + ' ' + h + ':' + m;
  810. return s;
  811. }
  812. $(".obadd").click(function() {
  813. $(".boundtj div p:eq(0)").html('<label>仓库:<select name="type" class="select">' + $("select[name=type]").html() + '</select></label><label>快递:<select name="express" class="select">' + $("select[name=express]").html() + '</select></label><label>运单号:<input value="" name="number" type="text"></label><label>时间:<input id="time" value="" name="time" type="text" onclick="laydate({istime: true,format:\'YYYY-MM-DD hh:mm\'})" readonly></label>');
  814. $(".boundtj div p:eq(1)").html("<font class='obaddgo'>确 定</font><font class='esc'>取 消</font>");
  815. $(".boundtj label #time").val(getBeforeDate());
  816. $(".boundtj").show();
  817. });
  818. $(".woadd").click(function() {
  819. $(".boundtj div p:eq(0)").html('<label>仓库:<select name="type" class="select">' + $("select[name=type]").html() + '</select></label><label>编号:<input value="" name="number" type="text"></label><label>时间:<input id="time" value="" name="time" type="text" onclick="laydate({istime: true,format:\'YYYY-MM-DD hh:mm\'})" readonly></label>');
  820. $(".boundtj div p:eq(1)").html("<font class='woaddgo'>确 定</font><font class='esc'>取 消</font>");
  821. $(".boundtj label #time").val(getBeforeDate());
  822. $(".boundtj").show();
  823. });
  824. $(".boundtj").on('click', ".obaddgo", function() {
  825. var f = "";
  826. $(".boundtj .select").each(function() {
  827. f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
  828. });
  829. $(".boundtj input:text").each(function() {
  830. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  831. });
  832. $.ajax({
  833. url: dataurl+"add",
  834. data: f,
  835. type: "POST",
  836. dataType: "json",
  837. success: function(c) {
  838. if (c && c.success) {
  839. searchspan(1);
  840. $(".boundtj p").html("");
  841. $(".boundtj").hide();
  842. $(".boundtj div p:eq(0)").html(c.msg);
  843. $(".boundtj div p:eq(1)").html("<font class='esc'>确 定</font>");
  844. $(".boundtj").show();
  845. } else {
  846. $(".ts p").html(c.msg);
  847. $(".ts").show();
  848. setTimeout('$(".ts").fadeOut()', 1000);
  849. }
  850. }
  851. });
  852. });
  853. $(".boundtj").on('click', ".woaddgo", function() {
  854. var f = "";
  855. $(".boundtj .select").each(function() {
  856. f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
  857. });
  858. $(".boundtj input:text").each(function() {
  859. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  860. });
  861. $.ajax({
  862. url: dataurl+"add",
  863. data: f,
  864. type: "POST",
  865. dataType: "json",
  866. success: function(c) {
  867. if (c && c.success) {
  868. searchspan(1);
  869. $(".boundtj p").html("");
  870. $(".boundtj").hide();
  871. $(".boundtj div p:eq(0)").html(c.title);
  872. $(".boundtj div p:eq(1)").html("<font class='esc'>确 定</font>");
  873. $(".boundtj").show();
  874. if (b.music == '1') {
  875. $("#music_d")[0].play();
  876. }
  877. $(".outbound").html(b.msg);
  878. $("#wigsout").val("");
  879. $("#wigsout").focus();
  880. } else {
  881. $("#wigsout").val("");
  882. $("#wigsout").focus();
  883. $(".ts p").html(c.msg);
  884. $(".ts").show();
  885. setTimeout('$(".ts").fadeOut()', 1000);
  886. }
  887. }
  888. });
  889. });
  890. $(".boundtj").on('click', ".esc", function() {
  891. $(".boundtj p").html("");
  892. $(".boundtj").hide();
  893. });
  894. $('.printwigs').click(function() {
  895. var a = "";
  896. $(".datatext input[name='check']:checked").each(function() {
  897. a = a + $(this).val() + ",";
  898. });
  899. if (a) {
  900. $(".systemwindow div p:eq(0)").text("是否确认批量打印所选内容?");
  901. $(".systemwindow div p:eq(1)").html("<p><font id='wigsprintall'>确 定</font><font class='esc'>取 消</font></p>");
  902. $(".systemwindow").show();
  903. } else {
  904. $(".ts p").html("请勾选需要打印的内容");
  905. $(".ts").show();
  906. setTimeout('$(".ts").fadeOut()', 1000);
  907. }
  908. })
  909. $(".systemwindow").on('click', "#wigsprintall", function() {
  910. $(".systemwindow").hide();
  911. $(".systemwindow div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> &nbsp; 正在处理打印信息,请稍后...");
  912. $(".systemwindow div p:eq(1)").html("");
  913. $(".systemwindow").show();
  914. var a = [];
  915. var i = 0;
  916. $(".datatext input[name='check']:checked").each(function() {
  917. orderinfo = $(this).parents('tr').find('.orderinfo').text()
  918. console.log(orderinfo);
  919. a.push(orderinfo)
  920. i++;
  921. });
  922. // console.log(orderinfo)
  923. $.ajax({
  924. type: 'post',
  925. url: '/wigs/processAdd',
  926. dataType: "json",
  927. data: { ids: a },
  928. success: function(resp) {
  929. // data = resp.data;
  930. if (resp.status) {
  931. print_dy(resp.data)
  932. } else {
  933. alert('暂无可执行订单')
  934. $(".systemwindow").hide();
  935. setTimeout('searchspan(2)', 900);
  936. // $(".systemwindow div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> &nbsp; 正在222232331313处理打印信息,请稍后...");
  937. // processinfo(data.success);
  938. }
  939. }
  940. })
  941. });
  942. $('.print_all').click(function() {
  943. var a = "";
  944. $(".datatext input[name='check']:checked").each(function() {
  945. a = a + $(this).val() + ",";
  946. });
  947. if (a) {
  948. $(".systemwindow div p:eq(0)").text("是否确认批量打印所选内容?");
  949. $(".systemwindow div p:eq(1)").html("<p><font id='printall'>确 定</font><font class='esc'>取 消</font></p>");
  950. $(".systemwindow").show();
  951. } else {
  952. $(".ts p").html("请勾选需要打印的内容");
  953. $(".ts").show();
  954. setTimeout('$(".ts").fadeOut()', 1000);
  955. }
  956. })
  957. $(".systemwindow").on('click', "#printall", function() {
  958. $(".systemwindow").hide();
  959. $(".systemwindow div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> &nbsp; 正在处理打印信息,请稍后...");
  960. $(".systemwindow div p:eq(1)").html("");
  961. $(".systemwindow").show();
  962. var a = [];
  963. var i = 0;
  964. $(".datatext input[name='check']:checked").each(function() {
  965. orderinfo = $(this).parents('tr').find('.orderinfo').text()
  966. console.log(orderinfo);
  967. a.push(orderinfo)
  968. i++;
  969. });
  970. if (a.length != 0) {
  971. $.ajax({
  972. type: 'post',
  973. url: '/wigs/printall',
  974. dataType: "json",
  975. data: { orderinfo: a },
  976. success: function(resp) {
  977. if (resp.status) {
  978. print_dy(resp.data)
  979. } else {
  980. alert("程序出了问题!")
  981. $(".systemwindow").hide();
  982. setTimeout('searchspan(2)', 900);
  983. }
  984. }
  985. })
  986. }
  987. $.ajax({
  988. type: 'post',
  989. url: '/wigs/processAdd',
  990. dataType: "json",
  991. data: { ids: a },
  992. success: function(resp) {
  993. // data = resp.data;
  994. if (resp.status) {
  995. print_dy(resp.data)
  996. } else {
  997. alert('暂无可执行订单')
  998. $(".systemwindow").hide();
  999. setTimeout('searchspan(2)', 900);
  1000. // $(".systemwindow div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> &nbsp; 正在222232331313处理打印信息,请稍后...");
  1001. // processinfo(data.success);
  1002. }
  1003. }
  1004. })
  1005. });
  1006. function processinfo(orderids) {
  1007. if (!orderids) {
  1008. return;
  1009. }
  1010. $.ajax({
  1011. type: 'post',
  1012. url: '/wigs/printall',
  1013. dataType: "json",
  1014. data: { orderids: orderids },
  1015. success: function(resp) {
  1016. if (resp.status) {
  1017. print_dy(resp.data)
  1018. } else {
  1019. alert("程序出了问题!")
  1020. $(".systemwindow").hide();
  1021. setTimeout('searchspan(2)', 900);
  1022. }
  1023. }
  1024. })
  1025. }
  1026. function print_dy(data) {
  1027. var iCurLine = 20
  1028. var leftwidth = 320;
  1029. LODOP.PRINT_INIT("");
  1030. ids = [];
  1031. if (LODOP.CVERSION) CLODOP.On_Return = function(TaskID, Value) {
  1032. // console.log(ids);
  1033. //返回打印结果 不追求精细控制 用这个即可
  1034. if (Value == "1") {
  1035. $.ajax({
  1036. type: 'post',
  1037. url: '/wigs/print_ok',
  1038. dataType: "json",
  1039. data: { 'ids': ids },
  1040. success: function(resp) {
  1041. if (resp.status == "ok") {
  1042. alert("打印成功")
  1043. } else {
  1044. alert("打印失败")
  1045. }
  1046. $(".systemwindow").hide();
  1047. setTimeout('searchspan(2)', 900);
  1048. }
  1049. })
  1050. } else {
  1051. alert("打印未成功");
  1052. $(".systemwindow").hide();
  1053. setTimeout('searchspan(2)', 900);
  1054. }
  1055. };
  1056. for (x in data) {
  1057. ids.push(data[x].id)
  1058. LODOP.ADD_PRINT_BARCODE(3, 10, 50, 350, "128Auto", data[x].number);
  1059. LODOP.SET_PRINT_STYLEA(0, "Angle", 90)
  1060. var str = data[x].orderinfo + data[x].orderremarks + data[x].shipremarks;
  1061. LODOP.ADD_PRINT_TEXT(350, 85, 350, 35, str);
  1062. LODOP.SET_PRINT_STYLEA(0, "FontSize", 11);
  1063. LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
  1064. LODOP.SET_PRINT_STYLEA(0, "Angle", 90)
  1065. // LODOP.SET_PRINT_PAGESIZE(3,450,70,"")//设置默认纸张
  1066. // LODOP.PRINTA();
  1067. LODOP.PRINT();
  1068. // LODOP.PREVIEW();
  1069. // return;
  1070. }
  1071. return;
  1072. }
  1073. $(".screen").click(function() {
  1074. var a = "";
  1075. $(".datatext input[name='check']:checked").each(function() {
  1076. a = a + $(this).val() + ",";
  1077. });
  1078. if (!a) {
  1079. $(".ts p").html("请勾选需要操作的内容");
  1080. $(".ts").show();
  1081. setTimeout('$(".ts").fadeOut()', 1000);
  1082. return false;
  1083. }
  1084. $(".systemwindow div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> &nbsp; 正在处理信息,请稍后...");
  1085. $(".systemwindow div p:eq(1)").html("");
  1086. $(".systemwindow").show();
  1087. $.ajax({
  1088. type: 'post',
  1089. url: '/systemprint/cz',
  1090. dataType: "json",
  1091. data: "cz=" + a + "&bj=" + $(this).data("d"),
  1092. success: function(c) {
  1093. if (c && c.success) {
  1094. $(".systemwindow").hide();
  1095. $(".tyrowscc div p:eq(0)").html(c.msg);
  1096. $(".tyrowscc div p:eq(1)").html("<font class='screenok'>确 定</font>");
  1097. $(".tyrowscc").show();
  1098. } else {
  1099. $(".systemwindow").hide();
  1100. $(".ts p").html(c.msg);
  1101. $(".ts").show();
  1102. setTimeout('$(".ts").fadeOut()', 1000);
  1103. }
  1104. }
  1105. })
  1106. });
  1107. $(".tyrowscc").on('click', ".screenok", function() {
  1108. $(".search span").click();
  1109. $(".tyrowscc").hide();
  1110. });
  1111. $(".systemwindow").on('click', "#printbq", function() {
  1112. $(".systemwindow").hide();
  1113. $(".ts p").html("<i class='fa fa-2x fa-cog fa-spin'></i> &nbsp; 系统操作中,请稍后...");
  1114. $(".ts").show();
  1115. var f = "";
  1116. var e = "";
  1117. var index = $(".cike select").find("option:selected").index();
  1118. if(index == '4')
  1119. {
  1120. f = f + $(".cike select").attr("name") + "=" + $(".cike select").children("option:selected").val() + "&";
  1121. $(".postgift .select").each(function() {
  1122. f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
  1123. });
  1124. }
  1125. else
  1126. {
  1127. $(".datalist .select").each(function() {
  1128. f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
  1129. });
  1130. }
  1131. $(".post .select").each(function() {
  1132. f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
  1133. });
  1134. $(".datalist input:text").each(function() {
  1135. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  1136. });
  1137. $(".datalist input:password").each(function() {
  1138. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  1139. });
  1140. $(".hidden input:hidden").each(function() {
  1141. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  1142. });
  1143. $(".datalist textarea").each(function() {
  1144. var vl = $(this).val().replace(/\+/g,"%2B");
  1145. vl = vl.replace(/\&/g,"%26");
  1146. f = f + $(this).attr("name") + "=" + vl + "&";
  1147. });
  1148. $(".datalistno input:hidden").each(function() {
  1149. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  1150. });
  1151. $(".pttab .post input:text").each(function() {
  1152. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  1153. });
  1154. $(".pttab .post .select").each(function() {
  1155. f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
  1156. });
  1157. for(i=0;i<$(".datalist .checkbox").length;i++)
  1158. {
  1159. var checkid = ""; var checkname = "";
  1160. $(".datalist .checkbox:eq("+i+") .ckrows input:checked").each(function(){
  1161. checkname = $(this).attr("name");
  1162. checkid = checkid + $(this).val()+",";
  1163. });
  1164. var cd = $(".cike select").find("option:selected").index();
  1165. if(checkname == "" && typeof addedit != "undefined" && (addedit == "/whlabel/enteradd/" || addedit == "/whlabel/enteredit/"))
  1166. {
  1167. if($(".datalist .checkbox:eq("+i+")").prevAll("em").text() == '长 度:')
  1168. {
  1169. if(checkname == "" && typeof cd != "undefined" && cd != 4)
  1170. {
  1171. $(".ts p").text($(".datalist .checkbox:eq("+i+")").prevAll("em").text()+"为必填项");
  1172. $(".ts").show();
  1173. setTimeout('$(".ts").fadeOut()', 600);
  1174. return false;
  1175. }
  1176. f = f + checkname + "=" + checkid + "&";
  1177. }
  1178. }
  1179. else
  1180. {
  1181. if(checkname == "")
  1182. {
  1183. $(".ts p").text($(".datalist .checkbox:eq("+i+")").prevAll("em").text()+"为必填项");
  1184. $(".ts").show();
  1185. setTimeout('$(".ts").fadeOut()', 600);
  1186. return false;
  1187. }
  1188. f = f + checkname + "=" + checkid + "&";
  1189. }
  1190. }
  1191. for(j=0;j<$(".post .checkbox").length;j++)
  1192. {
  1193. var pcheckid = ""; var pcheckname = "";
  1194. $(".post .checkbox:eq("+j+") .ckrows input:checked").each(function(){
  1195. pcheckname = $(this).attr("name");
  1196. pcheckid = pcheckid + $(this).val()+",";
  1197. });
  1198. if(pcheckname == "")
  1199. {
  1200. $(".ts p").text($(".post .checkbox:eq("+j+")").prevAll("em").text()+"为必填项");
  1201. $(".ts").show();
  1202. setTimeout('$(".ts").fadeOut()', 600);
  1203. return false;
  1204. }
  1205. f = f + pcheckname + "=" + pcheckid + "&";
  1206. }
  1207. var ab = 0;
  1208. $(".must").each(function() {
  1209. if ($.trim($(this).val()).length == 0) {
  1210. $(this).css("border", "1px solid #F66");
  1211. ab = ab + 1;
  1212. }
  1213. });
  1214. if (ab > 0) {
  1215. $(".ts p").text("红框为必填项");
  1216. $(".ts").show();
  1217. setTimeout('$(".ts").fadeOut()', 600);
  1218. return false;
  1219. }
  1220. $.ajax({
  1221. url: addedit,
  1222. data: f,
  1223. type: "POST",
  1224. dataType: "json",
  1225. success: function(a) {
  1226. if (a && a.success) {
  1227. $(".ts").hide();
  1228. $(".systemwindow").hide();
  1229. $(".systemwindow div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> &nbsp; 正在处理打印信息,请稍后...");
  1230. $(".systemwindow div p:eq(1)").html("");
  1231. $(".systemwindow").show();
  1232. wprinter.xbq(a);
  1233. xbqsite(1, 1, 0, 0, 0);
  1234. } else {
  1235. $(".ts").hide();
  1236. $(".ts p").html("生成标签失败,请重试");
  1237. $(".ts").fadeIn();
  1238. setTimeout('$(".ts").fadeOut()', 600);
  1239. }
  1240. }
  1241. });
  1242. });
  1243. function xbqsite(num, list, number, data, i) {
  1244. var jobsite = $("#site").html();
  1245. if (jobsite == '0') {
  1246. $("#job").html("");
  1247. $("#site").html("");
  1248. wprinter.sound("打印完成")
  1249. $(".systemwindow div p:eq(0)").html("打印完成!");
  1250. $(".systemwindow div p:eq(1)").html("<font class='printok'>确 定</font>");
  1251. $(".systemwindow").show();
  1252. return;
  1253. } else {
  1254. if (i < '71') {
  1255. if ($("#job").html() != '') {
  1256. wprinter.getStatusValue();
  1257. }
  1258. setTimeout(function() {
  1259. site(num, list, number, data, i + 1);
  1260. }, 1500);
  1261. return;
  1262. } else {
  1263. wprinter.sound("打印机异常")
  1264. $(".systemwindow div p:eq(0)").html("打印失败!系统已停止打印,请检查打印机!如未出此单,请再次打印");
  1265. $(".systemwindow div p:eq(1)").html("<font class='printok'>确 定</font>");
  1266. $(".systemwindow").show();
  1267. $("#job").html("");
  1268. $("#site").html("");
  1269. $(".tyrowsout").hide();
  1270. $("#orderinfo").val("");
  1271. $("#orderinfo").focus();
  1272. return;
  1273. }
  1274. }
  1275. }
  1276. $(".bbprint").click(function() {
  1277. var a = "";
  1278. $(".datatext input[name='check']:checked").each(function() {
  1279. a = a + $(this).val() + ",";
  1280. });
  1281. if (a) {
  1282. if ($("select[name='printer']").children("option:selected").val() == "") {
  1283. $(".ts p").html("请选择打印机!");
  1284. $(".ts").show();
  1285. setTimeout('$(".ts").fadeOut()', 1000);
  1286. } else {
  1287. $(".wigprintk div p:eq(0)").text("是否确认批量打印所选内容?");
  1288. $(".wigprintk div p:eq(1)").html("<p><font id='bbprinton'>确 定</font><font class='esc'>取 消</font></p>");
  1289. $(".wigprintk").show();
  1290. }
  1291. } else {
  1292. $(".ts p").html("请勾选需要打印的内容");
  1293. $(".ts").show();
  1294. setTimeout('$(".ts").fadeOut()', 1000);
  1295. }
  1296. });
  1297. $(".wigprintk .esc").click(function() {
  1298. $(".wigprintk").hide();
  1299. });
  1300. $(".wigprintk").on('click', "#bbprinton", function() {
  1301. $(".wigprintk").hide();
  1302. $(".wigprintk div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> &nbsp; 正在处理打印信息,请稍后...");
  1303. $(".wigprintk div p:eq(1)").html("");
  1304. $(".wigprintk").show();
  1305. var a = "";
  1306. var i = 0;
  1307. $(".datatext input[name='check']:checked").each(function() {
  1308. a = a + $(this).val() + ',';
  1309. i++;
  1310. });
  1311. var tf = $("select[name='print']").children("option:selected").val();
  1312. if(jcprint == 1)
  1313. {
  1314. wpajax(i - 1, a , tf);
  1315. }
  1316. else
  1317. {
  1318. wpajaxbjc(i - 1, a , tf);
  1319. }
  1320. });
  1321. // 头套布标检测打印状态-开始
  1322. function wpajax(num, list, tf) {
  1323. $.ajax({
  1324. url: printurl,
  1325. data: "s=" + list + "&n=" + num,
  1326. type: "POST",
  1327. dataType: "json",
  1328. timeout: 60001,
  1329. success: function(c) {
  1330. if (c.success) {
  1331. dyfs(c.rows);
  1332. if (c.rows['n'] > -1) {
  1333. bbsite(c.rows['n'],c.rows['data'], c.rows['number'], 1, 0);
  1334. } else {
  1335. bbsite(1, 1, c.rows['number'], 0, 0);
  1336. }
  1337. } else {
  1338. $(".wigprintk").hide();
  1339. layx.alert('错误', c.msg, function(id, button) {
  1340. $(".search span").click();
  1341. }, { dialogIcon: 'error' });
  1342. }
  1343. },
  1344. error: function(textStatus) {
  1345. wprinter.sound("错误,请求数据超时!请重试")
  1346. $(".wigprintk").hide();
  1347. layx.alert('错误', '请求数据超时!请重试', function(id, button) {
  1348. $(".search span").click();
  1349. }, { dialogIcon: 'error' });
  1350. },
  1351. });
  1352. }
  1353. function bbsite(num, list, number, data, i) {
  1354. var jobsite = $("#site").html();
  1355. if (jobsite == '0') {
  1356. $("#job").html("");
  1357. $("#site").html("");
  1358. if (data == '1') {
  1359. var tf = $("select[name='print']").children("option:selected").val();
  1360. wpajax(num, list, tf);
  1361. return;
  1362. } else {
  1363. //wprinter.sound("打印完成")
  1364. $(".wigprintk div p:eq(0)").html("打印完成!");
  1365. $(".wigprintk div p:eq(1)").html("<font class='printok'>确 定</font>");
  1366. $(".wigprintk").show();
  1367. return;
  1368. }
  1369. } else {
  1370. if (i < '71') {
  1371. if ($("#job").html() != '') {
  1372. wprinter.getStatusValue();
  1373. }
  1374. setTimeout(function() {
  1375. bbsite(num, list, number, data, i + 1);
  1376. }, 300);
  1377. return;
  1378. } else {
  1379. wprinter.sound("打印机异常")
  1380. $(".wigprintk div p:eq(0)").html("订单:" + number + " 打印失败!系统已停止打印,请检查打印机!如未出此单,请再次打印");
  1381. $(".wigprintk div p:eq(1)").html("<font class='printok'>确 定</font>");
  1382. $(".wigprintk").show();
  1383. $("#job").html("");
  1384. $("#site").html("");
  1385. $(".tyrowsout").hide();
  1386. $("#orderinfo").val("");
  1387. $("#orderinfo").focus();
  1388. return;
  1389. }
  1390. }
  1391. }
  1392. //头套布标检测打印状态-结束
  1393. //不检测是否打印完成-开始
  1394. function wpajaxbjc(num, list, number) {
  1395. $.ajax({
  1396. url: printurl,
  1397. data: "s=" + list + "&n=" + num,
  1398. type: "POST",
  1399. dataType: "json",
  1400. timeout: 60001,
  1401. success: function(c) {
  1402. if (c.success) {
  1403. bbsitebjc(c.rows);
  1404. } else {
  1405. $(".wigprintk").hide();
  1406. layx.alert('错误', c.msg, function(id, button) {
  1407. $(".search span").click();
  1408. }, { dialogIcon: 'error' });
  1409. }
  1410. },
  1411. error: function(textStatus) {
  1412. wprinter.sound("错误,请求数据超时!请重试")
  1413. $(".wigprintk").hide();
  1414. layx.alert('错误', '请求数据超时!请重试', function(id, button) {
  1415. $(".search span").click();
  1416. }, { dialogIcon: 'error' });
  1417. },
  1418. });
  1419. }
  1420. function bbsitebjc(data)
  1421. {
  1422. var j = 0;var x = 0;
  1423. dyfs(data);
  1424. $(".wigprintk div p:eq(0)").html("打印完成!");
  1425. $(".wigprintk div p:eq(1)").html("<font class='printok'>确 定</font>");
  1426. $(".wigprintk").show();
  1427. return;
  1428. }
  1429. //不检测是否打印完成-结束
  1430. $(".systemwindow").on('click', "#newbbprintks", function() {
  1431. $(".systemwindow").hide();
  1432. $(".ts p").html("<i class='fa fa-2x fa-cog fa-spin'></i> &nbsp; 系统操作中,请稍后...");
  1433. $(".ts").show();
  1434. var f = "";
  1435. var e = "";
  1436. var index = $(".cike select").find("option:selected").index();
  1437. if(index == '4')
  1438. {
  1439. f = f + $(".cike select").attr("name") + "=" + $(".cike select").children("option:selected").val() + "&";
  1440. $(".postgift .select").each(function() {
  1441. f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
  1442. });
  1443. }
  1444. else
  1445. {
  1446. $(".datalist .select").each(function() {
  1447. f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
  1448. });
  1449. }
  1450. $(".post .select").each(function() {
  1451. f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
  1452. });
  1453. $(".datalist input:text").each(function() {
  1454. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  1455. });
  1456. $(".datalist input:password").each(function() {
  1457. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  1458. });
  1459. $(".hidden input:hidden").each(function() {
  1460. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  1461. });
  1462. $(".datalist textarea").each(function() {
  1463. var vl = $(this).val().replace(/\+/g,"%2B");
  1464. vl = vl.replace(/\&/g,"%26");
  1465. f = f + $(this).attr("name") + "=" + vl + "&";
  1466. });
  1467. $(".datalistno input:hidden").each(function() {
  1468. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  1469. });
  1470. $(".pttab .post input:text").each(function() {
  1471. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  1472. });
  1473. $(".pttab .post .select").each(function() {
  1474. f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
  1475. });
  1476. for(i=0;i<$(".datalist .checkbox").length;i++)
  1477. {
  1478. var checkid = ""; var checkname = "";
  1479. $(".datalist .checkbox:eq("+i+") .ckrows input:checked").each(function(){
  1480. checkname = $(this).attr("name");
  1481. checkid = checkid + $(this).val()+",";
  1482. });
  1483. var cd = $(".cike select").find("option:selected").index();
  1484. if(checkname == "" && typeof addedit != "undefined" && (addedit == "/whlabel/enteradd/" || addedit == "/whlabel/enteredit/"))
  1485. {
  1486. if($(".datalist .checkbox:eq("+i+")").prevAll("em").text() == '长 度:')
  1487. {
  1488. if(checkname == "" && typeof cd != "undefined" && cd != 4)
  1489. {
  1490. $(".ts p").text($(".datalist .checkbox:eq("+i+")").prevAll("em").text()+"为必填项");
  1491. $(".ts").show();
  1492. setTimeout('$(".ts").fadeOut()', 600);
  1493. return false;
  1494. }
  1495. f = f + checkname + "=" + checkid + "&";
  1496. }
  1497. }
  1498. else
  1499. {
  1500. if(checkname == "")
  1501. {
  1502. $(".ts p").text($(".datalist .checkbox:eq("+i+")").prevAll("em").text()+"为必填项");
  1503. $(".ts").show();
  1504. setTimeout('$(".ts").fadeOut()', 600);
  1505. return false;
  1506. }
  1507. f = f + checkname + "=" + checkid + "&";
  1508. }
  1509. }
  1510. for(j=0;j<$(".post .checkbox").length;j++)
  1511. {
  1512. var pcheckid = ""; var pcheckname = "";
  1513. $(".post .checkbox:eq("+j+") .ckrows input:checked").each(function(){
  1514. pcheckname = $(this).attr("name");
  1515. pcheckid = pcheckid + $(this).val()+",";
  1516. });
  1517. if(pcheckname == "")
  1518. {
  1519. $(".ts p").text($(".post .checkbox:eq("+j+")").prevAll("em").text()+"为必填项");
  1520. $(".ts").show();
  1521. setTimeout('$(".ts").fadeOut()', 600);
  1522. return false;
  1523. }
  1524. f = f + pcheckname + "=" + pcheckid + "&";
  1525. }
  1526. var ab = 0;
  1527. $(".must").each(function() {
  1528. if ($.trim($(this).val()).length == 0) {
  1529. $(this).css("border", "1px solid #F66");
  1530. ab = ab + 1;
  1531. }
  1532. });
  1533. if (ab > 0) {
  1534. $(".ts p").text("红框为必填项");
  1535. $(".ts").show();
  1536. setTimeout('$(".ts").fadeOut()', 600);
  1537. return false;
  1538. }
  1539. $.ajax({
  1540. url: addedit,
  1541. data: f,
  1542. type: "POST",
  1543. dataType: "json",
  1544. success: function(a) {
  1545. if (a && a.success) {
  1546. $(".ts").hide();
  1547. $(".systemwindow").hide();
  1548. $(".systemwindow div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> &nbsp; 正在处理打印信息,请稍后...");
  1549. $(".systemwindow div p:eq(1)").html("");
  1550. $(".systemwindow").show();
  1551. wprinter.newbubiao(a['rows']);
  1552. $(".systemwindow div p:eq(0)").html("打印完成!");
  1553. $(".systemwindow div p:eq(1)").html("<font class='printok'>确 定</font>");
  1554. return;
  1555. } else {
  1556. $(".ts").hide();
  1557. $(".systemwindow div p:eq(0)").text(a.msg);
  1558. $(".systemwindow div p:eq(1)").html("<p><font class='esc'>确 定</font></p>");
  1559. $(".systemwindow").show();
  1560. }
  1561. }
  1562. });
  1563. });
  1564. function newbbnumberprint(d,n,zps,b,ph,is_jiaji) {
  1565. layx.load('loadId','操作中,请稍后',{shadable:0.6});
  1566. $.ajax({
  1567. url: addedit,
  1568. data: "type=0&data="+d+"&n="+n+"&zps="+zps+"&b="+b+"&ph="+ph+"&is_jiaji="+is_jiaji,
  1569. type: "POST",
  1570. dataType: "json",
  1571. success: function(a) {
  1572. layx.destroy('loadId');
  1573. if (a && a.success) {
  1574. wprinter.newbubiao(a['rows']);
  1575. $(".systemwindow div p:eq(0)").html("打印完成!");
  1576. $(".systemwindow div p:eq(1)").html("<font class='printok'>确 定</font>");
  1577. $(".systemwindow").show();
  1578. return;
  1579. } else {
  1580. $(".ts").hide();
  1581. $(".systemwindow div p:eq(0)").text(a.msg);
  1582. $(".systemwindow div p:eq(1)").html("<p><font class='esc'>确 定</font></p>");
  1583. $(".systemwindow").show();
  1584. }
  1585. }
  1586. });
  1587. };
  1588. function kswaigouprint(d,n,zps,purchase,b) {//外购
  1589. layx.load('loadId','操作中,请稍后',{shadable:0.6});
  1590. $.ajax({
  1591. url: addedit,
  1592. data: "type=1&&data="+d+"&n="+n+"&zps="+zps+"&purchase="+purchase+"&b="+b,
  1593. type: "POST",
  1594. dataType: "json",
  1595. success: function(a) {
  1596. layx.destroy('loadId');
  1597. if (a && a.success) {
  1598. wprinter.newbubiao(a['rows']);
  1599. $(".systemwindow div p:eq(0)").html("打印完成!");
  1600. $(".systemwindow div p:eq(1)").html("<font class='printok'>确 定</font>");
  1601. $(".systemwindow").show();
  1602. return;
  1603. } else {
  1604. $(".ts").hide();
  1605. $(".systemwindow div p:eq(0)").text(a.msg);
  1606. $(".systemwindow div p:eq(1)").html("<p><font class='esc'>确 定</font></p>");
  1607. $(".systemwindow").show();
  1608. }
  1609. }
  1610. });
  1611. };
  1612. function whlabelbhksprint(d,n) {//外购
  1613. if ($("select[name='printer']").children("option:selected").val() == "") {
  1614. $(".ts p").html("请选择打印机!");
  1615. $(".ts").show();
  1616. setTimeout('$(".ts").fadeOut()', 1000);
  1617. return;
  1618. }
  1619. layx.load('loadId','操作中,请稍后',{shadable:0.6});
  1620. $.ajax({
  1621. url: dataurl+"bbprint/",
  1622. data: "d="+d+"&n="+n,
  1623. type: "POST",
  1624. dataType: "json",
  1625. success: function(a) {
  1626. $(".systemwindow").hide();
  1627. layx.destroy('loadId');
  1628. if (a && a.success) {
  1629. wprinter.bhbubiao(a['rows']);
  1630. $(".express p:eq(0)").html('打印完成');
  1631. $(".express p:eq(1)").html("<font class='printfh' data-id='"+a.id+"'>确 定</font>");
  1632. $(".express").show();
  1633. return;
  1634. } else {
  1635. layx.alert('错误',a.msg,function(a,msg){
  1636. },{dialogIcon:'error'});
  1637. }
  1638. }
  1639. });
  1640. };
  1641. $(".systemwindow .esc").click(function() {
  1642. $(".systemwindow").hide();
  1643. });
  1644. $(".systemwindow").on('click', ".esc", function() {
  1645. $(".systemwindow").hide();
  1646. });