Browse Source

增加新打印模板接口

ChengJH 2 tháng trước cách đây
mục cha
commit
c304797543
20 tập tin đã thay đổi với 61 bổ sung23 xóa
  1. 1 1
      app/src/main/java/com/uas/huayunuasmes/fragment/BlueToothPrintFragment.java
  2. 41 3
      app/src/main/java/com/uas/huayunuasmes/fragment/LabeLreprintingFragment.java
  3. 1 1
      app/src/main/java/com/uas/huayunuasmes/util/PrintUtils.java
  4. 2 2
      build.gradle
  5. 2 2
      pda_libs/pulltoreflashlibrary/build/generated/source/buildConfig/debug/com/handmark/pulltorefresh/library/BuildConfig.java
  6. 2 2
      pda_libs/pulltoreflashlibrary/build/generated/source/buildConfig/release/com/handmark/pulltorefresh/library/BuildConfig.java
  7. BIN
      pda_libs/pulltoreflashlibrary/build/intermediates/classes/debug/com/handmark/pulltorefresh/library/BuildConfig.class
  8. BIN
      pda_libs/pulltoreflashlibrary/build/intermediates/classes/release/com/handmark/pulltorefresh/library/BuildConfig.class
  9. BIN
      pda_libs/pulltoreflashlibrary/build/intermediates/intermediate-jars/debug/classes.jar
  10. BIN
      pda_libs/pulltoreflashlibrary/build/intermediates/intermediate-jars/debug/full.jar
  11. BIN
      pda_libs/pulltoreflashlibrary/build/intermediates/intermediate-jars/release/classes.jar
  12. BIN
      pda_libs/pulltoreflashlibrary/build/intermediates/intermediate-jars/release/full.jar
  13. 2 2
      pda_libs/pulltoreflashlibrary/build/intermediates/manifests/aapt/debug/AndroidManifest.xml
  14. 1 1
      pda_libs/pulltoreflashlibrary/build/intermediates/manifests/aapt/debug/output.json
  15. 2 2
      pda_libs/pulltoreflashlibrary/build/intermediates/manifests/aapt/release/AndroidManifest.xml
  16. 1 1
      pda_libs/pulltoreflashlibrary/build/intermediates/manifests/aapt/release/output.json
  17. 2 2
      pda_libs/pulltoreflashlibrary/build/intermediates/manifests/full/debug/AndroidManifest.xml
  18. 1 1
      pda_libs/pulltoreflashlibrary/build/intermediates/manifests/full/debug/output.json
  19. 2 2
      pda_libs/pulltoreflashlibrary/build/intermediates/manifests/full/release/AndroidManifest.xml
  20. 1 1
      pda_libs/pulltoreflashlibrary/build/intermediates/manifests/full/release/output.json

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

@@ -339,7 +339,7 @@ public class BlueToothPrintFragment extends BaseFragment {
 
     private void setAdapter(List<BluetoothDevice> models) {
         List<BluetoothDevice> printDevices = new ArrayList<>();
-        if (!ListUtils.isEmpty(models)) {
+        if (!ListUtils.isEmptyBlue(models)) {
             for (int i = 0; i < models.size(); i++) {
                 BluetoothDevice bluetoothDevice = models.get(i);
                 if (bluetoothDevice != null && bluetoothDevice.getBluetoothClass().getDeviceClass() == ConnectHelper.PRINT_TYPE) {

+ 41 - 3
app/src/main/java/com/uas/huayunuasmes/fragment/LabeLreprintingFragment.java

@@ -3,6 +3,7 @@ package com.uas.huayunuasmes.fragment;
 import android.annotation.SuppressLint;
 import android.content.Intent;
 import android.os.Bundle;
+import android.util.Log;
 import android.view.KeyEvent;
 import android.view.View;
 import android.view.inputmethod.EditorInfo;
@@ -10,7 +11,9 @@ import android.widget.Button;
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.android.volley.Request;
 import com.android.volley.toolbox.StringRequest;
 import com.uas.huayunuasmes.R;
@@ -24,6 +27,7 @@ import com.uas.huayunuasmes.util.FragmentUtils;
 import com.uas.huayunuasmes.util.HttpCallback;
 import com.uas.huayunuasmes.util.HttpParams;
 import com.uas.huayunuasmes.util.PrintUtils;
+import com.uas.huayunuasmes.util.VolleyRequest;
 import com.uas.huayunuasmes.util.VollyRequest;
 import com.uas.huayunuasmes.view.ClearableEditText;
 
@@ -42,7 +46,6 @@ public class LabeLreprintingFragment extends BaseFragment implements View.OnClic
     private ClearableEditText storage_recharge_collect_ets;
     private LinearLayout line_hint;
     private TextView tv_hint1;
-    private JSONArray dataArray;
     private Button btn_starts;
 
     @Override
@@ -65,7 +68,7 @@ public class LabeLreprintingFragment extends BaseFragment implements View.OnClic
 
     @Override
     protected void initEvents() {
-
+        getPrintTemplate();
         storage_recharge_collect_ets.setOnEditorActionListener(new TextView.OnEditorActionListener() {
             @Override
             public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
@@ -119,12 +122,13 @@ public class LabeLreprintingFragment extends BaseFragment implements View.OnClic
                         progressDialog.dismiss();
                         storage_recharge_collect_ets.setText("");
                         storage_recharge_collect_ets.requestFocus();
-                        dataArray = FastjsonUtil.getJSONArray(o.toString(), "data");
+                        JSONArray dataArray = FastjsonUtil.getJSONArray(o.toString(), "data");
                         if (dataArray==null){
                             CommonUtil.toastNoRepeat(mActivity, "数据为空");
                             return;
                         }
                         printEvent(dataArray);
+
                     }
                     @Override
                     public void onFail(int flag, String failStr) throws Exception {
@@ -136,6 +140,39 @@ public class LabeLreprintingFragment extends BaseFragment implements View.OnClic
                 });
 
 
+    }
+    private void getPrintTemplate() {
+        VolleyRequest.getInstance().stringRequest(mStringRequest,
+                new HttpParams.Builder()
+                        .url(GloableParams.ADDRESS_BARINFO_PRINTMODEL)
+                        .method(Request.Method.GET)
+                        .flag(0)
+                        .tag("barinfoPrint")
+                        .addParam("caller", "Lotno!PDAPrint")//Barcode!PDAPrint仓库
+                        .build(), new HttpCallback() {
+                    @Override
+                    public void onSuccess(int flag, Object o) throws Exception {
+                        try {
+                            String result = o.toString();
+                            Log.e("prints", result);
+                            if (FastjsonUtil.validate(result)) {
+                                JSONObject resultObject = JSON.parseObject(result);
+                                JSONArray dataArray = resultObject.getJSONArray("data");
+                                if (dataArray != null && dataArray.size() > 0) {
+                                    SharedPreUtil.saveString(mActivity, Constants.FLAG.PRINT_TEMPLATE_CACHE, dataArray.toJSONString());
+                                }
+                            }
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+
+                    }
+
+                    @Override
+                    public void onFail(int flag, String failStr) throws Exception {
+                        Log.e("printf", failStr);
+                    }
+                });
     }
     public static String removeBrackets(String input) {
         return input.replaceAll("\\[", "").replaceAll("\\]", "");
@@ -162,6 +199,7 @@ public class LabeLreprintingFragment extends BaseFragment implements View.OnClic
             for (int i = 0; i < printArray.size(); i++) {
                 try {
                     String stingdata = removeBrackets(printArray.toString());
+                    Log.e("stingdata",stingdata);
                     int printResult = PrintUtils.printBar(mActivity, stingdata.toString(), mPrintDpi, null);
                     if (printResult <= 0) {
                         isFail = true;

+ 1 - 1
app/src/main/java/com/uas/huayunuasmes/util/PrintUtils.java

@@ -23,7 +23,7 @@ public class PrintUtils {
             if (TextUtils.isEmpty(printTemplate)) {
                 printTemplate = SharedPreUtil.getString(context, Constants.FLAG.PRINT_TEMPLATE_CACHE, "");
             }
-
+            Log.e("listArraythree2",dataJson);
             int offset = 6,
                     h = 400,
                     v = 800,

+ 2 - 2
build.gradle

@@ -44,8 +44,8 @@ ext {
             targetSdkVersion : 28,
             compileSdkVersion: 28,
             buildToolsVersion: "28.0.3",
-            versionCode      : 31,
-            versionName      : "v1.2.1"
+            versionCode      : 32,
+            versionName      : "v1.2.2"
     ]
 
     depsVersion = [

+ 2 - 2
pda_libs/pulltoreflashlibrary/build/generated/source/buildConfig/debug/com/handmark/pulltorefresh/library/BuildConfig.java

@@ -8,6 +8,6 @@ public final class BuildConfig {
   public static final String APPLICATION_ID = "com.handmark.pulltorefresh.library";
   public static final String BUILD_TYPE = "debug";
   public static final String FLAVOR = "";
-  public static final int VERSION_CODE = 30;
-  public static final String VERSION_NAME = "v1.2.0";
+  public static final int VERSION_CODE = 32;
+  public static final String VERSION_NAME = "v1.2.2";
 }

+ 2 - 2
pda_libs/pulltoreflashlibrary/build/generated/source/buildConfig/release/com/handmark/pulltorefresh/library/BuildConfig.java

@@ -8,6 +8,6 @@ public final class BuildConfig {
   public static final String APPLICATION_ID = "com.handmark.pulltorefresh.library";
   public static final String BUILD_TYPE = "release";
   public static final String FLAVOR = "";
-  public static final int VERSION_CODE = 31;
-  public static final String VERSION_NAME = "v1.2.1";
+  public static final int VERSION_CODE = 32;
+  public static final String VERSION_NAME = "v1.2.2";
 }

BIN
pda_libs/pulltoreflashlibrary/build/intermediates/classes/debug/com/handmark/pulltorefresh/library/BuildConfig.class


BIN
pda_libs/pulltoreflashlibrary/build/intermediates/classes/release/com/handmark/pulltorefresh/library/BuildConfig.class


BIN
pda_libs/pulltoreflashlibrary/build/intermediates/intermediate-jars/debug/classes.jar


BIN
pda_libs/pulltoreflashlibrary/build/intermediates/intermediate-jars/debug/full.jar


BIN
pda_libs/pulltoreflashlibrary/build/intermediates/intermediate-jars/release/classes.jar


BIN
pda_libs/pulltoreflashlibrary/build/intermediates/intermediate-jars/release/full.jar


+ 2 - 2
pda_libs/pulltoreflashlibrary/build/intermediates/manifests/aapt/debug/AndroidManifest.xml

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.handmark.pulltorefresh.library"
-    android:versionCode="30"
-    android:versionName="v1.2.0" >
+    android:versionCode="32"
+    android:versionName="v1.2.2" >
 
     <uses-sdk
         android:minSdkVersion="16"

+ 1 - 1
pda_libs/pulltoreflashlibrary/build/intermediates/manifests/aapt/debug/output.json

@@ -1 +1 @@
-[{"outputType":{"type":"AAPT_FRIENDLY_MERGED_MANIFESTS"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":30,"versionName":"v1.2.0","enabled":true,"outputFile":"pulltoreflashlibrary-debug.aar","fullName":"debug","baseName":"debug"},"path":"AndroidManifest.xml","properties":{"packageId":"com.handmark.pulltorefresh.library","split":""}}]
+[{"outputType":{"type":"AAPT_FRIENDLY_MERGED_MANIFESTS"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":32,"versionName":"v1.2.2","enabled":true,"outputFile":"pulltoreflashlibrary-debug.aar","fullName":"debug","baseName":"debug"},"path":"AndroidManifest.xml","properties":{"packageId":"com.handmark.pulltorefresh.library","split":""}}]

+ 2 - 2
pda_libs/pulltoreflashlibrary/build/intermediates/manifests/aapt/release/AndroidManifest.xml

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.handmark.pulltorefresh.library"
-    android:versionCode="31"
-    android:versionName="v1.2.1" >
+    android:versionCode="32"
+    android:versionName="v1.2.2" >
 
     <uses-sdk
         android:minSdkVersion="16"

+ 1 - 1
pda_libs/pulltoreflashlibrary/build/intermediates/manifests/aapt/release/output.json

@@ -1 +1 @@
-[{"outputType":{"type":"AAPT_FRIENDLY_MERGED_MANIFESTS"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":31,"versionName":"v1.2.1","enabled":true,"outputFile":"pulltoreflashlibrary-release.aar","fullName":"release","baseName":"release"},"path":"AndroidManifest.xml","properties":{"packageId":"com.handmark.pulltorefresh.library","split":""}}]
+[{"outputType":{"type":"AAPT_FRIENDLY_MERGED_MANIFESTS"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":32,"versionName":"v1.2.2","enabled":true,"outputFile":"pulltoreflashlibrary-release.aar","fullName":"release","baseName":"release"},"path":"AndroidManifest.xml","properties":{"packageId":"com.handmark.pulltorefresh.library","split":""}}]

+ 2 - 2
pda_libs/pulltoreflashlibrary/build/intermediates/manifests/full/debug/AndroidManifest.xml

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.handmark.pulltorefresh.library"
-    android:versionCode="30"
-    android:versionName="v1.2.0" >
+    android:versionCode="32"
+    android:versionName="v1.2.2" >
 
     <uses-sdk
         android:minSdkVersion="16"

+ 1 - 1
pda_libs/pulltoreflashlibrary/build/intermediates/manifests/full/debug/output.json

@@ -1 +1 @@
-[{"outputType":{"type":"MERGED_MANIFESTS"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":30,"versionName":"v1.2.0","enabled":true,"outputFile":"pulltoreflashlibrary-debug.aar","fullName":"debug","baseName":"debug"},"path":"AndroidManifest.xml","properties":{"packageId":"com.handmark.pulltorefresh.library","split":""}}]
+[{"outputType":{"type":"MERGED_MANIFESTS"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":32,"versionName":"v1.2.2","enabled":true,"outputFile":"pulltoreflashlibrary-debug.aar","fullName":"debug","baseName":"debug"},"path":"AndroidManifest.xml","properties":{"packageId":"com.handmark.pulltorefresh.library","split":""}}]

+ 2 - 2
pda_libs/pulltoreflashlibrary/build/intermediates/manifests/full/release/AndroidManifest.xml

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.handmark.pulltorefresh.library"
-    android:versionCode="31"
-    android:versionName="v1.2.1" >
+    android:versionCode="32"
+    android:versionName="v1.2.2" >
 
     <uses-sdk
         android:minSdkVersion="16"

+ 1 - 1
pda_libs/pulltoreflashlibrary/build/intermediates/manifests/full/release/output.json

@@ -1 +1 @@
-[{"outputType":{"type":"MERGED_MANIFESTS"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":31,"versionName":"v1.2.1","enabled":true,"outputFile":"pulltoreflashlibrary-release.aar","fullName":"release","baseName":"release"},"path":"AndroidManifest.xml","properties":{"packageId":"com.handmark.pulltorefresh.library","split":""}}]
+[{"outputType":{"type":"MERGED_MANIFESTS"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":32,"versionName":"v1.2.2","enabled":true,"outputFile":"pulltoreflashlibrary-release.aar","fullName":"release","baseName":"release"},"path":"AndroidManifest.xml","properties":{"packageId":"com.handmark.pulltorefresh.library","split":""}}]