|
@@ -27,9 +27,9 @@
|
|
|
<span id="havePrint" onclick="selectIsPrint(2);" class="returnOrderEtc">已打印</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <input class="my-input" type="text" id="printNumber" name="printNumber" value="3" placeholder="打印数量" style="margin-top: 10px;"/>
|
|
|
- <input class="my-input" type="hidden" id="settingNumber" name="settingNumber" value="3"/>
|
|
|
- <button type="button" class="my-btn-search" onclick="setting();" style="margin-right: 50px;margin-top: 10px;">打印</button>
|
|
|
+ <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>
|
|
|
|
|
|
</form>
|
|
|
</div>
|
|
@@ -67,12 +67,16 @@
|
|
|
<script type="text/javascript" src="${path}/common/static/h-ui.admin/js/H-ui.js"></script>
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
- if(${machineIsPrint} == 1){
|
|
|
- $("#notPrint").attr("class", "current");
|
|
|
- }
|
|
|
- if(${machineIsPrint} == 2){
|
|
|
- $("#havePrint").attr("class", "current");
|
|
|
- }
|
|
|
+
|
|
|
+ if(${machineIsPrint} == 1){
|
|
|
+ $("#notPrint").attr("class", "current");
|
|
|
+ $("#machineIsPrint").val(1);
|
|
|
+ }
|
|
|
+ if(${machineIsPrint} == 2){
|
|
|
+ $("#havePrint").attr("class", "current");
|
|
|
+ $("#machineIsPrint").val(2);
|
|
|
+ }
|
|
|
+
|
|
|
function selectIsPrint(printState) {
|
|
|
if(printState == 1){
|
|
|
$("#notPrint").attr("class", "current");
|
|
@@ -81,9 +85,80 @@
|
|
|
$("#havePrint").attr("class", "current");
|
|
|
$("#notPrint").removeClass("current");
|
|
|
}
|
|
|
+ $("#machineIsPrint").val(printState);
|
|
|
window.location.href=root_path + '/admin/machine/_machine_print_list?machineIsPrint='+printState;
|
|
|
}
|
|
|
+ //生成128条形码
|
|
|
+ function code128(barcode){
|
|
|
+ $("#codeId").val(barcode);
|
|
|
+ $("#bcTarget").empty().barcode($("#codeId").val(), "code128",{
|
|
|
+ barWidth:1, barHeight:23,showHRI:false
|
|
|
+ });
|
|
|
|
|
|
+ }
|
|
|
+ function printList() {
|
|
|
+ $.ajax({
|
|
|
+ cache: true,
|
|
|
+ type: "POST",
|
|
|
+ url: "${path}/admin/machine/machine_print_list",
|
|
|
+ data:{machineIsPrint : $("#machineIsPrint").val()},
|
|
|
+ success: function(data){
|
|
|
+ if(data != null){
|
|
|
+ var settingNumber = $("#settingNumber").val();
|
|
|
+ $.each(data,function(i,value) {
|
|
|
+ for (var i=0;i<settingNumber;i++){
|
|
|
+ code128(value.machineBarcode);
|
|
|
+ var barcodes = $("#bcTarget").html();
|
|
|
+ /*$("#barcodeId").html(machineBarcode);
|
|
|
+ $("#qrcodeImg").attr('src',machineQrcode);*/
|
|
|
+ $("#printlist").append('<div style="width: 227px;height: 150px;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">'+value.machineBarcode+'</span>' +
|
|
|
+ '<img style="position: absolute;right: 10px;top:24px;width: 78px;height: 78px;" src="'+value.machineQrcode+'" /> ' +
|
|
|
+ '<span style="position: absolute;right: 26px;top: 108px;font-size: 12px;">no:4295</span> ' +
|
|
|
+ '</div>');
|
|
|
+ }
|
|
|
+
|
|
|
+ updatePrint(value.machineId);
|
|
|
+ });
|
|
|
+ $("#printlist").printArea();
|
|
|
+ $("#printlist").html("");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function(){
|
|
|
+ console.log("查询最新机器失败!");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //动态刷新是否有最新的机器
|
|
|
+ ref = setInterval(function(){
|
|
|
+ latestMachine();
|
|
|
+ },200000);
|
|
|
+ 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"></td>');
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ error: function(){
|
|
|
+ console.log("查询最新机器失败!");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
|
|
|
function formatDate(now) {
|
|
@@ -105,6 +180,21 @@
|
|
|
}
|
|
|
return year+"-"+month+"-"+date;
|
|
|
}
|
|
|
+
|
|
|
+ function updatePrint(machineId){
|
|
|
+ $.ajax({
|
|
|
+ "type" : "post",
|
|
|
+ "url" : "${path}/admin/machine/_update_print",
|
|
|
+ "dataType" : "json",
|
|
|
+ "data" :{machineId : machineId},
|
|
|
+ "success" : function(data) {
|
|
|
+
|
|
|
+ },
|
|
|
+ "error":function(data){
|
|
|
+ alert("操作失败,请联系管理员!");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
</script>
|
|
|
</body>
|
|
|
</html>
|