|
|
@@ -22,7 +22,7 @@
|
|
|
<option value="">选择打印机</option>
|
|
|
</select>
|
|
|
</div>
|
|
|
- <a href="javascript:void(0);" class="printing">打 印</a>
|
|
|
+ <a href="javascript:void(0);" class="printing_bqpl">打 印</a>
|
|
|
<a href="javascript:void(0);" class="lv_print_excel">导入需要打印的文件</a>
|
|
|
<input id="upload-file" name="files" accept="image/xls,image/xlsx" type="file" class="none">
|
|
|
</div>
|
|
|
@@ -209,6 +209,145 @@
|
|
|
}
|
|
|
|
|
|
|
|
|
+ </script>
|
|
|
+
|
|
|
+ <script>
|
|
|
+ $(".printing_bqpl").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_bqpl'>确 定</font><font class='esc'>取 消</font></p>");
|
|
|
+ $(".systemwindow").show();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $(".ts p").html("请勾选需要打印的内容");
|
|
|
+ $(".ts").show();
|
|
|
+ setTimeout('$(".ts").fadeOut()', 1000);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ /* 批量打印开始 */
|
|
|
+ $(".systemwindow").on('click', "#printingon_bqpl", 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_bqpl(i - 1, a, tf);
|
|
|
+ });
|
|
|
+
|
|
|
+ function site_bqpl(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_bqpl(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_bqpl(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_bqpl(num, list, tf) {
|
|
|
+ $.ajax({
|
|
|
+ url: "/whlabelfz/printing/",
|
|
|
+ data: "tf=" + tf + "&s=" + list + "&n=" + num,
|
|
|
+ type: "POST",
|
|
|
+ dataType: "json",
|
|
|
+ timeout: 60001,
|
|
|
+ success: function(c) {
|
|
|
+ if (c.success) {
|
|
|
+ wprinter.xbq(c.rows.text)
|
|
|
+ if (c.rows['n'] > -1) {
|
|
|
+ //ajax(c.rows['n'],c.rows['data']);
|
|
|
+ site_bqpl(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_bqpl(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'
|
|
|
+ });
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
</script>
|
|
|
<script type="text/javascript" src="{$theme}js/excel/xlxs.js" ></script>
|
|
|
<script type="text/javascript" src="{$theme}js/laydate.js"></script>
|