123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716 |
- /* 批量打印提示 */
- $(".printing").click(function() {
- var a = "";
- $(".datatext input[name='check']:checked").each(function() {
- a = a + $(this).val() + ",";
- });
- if (a) {
- if ($("select[name='printer']").children("option:selected").val() == "") {
- $(".ts p").html("请选择打印机!");
- $(".ts").show();
- setTimeout('$(".ts").fadeOut()', 1000);
- } else {
- $(".systemwindow div p:eq(0)").text("是否确认批量打印所选内容?");
- $(".systemwindow div p:eq(1)").html("<p><font id='printingon'>确 定</font><font class='esc'>取 消</font></p>");
- $(".systemwindow").show();
- }
- } else {
- $(".ts p").html("请勾选需要打印的内容");
- $(".ts").show();
- setTimeout('$(".ts").fadeOut()', 1000);
- }
- });
- /* 批量打印开始 */
- $(".systemwindow").on('click', "#printingon", function() {
- $(".systemwindow").hide();
- $(".systemwindow div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> 正在处理打印信息,请稍后...");
- $(".systemwindow div p:eq(1)").html("");
- $(".systemwindow").show();
- var a = "";
- var i = 0;
- $(".datatext input[name='check']:checked").each(function() {
- a = a + $(this).val() + ',';
- i++;
- });
- var tf = $("select[name='print']").children("option:selected").val();
- ajax(i - 1, a , tf);
- });
- function site(num, list, number, data, i) {
- var jobsite = $("#site").html();
- if (jobsite == '0') {
- $("#job").html("");
- $("#site").html("");
- if (data == '1') {
- var tf = $("select[name='print']").children("option:selected").val();
- ajax(num, list, tf);
- return;
- } else if (data == '2') {
- $("#music_print_ok")[0].play();
- $(".tyrows").hide();
- $(".systemwindow").hide();
- $("#music_d")[0].play();
- $(".systemwindow div p:eq(0)").html('运单打印完成,请更换为新运单后再次操作出库');
- $(".systemwindow div p:eq(1)").html("<font class='wcsj'>确 定</font>");
- $(".systemwindow").show();
- $("#orderinfo").val("");
- $("#orderinfo").focus();
- } else {
- wprinter.sound("打印完成")
- $(".systemwindow div p:eq(0)").html("打印完成!");
- $(".systemwindow div p:eq(1)").html("<font class='printok'>确 定</font>");
- $(".systemwindow").show();
- return;
- }
- } else {
- if (i < '71') {
- if ($("#job").html() != '') {
- wprinter.getStatusValue();
- }
- setTimeout(function() {
- site(num, list, number, data, i + 1);
- }, 1500);
- return;
- } else {
- wprinter.sound("打印机异常")
- $(".systemwindow div p:eq(0)").html("订单:" + number + " 打印失败!系统已停止打印,请检查打印机!如未出此单,请再次打印");
- $(".systemwindow div p:eq(1)").html("<font class='printok'>确 定</font>");
- $(".systemwindow").show();
- $("#job").html("");
- $("#site").html("");
- $(".tyrowsout").hide();
- $("#orderinfo").val("");
- $("#orderinfo").focus();
- return;
- }
- }
- }
- function ajax(num, list, tf) {
- $.ajax({
- url: "/systemprint/printing/",
- data: "tf=" + tf + "&s=" + list + "&n=" + num,
- type: "POST",
- dataType: "json",
- timeout: 60001,
- success: function(c) {
- if (c.success) {
- if (c.rows['type'] == 1) {
- wprinter.pdffhd(c.rows);
- } else if (c.rows['type'] == 2) {
- wprinter.fhd(c.rows);
- }
- else if (c.rows['type'] == 4) {
- wprinter.thd(c.rows);
- }
- else if (c.rows['type'] == 5) {
- wprinter.pdf2fhd(c.rows);
- }else if (c.rows['type'] == 7) {
- //alert("获取同时操作以2部打印机的数据"+JSON.stringify(c))
- //同时两台打印机 一台打印快递单 一台打打印发票
- wprinter.pdffhd(c.rows);
-
- wprinter.fppdf(c.rows);
- }
- else if (c.rows['type'] == 8) {
- wprinter.pdffhdk5(c.rows);
- }
- if (c.rows['n'] > -1) {
- //ajax(c.rows['n'],c.rows['data']);
- site(c.rows['n'], c.rows['data'], c.rows['text']['number'], 1, 0);
- } else {
- if (c.rows['type'] == 3) {
- wprinter.sound("有错误订单")
- $(".systemwindow div p:eq(0)").html(c.rows['text']['number'] + "资料错误未成功打印,已移交给店员处理");
- $(".systemwindow div p:eq(1)").html("<font class='printok'>确 定</font>");
- $(".systemwindow").show();
- } else {
- site(1, 1, c.rows['text']['number'], 0, 0);
- }
- }
- } else {
- $(".systemwindow").hide();
- layx.alert('错误', c.msg, function(id, button) {
- $(".search span").click();
- }, { dialogIcon: 'error' });
- }
- },
- error: function(textStatus) {
- wprinter.sound("错误,请求数据超时!请重试")
- $(".systemwindow").hide();
- layx.alert('错误', '请求数据超时!请重试', function(id, button) {
- $(".search span").click();
- }, { dialogIcon: 'error' });
- },
- });
- }
- function outbound(data) {
- $(".search .number").val("");
- $(".search .waybill").val("");
- $.ajax({
- url: url + "outbound/",
- data: "number=" + $("input[name='outbound']").val() + "&id=" + LYlink + "&type=" + $("select[name='type']").children("option:selected").val() + "&express=" + $("select[name='express']").children("option:selected").val(),
- type: "POST",
- dataType: "json",
- success: function(b) {
- searchspan(1);
- $(".systemwindow").hide();
- if (b && b.success) {
- if (b.music == '1') {
- $("#music_d")[0].play();
- }
- $(".outbound").html(b.msg);
- $("#outbound").val("");
- $("#outbound").focus();
- } else {
- $("#outbound").blur();
- $("#music_c")[0].play();
- $(".systemwindow div p:eq(0)").html(b.msg);
- $(".systemwindow div p:eq(1)").html("<font class='wcoutbound'>确 定</font>");
- $(".systemwindow").show();
- $("#outbound").val("");
- }
- }
- });
- }
- function systembox() {
- $.ajax({
- url: dataurl + "out/",
- data: "number=" + $("input[name='systembox']").val() + "&warehouse=" + $("select[name='warehouse']").children("option:selected").val() + "&systemboxclassid=" + $("select[name='systemboxclassid']").children("option:selected").val(),
- type: "POST",
- dataType: "json",
- success: function(b) {
- $(".systemwindow").hide();
- if (b && b.success) {
- if (b.music == '1') {
- $("#music_d")[0].play();
- }
- $(".systembox").html(b.msg);
- $("#systembox").val("");
- $("#systembox").focus();
- } else {
- $("#systembox").blur();
- $("#music_c")[0].play();
- $(".systemwindow div p:eq(0)").html(b.msg);
- $(".systemwindow div p:eq(1)").html("<font class='wcoutboundbox'>确 定</font>");
- $(".systemwindow").show();
- $("#systembox").val("");
- }
- }
- });
- }
- function systemboxsh() {
- $(".datatext").html("");
- if($("input[name='class']").val() == '0')
- {
- $.ajax({
- url: "/systembox/classid/",
- data: "systemboxclassid=" + $("input[name='systemboxclassid']").val(),
- type: "POST",
- dataType: "json",
- success: function(b) {
- $(".systemwindow").hide();
- if (b && b.success) {
- if (b.music == '1') {
- $("#music_d")[0].play();
- }
- $("select[name='classid']").find('option[value="'+$("input[name='systemboxclassid']").val()+'"]').prop('selected',true);
- $("input[name='class']").val(1);
- searchspan(1);
- $(".exdata").html("<li style='font-size: 16px;'>"+b.sl+"</li>");
- $(".systemboxsh").html(b.msg);
- $("#systemboxsh").val("");
- $("#systemboxsh").focus();
- } else {
- $("#systemboxclassid").blur();
- $("#music_c")[0].play();
- $(".systemwindow div p:eq(0)").html(b.msg);
- $(".systemwindow div p:eq(1)").html("<font class='wcoutboundboxclassid'>确 定</font>");
- $(".systemwindow").show();
- $("#systemboxclassid").val("");
- }
- }
- });
- }
- else
- {
- $.ajax({
- url: "/systembox/rk/",
- data: "number=" + $("input[name='systemboxsh']").val() + "&warehouse=" + $("select[name='warehouse']").children("option:selected").val() + "&systemboxclassid=" + $("input[name='systemboxclassid']").val(),
- type: "POST",
- dataType: "json",
- success: function(b) {
- $(".systemwindow").hide();
- if (b && b.success) {
- if (b.music == '1') {
- $("#music_d")[0].play();
- }
- $(".exdata").html("<li style='font-size: 16px;'>"+b.sl+"</li>");
- $(".systemboxsh").html(b.msg);
- $("#systemboxsh").val("");
- $("#systemboxsh").focus();
- } else {
- $("#systemboxsh").blur();
- $("#music_c")[0].play();
- $(".systemwindow div p:eq(0)").html(b.msg);
- $(".systemwindow div p:eq(1)").html("<font class='wcoutboundboxsh'>确 定</font>");
- $(".systemwindow").show();
- $("#systemboxsh").val("");
- }
- }
- });
- }
- }
- $(".obdel").click(function() {
- var a = "";
- $(".datatext input[name='check']:checked").each(function() {
- a = a + $(this).val() + ",";
- });
- if (a) {
- $(".systemwindow div p:eq(0)").text("是否确认删除所选内容?");
- $(".systemwindow div p:eq(1)").html("<p><font id='obdelgo'>确 定</font><font class='esc'>取 消</font></p>");
- $(".systemwindow").show();
- } else {
- $(".ts p").html("请勾选需要删除的内容");
- $(".ts").show();
- setTimeout('$(".ts").fadeOut()', 1000);
- }
- });
- $(".systemwindow").on('click', "#obdelgo", function() {
- $(".systemwindow").hide();
- $(".systemwindow div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> 删除中,请稍后...");
- $(".systemwindow div p:eq(1)").html("");
- $(".systemwindow").show();
- var a = "";
- var i = 0;
- $(".datatext input[name='check']:checked").each(function() {
- a = a + $(this).val() + ',';
- i++;
- });
- $.ajax({
- url: dataurl+"del",
- data: "delarr=" + a,
- type: "POST",
- dataType: "json",
- success: function(b) {
- $(".systemwindow").hide();
- if (b && b.success) {
- searchspan(1);
- $(".outbound").html(b.data);
- $("#outbound").blur();
- $(".systemwindow div p:eq(0)").html("删除成功!");
- $(".systemwindow div p:eq(1)").html("<font class='wcoutbound'>确 定</font>");
- $(".systemwindow").show();
- } else {
- $("#outbound").blur();
- $(".systemwindow div p:eq(0)").html(b.msg);
- $(".systemwindow div p:eq(1)").html("<font class='wcoutbound'>确 定</font>");
- $(".systemwindow").show();
- }
- }
- });
- });
- /* 清空并聚焦出库input */
- $(".systemwindow").on('click', ".wcsj", function() {
- $("#orderinfo").val("");
- $("#weight").val("");
- $(".systemwindow").find(".gth").remove();
- $("#orderinfo").focus();
- $(".systemwindow").hide();
- });
- $(".systemwindow").on('click', ".wcoutbound", function() {
- $("#outbound").focus();
- $(".systemwindow").hide();
- });
- $(".systemwindow").on('click', ".wcoutboundbox", function() {
- $("#systembox").focus();
- $(".systemwindow").hide();
- });
- $(".systemwindow").on('click', ".wcoutboundboxsh", function() {
- $("#systemboxsh").focus();
- $(".systemwindow").hide();
- });
- $(".systemwindow").on('click', ".wcoutboundboxclassid", function() {
- $("#systemboxclassid").focus();
- $(".systemwindow").hide();
- });
- $(".systemwindow").on('click', ".printok", function() {
- $(".search span").click();
- $(".systemwindow").hide();
- });
- /* 更改出库信息 */
- function win() {
- if (typeof editurl != "undefined") {
- $(".datatext tr").each(function() {
- $(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>");
- });
- }
- }
- $(document).keyup(function(event) {
- if (event.keyCode == 13) {
- if (typeof systemfout != "undefined") {
- if ($("select[name='printer']").children("option:selected").val() == "") {
- $("#music_c")[0].play();
- $(".systemwindow div p:eq(0)").html('需要先选择打印机!');
- $(".systemwindow div p:eq(1)").html("<font class='wcsj'>确 定</font>");
- $(".systemwindow").show();
- $("#orderinfo").val("");
- $("#orderinfo").focus();
- return;
- }
- $("#orderinfo").blur();
- $(".systemwindow div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> 处理中,请稍后...");
- $(".systemwindow div p:eq(1)").html("");
- $(".systemwindow").show();
- $.ajax({
- url: "/systemfout/fout/",
- data: "order=" + $("#orderinfo").val() + "&weight=" + $("#weight").val(),
- type: "POST",
- dataType: "json",
- success: function(a) {
- $(".systemwindow").hide();
- if (a && a.success) {
- if (typeof a.yd != "undefined") {
- $("#orderinfo").blur();
- $("#music_c")[0].play();
- $("#music_print")[0].play();
- $(".tyrowsout p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> 此运单已过期,系统打印处理中,请勿关闭!");
- $(".tyrowsout p:eq(1)").html("");
- $(".tyrowsout").show();
- $.ajax({
- url: "/systemfout/fedexhz/",
- data: "id=" + a.id + "&name=" + a.name + "&express=" + a.express,
- type: "POST",
- dataType: "json",
- success: function(b) {
- $(".systemwindow").hide();
- if (b && b.success) {
- wprinter.pdf(b.rows)
- site(1, 1, b.rows['text']['number'], 2, 0);
- } else {
- $(".tyrows").hide();
- $("#music_c")[0].play();
- wprinter.sound(b.msg);
- $(".systemwindow div p:eq(0)").html(b.msg);
- $(".systemwindow div p:eq(1)").html("<font class='wcsj'>确 定</font>");
- $(".systemwindow").show();
- $("#orderinfo").val("");
- $("#orderinfo").focus();
- }
- }
- });
- } else {
- $("#music_d")[0].play();
- $("#orderinfo").val("");
- $("#weight").val("");
- $(".search span").click();
- $("#orderinfo").focus();
- }
- } else {
- if (typeof a.outnumber != "undefined")
- {
- $("#music_c")[0].play();
- layx.confirm('警告',a.msg,null,{
- buttons:[
- {
- label:'确认出库',
- callback:function(id, button, event){
- $.ajax({
- url: "/systemfout/outnumber/",
- data: "outnumber=" + a.outnumber+"&post=" + a.post+"&fullorder_name=" + a.fullorder_name,
- type: "POST",
- dataType: "json",
- success: function(a) {
- $(".systemwindow").hide();
- $("#orderinfo").focus();
- if (a && a.success) {
- }
- }
- });
- $("#orderinfo").val("");
- layx.destroy(id);
- }
- },
- {
- label:'取消出库',
- callback:function(id, button, event){
- layx.destroy(id);
- }
- }
- ]
- });
- }
- else
- {
- $("#music_c")[0].play();
- wprinter.sound(a.msg);
- $(".systemwindow div p:eq(0)").html(a.msg);
- $(".systemwindow div p:eq(1)").html("<font class='wcsj'>确 定</font>");
- $(".systemwindow").prepend("<p class='gth' style='font-size: 200px;color: #F00;font-weight: bolder;text-align: center;'>X</p>");
- $(".systemwindow").show();
- $("#orderinfo").val("");
- //$("#orderinfo").focus();
- }
- }
- }
- });
- }
- if (typeof systembound != "undefined") {
- $(".search .number").val("");
- $(".search .waybill").val("");
- $.ajax({
- url: "/systembound/out",
- data: "number=" + $("input[name='outbound']").val() + "&type=" + $("select[name='type']").children("option:selected").val() + "&express=" + $("select[name='express']").children("option:selected").val(),
- type: "POST",
- dataType: "json",
- success: function(b) {
- searchspan(1);
- $(".systemwindow").hide();
- if (b && b.success) {
- if (b.music == '1') {
- $("#music_d")[0].play();
- }
- $(".outbound").html(b.msg);
- $("#outbound").val("");
- $("#outbound").focus();
- } else {
- $("#outbound").blur();
- $("#music_c")[0].play();
- wprinter.sound(b.msg);
- $(".systemwindow div p:eq(0)").html(b.msg);
- $(".systemwindow div p:eq(1)").html("<font class='wcoutbound'>确 定</font>");
- $(".systemwindow").show();
- $("#outbound").val("");
- }
- }
- });
- }
- if (typeof systemboxck != "undefined") {
- systembox();
- }
- if (typeof systemclassidsh != "undefined") {
- systemboxsh();
- }
- if (typeof systemwigsout != "undefined") {
- $(".search .number").val("");
- $(".search .waybill").val("");
- $.ajax({
- url: "/systemwigsout/out",
- 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(),
- type: "POST",
- dataType: "json",
- success: function(b) {
- searchspan(1);
- $(".systemwindow").hide();
- if (b && b.success) {
- $("#music_d")[0].play();
-
- $(".outbound").html(b.msg);
- $("#wigsout").val("");
- $("#wigsout").focus();
- } else {
- $("#wigsout").blur();
- $("#music_c")[0].play();
- wprinter.sound(b.msg);
- $(".systemwindow div p:eq(0)").html(b.msg);
- $(".systemwindow div p:eq(1)").html("<font class='wcoutbound'>确 定</font>");
- $(".systemwindow").show();
- $("#wigsout").val("");
- }
- }
- });
- }
- if (typeof systemwigscw != "undefined") {
- $(".search .number").val("");
- $(".search .waybill").val("");
- $.ajax({
- url: "/systemwigscw/out",
- data: "number=" + $("input[name='wigscwout']").val() + "&type=" + $("select[name='type']").children("option:selected").val() + "&timetk=" + $("input[name='timetk']").val(),
- type: "POST",
- dataType: "json",
- success: function(b) {
- searchspan(1);
- $(".systemwindow").hide();
- if (b && b.success) {
- if (b.music == '1') {
- $("#music_d")[0].play();
- }
- $(".outbound").html(b.msg);
- $("#wigsout").val("");
- $("#wigsout").focus();
- } else {
- $("#wigsout").blur();
- $("#music_c")[0].play();
- wprinter.sound(b.msg);
- $(".systemwindow div p:eq(0)").html(b.msg);
- $(".systemwindow div p:eq(1)").html("<font class='wcoutbound'>确 定</font>");
- $(".systemwindow").show();
- $("#wigsout").val("");
- }
- }
- });
- }
- if (typeof ckty != "undefined") {
- $.ajax({
- url: ckty,
- data: "barcode=" + $("input[name='barcode']").val(),
- type: "POST",
- dataType: "json",
- success: function(b) {
- searchspan(1);
- $(".systemwindow").hide();
- if (b && b.success) {
- if (b.music == '1') {
- $("#music_d")[0].play();
- }
- $(".outbound").html(b.msg);
- $("#barcode").val("");
- $("#barcode").focus();
- } else {
- $("#barcode").blur();
- $("#music_c")[0].play();
- $(".wigprintk div p:eq(0)").html(b.msg);
- $(".wigprintk").show();
- $("#barcode").val("");
- }
- }
- });
- }
- if (typeof systemretreat != "undefined") {
- if ($("select[name='printer']").children("option:selected").val() == "") {
- $("#music_c")[0].play();
- $(".systemwindow div p:eq(0)").html('需要先选择打印机!');
- $(".systemwindow div p:eq(1)").html("<font class='wcsj'>确 定</font>");
- $(".systemwindow").show();
- $("#orderinfo").val("");
- $("#orderinfo").focus();
- return;
- }
- $("#orderinfo").blur();
- $(".systemwindow div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> 处理中,请稍后...");
- $(".systemwindow div p:eq(1)").html("");
- $(".systemwindow").show();
- $.ajax({
- url: "/systemretreat/out/",
- data: "order=" + $("#orderinfo").val() + "&weight=" + $("#weight").val(),
- type: "POST",
- dataType: "json",
- success: function(a) {
- $(".systemwindow").hide();
- if (a && a.success) {
- $("#music_d")[0].play();
- $("#orderinfo").val("");
- $("#weight").val("");
- $(".search span").click();
- $("#orderinfo").focus();
- } else {
- $("#music_c")[0].play();
- wprinter.sound(a.msg);
- $(".systemwindow div p:eq(0)").html(a.msg);
- $(".systemwindow div p:eq(1)").html("<font class='wcsj'>确 定</font>");
- $(".systemwindow").prepend("<p class='gth' style='font-size: 200px;color: #F00;font-weight: bolder;text-align: center;'>X</p>");
- $(".systemwindow").show();
- $("#orderinfo").val("");
- //$("#orderinfo").focus();
- }
- }
- });
- }
- }
- });
- $(".wigprintk .wigprintqd").click(function() {
- $(".wigprintk").hide();
- $("#barcode").focus();
- });
-
- $(".wigprintk").on('click', ".printok", function() {
- $(".search span").click();
- $(".wigprintk").hide();
- $("#barcode").focus();
- });
- $(".excel").click(function() {
- var f = "";
- $(".select").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
- });
- $("input:text").each(function() {
- var text = $(this).val().replace(/&/g,"%26");
- text = text.replace(/#/g,"%23");
- text = text.replace(/\+/g,"%2B");
- f = f + $(this).attr("name") + "=" + text + "&";
- });
- $("input:hidden").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).val() + "&";
- });
- var t = "";
- var i = 0;
- $(".datatitle td").each(function() {
- if (i > 0) {
- t = t + "<td>" + $(this).text() + "</td>";
- }
- i++;
- });
- var a = "";
- $(".datatext input[name='check']:checked").each(function() {
- a = a + $(this).val() + ",";
- });
- f = f + "excel=1&a=" + a + "&t=" + t;
- window.location.href = "/systemfout/excel?fexcel=" + $("select[name=fexcel]").find("option:selected").val() + "&" + f;
- $("select[name=fexcel] option:eq(0)").prop('selected', 'selected');
- });
- $(".cpexcel").click(function() {
- var f = "";
- $(".select").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
- });
- $("input:text").each(function() {
- var text = $(this).val().replace(/&/g,"%26");
- text = text.replace(/#/g,"%23");
- text = text.replace(/\+/g,"%2B");
- f = f + $(this).attr("name") + "=" + text + "&";
- });
- $("input:hidden").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).val() + "&";
- });
- var t = "";
- var i = 0;
- $(".datatitle td").each(function() {
- if (i > 0) {
- t = t + "<td>" + $(this).text() + "</td>";
- }
- i++;
- });
- var a = "";
- $(".datatext input[name='check']:checked").each(function() {
- a = a + $(this).val() + ",";
- });
- f = f + "excel=1&a=" + a + "&t=" + t;
- window.location.href = "/systemfout/cpexcel?fexcel=" + $("select[name=fexcel]").find("option:selected").val() + "&" + f;
- $("select[name=fexcel] option:eq(0)").prop('selected', 'selected');
- });
- $(".exceldy").click(function() {
- var f = "";
- $(".select").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
- });
- $("input:text").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).val() + "&";
- });
- $("input:hidden").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).val() + "&";
- });
- var t = "";
- var i = 0;
- $(".datatitle td").each(function() {
- if (i > 0) {
- t = t + "<td>" + $(this).text() + "</td>";
- }
- i++;
- });
- var a = "";
- $(".datatext input[name='check']:checked").each(function() {
- a = a + $(this).val() + ",";
- });
- f = f + "excel=1&a=" + a + "&t=" + t;
- window.location.href = "/systemprint//exceldy?fexcel=1&" + f;
- $("select[name=fexcel] option:eq(0)").prop('selected', 'selected');
- });
- $(".dowot").click(function() {
- var f = "";
- $(".select").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
- });
- $("input:text").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).val() + "&";
- });
- $("input:hidden").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).val() + "&";
- });
- if($("input[name=systembox]").length > 0)
- {
- if($("select[name='warehouse']").children("option:selected").val() == '')
- {
- $(".ts p").text("请选择仓库!");
- $(".ts").show();
- setTimeout('$(".ts").fadeOut()', 800);
- return false;
- }
- }
- window.location.href = dataurl+"excel?fexcel=1&" + f;
- $("select[name=fexcel] option:eq(0)").prop('selected', 'selected');
- });
- $(".downloadexcel").click(function() {
- var f = "";
- var cb = "";
- $(".download .ckrows input:checked").each(function(){
- cb = cb + $(this).val() + "|";
- });
- if(cb == "")
- {
- $(".ts p").text("请选择产品类型!");
- $(".ts").show();
- setTimeout('$(".ts").fadeOut()', 800);
- return false;
- }
- f = "category=" + cb + "&";
- $(".select").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
- });
- $("input:text").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).val() + "&";
- });
- $("input:hidden").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).val() + "&";
- });
- for(j=0;j<$(".datalist .checkbox").length;j++)
- {
- var pcheckid = ""; var pcheckname = "";
- $(".checkbox:eq("+j+") .ckrows input:checked").each(function(){
- pcheckname = $(this).attr("name");
- pcheckid = pcheckid + $(this).val()+",";
- });
-
- f = f + pcheckname + "=" + pcheckid + "&";
- }
- window.location.href = "/systemdownload/data?fexcel=1&" + f;
- $("select[name=fexcel] option:eq(0)").prop('selected', 'selected');
- });
- $(".downloadexcellist").click(function() {
- var f = "";
- var cb = "";
- $(".download .ckrows input:checked").each(function(){
- cb = cb + $(this).val() + "|";
- });
- if(cb == "")
- {
- $(".ts p").text("请选择产品类型!");
- $(".ts").show();
- setTimeout('$(".ts").fadeOut()', 800);
- return false;
- }
- f = "category=" + cb + "&";
- $(".select").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
- });
- $("input:text").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).val() + "&";
- });
- $("input:hidden").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).val() + "&";
- });
- window.location.href = "/systemdownload/listread?fexcel=1&" + f;
- $("select[name=fexcel] option:eq(0)").prop('selected', 'selected');
- });
- /* 时间计算 */
- function getBeforeDate() { //n为你要传入的参数,当前为0,前一天为-1,后一天为1
- var myDate = new Date;
- var year = myDate.getFullYear(); //获取当前年
- var mon = myDate.getMonth() + 1; //获取当前月
- var date = myDate.getDate(); //获取当前日
- var h = myDate.getHours(); //获取当前小时数(0-23)
- var m = myDate.getMinutes(); //获取当前分钟数(0-59)
- var s = myDate.getSeconds(); //获取当前秒
- var week = myDate.getDay();
- var weeks = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
- s = year + '-' + mon + '-' + date + ' ' + h + ':' + m;
- return s;
- }
- $(".obadd").click(function() {
- $(".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>');
- $(".boundtj div p:eq(1)").html("<font class='obaddgo'>确 定</font><font class='esc'>取 消</font>");
- $(".boundtj label #time").val(getBeforeDate());
- $(".boundtj").show();
- });
- $(".woadd").click(function() {
- $(".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>');
- $(".boundtj div p:eq(1)").html("<font class='woaddgo'>确 定</font><font class='esc'>取 消</font>");
- $(".boundtj label #time").val(getBeforeDate());
- $(".boundtj").show();
- });
- $(".boundtj").on('click', ".obaddgo", function() {
- var f = "";
- $(".boundtj .select").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
- });
- $(".boundtj input:text").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).val() + "&";
- });
- $.ajax({
- url: dataurl+"add",
- data: f,
- type: "POST",
- dataType: "json",
- success: function(c) {
- if (c && c.success) {
- searchspan(1);
- $(".boundtj p").html("");
- $(".boundtj").hide();
- $(".boundtj div p:eq(0)").html(c.msg);
- $(".boundtj div p:eq(1)").html("<font class='esc'>确 定</font>");
- $(".boundtj").show();
- } else {
- $(".ts p").html(c.msg);
- $(".ts").show();
- setTimeout('$(".ts").fadeOut()', 1000);
- }
- }
- });
- });
- $(".boundtj").on('click', ".woaddgo", function() {
- var f = "";
- $(".boundtj .select").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
- });
- $(".boundtj input:text").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).val() + "&";
- });
- $.ajax({
- url: dataurl+"add",
- data: f,
- type: "POST",
- dataType: "json",
- success: function(c) {
- if (c && c.success) {
- searchspan(1);
- $(".boundtj p").html("");
- $(".boundtj").hide();
- $(".boundtj div p:eq(0)").html(c.title);
- $(".boundtj div p:eq(1)").html("<font class='esc'>确 定</font>");
- $(".boundtj").show();
- if (b.music == '1') {
- $("#music_d")[0].play();
- }
- $(".outbound").html(b.msg);
- $("#wigsout").val("");
- $("#wigsout").focus();
- } else {
- $("#wigsout").val("");
- $("#wigsout").focus();
- $(".ts p").html(c.msg);
- $(".ts").show();
- setTimeout('$(".ts").fadeOut()', 1000);
- }
- }
- });
- });
- $(".boundtj").on('click', ".esc", function() {
- $(".boundtj p").html("");
- $(".boundtj").hide();
- });
- $('.printwigs').click(function() {
- var a = "";
- $(".datatext input[name='check']:checked").each(function() {
- a = a + $(this).val() + ",";
- });
- if (a) {
- $(".systemwindow div p:eq(0)").text("是否确认批量打印所选内容?");
- $(".systemwindow div p:eq(1)").html("<p><font id='wigsprintall'>确 定</font><font class='esc'>取 消</font></p>");
- $(".systemwindow").show();
- } else {
- $(".ts p").html("请勾选需要打印的内容");
- $(".ts").show();
- setTimeout('$(".ts").fadeOut()', 1000);
- }
- })
- $(".systemwindow").on('click', "#wigsprintall", function() {
- $(".systemwindow").hide();
- $(".systemwindow div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> 正在处理打印信息,请稍后...");
- $(".systemwindow div p:eq(1)").html("");
- $(".systemwindow").show();
- var a = [];
- var i = 0;
- $(".datatext input[name='check']:checked").each(function() {
- orderinfo = $(this).parents('tr').find('.orderinfo').text()
- console.log(orderinfo);
- a.push(orderinfo)
- i++;
- });
- // console.log(orderinfo)
- $.ajax({
- type: 'post',
- url: '/wigs/processAdd',
- dataType: "json",
- data: { ids: a },
- success: function(resp) {
- // data = resp.data;
- if (resp.status) {
- print_dy(resp.data)
- } else {
- alert('暂无可执行订单')
- $(".systemwindow").hide();
- setTimeout('searchspan(2)', 900);
- // $(".systemwindow div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> 正在222232331313处理打印信息,请稍后...");
- // processinfo(data.success);
- }
- }
- })
- });
- $('.print_all').click(function() {
- var a = "";
- $(".datatext input[name='check']:checked").each(function() {
- a = a + $(this).val() + ",";
- });
- if (a) {
- $(".systemwindow div p:eq(0)").text("是否确认批量打印所选内容?");
- $(".systemwindow div p:eq(1)").html("<p><font id='printall'>确 定</font><font class='esc'>取 消</font></p>");
- $(".systemwindow").show();
- } else {
- $(".ts p").html("请勾选需要打印的内容");
- $(".ts").show();
- setTimeout('$(".ts").fadeOut()', 1000);
- }
- })
- $(".systemwindow").on('click', "#printall", function() {
- $(".systemwindow").hide();
- $(".systemwindow div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> 正在处理打印信息,请稍后...");
- $(".systemwindow div p:eq(1)").html("");
- $(".systemwindow").show();
- var a = [];
- var i = 0;
- $(".datatext input[name='check']:checked").each(function() {
- orderinfo = $(this).parents('tr').find('.orderinfo').text()
- console.log(orderinfo);
- a.push(orderinfo)
- i++;
- });
- if (a.length != 0) {
- $.ajax({
- type: 'post',
- url: '/wigs/printall',
- dataType: "json",
- data: { orderinfo: a },
- success: function(resp) {
- if (resp.status) {
- print_dy(resp.data)
- } else {
- alert("程序出了问题!")
- $(".systemwindow").hide();
- setTimeout('searchspan(2)', 900);
- }
- }
- })
- }
- $.ajax({
- type: 'post',
- url: '/wigs/processAdd',
- dataType: "json",
- data: { ids: a },
- success: function(resp) {
- // data = resp.data;
- if (resp.status) {
- print_dy(resp.data)
- } else {
- alert('暂无可执行订单')
- $(".systemwindow").hide();
- setTimeout('searchspan(2)', 900);
- // $(".systemwindow div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> 正在222232331313处理打印信息,请稍后...");
- // processinfo(data.success);
- }
- }
- })
- });
- function processinfo(orderids) {
- if (!orderids) {
- return;
- }
- $.ajax({
- type: 'post',
- url: '/wigs/printall',
- dataType: "json",
- data: { orderids: orderids },
- success: function(resp) {
- if (resp.status) {
- print_dy(resp.data)
- } else {
- alert("程序出了问题!")
- $(".systemwindow").hide();
- setTimeout('searchspan(2)', 900);
- }
- }
- })
- }
- function print_dy(data) {
- var iCurLine = 20
- var leftwidth = 320;
- LODOP.PRINT_INIT("");
- ids = [];
- if (LODOP.CVERSION) CLODOP.On_Return = function(TaskID, Value) {
- // console.log(ids);
- //返回打印结果 不追求精细控制 用这个即可
- if (Value == "1") {
- $.ajax({
- type: 'post',
- url: '/wigs/print_ok',
- dataType: "json",
- data: { 'ids': ids },
- success: function(resp) {
- if (resp.status == "ok") {
- alert("打印成功")
- } else {
- alert("打印失败")
- }
- $(".systemwindow").hide();
- setTimeout('searchspan(2)', 900);
- }
- })
- } else {
- alert("打印未成功");
- $(".systemwindow").hide();
- setTimeout('searchspan(2)', 900);
- }
- };
- for (x in data) {
- ids.push(data[x].id)
- LODOP.ADD_PRINT_BARCODE(3, 10, 50, 350, "128Auto", data[x].number);
- LODOP.SET_PRINT_STYLEA(0, "Angle", 90)
- var str = data[x].orderinfo + data[x].orderremarks + data[x].shipremarks;
- LODOP.ADD_PRINT_TEXT(350, 85, 350, 35, str);
- LODOP.SET_PRINT_STYLEA(0, "FontSize", 11);
- LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
- LODOP.SET_PRINT_STYLEA(0, "Angle", 90)
- // LODOP.SET_PRINT_PAGESIZE(3,450,70,"")//设置默认纸张
- // LODOP.PRINTA();
- LODOP.PRINT();
- // LODOP.PREVIEW();
- // return;
- }
- return;
- }
- $(".screen").click(function() {
- var a = "";
- $(".datatext input[name='check']:checked").each(function() {
- a = a + $(this).val() + ",";
- });
- if (!a) {
- $(".ts p").html("请勾选需要操作的内容");
- $(".ts").show();
- setTimeout('$(".ts").fadeOut()', 1000);
- return false;
- }
- $(".systemwindow div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> 正在处理信息,请稍后...");
- $(".systemwindow div p:eq(1)").html("");
- $(".systemwindow").show();
-
- $.ajax({
- type: 'post',
- url: '/systemprint/cz',
- dataType: "json",
- data: "cz=" + a + "&bj=" + $(this).data("d"),
- success: function(c) {
- if (c && c.success) {
- $(".systemwindow").hide();
- $(".tyrowscc div p:eq(0)").html(c.msg);
- $(".tyrowscc div p:eq(1)").html("<font class='screenok'>确 定</font>");
- $(".tyrowscc").show();
- } else {
- $(".systemwindow").hide();
- $(".ts p").html(c.msg);
- $(".ts").show();
- setTimeout('$(".ts").fadeOut()', 1000);
- }
- }
- })
- });
- $(".tyrowscc").on('click', ".screenok", function() {
- $(".search span").click();
- $(".tyrowscc").hide();
- });
- $(".systemwindow").on('click', "#printbq", function() {
- $(".systemwindow").hide();
- $(".ts p").html("<i class='fa fa-2x fa-cog fa-spin'></i> 系统操作中,请稍后...");
- $(".ts").show();
- var f = "";
- var e = "";
- var index = $(".cike select").find("option:selected").index();
- if(index == '4')
- {
- f = f + $(".cike select").attr("name") + "=" + $(".cike select").children("option:selected").val() + "&";
- $(".postgift .select").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
- });
- }
- else
- {
- $(".datalist .select").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
- });
- }
- $(".post .select").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
- });
- $(".datalist input:text").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).val() + "&";
- });
- $(".datalist input:password").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).val() + "&";
- });
- $(".hidden input:hidden").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).val() + "&";
- });
-
- $(".datalist textarea").each(function() {
- var vl = $(this).val().replace(/\+/g,"%2B");
- vl = vl.replace(/\&/g,"%26");
- f = f + $(this).attr("name") + "=" + vl + "&";
- });
- $(".datalistno input:hidden").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).val() + "&";
- });
- $(".pttab .post input:text").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).val() + "&";
- });
- $(".pttab .post .select").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
- });
- for(i=0;i<$(".datalist .checkbox").length;i++)
- {
- var checkid = ""; var checkname = "";
- $(".datalist .checkbox:eq("+i+") .ckrows input:checked").each(function(){
- checkname = $(this).attr("name");
- checkid = checkid + $(this).val()+",";
- });
- var cd = $(".cike select").find("option:selected").index();
- if(checkname == "" && typeof addedit != "undefined" && (addedit == "/whlabel/enteradd/" || addedit == "/whlabel/enteredit/"))
- {
- if($(".datalist .checkbox:eq("+i+")").prevAll("em").text() == '长 度:')
- {
- if(checkname == "" && typeof cd != "undefined" && cd != 4)
- {
- $(".ts p").text($(".datalist .checkbox:eq("+i+")").prevAll("em").text()+"为必填项");
- $(".ts").show();
- setTimeout('$(".ts").fadeOut()', 600);
- return false;
- }
- f = f + checkname + "=" + checkid + "&";
- }
- }
- else
- {
- if(checkname == "")
- {
- $(".ts p").text($(".datalist .checkbox:eq("+i+")").prevAll("em").text()+"为必填项");
- $(".ts").show();
- setTimeout('$(".ts").fadeOut()', 600);
- return false;
- }
- f = f + checkname + "=" + checkid + "&";
- }
-
- }
- for(j=0;j<$(".post .checkbox").length;j++)
- {
- var pcheckid = ""; var pcheckname = "";
- $(".post .checkbox:eq("+j+") .ckrows input:checked").each(function(){
- pcheckname = $(this).attr("name");
- pcheckid = pcheckid + $(this).val()+",";
- });
- if(pcheckname == "")
- {
- $(".ts p").text($(".post .checkbox:eq("+j+")").prevAll("em").text()+"为必填项");
- $(".ts").show();
- setTimeout('$(".ts").fadeOut()', 600);
- return false;
- }
- f = f + pcheckname + "=" + pcheckid + "&";
-
- }
-
- var ab = 0;
- $(".must").each(function() {
- if ($.trim($(this).val()).length == 0) {
- $(this).css("border", "1px solid #F66");
- ab = ab + 1;
- }
- });
- if (ab > 0) {
- $(".ts p").text("红框为必填项");
- $(".ts").show();
- setTimeout('$(".ts").fadeOut()', 600);
- return false;
- }
- $.ajax({
- url: addedit,
- data: f,
- type: "POST",
- dataType: "json",
- success: function(a) {
- if (a && a.success) {
- $(".ts").hide();
- $(".systemwindow").hide();
- $(".systemwindow div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> 正在处理打印信息,请稍后...");
- $(".systemwindow div p:eq(1)").html("");
- $(".systemwindow").show();
- wprinter.xbq(a);
- xbqsite(1, 1, 0, 0, 0);
- } else {
- $(".ts").hide();
- $(".ts p").html("生成标签失败,请重试");
- $(".ts").fadeIn();
- setTimeout('$(".ts").fadeOut()', 600);
- }
- }
- });
- });
- function xbqsite(num, list, number, data, i) {
- var jobsite = $("#site").html();
- if (jobsite == '0') {
- $("#job").html("");
- $("#site").html("");
-
- wprinter.sound("打印完成")
- $(".systemwindow div p:eq(0)").html("打印完成!");
- $(".systemwindow div p:eq(1)").html("<font class='printok'>确 定</font>");
- $(".systemwindow").show();
- return;
-
- } else {
- if (i < '71') {
- if ($("#job").html() != '') {
- wprinter.getStatusValue();
- }
- setTimeout(function() {
- site(num, list, number, data, i + 1);
- }, 1500);
- return;
- } else {
- wprinter.sound("打印机异常")
- $(".systemwindow div p:eq(0)").html("打印失败!系统已停止打印,请检查打印机!如未出此单,请再次打印");
- $(".systemwindow div p:eq(1)").html("<font class='printok'>确 定</font>");
- $(".systemwindow").show();
- $("#job").html("");
- $("#site").html("");
- $(".tyrowsout").hide();
- $("#orderinfo").val("");
- $("#orderinfo").focus();
- return;
- }
- }
- }
- $(".bbprint").click(function() {
- var a = "";
- $(".datatext input[name='check']:checked").each(function() {
- a = a + $(this).val() + ",";
- });
- if (a) {
- if ($("select[name='printer']").children("option:selected").val() == "") {
- $(".ts p").html("请选择打印机!");
- $(".ts").show();
- setTimeout('$(".ts").fadeOut()', 1000);
- } else {
- $(".wigprintk div p:eq(0)").text("是否确认批量打印所选内容?");
- $(".wigprintk div p:eq(1)").html("<p><font id='bbprinton'>确 定</font><font class='esc'>取 消</font></p>");
- $(".wigprintk").show();
- }
- } else {
- $(".ts p").html("请勾选需要打印的内容");
- $(".ts").show();
- setTimeout('$(".ts").fadeOut()', 1000);
- }
- });
- $(".wigprintk .esc").click(function() {
- $(".wigprintk").hide();
- });
- $(".wigprintk").on('click', "#bbprinton", function() {
- $(".wigprintk").hide();
- $(".wigprintk div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> 正在处理打印信息,请稍后...");
- $(".wigprintk div p:eq(1)").html("");
- $(".wigprintk").show();
- var a = "";
- var i = 0;
- $(".datatext input[name='check']:checked").each(function() {
- a = a + $(this).val() + ',';
- i++;
- });
- var tf = $("select[name='print']").children("option:selected").val();
- if(jcprint == 1)
- {
- wpajax(i - 1, a , tf);
- }
- else
- {
- wpajaxbjc(i - 1, a , tf);
- }
- });
- // 头套布标检测打印状态-开始
- function wpajax(num, list, tf) {
- $.ajax({
- url: printurl,
- data: "s=" + list + "&n=" + num,
- type: "POST",
- dataType: "json",
- timeout: 60001,
- success: function(c) {
- if (c.success) {
- dyfs(c.rows);
- if (c.rows['n'] > -1) {
- bbsite(c.rows['n'],c.rows['data'], c.rows['number'], 1, 0);
- } else {
- bbsite(1, 1, c.rows['number'], 0, 0);
- }
- } else {
- $(".wigprintk").hide();
- layx.alert('错误', c.msg, function(id, button) {
- $(".search span").click();
- }, { dialogIcon: 'error' });
- }
- },
- error: function(textStatus) {
- wprinter.sound("错误,请求数据超时!请重试")
- $(".wigprintk").hide();
- layx.alert('错误', '请求数据超时!请重试', function(id, button) {
- $(".search span").click();
- }, { dialogIcon: 'error' });
- },
- });
- }
- function bbsite(num, list, number, data, i) {
- var jobsite = $("#site").html();
- if (jobsite == '0') {
- $("#job").html("");
- $("#site").html("");
- if (data == '1') {
- var tf = $("select[name='print']").children("option:selected").val();
- wpajax(num, list, tf);
- return;
- } else {
- //wprinter.sound("打印完成")
- $(".wigprintk div p:eq(0)").html("打印完成!");
- $(".wigprintk div p:eq(1)").html("<font class='printok'>确 定</font>");
- $(".wigprintk").show();
- return;
- }
- } else {
- if (i < '71') {
- if ($("#job").html() != '') {
- wprinter.getStatusValue();
- }
- setTimeout(function() {
- bbsite(num, list, number, data, i + 1);
- }, 300);
- return;
- } else {
- wprinter.sound("打印机异常")
- $(".wigprintk div p:eq(0)").html("订单:" + number + " 打印失败!系统已停止打印,请检查打印机!如未出此单,请再次打印");
- $(".wigprintk div p:eq(1)").html("<font class='printok'>确 定</font>");
- $(".wigprintk").show();
- $("#job").html("");
- $("#site").html("");
- $(".tyrowsout").hide();
- $("#orderinfo").val("");
- $("#orderinfo").focus();
- return;
- }
- }
- }
- //头套布标检测打印状态-结束
- //不检测是否打印完成-开始
- function wpajaxbjc(num, list, number) {
- $.ajax({
- url: printurl,
- data: "s=" + list + "&n=" + num,
- type: "POST",
- dataType: "json",
- timeout: 60001,
- success: function(c) {
- if (c.success) {
- bbsitebjc(c.rows);
-
- } else {
- $(".wigprintk").hide();
- layx.alert('错误', c.msg, function(id, button) {
- $(".search span").click();
- }, { dialogIcon: 'error' });
- }
- },
- error: function(textStatus) {
- wprinter.sound("错误,请求数据超时!请重试")
- $(".wigprintk").hide();
- layx.alert('错误', '请求数据超时!请重试', function(id, button) {
- $(".search span").click();
- }, { dialogIcon: 'error' });
- },
- });
- }
- function bbsitebjc(data)
- {
- var j = 0;var x = 0;
- dyfs(data);
- $(".wigprintk div p:eq(0)").html("打印完成!");
- $(".wigprintk div p:eq(1)").html("<font class='printok'>确 定</font>");
- $(".wigprintk").show();
- return;
- }
- //不检测是否打印完成-结束
- $(".systemwindow").on('click', "#newbbprintks", function() {
- $(".systemwindow").hide();
- $(".ts p").html("<i class='fa fa-2x fa-cog fa-spin'></i> 系统操作中,请稍后...");
- $(".ts").show();
- var f = "";
- var e = "";
- var index = $(".cike select").find("option:selected").index();
- if(index == '4')
- {
- f = f + $(".cike select").attr("name") + "=" + $(".cike select").children("option:selected").val() + "&";
- $(".postgift .select").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
- });
- }
- else
- {
- $(".datalist .select").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
- });
- }
- $(".post .select").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
- });
- $(".datalist input:text").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).val() + "&";
- });
- $(".datalist input:password").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).val() + "&";
- });
- $(".hidden input:hidden").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).val() + "&";
- });
-
- $(".datalist textarea").each(function() {
- var vl = $(this).val().replace(/\+/g,"%2B");
- vl = vl.replace(/\&/g,"%26");
- f = f + $(this).attr("name") + "=" + vl + "&";
- });
- $(".datalistno input:hidden").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).val() + "&";
- });
- $(".pttab .post input:text").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).val() + "&";
- });
- $(".pttab .post .select").each(function() {
- f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
- });
- for(i=0;i<$(".datalist .checkbox").length;i++)
- {
- var checkid = ""; var checkname = "";
- $(".datalist .checkbox:eq("+i+") .ckrows input:checked").each(function(){
- checkname = $(this).attr("name");
- checkid = checkid + $(this).val()+",";
- });
- var cd = $(".cike select").find("option:selected").index();
- if(checkname == "" && typeof addedit != "undefined" && (addedit == "/whlabel/enteradd/" || addedit == "/whlabel/enteredit/"))
- {
- if($(".datalist .checkbox:eq("+i+")").prevAll("em").text() == '长 度:')
- {
- if(checkname == "" && typeof cd != "undefined" && cd != 4)
- {
- $(".ts p").text($(".datalist .checkbox:eq("+i+")").prevAll("em").text()+"为必填项");
- $(".ts").show();
- setTimeout('$(".ts").fadeOut()', 600);
- return false;
- }
- f = f + checkname + "=" + checkid + "&";
- }
- }
- else
- {
- if(checkname == "")
- {
- $(".ts p").text($(".datalist .checkbox:eq("+i+")").prevAll("em").text()+"为必填项");
- $(".ts").show();
- setTimeout('$(".ts").fadeOut()', 600);
- return false;
- }
- f = f + checkname + "=" + checkid + "&";
- }
-
- }
- for(j=0;j<$(".post .checkbox").length;j++)
- {
- var pcheckid = ""; var pcheckname = "";
- $(".post .checkbox:eq("+j+") .ckrows input:checked").each(function(){
- pcheckname = $(this).attr("name");
- pcheckid = pcheckid + $(this).val()+",";
- });
- if(pcheckname == "")
- {
- $(".ts p").text($(".post .checkbox:eq("+j+")").prevAll("em").text()+"为必填项");
- $(".ts").show();
- setTimeout('$(".ts").fadeOut()', 600);
- return false;
- }
- f = f + pcheckname + "=" + pcheckid + "&";
-
- }
-
- var ab = 0;
- $(".must").each(function() {
- if ($.trim($(this).val()).length == 0) {
- $(this).css("border", "1px solid #F66");
- ab = ab + 1;
- }
- });
- if (ab > 0) {
- $(".ts p").text("红框为必填项");
- $(".ts").show();
- setTimeout('$(".ts").fadeOut()', 600);
- return false;
- }
- $.ajax({
- url: addedit,
- data: f,
- type: "POST",
- dataType: "json",
- success: function(a) {
- if (a && a.success) {
- $(".ts").hide();
- $(".systemwindow").hide();
- $(".systemwindow div p:eq(0)").html("<i class='fa fa-2x fa-cog fa-spin'></i> 正在处理打印信息,请稍后...");
- $(".systemwindow div p:eq(1)").html("");
- $(".systemwindow").show();
- wprinter.newbubiao(a['rows']);
- $(".systemwindow div p:eq(0)").html("打印完成!");
- $(".systemwindow div p:eq(1)").html("<font class='printok'>确 定</font>");
- return;
- } else {
- $(".ts").hide();
- $(".systemwindow div p:eq(0)").text(a.msg);
- $(".systemwindow div p:eq(1)").html("<p><font class='esc'>确 定</font></p>");
- $(".systemwindow").show();
- }
- }
- });
- });
- function newbbnumberprint(d,n,zps,b,ph,is_jiaji) {
- layx.load('loadId','操作中,请稍后',{shadable:0.6});
- $.ajax({
- url: addedit,
- data: "type=0&data="+d+"&n="+n+"&zps="+zps+"&b="+b+"&ph="+ph+"&is_jiaji="+is_jiaji,
- type: "POST",
- dataType: "json",
- success: function(a) {
- layx.destroy('loadId');
- if (a && a.success) {
- wprinter.newbubiao(a['rows']);
- $(".systemwindow div p:eq(0)").html("打印完成!");
- $(".systemwindow div p:eq(1)").html("<font class='printok'>确 定</font>");
- $(".systemwindow").show();
- return;
- } else {
- $(".ts").hide();
- $(".systemwindow div p:eq(0)").text(a.msg);
- $(".systemwindow div p:eq(1)").html("<p><font class='esc'>确 定</font></p>");
- $(".systemwindow").show();
- }
- }
- });
- };
- function kswaigouprint(d,n,zps,purchase,b) {//外购
- layx.load('loadId','操作中,请稍后',{shadable:0.6});
- $.ajax({
- url: addedit,
- data: "type=1&&data="+d+"&n="+n+"&zps="+zps+"&purchase="+purchase+"&b="+b,
- type: "POST",
- dataType: "json",
- success: function(a) {
- layx.destroy('loadId');
- if (a && a.success) {
- wprinter.newbubiao(a['rows']);
- $(".systemwindow div p:eq(0)").html("打印完成!");
- $(".systemwindow div p:eq(1)").html("<font class='printok'>确 定</font>");
- $(".systemwindow").show();
- return;
- } else {
- $(".ts").hide();
- $(".systemwindow div p:eq(0)").text(a.msg);
- $(".systemwindow div p:eq(1)").html("<p><font class='esc'>确 定</font></p>");
- $(".systemwindow").show();
- }
- }
- });
- };
- function whlabelbhksprint(d,n) {//外购
- if ($("select[name='printer']").children("option:selected").val() == "") {
- $(".ts p").html("请选择打印机!");
- $(".ts").show();
- setTimeout('$(".ts").fadeOut()', 1000);
- return;
- }
- layx.load('loadId','操作中,请稍后',{shadable:0.6});
- $.ajax({
- url: dataurl+"bbprint/",
- data: "d="+d+"&n="+n,
- type: "POST",
- dataType: "json",
- success: function(a) {
- $(".systemwindow").hide();
- layx.destroy('loadId');
- if (a && a.success) {
- wprinter.bhbubiao(a['rows']);
- $(".express p:eq(0)").html('打印完成');
- $(".express p:eq(1)").html("<font class='printfh' data-id='"+a.id+"'>确 定</font>");
- $(".express").show();
- return;
- } else {
- layx.alert('错误',a.msg,function(a,msg){
- },{dialogIcon:'error'});
- }
- }
- });
- };
- $(".systemwindow .esc").click(function() {
- $(".systemwindow").hide();
- });
- $(".systemwindow").on('click', ".esc", function() {
- $(".systemwindow").hide();
- });
|