print.js 62 KB

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