|
@@ -30,21 +30,21 @@
|
|
|
<input class="my-input" type="hidden" id="machineIsPrint" name="machineIsPrint"/>
|
|
|
<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="margin-right: 50px;margin-top: 10px;">打印</button>
|
|
|
-
|
|
|
+ <button type="button" class="my-btn-search" onclick="batchUpdatePring();" style="margin-right: 50px;margin-top: 10px;">修改为已打印</button>
|
|
|
</form>
|
|
|
</div>
|
|
|
<div class="mt-2" style="margin: 20px;">
|
|
|
- <table class="table table-border table-bordered table-bg table-hover table-sort">
|
|
|
+ <table class="table table-border table-bordered table-bg table-hover table-sort" style=" width: 50%;margin: 0 auto;">
|
|
|
<thead>
|
|
|
<tr class="text-c">
|
|
|
<th width="1"><input name='checkbox' type='checkbox' value='' id="all" >全选</th>
|
|
|
- <th width="10">机器条码(点击打印)</th>
|
|
|
+ <th width="10">产品条码</th>
|
|
|
<th width="20">操作</th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<tbody id="listid">
|
|
|
<#list machineList as list>
|
|
|
- <tr>
|
|
|
+ <tr class="text-c">
|
|
|
<td width="2">
|
|
|
<input name='checkbox' type='checkbox' value='${list.machineBarcode }${list.machineQrcode }${list.machineProduceType }' >
|
|
|
</td>
|
|
@@ -70,11 +70,15 @@
|
|
|
<script type="text/javascript" src="${path}/common/static/h-ui.admin/js/H-ui.js"></script>
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
- $("#all").click(function(){
|
|
|
- $("input[name='checkbox']").attr("checked","true");
|
|
|
- })
|
|
|
-
|
|
|
+ $("#all").on('click',function(){
|
|
|
+ console.log($(this).prop('checked'));
|
|
|
+ if($(this).prop('checked')){
|
|
|
+ $("input[name='checkbox']").prop("checked","true");
|
|
|
+ }else{
|
|
|
+ $("input[name='checkbox']").removeAttr("checked");
|
|
|
+ }
|
|
|
|
|
|
+ });
|
|
|
if(${machineIsPrint} == 1){
|
|
|
$("#notPrint").attr("class", "current");
|
|
|
$("#machineIsPrint").val(1);
|
|
@@ -105,43 +109,71 @@
|
|
|
|
|
|
}
|
|
|
function printList() {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
var machineBarcode = null;
|
|
|
var machineQrcode = null;
|
|
|
- var machineProduceType = null
|
|
|
+ var machineProduceType = null;
|
|
|
+ var prints = "";
|
|
|
+ var settingNumber = $("#settingNumber").val();
|
|
|
+ var msg = "每个条形码打印数量为"+settingNumber+"条!";
|
|
|
+ layer.confirm(msg, {
|
|
|
+ btn: ['确认','取消'] //按钮
|
|
|
+ }, function(){
|
|
|
$("input[name='checkbox']:checkbox:checked").each(function(){
|
|
|
+ prints += $(this).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);
|
|
|
- code128(machineBarcode);
|
|
|
- var barcodes = $("#bcTarget").html();
|
|
|
- /*$("#barcodeId").html(machineBarcode);
|
|
|
- $("#qrcodeImg").attr('src',machineQrcode);*/
|
|
|
- if(machineProduceType == 1){//净水机模板
|
|
|
- $("#printlist").append('<div style="width: 227px;height: 142px;position: relative;margin-left: 20px;">' +
|
|
|
- '<span style="position: absolute;left: 10px;top:20px;font-size: 14px;">WaterO可移动智能净水机</span>' +
|
|
|
- '<span style="position: absolute;left: 10px;top: 44px;font-size: 12px;">型号:WA-1X</span>' +
|
|
|
- '<span style="position: absolute;left: 10px;top: 60px;font-size: 12px;">S/N</span>' +
|
|
|
- '<div style="position: absolute;top: 80px;height: 23px;" id="bcTarget2" class="barcodeImg">'+barcodes+'</div>' +
|
|
|
- '<span style="position: absolute;left: 10px;top: 108px;font-size: 12px;width: 116px;text-align: center;" id="barcodeId">'+machineBarcode+'</span>' +
|
|
|
- '<img style="position: absolute;right: 10px;top:24px;width: 78px;height: 78px;" id="qrcodeImg" src="'+machineQrcode+'" /> ' +
|
|
|
- '<span style="position: absolute;right: 26px;top: 108px;font-size: 12px;">no.:4295</span> ' +
|
|
|
- '</div>');
|
|
|
+ for (var i=0;i<settingNumber;i++){
|
|
|
+ code128(machineBarcode);
|
|
|
+ var barcodes = $("#bcTarget").html();
|
|
|
+ /*$("#barcodeId").html(machineBarcode);
|
|
|
+ $("#qrcodeImg").attr('src',machineQrcode);*/
|
|
|
+ if(machineProduceType == 1){//净水机模板
|
|
|
+ $("#printlist").append('<div style="width: 268px;height: 152px;position: relative;">' +
|
|
|
+ '<span style="position: absolute;top:0px;font-size: 14px;">WaterO可移动智能净水机</span>' +
|
|
|
+ '<span style="position: absolute;top: 24px;font-size: 12px;">型号:WA-1X</span>' +
|
|
|
+ '<span style="position: absolute;top: 40px;font-size: 12px;">S/N</span>' +
|
|
|
+ '<div style="position: absolute;left: -10px;top: 75px;height: 30px;" id="bcTarget2" class="barcodeImg">'+barcodes+'</div>' +
|
|
|
+ '<span style="position: absolute;top: 102px;font-size: 12px;width: 116px;text-align: center;" id="barcodeId">'+machineBarcode+'</span>' +
|
|
|
+ '<img style="position: absolute;right: 2px;top:18px;width: 86px;height: 86px;" id="qrcodeImg" src="'+machineQrcode+'" /> ' +
|
|
|
+ '<span style="position: absolute;right: 26px;top: 102px;font-size: 12px;">NO.4295</span> ' +
|
|
|
+ '</div>');
|
|
|
+ }
|
|
|
+ if(machineProduceType == 2){//冲奶机模板
|
|
|
+ $("#printlist").append('<div style="width: 268px;height: 152px;position: relative;">' +
|
|
|
+ '<span style="position: absolute;top:0px;font-size: 14px;">爱贝源冲奶机</span>' +
|
|
|
+ '<span style="position: absolute;top: 24px;font-size: 12px;">型号:WA-1X</span>' +
|
|
|
+ '<span style="position: absolute;top: 40px;font-size: 12px;">S/N</span>' +
|
|
|
+ '<div style="position: absolute;left: -10px;top: 75px;height: 30px;" id="bcTarget2" class="barcodeImg">'+barcodes+'</div>' +
|
|
|
+ '<span style="position: absolute;top: 102px;font-size: 12px;width: 116px;text-align: center;" id="barcodeId">'+machineBarcode+'</span>' +
|
|
|
+ '<img style="position: absolute;right: 2px;top:18px;width: 86px;height: 86px;" id="qrcodeImg" src="'+machineQrcode+'" /> ' +
|
|
|
+ '<span style="position: absolute;right: 26px;top: 102px;font-size: 12px;">NO.4295</span> ' +
|
|
|
+ '</div>');
|
|
|
+ }
|
|
|
+ /*updatePrint(machineBarcode);*/
|
|
|
}
|
|
|
- if(machineProduceType == 2){//冲奶机模板
|
|
|
- $("#printlist").append('<div style="width: 227px;height: 142px;position: relative;margin-left: 20px;">' +
|
|
|
- '<span style="position: absolute;left: 10px;top:20px;font-size: 14px;">爱贝源冲奶机</span>' +
|
|
|
- '<span style="position: absolute;left: 10px;top: 44px;font-size: 12px;">型号:WA-1X</span>' +
|
|
|
- '<span style="position: absolute;left: 10px;top: 60px;font-size: 12px;">S/N</span>' +
|
|
|
- '<div style="position: absolute;top: 80px;height: 23px;" id="bcTarget2" class="barcodeImg">'+barcodes+'</div>' +
|
|
|
- '<span style="position: absolute;left: 10px;top: 108px;font-size: 12px;width: 116px;text-align: center;" id="barcodeId">'+machineBarcode+'</span>' +
|
|
|
- '<img style="position: absolute;right: 10px;top:24px;width: 78px;height: 78px;" id="qrcodeImg" src="'+machineQrcode+'" /> ' +
|
|
|
- '<span style="position: absolute;right: 26px;top: 108px;font-size: 12px;">no:4295</span> ' +
|
|
|
- '</div>');
|
|
|
- }
|
|
|
- updatePrint(machineBarcode);
|
|
|
})
|
|
|
- $("#printlist").printArea();
|
|
|
- $("#printlist").html("");
|
|
|
+ if(prints != ""){
|
|
|
+ $("#printlist").printArea();
|
|
|
+ $("#printlist").html("");
|
|
|
+ layer.closeAll();
|
|
|
+ }else{
|
|
|
+ layer.msg('未选中需要打印的条形码', {icon: 2,time:2000});
|
|
|
+ }
|
|
|
+ }, function(){
|
|
|
+ return;
|
|
|
+ });
|
|
|
+
|
|
|
+ /*if (confirm(msg)==true){
|
|
|
+
|
|
|
+ }else{
|
|
|
+ return;
|
|
|
+ }*/
|
|
|
+
|
|
|
+ prints = "";
|
|
|
/*$.ajax({
|
|
|
cache: true,
|
|
|
type: "POST",
|
|
@@ -207,50 +239,38 @@
|
|
|
latestMachine();
|
|
|
},2000);
|
|
|
function latestMachine() {
|
|
|
- $.ajax({
|
|
|
- cache: true,
|
|
|
- type: "POST",
|
|
|
- url: "${path}/admin/machine/_LatestMachine_list",
|
|
|
- data:{machineId : $("#machineId").val()},// 你的formid
|
|
|
- success: function(data){
|
|
|
- if(data != null){
|
|
|
- $.each(data,function(i,value) {
|
|
|
- if(i+1 == data.length){
|
|
|
- $("#machineId").val(value.machineId);
|
|
|
- }
|
|
|
- $("#listid").prepend('<td class="text-c" width="10">'+value.machineBarcode+'</td>' +
|
|
|
- '<td class="td-manage text-c"> <a onclick="machineLogs('+value.machineId+');" title="生产流程" href="javascript:;" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont"></i></a> </td>');
|
|
|
- });
|
|
|
- }
|
|
|
+ var machineIsPrint = $("#machineIsPrint").val();
|
|
|
+ if(machineIsPrint == 2){
|
|
|
+ $.ajax({
|
|
|
+ cache: true,
|
|
|
+ type: "POST",
|
|
|
+ url: "${path}/admin/machine/_LatestMachine_list",
|
|
|
+ data:{machineId : $("#machineId").val()},// 你的formid
|
|
|
+ success: function(data){
|
|
|
+ if(data != null){
|
|
|
+ $.each(data,function(i,value) {
|
|
|
+ if(i+1 == data.length){
|
|
|
+ $("#machineId").val(value.machineId);
|
|
|
+ }
|
|
|
+ $("#listid").prepend('<tr><td width="2"> ' +
|
|
|
+ '<input name="checkbox" type="checkbox" value="'+value.machineBarcode+value.machineQrcode+value.machineProduceType+'" > </td>' +
|
|
|
+ '<td class="text-c" width="10">'+value.machineBarcode+'</td>' +
|
|
|
+ '<td class="td-manage text-c"> <a onclick="machineLogs('+value.machineId+');" title="生产流程" href="javascript:;" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont"></i></a> </td></tr>');
|
|
|
|
|
|
- },
|
|
|
- error: function(){
|
|
|
- console.log("查询最新机器失败!");
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- function formatDate(now) {
|
|
|
- var time = new Date(now);
|
|
|
- var year=time.getFullYear();
|
|
|
- var month=time.getMonth()+1;
|
|
|
- var date=time.getDate();
|
|
|
- var hour=time.getHours();
|
|
|
- var minute=time.getMinutes();
|
|
|
- var second=time.getSeconds();
|
|
|
- if(month < 10){
|
|
|
- month = "0"+month;
|
|
|
- }
|
|
|
- if(date < 10){
|
|
|
- date = "0"+date;
|
|
|
- }
|
|
|
- if(minute < 10){
|
|
|
- minute = "0"+minute;
|
|
|
+ },
|
|
|
+ error: function(){
|
|
|
+ console.log("查询最新机器失败!");
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- return year+"-"+month+"-"+date;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+
|
|
|
function updatePrint(machineBarcode){
|
|
|
$.ajax({
|
|
|
"type" : "post",
|
|
@@ -269,6 +289,27 @@
|
|
|
function machineLogs(machineId) {
|
|
|
window.location.href=root_path + '/admin/machine/_machine_logs_list?machineId='+machineId;
|
|
|
}
|
|
|
+
|
|
|
+ function batchUpdatePring(){
|
|
|
+ var a = new Array();
|
|
|
+ $("input[name='checkbox']:checkbox:checked").each(function(i) {
|
|
|
+ a[i] = $(this).val().substring(0, 13);
|
|
|
+ })
|
|
|
+ $.ajax({
|
|
|
+ "type" : "post",
|
|
|
+ "url" : "${path}/admin/machine/_batchUpdate_print",
|
|
|
+ "dataType" : "json",
|
|
|
+ "data" :{machineBarcodes : ""+a},
|
|
|
+ /*"data" :{machineBarcodes : JSON.stringify(a)},*/
|
|
|
+ "success" : function(data) {
|
|
|
+ layer.msg('修改成功!', {icon: 1,time:2000});
|
|
|
+ },
|
|
|
+ "error":function(data){
|
|
|
+ /*alert("操作失败,请联系管理员!");*/
|
|
|
+ layer.msg('操作失败!', {icon: 2,time:2000});
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
</script>
|
|
|
</body>
|
|
|
</html>
|