Selaa lähdekoodia

打印页面调试

liujiankang 7 vuotta sitten
vanhempi
commit
e5e320fd3a

+ 24 - 24
watero-rst-web/src/main/webapp/WEB-INF/views/pts/machine/machine_List.ftl

@@ -185,36 +185,36 @@
                     /*$("#barcodeId").html(machineBarcode);
                     $("#qrcodeImg").attr('src',machineQrcode);*/
                     if(produceType == 1){//净水机模板
-                        $("#printlist").append('<div style="width: 268px;height: 162px;position: relative;">' +
-                                '<span style="position: absolute;top:-1px;font-size: 14px;">WaterO可移动智能净水机</span>' +
-                                '<span style="position: absolute;top: 23px;font-size: 12px;">型号:'+producePattern+'-'+produceModel+'</span>' +
-                                '<span style="position: absolute;top: 39px;font-size: 12px;">S/N</span>' +
-                                '<div style="position: absolute;left: -10px;top: 74px;height: 30px;" id="bcTarget2" class="barcodeImg">'+barcodes+'</div>' +
-                                '<span style="position: absolute;top: 101px;font-size: 12px;width: 116px;text-align: center;" id="barcodeId">'+machineBarcode+'</span>' +
-                                '<img style="position: absolute;right: 2px;top:17px;width: 86px;height: 86px;" id="qrcodeImg" src="'+machineQrcode+'" /> ' +
-                                '<span style="position: absolute;right: 9px;top: 101px;font-size: 12px;">'+ machineNo +'</span>' +
+                        $("#printlist").append('<div style="width: 242px;height: 120px;position: relative;">' +
+                                '<span style="position: absolute;left: 10px;font-size: 14px;">WaterO可移动智能净水机</span>' +
+                                '<span style="position: absolute;top: 25px;left: 10px;font-size: 12px;">型号:'+producePattern+'-'+produceModel+'</span>' +
+                                '<span style="position: absolute;top: 40px;left: 10px;font-size: 12px;">S/N</span>' +
+                                '<div style="position: absolute;left: 5px;top: 64px;height: 30px;" id="bcTarget2" class="barcodeImg">'+barcodes+'</div>' +
+                                '<span style="position: absolute;top: 85px;left: 10px;font-size: 12px;width: 116px;text-align: center;" id="barcodeId">'+machineBarcode+'</span>' +
+                                '<img style="position: absolute;right: 5px;top:18px;width: 76px;height: 76px;" id="qrcodeImg" src="'+machineQrcode+'" /> ' +
+                                '<span style="position: absolute;right: 9px;top: 85px;font-size: 12px;">'+ machineNo +'</span>' +
                                 '</div>');
                     }
                     if(produceType == '' || produceType == null){
-                        $("#printlist").append('<div style="width: 268px;height: 162px;position: relative;">' +
-                                '<span style="position: absolute;top:-1px;font-size: 14px;">WaterO可移动智能净水机</span>' +
-                                '<span style="position: absolute;top: 23px;font-size: 12px;">型号:'+producePattern+'-'+produceModel+'</span>' +
-                                '<span style="position: absolute;top: 39px;font-size: 12px;">S/N</span>' +
-                                '<div style="position: absolute;left: -10px;top: 74px;height: 30px;" id="bcTarget2" class="barcodeImg">'+barcodes+'</div>' +
-                                '<span style="position: absolute;top: 101px;font-size: 12px;width: 116px;text-align: center;" id="barcodeId">'+machineBarcode+'</span>' +
-                                '<img style="position: absolute;right: 2px;top:17px;width: 86px;height: 86px;" id="qrcodeImg" src="'+machineQrcode+'" /> ' +
-                                '<span style="position: absolute;right: 9px;top: 101px;font-size: 12px;">'+ machineNo +'</span>' +
+                        $("#printlist").append('<div style="width: 242px;height: 120px;position: relative;">' +
+                                '<span style="position: absolute;left: 10px;font-size: 14px;">WaterO可移动智能净水机</span>' +
+                                '<span style="position: absolute;top: 25px;left: 10px;font-size: 12px;">型号:'+producePattern+'-'+produceModel+'</span>' +
+                                '<span style="position: absolute;top: 40px;left: 10px;font-size: 12px;">S/N</span>' +
+                                '<div style="position: absolute;left: 5px;top: 64px;height: 30px;" id="bcTarget2" class="barcodeImg">'+barcodes+'</div>' +
+                                '<span style="position: absolute;top: 85px;left: 10px;font-size: 12px;width: 116px;text-align: center;" id="barcodeId">'+machineBarcode+'</span>' +
+                                '<img style="position: absolute;right: 5px;top:18px;width: 76px;height: 76px;" id="qrcodeImg" src="'+machineQrcode+'" /> ' +
+                                '<span style="position: absolute;right: 9px;top: 85px;font-size: 12px;">'+ machineNo +'</span>' +
                                 '</div>');
                     }
                     if(produceType == 2){//冲奶机模板
-                        $("#printlist").append('<div style="width: 268px;height: 162px;position: relative;">' +
-                                '<span style="position: absolute;top:-1px;font-size: 14px;">爱贝源冲奶机</span>' +
-                                '<span style="position: absolute;top: 23px;font-size: 12px;">型号:'+producePattern+'-'+produceModel+'</span>' +
-                                '<span style="position: absolute;top: 39px;font-size: 12px;">S/N</span>' +
-                                '<div style="position: absolute;left: -10px;top: 74px;height: 30px;" id="bcTarget2" class="barcodeImg">'+barcodes+'</div>' +
-                                '<span style="position: absolute;top: 101px;font-size: 12px;width: 116px;text-align: center;" id="barcodeId">'+machineBarcode+'</span>' +
-                                '<img style="position: absolute;right: 2px;top:17px;width: 86px;height: 86px;" id="qrcodeImg" src="'+machineQrcode+'" /> ' +
-                                '<span style="position: absolute;right: 9px;top: 101px;font-size: 12px;">'+ machineNo +'</span>' +
+                        $("#printlist").append('<div style="width: 242px;height: 120px;position: relative;">' +
+                                '<span style="position: absolute;left: 10px;font-size: 14px;">爱贝源冲奶机</span>' +
+                                '<span style="position: absolute;top: 25px;left: 10px;font-size: 12px;">型号:'+producePattern+'-'+produceModel+'</span>' +
+                                '<span style="position: absolute;top: 40px;left: 10px;font-size: 12px;">S/N</span>' +
+                                '<div style="position: absolute;left: 5px;top: 64px;height: 30px;" id="bcTarget2" class="barcodeImg">'+barcodes+'</div>' +
+                                '<span style="position: absolute;top: 85px;left: 10px;font-size: 12px;width: 116px;text-align: center;" id="barcodeId">'+machineBarcode+'</span>' +
+                                '<img style="position: absolute;right: 5px;top:18px;width: 76px;height: 76px;" id="qrcodeImg" src="'+machineQrcode+'" /> ' +
+                                '<span style="position: absolute;right: 9px;top: 85px;font-size: 12px;">'+ machineNo +'</span>' +
                                 '</div>');
                     }
 

+ 48 - 36
watero-rst-web/src/main/webapp/WEB-INF/views/pts/machine/machine_print_List.ftl

@@ -95,7 +95,7 @@
 			<input type="hidden" value="${machineId!''}" name="machineId" id="machineId">
             <input type="hidden" value="" name="codeId" id="codeId">
             <div style="position: absolute;top: 80px;height: 23px;display:none;" id="bcTarget" class="barcodeImg"></div>
-			<div  <#--style="display:none;"--> >
+			<div  style="display:none;" >
 				<div id="printlist">
                 </div>
 			</div>
@@ -148,10 +148,12 @@
                 var machineQrcode = null;
                 var machineProduceType = null;
                 var prints = "";
+                var numbers = 0;
                 var settingNumber = $("#settingNumber").val();
 
                 $("input[name='checkbox']:checkbox:checked").each(function () {
                     prints += $(this).val();
+                    numbers = numbers+parseInt(settingNumber);
                     machineBarcode = $(this).val().substring(0, 13);
                     machineQrcode = $(this).val().substring(13, ($(this).val().length) - 1);
                     machineProduceType = $(this).val().substring(($(this).val().length) - 1, $(this).val().length);
@@ -168,37 +170,47 @@
                         /*$("#barcodeId").html(machineBarcode);
                         $("#qrcodeImg").attr('src',machineQrcode);*/
                         if (machineProduceType == 1) {//净水机模板
-                            $("#printlist").append('<div style="width: 242px;height: 132px;position: relative;">' +
-                                    '<span style="position: absolute;top:-1px;font-size: 14px;">WaterO可移动智能净水机</span>' +
-                                    '<span style="position: absolute;top: 22px;font-size: 12px;">型号:'+producePattern+'-'+produceModel+'</span>' +
-                                    '<span style="position: absolute;top: 37px;font-size: 12px;">S/N</span>' +
-                                    '<div style="position: absolute;left: -5px;top: 54px;height: 30px;" id="bcTarget2" class="barcodeImg">'+barcodes+'</div>' +
-                                    '<span style="position: absolute;top: 82px;font-size: 12px;width: 116px;text-align: center;" id="barcodeId">'+machineBarcode+'</span>' +
-                                    '<img style="position: absolute;right: 2px;top:14px;width: 76px;height: 76px;" id="qrcodeImg" src="'+machineQrcode+'" /> ' +
-                                    '<span style="position: absolute;right: 9px;top: 82px;font-size: 12px;">'+ machineNo +'</span>' +
+                            $("#printlist").append('<div style="width: 242px;height: 120px;position: relative;">' +
+                                    '<span style="position: absolute;left: 10px;font-size: 14px;">WaterO可移动智能净水机</span>' +
+                                    '<span style="position: absolute;top: 25px;left: 10px;font-size: 12px;">型号:'+producePattern+'-'+produceModel+'</span>' +
+                                    '<span style="position: absolute;top: 40px;left: 10px;font-size: 12px;">S/N</span>' +
+                                    '<div style="position: absolute;left: 5px;top: 64px;height: 30px;" id="bcTarget2" class="barcodeImg">'+barcodes+'</div>' +
+                                    '<span style="position: absolute;top: 85px;left: 10px;font-size: 12px;width: 116px;text-align: center;" id="barcodeId">'+machineBarcode+'</span>' +
+                                    '<img style="position: absolute;right: 5px;top:18px;width: 76px;height: 76px;" id="qrcodeImg" src="'+machineQrcode+'" /> ' +
+                                    '<span style="position: absolute;right: 9px;top: 85px;font-size: 12px;">'+ machineNo +'</span>' +
                                     '</div>');
                         }
                         if (machineProduceType == 2) {//冲奶机模板
-                            $("#printlist").append('<div style="width: 268px;height: 162px;position: relative;">' +
-                                    '<span style="position: absolute;top:-1px;font-size: 14px;">爱贝源冲奶机</span>' +
-                                    '<span style="position: absolute;top: 23px;font-size: 12px;">型号:'+producePattern+'-'+produceModel+'</span>' +
-                                    '<span style="position: absolute;top: 39px;font-size: 12px;">S/N</span>' +
-                                    '<div style="position: absolute;left: -10px;top: 74px;height: 30px;" id="bcTarget2" class="barcodeImg">'+barcodes+'</div>' +
-                                    '<span style="position: absolute;top: 101px;font-size: 12px;width: 116px;text-align: center;" id="barcodeId">'+machineBarcode+'</span>' +
-                                    '<img style="position: absolute;right: 2px;top:17px;width: 86px;height: 86px;" id="qrcodeImg" src="'+machineQrcode+'" /> ' +
-                                    '<span style="position: absolute;right: 9px;top: 101px;font-size: 12px;">'+ machineNo +'</span>' +
+                            $("#printlist").append('<div style="width: 242px;height: 120px;position: relative;">' +
+                                    '<span style="position: absolute;left: 10px;font-size: 14px;">爱贝源冲奶机</span>' +
+                                    '<span style="position: absolute;top: 25px;left: 10px;font-size: 12px;">型号:'+producePattern+'-'+produceModel+'</span>' +
+                                    '<span style="position: absolute;top: 40px;left: 10px;font-size: 12px;">S/N</span>' +
+                                    '<div style="position: absolute;left: 5px;top: 64px;height: 30px;" id="bcTarget2" class="barcodeImg">'+barcodes+'</div>' +
+                                    '<span style="position: absolute;top: 85px;left: 10px;font-size: 12px;width: 116px;text-align: center;" id="barcodeId">'+machineBarcode+'</span>' +
+                                    '<img style="position: absolute;right: 5px;top:18px;width: 76px;height: 76px;" id="qrcodeImg" src="'+machineQrcode+'" /> ' +
+                                    '<span style="position: absolute;right: 9px;top: 85px;font-size: 12px;">'+ machineNo +'</span>' +
                                     '</div>');
                         }
                         /*updatePrint(machineBarcode);*/
                     }
-                })
-                if (prints != "") {
+                });
+                numbers = numbers - parseInt(settingNumber);
+                if(numbers > 40){
+                    layer.msg('一次最多支持打印40张条形码', {icon: 2, time: 2000});
+                }else if (prints != ""){
                     $("#printlist").printArea();
-                    /*$("#printlist").html("");*/
+                    $("#printlist").html("");
                     layer.closeAll();
                 } else {
                     layer.msg('未选中需要打印的条形码', {icon: 2, time: 2000});
                 }
+                /*if (prints != "") {
+                    $("#printlist").printArea();
+                    $("#printlist").html("");
+                    layer.closeAll();
+                } else {
+                    layer.msg('未选中需要打印的条形码', {icon: 2, time: 2000});
+                }*/
 
                 prints = "";
             }
@@ -324,25 +336,25 @@
                             '</div>');*/
 
                     if(machineProduceType == 1){//净水机模板
-                        $("#printlist").append('<div style="width: 268px;height: 162px;position: relative;">' +
-                                '<span style="position: absolute;top:-1px;font-size: 14px;">WaterO可移动智能净水机</span>' +
-                                '<span style="position: absolute;top: 23px;font-size: 12px;">型号:'+producePattern+'-'+produceModel+'</span>' +
-                                '<span style="position: absolute;top: 39px;font-size: 12px;">S/N</span>' +
-                                '<div style="position: absolute;left: -10px;top: 74px;height: 30px;" id="bcTarget2" class="barcodeImg">'+barcodes+'</div>' +
-                                '<span style="position: absolute;top: 101px;font-size: 12px;width: 116px;text-align: center;" id="barcodeId">'+machineBarcode+'</span>' +
-                                '<img style="position: absolute;right: 2px;top:17px;width: 86px;height: 86px;" id="qrcodeImg" src="'+machineQrcode+'" /> ' +
-                                '<span style="position: absolute;right: 9px;top: 101px;font-size: 12px;">'+ machineNo +'</span>' +
+                        $("#printlist").append('<div style="width: 242px;height: 120px;position: relative;">' +
+                                '<span style="position: absolute;left: 10px;font-size: 14px;">WaterO可移动智能净水机</span>' +
+                                '<span style="position: absolute;top: 25px;left: 10px;font-size: 12px;">型号:'+producePattern+'-'+produceModel+'</span>' +
+                                '<span style="position: absolute;top: 40px;left: 10px;font-size: 12px;">S/N</span>' +
+                                '<div style="position: absolute;left: 5px;top: 64px;height: 30px;" id="bcTarget2" class="barcodeImg">'+barcodes+'</div>' +
+                                '<span style="position: absolute;top: 85px;left: 10px;font-size: 12px;width: 116px;text-align: center;" id="barcodeId">'+machineBarcode+'</span>' +
+                                '<img style="position: absolute;right: 5px;top:18px;width: 76px;height: 76px;" id="qrcodeImg" src="'+machineQrcode+'" /> ' +
+                                '<span style="position: absolute;right: 9px;top: 85px;font-size: 12px;">'+ machineNo +'</span>' +
                                 '</div>');
                     }
                     if(machineProduceType == 2){//冲奶机模板
-                        $("#printlist").append('<div style="width: 268px;height: 162px;position: relative;">' +
-                                '<span style="position: absolute;top:-1px;font-size: 14px;">爱贝源冲奶机</span>' +
-                                '<span style="position: absolute;top: 23px;font-size: 12px;">型号:'+producePattern+'-'+produceModel+'</span>' +
-                                '<span style="position: absolute;top: 39px;font-size: 12px;">S/N</span>' +
-                                '<div style="position: absolute;left: -10px;top: 74px;height: 30px;" id="bcTarget2" class="barcodeImg">'+barcodes+'</div>' +
-                                '<span style="position: absolute;top: 101px;font-size: 12px;width: 116px;text-align: center;" id="barcodeId">'+machineBarcode+'</span>' +
-                                '<img style="position: absolute;right: 2px;top:17px;width: 86px;height: 86px;" id="qrcodeImg" src="'+machineQrcode+'" /> ' +
-                                '<span style="position: absolute;right: 9px;top: 101px;font-size: 12px;">'+ machineNo +'</span>' +
+                        $("#printlist").append('<div style="width: 242px;height: 120px;position: relative;">' +
+                                '<span style="position: absolute;left: 10px;font-size: 14px;">爱贝源冲奶机</span>' +
+                                '<span style="position: absolute;top: 25px;left: 10px;font-size: 12px;">型号:'+producePattern+'-'+produceModel+'</span>' +
+                                '<span style="position: absolute;top: 40px;left: 10px;font-size: 12px;">S/N</span>' +
+                                '<div style="position: absolute;left: 5px;top: 64px;height: 30px;" id="bcTarget2" class="barcodeImg">'+barcodes+'</div>' +
+                                '<span style="position: absolute;top: 85px;left: 10px;font-size: 12px;width: 116px;text-align: center;" id="barcodeId">'+machineBarcode+'</span>' +
+                                '<img style="position: absolute;right: 5px;top:18px;width: 76px;height: 76px;" id="qrcodeImg" src="'+machineQrcode+'" /> ' +
+                                '<span style="position: absolute;right: 9px;top: 85px;font-size: 12px;">'+ machineNo +'</span>' +
                                 '</div>');
                     }
                 }