Переглянути джерело

修改牙刷打印条码格式

liujiankang 7 роки тому
батько
коміт
1866390d8d

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

@@ -65,6 +65,7 @@
                                     <input name='checkbox' type='checkbox' value='${list.machineBarcode }' machineId='${list.machineId }'>
                                     <input type="hidden" value="${list.machineId + 1000000 }" id="${list.machineBarcode + 'Id'}">
                                     <input type="hidden" value="${list.machineQrcode}" id="machineQrcode${list.machineId }">
+                                    <input type="hidden" value="${(list.machineCreateTime?string("yyyy/MM/dd"))!''}" id="machineCreateTime${list.machineId }">
                                     <input type="hidden" value="${list.machineProduceType}" id="machineProduceType${list.machineId }">
                                 </td>
                                 <td class="text-c" style="font-size: 24px" width="10">${list.machineBarcode?substring(list.machineBarcode?length-5) }</td>
@@ -97,8 +98,8 @@
 			<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 id="printlist" style="margin-left: 75px;">
+			<div style="display:none;">
+				<div id="printlist" style="margin-left: 28px;">
                 </div>
 			</div>
 		</div>
@@ -145,42 +146,49 @@
                     });
 
                 }
+
+            function getNowFormatDate() {
+                var date = new Date();
+                var seperator1 = "/";
+                var year = date.getFullYear();
+                var month = date.getMonth() + 1;
+                var strDate = date.getDate();
+                if (month >= 1 && month <= 9) {
+                    month = "0" + month;
+                }
+                if (strDate >= 0 && strDate <= 9) {
+                    strDate = "0" + strDate;
+                }
+                var currentdate = year + seperator1 + month + seperator1 + strDate;
+                return currentdate;
+            }
             function  printList() {
                 var machineBarcode = null;
                 var machineQrcode = null;
+                var machineCreateTime = null;
                 var machineProduceType = null;
                 var prints = "";
-                /*var numbers = 0;*/
                 var settingNumber = $("#settingNumber").val();
-                var is = null;
-                var L = null;
-                var R = null;
                 var selectNum = $("#listid").find("input[name='checkbox']:checked").length;
+                if(selectNum > 50){
+                    layer.msg('每次打印条数最多可支持50条', {icon: 2, time: 2000});
+                    return;
+                }
                 $("input[name='checkbox']:checkbox:checked").each(function (index,element) {
                     prints += $(this).val();
                     /*numbers = numbers+parseInt(settingNumber);*/
-                    is = (index+1)%2;
                     var machineId = $(this).attr("machineId");
                     machineBarcode = $(this).val();
                     machineQrcode = $("#machineQrcode"+machineId).val();
+                    machineCreateTime = $("#machineCreateTime"+machineId).val();
                     machineProduceType = $("#machineProduceType"+machineId).val();
-                    if(is == 1){
-                        R = null;
-                        L = '<img style="position: absolute;float: left; width: 55px;height: 55px;" src="'+machineQrcode+'" />';
-                        if(selectNum == index+1){
-                            $("#printlist").append('<div style="width: 138px;height: 100px;position: relative;margin-bottom: 4px;">'+
-                                    L+
-                                    R+
-                                    '</div>');
-                        }
-                    }
-                    if(is == 0){
-                        R = '<img style="position: absolute;float: left;margin-left: 63px; width: 55px;height: 55px;" src="'+machineQrcode+'" />';
-                        $("#printlist").append('<div style="width: 138px; height: 100px;position: relative;margin-bottom: 4px;">'+
-                                L+
-                                R+
-                                '</div>');
-                    }
+                    /*if((index+1)%10 == 0){
+                        num = parseInt(num) + 1;
+                    }*/
+                    $("#printlist").append('<div style="width: 156px;height: 183px;margin-top: 0px;position: relative;/*position: relative;margin-bottom: 4px;*/"> ' +
+                            '<img style="position: absolute; width: 130px;height: 128px;margin-top: 15px;" src="'+machineQrcode+'" />' +
+                            '<span style="position: absolute;margin-left: 20px;margin-top: 133px;font-size: 16px;">'+machineCreateTime+'</span>' +
+                            '</div>');
 
                     if(${machineIsPrint} == '1')
                     {
@@ -188,15 +196,7 @@
                         $("#" + machineBarcode).remove();
                     }
                 });
-                /*numbers = numbers - parseInt(settingNumber);*/
-                /*计算总打印数量*/
-               /* var num = $("#settingNumber").val();
-                var selectNum = $("#listid").find("input[name='checkbox']:checked").length;
-                var machinePrintNumber = parseInt(num)*parseInt(selectNum);
-*/
-                /*if(machinePrintNumber > 24){
-                    layer.msg('一次最多支持打印24张条形码', {icon: 2, time: 2000});
-                }else */if (prints != ""){
+                if (prints != ""){
                     $("#printlist").printArea();
                     $("#printlist").html("");
                     layer.closeAll();
@@ -308,12 +308,13 @@
 
             //单个打印条形码
              function barCodePrint(barCode,machineId){
-
+                 var machineCreateTime = $("#machineCreateTime"+machineId).val();
                  var  machineBarcode = barCode;
                  var machineQrcode = $("#machineQrcode"+machineId).val();
-                     $("#printlist").append('<div style="width: 138px; height: 100px;position: relative;margin-bottom: 4px;">'+
-                             '<img style="position: absolute;float: left; width: 55px;height: 55px;" src="'+machineQrcode+'" />'+
-                             '</div>');
+                 $("#printlist").append('<div style="width: 156px;height: 183px;margin-top: 0px;position: relative;/*position: relative;margin-bottom: 4px;*/"> ' +
+                         '<img style="position: absolute; width: 130px;height: 128px;margin-top: 15px;" src="'+machineQrcode+'" />' +
+                         '<span style="position: absolute;margin-left: 20px;margin-top: 133px;font-size: 16px;">'+machineCreateTime+'</span>' +
+                         '</div>');
                      if(${machineIsPrint} == '1')
                      {
                          updatePrint(machineBarcode,false);