瀏覽代碼

update: 打印格式中新增工艺(待测试)

huwanxiao 1 年之前
父節點
當前提交
d28e17bc58
共有 2 個文件被更改,包括 201 次插入208 次删除
  1. 3 3
      app/src/main/java/com/naz/sdkdemo/BaseApplication.java
  2. 198 205
      app/src/main/java/com/naz/sdkdemo/MainActivity.java

+ 3 - 3
app/src/main/java/com/naz/sdkdemo/BaseApplication.java

@@ -139,17 +139,17 @@ public class BaseApplication extends Application {
                 e.printStackTrace();
             }
         }
-
+        String formatData = formattedTime + " " + AppConfig.APP_VERSION + "------>>" + data;
         try (BufferedWriter writer = new BufferedWriter(new FileWriter(logFile.getAbsoluteFile(), true))) {
             // 使用true作为FileWriter构造函数的第二个参数,以启用追加模式
-            writer.write(formattedTime + " " + data);
+            writer.write(formatData);
             writer.newLine();  // 如果你想在数据后添加换行符
             Log.e("--------->>>", "--------->>>数据已成功追加到文件中");
         } catch (IOException e) {
             Log.e("--------->>>", "--------->>>追加日志发生错误");
         }
 
-        return formattedTime + " " + data;
+        return formatData;
     }
 
     public static String readDataFromLogFile() {

+ 198 - 205
app/src/main/java/com/naz/sdkdemo/MainActivity.java

@@ -404,7 +404,7 @@ public class MainActivity extends BaseActivity {
         Log.e("------->","-------->"+UserCache.getSerialName());
     }
     //region -------------------------------------WebInterface相关方法开始----------------------------
-    String mUrl = "http://192.168.0.133:8082";
+    String mUrl = "https://dwytbt.qingyaokeji.com/index.html#/";
     private void checkNet() {
         if (!MyTools.isNetworkAvailable(getApplicationContext())) {
             ll_nonet.setVisibility(View.VISIBLE);
@@ -1296,6 +1296,7 @@ public class MainActivity extends BaseActivity {
                     .text(mOffsetX*mPot - mFontHeightDistanceHalf / 2, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "订单号:")
                     .text(mOffsetX*mPot, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.exe_sale_order_b.no)
                     .text((mOffsetX-mSpace)*mPot-mFontHeight, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "产  品:");
+            // 产品名部分
             String[] productName = getStrs(module.material_code_show, (mPaperHeight-2*mOffsetY-mSpace-mCodeSize)*mPot-5*mFontWidth);
             printer.text((mOffsetX-mSpace)*mPot-mFontHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, productName[0]);
             int currentHeight = (mOffsetX-mSpace)*mPot-2*mFontHeight;
@@ -1308,43 +1309,105 @@ public class MainActivity extends BaseActivity {
                 printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, " ");
                 currentHeight = currentHeight-mFontHeight;
             }
-            currentHeight = currentHeight-mSpace*mPot;
-            printer.text(currentHeight - mFontHeightDistanceHalf, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "花  色:")  // 花色 -> module.decor_code_show
-                    .text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.decor_code_show);
-            // 测试用
-            //module.box_order_product.color_two = "第二花色  第二花色";
-            if (module.decor_two_code_show !=null){
-                printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth)+getStrLength2(module.decor_code_show)+mSpace*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.decor_two_code_show);
-            }
-//            // 工艺部分
-//            currentHeight = currentHeight-mFontHeight-mSpace*mPot;
-//            printer.text(currentHeight - mFontHeightDistanceHalf, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "工  艺:")       // 工艺 -> module.craft_type_code_show
-//                    .text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.craft_type_code_show);
-//            // 测试用
-//            module.box_order_product.process_title_two = "第二工艺  第二工艺";
-//            if (module.craft_type_two_code_show!=null){
-//                printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth)+getStrLength2(module.craft_type_code_show)+mSpace*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.craft_type_two_code_show);
+
+            // module.box_order_product.color_two = "第二花色"; // 测试用
+            // module.box_order_product.process_title_two = "第二工艺"; // 测试用
+            // module.box_order_product.customer_name = "随便说点什么随便说点什么随便"; // 测试用
+            // module.box_order_product.color = "西雅项目-2";
+            // module.box_order_product.process_title = "西雅工艺-2";
+//            if(TextUtils.isEmpty(module.decor_two_code_show) && TextUtils.isEmpty(module.craft_type_two_code_show)) {
+//                // 如果是单花色、单工艺, 则合并在一行显示
+//                currentHeight = currentHeight-mSpace*mPot;
+//                printer.text(currentHeight - mFontHeightDistanceHalf, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "花  色:")  // 花色 -> module.decor_code_show
+//                        .text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.decor_code_show)
+//                        .text(currentHeight - mFontHeightDistanceHalf, (int) (mOffsetY*mPot+(4*mFontWidth)+getStrLength2(module.decor_code_show)+(0.5*mFontWidth)), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "工  艺:")
+//                        .text(currentHeight, (int) (mOffsetY*mPot+(4*mFontWidth)+getStrLength2(module.decor_code_show)+(0.5*mFontWidth)+(4*mFontWidth)), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.craft_type_code_show);
+//
+//                currentHeight = currentHeight-mFontHeight-mSpace*mPot;
+//                printer.text(currentHeight - mFontHeightDistanceHalf, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "经销商:");  // 经销商: ->  module.exe_sale_order_b.customer_name
+//                String[] customerName = getStrs(module.exe_sale_order_b.customer_name, mPaperHeight*mPot - 12 * mFontWidth);
+//                if (!TextUtils.isEmpty(customerName[0])){
+//                    printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, customerName[0]);
+//                }
+//                if (!TextUtils.isEmpty(customerName[1])){
+//                    currentHeight = currentHeight-mFontHeight-mSpace*mPot;
+//                    printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, customerName[1]);
+//                } else {
+//                    currentHeight = currentHeight-mFontHeight-mSpace*mPot;
+//                    printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, " ");
+//                }
+//
+//                currentHeight = currentHeight-mFontHeight-mSpace*mPot;
+//                currentHeight = currentHeight - mFontHeight-mSpace*mPot/8;
+//                printer.text(currentHeight - mFontHeightDistanceHalf, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "包装数量:")    // 包装数量 -> module.box_num
+//                        .text(currentHeight, mOffsetY*mPot+(5*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.box_num)
+//                        .text(currentHeight + mFontHeight/2, (mPaperHeight-5)*mPot-getStrLength(module.box_no)-getStrLength("包装单号: "), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "包装单号:  ")  // 包装单号 -> module.box_no
+//                        .text(currentHeight+ mFontHeight/2, (mPaperHeight-5)*mPot-getStrLength(module.box_no), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, module.box_no)
+//                        .text(currentHeight - 3 * mFontHeight / 4, (mPaperHeight-5)*mPot-getStrLength(module.box_no)-getStrLength("包装单号: "), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, module.now_date);
+//            } else {
+                // 多花色 或 多工艺
+                currentHeight = currentHeight-mSpace*mPot;
+                // 花色部分
+                printer.text(currentHeight - mFontHeightDistanceHalf, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "花  色:")  // 花色 -> module.decor_code_show
+                        .text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.decor_code_show);
+                // 第二花色
+                if (module.decor_two_code_show !=null){
+                    printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth)+getStrLength2(module.decor_code_show)+mSpace*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.decor_two_code_show);
+                }
+                // 工艺部分
+                currentHeight = currentHeight-mFontHeight-mSpace*mPot;
+                printer.text(currentHeight - mFontHeightDistanceHalf, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "工  艺:")       // 工艺 -> module.craft_type_code_show
+                        .text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.craft_type_code_show);
+                // 第二工艺
+                if (module.craft_type_two_code_show!=null){
+                    printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth)+getStrLength2(module.craft_type_code_show)+mSpace*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.craft_type_two_code_show);
+                }
+                // 经销商部分
+                currentHeight = currentHeight-mFontHeight-mSpace*mPot;
+                String[] customerName = getStrs(module.exe_sale_order_b.customer_name, mPaperHeight*mPot - 6 * mFontWidth);
+                if(module.exe_sale_order_b.customer_name.length() < 14) {
+                    // 单行放大字体
+                    printer.text(currentHeight - mFontHeightDistanceHalf, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "经销商:");  // 经销商: ->  module.exe_sale_order_b.customer_name
+                    if (!TextUtils.isEmpty(customerName[0])){
+                        printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, customerName[0]);
+                    }
+                    currentHeight = currentHeight-mFontHeight-mSpace*mPot*3;
+                } else if(module.exe_sale_order_b.customer_name.length() < 20) {
+                    // 单行缩小字体
+                    currentHeight = currentHeight-mTextSpace*mPot;
+                    currentHeight = currentHeight-mFontHeight/2;
+                    printer.text(currentHeight, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "经销商:");  // 经销商: ->  module.exe_sale_order_b.customer_name
+                    if (!TextUtils.isEmpty(customerName[0])){
+                        printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, customerName[0]);
+                    }
+
+                    currentHeight = currentHeight-mFontHeight/2;
+                    printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, " ");
+
+                    currentHeight = currentHeight-mFontHeight-mSpace*mPot-mTextSpace*mPot;
+                } else {
+                    // 多行缩小字体
+                    currentHeight = currentHeight-mTextSpace*mPot;
+                    printer.text(currentHeight, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "经销商:");  // 经销商: ->  module.exe_sale_order_b.customer_name
+                    if (!TextUtils.isEmpty(customerName[0])){
+                        printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, customerName[0]);
+                    }
+                    if (!TextUtils.isEmpty(customerName[1])){
+                        currentHeight = currentHeight-mFontHeight;
+                        printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, customerName[1]);
+                    } else {
+                        currentHeight = currentHeight-mFontHeight;
+                        printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, " ");
+                    }
+                    currentHeight = currentHeight-mFontHeight-mSpace*mPot-mTextSpace*mPot;
+                }
+                // 底部显示
+                printer.text(currentHeight - mFontHeightDistanceHalf, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "包装数量:")    // 包装数量 -> module.box_num
+                        .text(currentHeight, mOffsetY*mPot+(5*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.box_num)
+                        .text(currentHeight + mFontHeight/2, (mPaperHeight-5)*mPot-getStrLength(module.box_no)-getStrLength("包装单号: "), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "包装单号:  ")  // 包装单号 -> module.box_no
+                        .text(currentHeight+ mFontHeight/2, (mPaperHeight-5)*mPot-getStrLength(module.box_no), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, module.box_no)
+                        .text(currentHeight - mFontHeight/2, (mPaperHeight-5)*mPot-getStrLength(module.box_no)-getStrLength("包装单号: "), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, module.now_date);
 //            }
-            currentHeight = currentHeight-mFontHeight-mSpace*mPot;
-            printer.text(currentHeight - mFontHeightDistanceHalf, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "经销商:");  // 经销商: ->  module.exe_sale_order_b.customer_name
-            String[] customerName = getStrs(module.exe_sale_order_b.customer_name , mPaperHeight*mPot-5*mFontWidth);
-            if (!TextUtils.isEmpty(customerName[0])){
-               printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, customerName[0]);
-            }
-            if (!TextUtils.isEmpty(customerName[1])){
-               currentHeight = currentHeight-mFontHeight-mSpace*mPot;
-               printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, customerName[1]);
-            }else{
-               currentHeight = currentHeight-mFontHeight-mSpace*mPot;
-               printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, "");
-            }
-            currentHeight = currentHeight-mFontHeight-mSpace*mPot;
-            currentHeight = currentHeight-mFontHeight-mSpace*mPot/8;
-            printer.text(currentHeight - mFontHeightDistanceHalf, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "包装数量:")    // 包装数量 -> module.box_num
-                    .text(currentHeight, mOffsetY*mPot+(5*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.box_num)
-                    .text(currentHeight + mFontHeight/2, (mPaperHeight-5)*mPot-getStrLength(module.box_no)-getStrLength("包装单号:"), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "包装单号:  ")  // 包装单号 -> module.box_no
-                    .text(currentHeight+ mFontHeight/2, (mPaperHeight-5)*mPot-getStrLength(module.box_no), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, module.box_no)
-                    .text(currentHeight - 3 * mFontHeight / 4, (mPaperHeight-5)*mPot-getStrLength(module.box_no)-getStrLength("包装单号:"), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, module.now_date);
             // 二维码   qrX:32  qrY:30  cellWidth:10
             // 二维码   qrX:25  qrY:25  cellWidth:8
             int qrX = (mOffsetX - 26)* mPot;
@@ -1413,6 +1476,7 @@ public class MainActivity extends BaseActivity {
                     .text(mOffsetX*mPot - mFontHeightDistanceHalf / 2, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "订单号:")
                     .text(mOffsetX*mPot, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.box_order_product.order_no)
                     .text((mOffsetX-mSpace)*mPot-mFontHeight, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "产  品:");
+            // 产品名部分
             String[] productName = getStrs(module.box_order_product.material_title, (mPaperHeight-2*mOffsetY-mSpace-mCodeSize)*mPot-5*mFontWidth);
             printer.text((mOffsetX-mSpace)*mPot-mFontHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, productName[0]);
             int currentHeight = (mOffsetX-mSpace)*mPot-2*mFontHeight;
@@ -1425,43 +1489,105 @@ public class MainActivity extends BaseActivity {
                 printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, " ");
                 currentHeight = currentHeight-mFontHeight;
             }
-            currentHeight = currentHeight-mSpace*mPot;
-            printer.text(currentHeight - mFontHeightDistanceHalf, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "花  色:")  // 花色 -> module.decor_code_show
-                    .text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.box_order_product.color);
-            // 测试用
-//            module.box_order_product.color_two = "第二花色  第二花色";
-            if (module.box_order_product.color_two !=null){
-                printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth)+getStrLength2(module.box_order_product.color)+mSpace*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.box_order_product.color_two);
-            }
-//            // 工艺部分
-//            currentHeight = currentHeight-mFontHeight-mSpace*mPot;
-//            printer.text(currentHeight - mFontHeightDistanceHalf, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "工  艺:")       // 工艺 -> module.craft_type_code_show
-//                    .text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.box_order_product.process_title);
-//            // 测试用
-//            module.box_order_product.process_title_two = "第二工艺  第二工艺";
-//            if (module.box_order_product.process_title_two!=null){
-//                printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth)+getStrLength2(module.box_order_product.process_title)+mSpace*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.box_order_product.process_title_two);
-//            }
-            currentHeight = currentHeight-mFontHeight-mSpace*mPot;
-            printer.text(currentHeight - mFontHeightDistanceHalf, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "经销商:");  // 经销商: ->  module.exe_sale_order_b.customer_name
-            String[] customerName = getStrs(module.box_order_product.customer_name, mPaperHeight*mPot - 12 * mFontWidth);
-            if (!TextUtils.isEmpty(customerName[0])){
-                printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, customerName[0]);
-            }
-            if (!TextUtils.isEmpty(customerName[1])){
+
+//            module.box_order_product.color_two = "第二花色"; // 测试用
+//            module.box_order_product.process_title_two = "第二工艺"; // 测试用
+//            module.box_order_product.customer_name = "随便说点什么随便说点什么随"; // 测试用
+//            module.box_order_product.color = "西雅项目-2"; // 测试用
+//            module.box_order_product.process_title = "西雅工艺-2"; // 测试用
+//            if(TextUtils.isEmpty(module.box_order_product.color_two) && TextUtils.isEmpty(module.box_order_product.process_title_two)) {
+//                // 如果是单花色、单工艺, 则合并在一行显示
+//                currentHeight = currentHeight-mSpace*mPot;
+//                printer.text(currentHeight - mFontHeightDistanceHalf, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "花  色:")  // 花色 -> module.decor_code_show
+//                        .text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.box_order_product.color)
+//                        .text(currentHeight - mFontHeightDistanceHalf, (int) (mOffsetY*mPot+(4*mFontWidth)+getStrLength2(module.box_order_product.color)+(0.5*mFontWidth)), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "工  艺:")
+//                        .text(currentHeight, (int) (mOffsetY*mPot+(4*mFontWidth)+getStrLength2(module.box_order_product.color)+(0.5*mFontWidth)+(4*mFontWidth)), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.box_order_product.process_title);
+//
+//                currentHeight = currentHeight-mFontHeight-mSpace*mPot;
+//                printer.text(currentHeight - mFontHeightDistanceHalf, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "经销商:");  // 经销商: ->  module.exe_sale_order_b.customer_name
+//                String[] customerName = getStrs(module.box_order_product.customer_name, mPaperHeight*mPot - 12 * mFontWidth);
+//                if (!TextUtils.isEmpty(customerName[0])){
+//                    printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, customerName[0]);
+//                }
+//                if (!TextUtils.isEmpty(customerName[1])){
+//                    currentHeight = currentHeight-mFontHeight-mSpace*mPot;
+//                    printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, customerName[1]);
+//                } else {
+//                    currentHeight = currentHeight-mFontHeight-mSpace*mPot;
+//                    printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, " ");
+//                }
+//
+//                currentHeight = currentHeight-mFontHeight-mSpace*mPot;
+//                currentHeight = currentHeight - mFontHeight-mSpace*mPot/8;
+//                printer.text(currentHeight - mFontHeightDistanceHalf, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "包装数量:")    // 包装数量 -> module.box_num
+//                        .text(currentHeight, mOffsetY*mPot+(5*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.box_order_product.box_num)
+//                        .text(currentHeight + mFontHeight/2, (mPaperHeight-5)*mPot-getStrLength(module.no)-getStrLength("包装单号: "), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "包装单号:  ")  // 包装单号 -> module.box_no
+//                        .text(currentHeight+ mFontHeight/2, (mPaperHeight-5)*mPot-getStrLength(module.no), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, module.no)
+//                        .text(currentHeight - 3 * mFontHeight / 4, (mPaperHeight-5)*mPot-getStrLength(module.no)-getStrLength("包装单号: "), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, module.now_date);
+//            } else {
+                // 多花色 或 多工艺
+                currentHeight = currentHeight-mSpace*mPot;
+                // 花色部分
+                printer.text(currentHeight - mFontHeightDistanceHalf, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "花  色:")  // 花色 -> module.decor_code_show
+                        .text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.box_order_product.color);
+                // 第二花色
+                if (module.box_order_product.color_two !=null){
+                    printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth)+getStrLength2(module.box_order_product.color)+mSpace*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.box_order_product.color_two);
+                }
+                // 工艺部分
                 currentHeight = currentHeight-mFontHeight-mSpace*mPot;
-                printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, customerName[1]);
-            } else {
+                printer.text(currentHeight - mFontHeightDistanceHalf, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "工  艺:")       // 工艺 -> module.craft_type_code_show
+                        .text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.box_order_product.process_title);
+                // 第二工艺
+                if (module.box_order_product.process_title_two!=null){
+                    printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth)+getStrLength2(module.box_order_product.process_title)+mSpace*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.box_order_product.process_title_two);
+                }
+                // 经销商部分
                 currentHeight = currentHeight-mFontHeight-mSpace*mPot;
-                printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, " ");
-            }
-            currentHeight = currentHeight-mFontHeight-mSpace*mPot;
-            currentHeight = currentHeight - mFontHeight-mSpace*mPot/8;
-            printer.text(currentHeight - mFontHeightDistanceHalf, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "包装数量:")    // 包装数量 -> module.box_num
-                    .text(currentHeight, mOffsetY*mPot+(5*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.box_order_product.box_num)
-                    .text(currentHeight + mFontHeight/2, (mPaperHeight-5)*mPot-getStrLength(module.no)-getStrLength("包装单号: "), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "包装单号:  ")  // 包装单号 -> module.box_no
-                    .text(currentHeight+ mFontHeight/2, (mPaperHeight-5)*mPot-getStrLength(module.no), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, module.no)
-                    .text(currentHeight - 3 * mFontHeight / 4, (mPaperHeight-5)*mPot-getStrLength(module.no)-getStrLength("包装单号: "), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, module.now_date);
+                String[] customerName = getStrs(module.box_order_product.customer_name, mPaperHeight*mPot - 6 * mFontWidth);
+                if(module.box_order_product.customer_name.length() < 14) {
+                    // 单行放大字体
+                    printer.text(currentHeight - mFontHeightDistanceHalf, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "经销商:");  // 经销商: ->  module.exe_sale_order_b.customer_name
+                    if (!TextUtils.isEmpty(customerName[0])){
+                        printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, customerName[0]);
+                    }
+                    currentHeight = currentHeight-mFontHeight-mSpace*mPot*3;
+                } else if(module.box_order_product.customer_name.length() < 20) {
+                    // 单行缩小字体
+                    currentHeight = currentHeight-mTextSpace*mPot;
+                    currentHeight = currentHeight-mFontHeight/2;
+                    printer.text(currentHeight, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "经销商:");  // 经销商: ->  module.exe_sale_order_b.customer_name
+                    if (!TextUtils.isEmpty(customerName[0])){
+                        printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, customerName[0]);
+                    }
+
+                    currentHeight = currentHeight-mFontHeight/2;
+                    printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, " ");
+
+                    currentHeight = currentHeight-mFontHeight-mSpace*mPot-mTextSpace*mPot;
+                } else {
+                    // 多行缩小字体
+                    currentHeight = currentHeight-mTextSpace*mPot;
+                    printer.text(currentHeight, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "经销商:");  // 经销商: ->  module.exe_sale_order_b.customer_name
+                    if (!TextUtils.isEmpty(customerName[0])){
+                        printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, customerName[0]);
+                    }
+                    if (!TextUtils.isEmpty(customerName[1])){
+                        currentHeight = currentHeight-mFontHeight;
+                        printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, customerName[1]);
+                    } else {
+                        currentHeight = currentHeight-mFontHeight;
+                        printer.text(currentHeight, mOffsetY*mPot+(4*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, " ");
+                    }
+                    currentHeight = currentHeight-mFontHeight-mSpace*mPot-mTextSpace*mPot;
+                }
+                // 底部显示
+                printer.text(currentHeight - mFontHeightDistanceHalf, mOffsetY*mPot, FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "包装数量:")    // 包装数量 -> module.box_num
+                        .text(currentHeight, mOffsetY*mPot+(5*mFontWidth), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple1,fontSizeMultiple1, module.box_order_product.box_num)
+                        .text(currentHeight + mFontHeight/2, (mPaperHeight-5)*mPot-getStrLength(module.no)-getStrLength("包装单号: "), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, "包装单号:  ")  // 包装单号 -> module.box_no
+                        .text(currentHeight+ mFontHeight/2, (mPaperHeight-5)*mPot-getStrLength(module.no), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, module.no)
+                        .text(currentHeight - mFontHeight/2, (mPaperHeight-5)*mPot-getStrLength(module.no)-getStrLength("包装单号: "), FNT_SIMPLIFIED_CHINESE, ROTATION_90, fontSizeMultiple,fontSizeMultiple, module.now_date);
+//            }
             // 二维码   qrX:32  qrY:30  cellWidth:10
             // 二维码   qrX:25  qrY:25  cellWidth:8
             int qrX = (mOffsetX - 26)* mPot;
@@ -2331,138 +2457,6 @@ public class MainActivity extends BaseActivity {
                 }
             });
         });
-
-
-//        // TODO 测试代码
-//        // 当前apk的版本
-//        String currentVersion = "3.24.0906";
-//        String[] currentVersionSplit = currentVersion.split("[.]");
-//        if(currentVersionSplit == null || currentVersionSplit.length != 3) {
-//            XToast.showToast("当前版本格式解析错误");
-//            return;
-//        }
-//        // 指定的apk版本
-//        String publicVersion = "3.24.0908";
-//        // 可下载的apk列表
-//        List<VersionBean> beanArrayList = new ArrayList<>();
-//        VersionBean versionBean = new VersionBean();
-//        versionBean.load = "https://t9.qingyaokeji.com/dwy/updateprod0906.apk";
-//        versionBean.remark = "更新文案";
-//        versionBean.type = "1";
-//        versionBean.version = "测试包-3.24.0908";
-//        beanArrayList.add(versionBean);
-//        // 对返回的apk列表信息进行数据解析
-//        List<VersionBean> versionBeanList = parseVersionInfo(beanArrayList);
-//        // 从更新列表中筛选出指定的apk版本
-//        VersionBean specifyVersion = null;
-//        for (VersionBean bean : versionBeanList) {
-//            // 判断是否为指定的apk生产版本版本
-//            if(bean.versionCode.equals(publicVersion) && bean.type.equals("1")) {
-//                specifyVersion = bean;
-//                break;
-//            }
-//        }
-//        if(specifyVersion == null) {
-//            XToast.showToast("未找到指定版本");
-//            return;
-//        }
-//        // 找到了指定版本并且数据解析正确
-//        if(specifyVersion != null && specifyVersion.checkExtraFields()) {
-//            // 将本地的版本与指定的apk版本进行比对
-//            // 先进行大版本更新
-//            if(currentVersionSplit[0].compareTo(specifyVersion.bigVersion) < 0) {
-//                // 如果当前版本的大版本比较指定的大版本小,那么应该自动更新
-//                downloadService.downloadApk(NewMainActivity.this, specifyVersion.load);
-//            } else if(currentVersionSplit[0].equals(specifyVersion.bigVersion)) {
-//                String noLongerVersion = SPUtils.getString(Constants.IS_SHOW_VERSION_UPDATE_DIALOG);
-//                if(!noLongerVersion.equals(specifyVersion.versionCode)) {
-//                    // 如果大版本相同则判断小版本
-//                    if(currentVersionSplit[2].compareTo(specifyVersion.smallVersion) < 0) {
-//                        // 弹出版本更新弹窗
-//                        VersionBean finalSpecifyVersion = specifyVersion;
-//                        VersionUpdateDialog dialog = new VersionUpdateDialog(this, new VersionUpdateDialog.OnBtnClickListener() {
-//                            @Override
-//                            public void OnCommitClickListener(VersionUpdateDialog dialog, View clickView) {
-//                                loadingLabel = "正在下载中";
-//                                loadingDetailLabel = "请稍候";
-//                                showLoading();
-//                                downloadService.downloadApk(NewMainActivity.this, finalSpecifyVersion.load);
-//                                dialog.dismiss();
-//                            }
-//
-//                            @Override
-//                            public void OnCloseListener(VersionUpdateDialog dialog, View clickView) {
-//                                dialog.dismiss();
-//                            }
-//
-//                            @Override
-//                            public void OnNoLongerListener(VersionUpdateDialog dialog, View clickView) {
-//                                // 记录下次不再提示的版本的版本号
-//                                // 该版本是否点了不再提醒
-//                                SPUtils.setString(Constants.IS_SHOW_VERSION_UPDATE_DIALOG, finalSpecifyVersion.versionCode);
-//                                // 当下次的大小版本大于这个版本的时候依旧会提示
-//                                dialog.dismiss();
-//                            }
-//                        }, specifyVersion.remark, false,"立即更新");
-//                        dialog.show();
-//                    }
-//                }
-//
-//            }
-//        }
-
-
-
-//        // 正式包开启更新检查
-//        String flag = AppConfig.APP_VERSION.contains("正式包")? "1" : "0";
-//        String prefix = AppConfig.APP_VERSION.contains("正式包")? "正式包-" : "测试包-";
-//        // 获取版本列表
-//        List<VersionBean> versionBeanList = new ArrayList<>();
-//        ApiHelper.versionInfoList(this, 1, (code, msg, data) -> {
-//            // 保存版本信息
-//            if(data instanceof List) {
-//                List<?> content = (ArrayList<?>) data;
-//                for (Object o : content) {
-//                    VersionBean item = (VersionBean) o;
-//                    if(!AppConfig.APP_VERSION.contains(item.version) && item.type.equals(flag)) {
-//                        versionBeanList.add(item);
-//                    }
-//                }
-//            }
-//            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
-//                versionBeanList.sort(new Comparator<VersionBean>() {
-//                    @Override
-//                    public int compare(VersionBean v1, VersionBean v2) {
-//                        return v2.version.compareTo(v1.version);
-//                    }
-//                });
-//            }
-//            // 获取最新的版本
-//            if(versionBeanList.size() > 0) {
-//                VersionBean latestVersion = versionBeanList.get(0);
-//                // 将最新的版本和当前的版本进行比较
-//                String latestVersionName = latestVersion.version.replace(prefix, "");
-//                if(AppConfig.APP_VERSION_CODE.compareTo(latestVersionName) < 0) {
-//                    // 如果线上版本大于当前版本,则提示更新
-//                    SimpleDialog dialog = new SimpleDialog(this, new SimpleDialog.OnBtnClickListener() {
-//                        @Override
-//                        public void OnCommitClickListener(SimpleDialog dialog, View clickView) {
-//                            loadingLabel = "正在下载中";
-//                            loadingDetailLabel = "请稍候";
-//                            showLoading();
-//                            downloadService.downloadApk(NewMainActivity.this, latestVersion.load);
-//                            dialog.dismiss();
-//                        }
-//
-//                        @Override
-//                        public void OnCloseListener(SimpleDialog dialog, View clickView) {
-//
-//                        }
-//                    }, latestVersion.remark, false,"立即更新");
-//                    dialog.show();
-//                }
-//            }
-//        });
     }
     private List<VersionBean> parseVersionInfo(List<VersionBean> beanArrayList) {
         for (VersionBean versionBean : beanArrayList) {
@@ -2597,7 +2591,6 @@ public class MainActivity extends BaseActivity {
     @Override
     protected void onResume() {
         super.onResume();
-        toCheckVersionUpdate();
     }
 
     @Override