浏览代码

Merge branch 'master' of http://git.iamberry.com/hexiugang/iamberry-common-parent

# Conflicts:
#	watero-rst-web/src/main/java/com/iamberry/rst/controllers/pts/AdminMachineController.java
#	watero-rst-web/src/main/webapp/WEB-INF/views/pts/machine/addRenovationMachine.ftl
liujiankang 7 年之前
父节点
当前提交
16d8a2bd30

+ 1 - 1
watero-rst-web/src/main/java/com/iamberry/rst/controllers/pts/AdminMachineController.java

@@ -747,7 +747,7 @@ public class AdminMachineController {
                 String realPath = servletContext.getRealPath(ResultInfo.QRCODE_TOOTH_IMAGE);
                 boolean bl = false;
                 try {
-                    bl = QrCodeUtil.createQrCode("www.iamberry.com",realPath+"/"+berQrcode+num+".",430,430);
+                    bl = QrCodeUtil.createQrCode("www.iamberry.com"+berQrcode+num,realPath+"/"+berQrcode+num+".",430,430);
                 }catch (Exception e){
                     e.printStackTrace();
                 }

+ 43 - 98
watero-rst-web/src/main/webapp/WEB-INF/views/pts/machine/tooth_print_List.ftl

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html>
+<html xmlns="http://www.w3.org/1999/html">
 	<head>
 		<meta charset="UTF-8">
 		<title></title>
@@ -33,8 +33,8 @@
                         </div>
                     </div>
                 <input class="my-input" type="hidden" id="machineIsPrint" name="machineIsPrint" />
-                <input  class="my-input" type="text" value="每个二维码打印数量:" readonly="readonly" style="border: 0;margin-top: 8px;margin-right: 0"/>
-                <input class="my-input" type="text" id="settingNumber" name="printNumber" value="3" placeholder="打印数量" style="margin-top: 10px;"/>
+               <#-- <input  class="my-input" type="text" value="每个二维码打印数量:" readonly="readonly" style="border: 0;margin-top: 8px;margin-right: 0"/>
+                <input class="my-input" type="text" id="settingNumber" name="printNumber" value="3" placeholder="打印数量" style="margin-top: 10px;"/>-->
                 <button type="button" class="my-btn-search" onclick="printList();" style="cursor:pointer; margin-right: 50px;margin-top: 10px;">打印</button>
                 <button id="updatePrintId" type="button" class="my-btn-search" onclick="batchUpdatePring();" style="cursor:pointer; margin-right: 50px;margin-top: 10px;">修改为已打印</button>
 			</form>
@@ -94,7 +94,6 @@
                     </tfoot>
                 </#if>
             </div>
-
 			<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>
@@ -151,59 +150,53 @@
                 var machineQrcode = null;
                 var machineProduceType = null;
                 var prints = "";
-                var numbers = 0;
+                /*var numbers = 0;*/
                 var settingNumber = $("#settingNumber").val();
-
-                $("input[name='checkbox']:checkbox:checked").each(function () {
+                var is = null;
+                var L = null;
+                var R = null;
+                var selectNum = $("#listid").find("input[name='checkbox']:checked").length;
+                $("input[name='checkbox']:checkbox:checked").each(function (index,element) {
                     prints += $(this).val();
-                    numbers = numbers+parseInt(settingNumber);
+                    /*numbers = numbers+parseInt(settingNumber);*/
+                    is = (index+1)%2;
                     var machineId = $(this).attr("machineId");
-
                     machineBarcode = $(this).val();
                     machineQrcode = $("#machineQrcode"+machineId).val();
-
                     machineProduceType = $("#machineProduceType"+machineId).val();
-                    /*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);*/
-
-
-                    var produce = getProduce(machineId);
-                    var producePattern =  produce.producePattern;    //获取产品型号前两位
-                    var produceModel =  produce.produceModel;        //获取产品型号后两位
-                    var produceName = produce.produceName;            //获取产品名称
-
-                    var machineNo = "NO." + $("#"+machineBarcode+"Id").val();
-                    for (var i = 0; i < settingNumber; i++) {
-                        code128(machineBarcode);
-                        var barcodes = $("#bcTarget").html();
-                            $("#printlist").append('<div style="width: 242px;height: 120px;position: relative;">' +
-                                    '<span style="position: absolute;left: 10px;font-size: 14px;">'+produceName+'</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>' +
+                    if(is == 1){
+                        R = null;
+                        L = '<img style="position: absolute;float: left; width: 170px;height: 170px;" src="'+machineQrcode+'" />';
+                        if(selectNum == index+1){
+                            $("#printlist").append('<div style="width: 420px;height: 180px;position: relative;">'+
+                                    L+
+                                    R+
                                     '</div>');
-
-                        if(${machineIsPrint} == '1')
-                        {
-                            updatePrint(machineBarcode,false);
-                            $("#" + machineBarcode).remove();
                         }
                     }
-                });
-                numbers = numbers - parseInt(settingNumber);
+                    if(is == 0){
+                        R = '<img style="position: absolute;float: left;margin-left: 170px; width: 170px;height: 170px;" src="'+machineQrcode+'" />';
+                        $("#printlist").append('<div style="width: 420px;height: 180px;position: relative;">'+
+                                L+
+                                R+
+                                '</div>');
+                    }
 
+                    if(${machineIsPrint} == '1')
+                    {
+                        updatePrint(machineBarcode,false);
+                        $("#" + machineBarcode).remove();
+                    }
+                });
+                /*numbers = numbers - parseInt(settingNumber);*/
                 /*计算总打印数量*/
-                var num = $("#settingNumber").val();
+               /* var num = $("#settingNumber").val();
                 var selectNum = $("#listid").find("input[name='checkbox']:checked").length;
                 var machinePrintNumber = parseInt(num)*parseInt(selectNum);
-
-                if(machinePrintNumber > 24){
+*/
+                /*if(machinePrintNumber > 24){
                     layer.msg('一次最多支持打印24张条形码', {icon: 2, time: 2000});
-                }else if (prints != ""){
+                }else */if (prints != ""){
                     $("#printlist").printArea();
                     $("#printlist").html("");
                     layer.closeAll();
@@ -212,15 +205,6 @@
                 }
 
                 $("#printlist").html("");  //未打印成功,需要清除数据
-
-                /*if (prints != "") {
-                    $("#printlist").printArea();
-                    $("#printlist").html("");
-                    layer.closeAll();
-                } else {
-                    layer.msg('未选中需要打印的条形码', {icon: 2, time: 2000});
-                }*/
-
                 prints = "";
             }
             //动态刷新是否有最新的机器
@@ -250,7 +234,7 @@
                                     if(value.machineProduceType == 2){
                                         machineType = "冲奶机";
                                     }*/
-                                    var private = value.machineBarcode.substr(value.machineBarcode.length-4);
+                                    var private = value.machineBarcode.substr(value.machineBarcode.length-5);
                                     var machineCreateTime = formatDate(value.machineCreateTime,"yyyy-MM-dd HH:mm:ss");
                                     $("#listid").prepend('<tr class="text-c"><td width="2"> ' +
                                             '<input name="checkbox" type="checkbox" value="'+value.machineBarcode+'"  machineId="'+value.machineId+'"> ' +
@@ -326,55 +310,16 @@
              function barCodePrint(barCode,machineId){
                  var  machineBarcode = barCode;
                  var machineQrcode = $("#machineQrcode"+machineId).val();
-                 var machineProduceType = $("#machineProduceType"+machineId).val();
-                 var machineNo = "NO." + $("#"+machineBarcode+"Id").val();
-                var settingNumber = $("#settingNumber").val();
-
-                 var produce = getProduce(machineId);
-                 var producePattern =  produce.producePattern;    //获取产品型号前两位
-                 var produceModel =  produce.produceModel;        //获取产品型号后两位
-                 var produceName = produce.produceName;            //获取产品名称
-
-                for (var i=0;i<settingNumber;i++){
-                    code128(machineBarcode);
-                    var barcodes = $("#bcTarget").html();
-
-                    /*if(machineProduceType == 1){//净水机模板*/
-                        $("#printlist").append('<div style="width: 242px;height: 120px;position: relative;">' +
-                                '<span style="position: absolute;left: 10px;font-size: 14px;">'+produceName+'</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: 242px;height: 120px;position: relative;">' +
-                                '<span style="position: absolute;left: 10px;font-size: 14px;">'+produceName+'</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(settingNumber > 24){
-                     layer.msg('一次最多支持打印24张条形码', {icon: 2, time: 2000});
-                 }else{
-                     $("#printlist").printArea();
-                     $("#printlist").html("");
+                     $("#printlist").append('<div style="width: 420px;height: 180px;position: relative;">'+
+                             '<img style="position: absolute;float: left; width: 170px;height: 170px;" src="'+machineQrcode+'" />'+
+                             '</div>');
                      if(${machineIsPrint} == '1')
                      {
-                         updatePrint(machineBarcode, false);
+                         updatePrint(machineBarcode,false);
                          $("#" + machineBarcode).remove();
                      }
-                 }
-
+                     $("#printlist").printArea();
+                     $("#printlist").html("");
             }
 
             /*获取产品信息*/