|
@@ -2,13 +2,13 @@ package com.uas.uas_mes_standard.util;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
import android.content.Context;
|
|
|
import android.text.TextUtils;
|
|
import android.text.TextUtils;
|
|
|
|
|
+import android.util.Log;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.uas.uas_mes_standard.tools.SharedPreUtil;
|
|
|
|
|
-
|
|
|
|
|
import com.uas.uas_mes_standard.bluebooths.PrintHelper;
|
|
import com.uas.uas_mes_standard.bluebooths.PrintHelper;
|
|
|
|
|
+import com.uas.uas_mes_standard.tools.SharedPreUtil;
|
|
|
|
|
|
|
|
public class PrintUtils {
|
|
public class PrintUtils {
|
|
|
|
|
|
|
@@ -43,10 +43,10 @@ public class PrintUtils {
|
|
|
double barHeight = FastjsonUtil.getDouble(templateObject, "LP_HEIGHT");
|
|
double barHeight = FastjsonUtil.getDouble(templateObject, "LP_HEIGHT");
|
|
|
int barHeightInt = (int) (barHeight * dpi / 25.4);
|
|
int barHeightInt = (int) (barHeight * dpi / 25.4);
|
|
|
int fontSize = FastjsonUtil.getInt(templateObject, "LP_SIZE");
|
|
int fontSize = FastjsonUtil.getInt(templateObject, "LP_SIZE");
|
|
|
|
|
+// String lp_font = FastjsonUtil.getText(templateObject, "LP_FONT");//字体类型
|
|
|
String printKey = FastjsonUtil.getText(templateObject, "LP_NAME");
|
|
String printKey = FastjsonUtil.getText(templateObject, "LP_NAME");
|
|
|
-
|
|
|
|
|
String printText = FastjsonUtil.getText(dataJson, printKey);
|
|
String printText = FastjsonUtil.getText(dataJson, printKey);
|
|
|
-
|
|
|
|
|
|
|
+ Log.e("printText",printText);
|
|
|
if (!TextUtils.isEmpty(printText)) {
|
|
if (!TextUtils.isEmpty(printText)) {
|
|
|
switch (valuetype) {
|
|
switch (valuetype) {
|
|
|
case "barcode":
|
|
case "barcode":
|
|
@@ -55,7 +55,7 @@ public class PrintUtils {
|
|
|
.setY(printY)
|
|
.setY(printY)
|
|
|
.setHeight(barHeightInt - (int) (2 * dpi / 25.4))
|
|
.setHeight(barHeightInt - (int) (2 * dpi / 25.4))
|
|
|
.setCodeTextFont(4)
|
|
.setCodeTextFont(4)
|
|
|
- .setCodeTextSize(2)
|
|
|
|
|
|
|
+ .setCodeTextSize(fontSize)
|
|
|
.build();
|
|
.build();
|
|
|
break;
|
|
break;
|
|
|
case "text":
|
|
case "text":
|
|
@@ -68,6 +68,7 @@ public class PrintUtils {
|
|
|
.setY(printY)
|
|
.setY(printY)
|
|
|
.setBold(1)
|
|
.setBold(1)
|
|
|
.setTextFont(textFont)
|
|
.setTextFont(textFont)
|
|
|
|
|
+ .setTextSize(fontSize)
|
|
|
.build();
|
|
.build();
|
|
|
break;
|
|
break;
|
|
|
case "qrcode"://打印二维码
|
|
case "qrcode"://打印二维码
|