Browse Source

蓝牙打印条码尺寸修改

ChengJH 1 year ago
parent
commit
1d6e8c8040

+ 3 - 1
app/src/main/java/com/uas/uaspda/fragment/BlueToothPrintFragment.java

@@ -339,7 +339,9 @@ public class BlueToothPrintFragment extends BaseFragment {
         if (!ListUtils.isEmpty(models)) {
             for (int i = 0; i < models.size(); i++) {
                 BluetoothDevice bluetoothDevice = models.get(i);
-                if (bluetoothDevice != null && bluetoothDevice.getBluetoothClass().getDeviceClass() == ConnectHelper.PRINT_TYPE) {
+                if (bluetoothDevice != null
+//                        && bluetoothDevice.getBluetoothClass().getDeviceClass() == ConnectHelper.PRINT_TYPE
+                ) {
                     printDevices.add(bluetoothDevice);
                 }
             }

+ 21 - 24
app/src/main/java/com/uas/uaspda/fragment/IndexSettingFragment.java

@@ -49,11 +49,8 @@ import com.uas.uaspda.util.AndroidUtil;
 import com.uas.uaspda.util.CommonUtil;
 import com.uas.uaspda.util.Constants;
 import com.uas.uaspda.util.FileUtils;
-import com.uas.uaspda.util.HttpCallback;
-import com.uas.uaspda.util.HttpParams;
 import com.uas.uaspda.util.JsonTools;
 import com.uas.uaspda.util.LogUtil;
-import com.uas.uaspda.util.VolleyRequest;
 
 import org.json.JSONArray;
 import org.json.JSONException;
@@ -693,27 +690,27 @@ public class IndexSettingFragment extends BaseFragment implements View.OnClickLi
         mRequestQueue.add(mJsonRequest);
 
     }
-    private void searchLocation() {
-        progressDialog.show();
-        VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
-                .url(GloableParams.ADDRESS_CHECK_LOCATIONCHECKS)
-                .method(Request.Method.POST)
-                .addParam("id","157023")
-                .build(), new HttpCallback() {
-            @Override
-            public void onSuccess(int flag, Object o) throws Exception {
-                progressDialog.dismiss();
-
-
-            }
-
-            @Override
-            public void onFail(int flag, String failStr) throws Exception {
-                progressDialog.dismiss();
-                CommonUtil.toastNoRepeat(mActivity, failStr);
-            }
-        });
-    }
+//    private void searchLocation() {
+//        progressDialog.show();
+//        VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
+//                .url(GloableParams.ADDRESS_CHECK_LOCATIONCHECKS)
+//                .method(Request.Method.POST)
+//                .addParam("id","157023")
+//                .build(), new HttpCallback() {
+//            @Override
+//            public void onSuccess(int flag, Object o) throws Exception {
+//                progressDialog.dismiss();
+//
+//
+//            }
+//
+//            @Override
+//            public void onFail(int flag, String failStr) throws Exception {
+//                progressDialog.dismiss();
+//                CommonUtil.toastNoRepeat(mActivity, failStr);
+//            }
+//        });
+//    }
 
 
 

+ 14 - 4
app/src/main/java/com/uas/uaspda/global/GloableParams.java

@@ -222,6 +222,8 @@ public class GloableParams {
     public static String ADDRESS_SPM_GETLINE;
     public static String ADDRESS_SMT_FORECASTDATACHECK;
     public static String ADDRESS_CHECK_LOCATIONCHECK;
+    public static String ADDRESS_SMT_REPEATCHECK_DATA;
+    public static String ADDRESS_CHECK_LOCATIONDATAREPEATCHECK;
 
 
     //连接服务器请求地址
@@ -433,7 +435,10 @@ public class GloableParams {
     // 货物查询:储位信息查询
     private static final String ADDRESSTAIL_CHECK_LOCATIONCHECK = "/api/pda/check/locationCheck.action";
 
-
+    private static final String ADDRESSTAIL_CHECK_LOCATIONCHECKS = "/common/downloadbyId.action";
+    //复检校验
+    private static final String ADDRESSTAIL_SMT_START_DATAREPEATCHECK = "/api/pda/smt/checkDataRepeat.action";
+    private static final String ADDRESSTAIL_SMT_DATAREPEATCHECK_DATA = "/api/pda/smt/startCheckRepeat.action";
     // 仓库管理:拆批合批,页面二:分拆批次页面
     private static final String ADDRESSTAIL_BARCODEENTEREVENT = "/api/pda/batch/getBarcodeData.action";
     private static final String ADDRESSTAIL_BREAKINGBTNCLICKEVENT = "/api/pda/batch/breakingBatch.action";
@@ -698,19 +703,20 @@ public class GloableParams {
     public static final String LISTNAME_PREMATERIAL_QUERY = "备料查询";
     public static final String LISTNAME_FEEDER_BIND = "飞达料盘绑定";
     public static final String LISTNAME_FEEDER_UNBIND = "飞达料盘解绑";
-
+    public static final String LISTNAME_FEEDER_CHECKINSPECTION = "复检校验";
     public static final String[] feederListNames = {LISTNAME_FEEDER_IN, LISTNAME_FEEDER_JOIN, LISTNAME_FEEDER_CHANGE, LISTNAME_FEEDER_DOWN,
             LISTNAME_FEEDER_DOWNALL, LISTNAME_FEEDER_QUERY, LISTNAME_FEEDER_SWITCH,
             LISTNAME_FEEDER_CHECK, LISTNAME_FEEDER_MACHINE, LISTNAME_REQUEST_MACHINE,
             LISTNAME_LOCATION_QUERY, LISTNAME_PREMATERIAL_QUERY, LISTNAME_FEEDER_BIND,
-            LISTNAME_FEEDER_UNBIND};
+            LISTNAME_FEEDER_UNBIND,LISTNAME_FEEDER_CHECKINSPECTION};
     public static final int[] feederListImgs = {R.drawable.index_smt_up, R.drawable.index_smt_joint,
             R.drawable.index_smt_change, R.drawable.index_smt_down,
             R.drawable.index_smt_downall, R.drawable.index_smt_query,
             R.drawable.index_smt_switch, R.drawable.index_smt_check,
             R.drawable.index_smt_machine, R.drawable.index_smt_request,
             R.drawable.index_location_query, R.drawable.index_prematerial_query,
-            R.drawable.index_prematerial_query, R.drawable.index_smt_query};
+            R.drawable.index_prematerial_query, R.drawable.index_smt_query,
+            R.drawable.index_smt_check};
 
     //-->入库管理
     public static final String MENU_STORAGE_RECHARGE = "收料";
@@ -993,5 +999,9 @@ public class GloableParams {
         GloableParams.ADDRESS_SPM_GETLINE = uriHead + GloableParams.ADDRESSTAIL_SPM_GETLINE;
         GloableParams.ADDRESS_SMT_FORECASTDATACHECK = uriHead + GloableParams.ADDRESSTAIL_SMT_FORECASTDATACHECK;
         GloableParams.ADDRESS_CHECK_LOCATIONCHECK = uriHead + GloableParams.ADDRESSTAIL_CHECK_LOCATIONCHECK;
+//        GloableParams.ADDRESS_CHECK_LOCATIONCHECK = uriHead + GloableParams.ADDRESSTAIL_CHECK_LOCATIONCHECKS;
+        GloableParams.ADDRESS_SMT_REPEATCHECK_DATA = uriHead + GloableParams.ADDRESSTAIL_SMT_DATAREPEATCHECK_DATA;
+        GloableParams.ADDRESS_CHECK_LOCATIONDATAREPEATCHECK = uriHead + GloableParams.ADDRESSTAIL_SMT_START_DATAREPEATCHECK;
+
     }
 }

+ 20 - 8
app/src/main/java/com/uas/uaspda/util/PrintUtils.java

@@ -2,6 +2,7 @@ package com.uas.uaspda.util;
 
 import android.content.Context;
 import android.text.TextUtils;
+import android.util.Log;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
@@ -22,10 +23,14 @@ public class PrintUtils {
             }
 
             int offset = 6,
-                    h = 200,
-                    v = 200,
+                    h = 400,
+                    v = 800,
                     height = 200,
                     qty = 1;
+//                    h = 200,
+//                    v = 200,
+//                    height = 200,
+//                    qty = 1;
 
             JSONArray templateArray = JSON.parseArray(printTemplate);
             if (templateArray != null && templateArray.size() > 0) {
@@ -41,10 +46,12 @@ public class PrintUtils {
                         int printY = (int) (toprate * dpi / 25.4);
                         double barHeight = FastjsonUtil.getDouble(templateObject, "LP_HEIGHT");
                         int barHeightInt = (int) (barHeight * dpi / 25.4);
+                        int  lp_width = FastjsonUtil.getInt(templateObject, "LP_WIDTH");
                         int fontSize = FastjsonUtil.getInt(templateObject, "LP_SIZE");
                         String printKey = FastjsonUtil.getText(templateObject, "LP_NAME");
 
                         String printText = FastjsonUtil.getText(dataJson, printKey);
+                        Log.e("printText==",printText);
 
                         if (!TextUtils.isEmpty(printText)) {
                             switch (valuetype) {
@@ -54,7 +61,7 @@ public class PrintUtils {
                                             .setY(printY)
                                             .setHeight(barHeightInt - (int) (2 * dpi / 25.4))
                                             .setCodeTextFont(4)
-                                            .setCodeTextSize(2)
+                                            .setCodeTextSize(1)
                                             .build();
                                     break;
                                 case "text":
@@ -62,11 +69,16 @@ public class PrintUtils {
                                     if ("BAR_BATCHCODE".equals(printKey)) {
                                         textFont = 7;
                                     }
-                                    printHelper = printHelper.printText(printText)
-                                            .setX(printX)
-                                            .setY(printY + (int) ((0.6 * dpi) / 25.4))
-                                            .setBold(2)
-                                            .setTextFont(textFont)
+                                    if (StringUtil.isEmpty(String.valueOf(fontSize))){
+                                        fontSize=1;
+                                    }
+                                    printHelper = printHelper.printText("")
+                                            .setTextAutLine(printX+"",printY + (int) ((0.6 * dpi) / 25.4)+"",lp_width,fontSize,false,false,printText)
+//                                            .setX(printX)
+//                                            .setY(printY + (int) ((0.6 * dpi) / 25.4))
+//                                            .setBold(2)
+//                                            .setTextFont(textFont)
+//                                            .setTextFont(fontSize)
                                             .build();
                                     break;
                                 case "qrcode"://打印二维码

+ 5 - 2
pda_libs/bluetooth/src/main/java/com/uas/bluetooth/PrintHelper.java

@@ -86,7 +86,10 @@ public class PrintHelper {
             this.textSize = textSize;
             return this;
         }
-
+        public TextBuilder setTextAutLine(String x,String y,int width,int size,boolean isbole,boolean isdouble,String str) throws Exception {
+            HPRTPrinterHelper .AutLine(x,y,width,size,isbole,isdouble,str);
+            return this;
+        }
         public TextBuilder setBold(int bold) {
             if (bold < 0) {
                 bold = 0;
@@ -120,7 +123,7 @@ public class PrintHelper {
         private String barCodeType = HPRTPrinterHelper.code128;//打印类型
         private String orientation = HPRTPrinterHelper.BARCODE;//条形码方向
         private int width = 1;//宽度 窄条的单位宽度
-        private int ratio = 1;//宽条与窄条的比率0 = 1.5 :1 20 = 2.0:1 26 = 2.6:1 1 = 2.0 :1 21 = 2.1:1 27 = 2.7:1 2 = 2.5 :1 22 = 2.2:1 28 = 2.8:1 3 = 3.0 :1 23 = 2.3:1 29 = 2.9:1 4 = 3.5 :1 24 = 2.4:1 30 = 3.0:1
+        private int ratio = 0;//宽条与窄条的比率0 = 1.5 :1 20 = 2.0:1 26 = 2.6:1 1 = 2.0 :1 21 = 2.1:1 27 = 2.7:1 2 = 2.5 :1 22 = 2.2:1 28 = 2.8:1 3 = 3.0 :1 23 = 2.3:1 29 = 2.9:1 4 = 3.5 :1 24 = 2.4:1 30 = 3.0:1
         private int height = 80;//条码的单位高度
         private int codeTextFont = 1;//注释条码时要使用的字体号。 (当isReader)
         private int codeTextSize = 1;//注释条码时要使用的字体大小。 (当isReader)