Bladeren bron

代码备份

RaoMeng 4 jaren geleden
bovenliggende
commit
9b8010ff2a

+ 111 - 0
app/src/main/java/com/uas/pda_mes_sa/fragment/StepReceiveFragment.java

@@ -1,14 +1,39 @@
 package com.uas.pda_mes_sa.fragment;
 
+import android.app.Activity;
+import android.content.Intent;
+import android.text.TextUtils;
 import android.view.KeyEvent;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.android.volley.Request;
 import com.uas.pda_mes_sa.R;
+import com.uas.pda_mes_sa.global.GloableParams;
+import com.uas.pda_mes_sa.listener.MyEditorActionListener;
+import com.uas.pda_mes_sa.util.CameraUtil;
+import com.uas.pda_mes_sa.util.CommonUtil;
+import com.uas.pda_mes_sa.util.FastjsonUtil;
+import com.uas.pda_mes_sa.util.HttpCallback;
+import com.uas.pda_mes_sa.util.HttpParams;
+import com.uas.pda_mes_sa.util.VolleyRequest;
+import com.uas.pda_mes_sa.view.ClearableEditText;
+import com.uuzuche.lib_zxing.activity.CaptureActivity;
+import com.uuzuche.lib_zxing.activity.CodeUtils;
 
 /**
  * Created by RaoMeng on 2020/4/26
  * Desc: 工步接收
  */
 public class StepReceiveFragment extends BaseFragment {
+    private static final int SCAN_BARCODE_CODE = 111;
+    private ClearableEditText mBarcodeEditText;
+    private ImageView mScanImageView;
+    private TextView mResultTextView;
+
     @Override
     protected int getLayout() {
         return R.layout.fragment_step_receive;
@@ -17,11 +42,33 @@ public class StepReceiveFragment extends BaseFragment {
     @Override
     protected void initViews() {
         setTitle("工步接收");
+
+        mBarcodeEditText = root.findViewById(R.id.step_receive_barcode_et);
+        mScanImageView = root.findViewById(R.id.step_receive_scan_iv);
+        mResultTextView = root.findViewById(R.id.step_receive_result_tv);
     }
 
     @Override
     protected void initEvents() {
+        mScanImageView.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                if (CameraUtil.hasCamera()) {
+                    Intent intent = new Intent();
+                    intent.setClass(mActivity, CaptureActivity.class);
+                    startActivityForResult(intent, SCAN_BARCODE_CODE);
+                } else {
+                    CommonUtil.toastNoRepeat(mActivity, getString(R.string.no_camera_detected));
+                }
+            }
+        });
 
+        CommonUtil.setEditorActionListener(mBarcodeEditText, new MyEditorActionListener() {
+            @Override
+            public void MyEditorAction(String text, int actionId, KeyEvent event) {
+                stepReceive(text);
+            }
+        });
     }
 
     @Override
@@ -29,6 +76,70 @@ public class StepReceiveFragment extends BaseFragment {
 
     }
 
+    private void stepReceive(String barcode) {
+        if (TextUtils.isEmpty(barcode)) {
+            return;
+        }
+        mResultTextView.setText("");
+        progressDialog.show();
+        VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
+                .url(GloableParams.ADDRESS_WIPSTEPTURN_ACCEPT)
+                .method(Request.Method.POST)
+                .addParam("lotno", barcode)
+                .build(), new HttpCallback() {
+            @Override
+            public void onSuccess(int flag, Object o) throws Exception {
+                progressDialog.dismiss();
+                CommonUtil.toastNoRepeat(mActivity, "接收成功");
+                try {
+                    String result = o.toString();
+                    JSONObject resultObject = JSON.parseObject(result);
+                    JSONObject dataObject = resultObject.getJSONObject("data");
+                    if (dataObject != null) {
+                        mResultTextView.setText(
+                                "批号:" + FastjsonUtil.getText(dataObject, "LOTNO")
+                                        + "\n数量:" + FastjsonUtil.getText(dataObject, "QTY")
+                                        + "\n接收成功"
+                        );
+                    }
+                    mBarcodeEditText.setText("");
+                    mBarcodeEditText.requestFocus();
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+
+            @Override
+            public void onFail(int flag, String failStr) throws Exception {
+                progressDialog.dismiss();
+                mResultTextView.setText(failStr);
+                CommonUtil.toastNoRepeat(mActivity, failStr);
+                mBarcodeEditText.setText("");
+                mBarcodeEditText.requestFocus();
+            }
+        });
+    }
+
+
+    @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+
+        if (resultCode != Activity.RESULT_OK) {
+            return;
+        }
+
+        if (requestCode == SCAN_BARCODE_CODE && data != null) {
+            if (data.getExtras() != null) {
+                String result = data.getExtras().getString(CodeUtils.RESULT_STRING);
+                mBarcodeEditText.setText(result);
+                mBarcodeEditText.setSelection(result.length());
+                stepReceive(result);
+            }
+        }
+    }
+
+
     @Override
     public boolean onKeyDown(int keyCode, KeyEvent event) {
         return false;

+ 119 - 0
app/src/main/java/com/uas/pda_mes_sa/fragment/StepTransferFragment.java

@@ -1,14 +1,42 @@
 package com.uas.pda_mes_sa.fragment;
 
+import android.app.Activity;
+import android.content.Intent;
+import android.text.TextUtils;
 import android.view.KeyEvent;
+import android.view.View;
+import android.widget.CheckBox;
+import android.widget.ImageView;
+import android.widget.TextView;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.android.volley.Request;
 import com.uas.pda_mes_sa.R;
+import com.uas.pda_mes_sa.global.GloableParams;
+import com.uas.pda_mes_sa.listener.MyEditorActionListener;
+import com.uas.pda_mes_sa.util.CameraUtil;
+import com.uas.pda_mes_sa.util.CommonUtil;
+import com.uas.pda_mes_sa.util.FastjsonUtil;
+import com.uas.pda_mes_sa.util.HttpCallback;
+import com.uas.pda_mes_sa.util.HttpParams;
+import com.uas.pda_mes_sa.util.VolleyRequest;
+import com.uas.pda_mes_sa.view.ClearableEditText;
+import com.uuzuche.lib_zxing.activity.CaptureActivity;
+import com.uuzuche.lib_zxing.activity.CodeUtils;
 
 /**
  * Created by RaoMeng on 2020/4/26
  * Desc: 工步移交
  */
 public class StepTransferFragment extends BaseFragment {
+    private static final int SCAN_BARCODE_CODE = 111;
+
+    private ClearableEditText mBarcodeEditText;
+    private ImageView mScanImageView;
+    private TextView mResultTextView;
+    private CheckBox mCancelCheckBox;
+
     @Override
     protected int getLayout() {
         return R.layout.fragment_step_transfer;
@@ -17,11 +45,34 @@ public class StepTransferFragment extends BaseFragment {
     @Override
     protected void initViews() {
         setTitle("工步移交");
+
+        mBarcodeEditText = root.findViewById(R.id.step_transfer_barcode_et);
+        mScanImageView = root.findViewById(R.id.step_transfer_scan_iv);
+        mResultTextView = root.findViewById(R.id.step_transfer_result_tv);
+        mCancelCheckBox = root.findViewById(R.id.step_transfer_cancel_cb);
     }
 
     @Override
     protected void initEvents() {
+        mScanImageView.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                if (CameraUtil.hasCamera()) {
+                    Intent intent = new Intent();
+                    intent.setClass(mActivity, CaptureActivity.class);
+                    startActivityForResult(intent, SCAN_BARCODE_CODE);
+                } else {
+                    CommonUtil.toastNoRepeat(mActivity, getString(R.string.no_camera_detected));
+                }
+            }
+        });
 
+        CommonUtil.setEditorActionListener(mBarcodeEditText, new MyEditorActionListener() {
+            @Override
+            public void MyEditorAction(String text, int actionId, KeyEvent event) {
+                stepSend(text);
+            }
+        });
     }
 
     @Override
@@ -29,6 +80,74 @@ public class StepTransferFragment extends BaseFragment {
 
     }
 
+    private void stepSend(String barcode) {
+        if (TextUtils.isEmpty(barcode)) {
+            return;
+        }
+        mResultTextView.setText("");
+        progressDialog.show();
+        VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
+                .url(GloableParams.ADDRESS_WIPSTEPTURN_SEND)
+                .method(Request.Method.POST)
+                .addParam("lotno", barcode)
+                .addParam("cancel", String.valueOf(mCancelCheckBox.isChecked()))
+                .build(), new HttpCallback() {
+            @Override
+            public void onSuccess(int flag, Object o) throws Exception {
+                progressDialog.dismiss();
+                String msg = "移交成功";
+                if (mCancelCheckBox.isChecked()) {
+                    msg = "撤销移交成功";
+                }
+                CommonUtil.toastNoRepeat(mActivity, msg);
+                try {
+                    String result = o.toString();
+                    JSONObject resultObject = JSON.parseObject(result);
+                    JSONObject dataObject = resultObject.getJSONObject("data");
+                    if (dataObject != null) {
+                        mResultTextView.setText(
+                                "批号:" + FastjsonUtil.getText(dataObject, "LOTNO")
+                                        + "\n数量:" + FastjsonUtil.getText(dataObject, "QTY")
+                                        + "\n" + msg
+                        );
+                    }
+                    mBarcodeEditText.setText("");
+                    mBarcodeEditText.requestFocus();
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+
+            @Override
+            public void onFail(int flag, String failStr) throws Exception {
+                progressDialog.dismiss();
+                mResultTextView.setText(failStr);
+                CommonUtil.toastNoRepeat(mActivity, failStr);
+                mBarcodeEditText.setText("");
+                mBarcodeEditText.requestFocus();
+            }
+        });
+    }
+
+
+    @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+
+        if (resultCode != Activity.RESULT_OK) {
+            return;
+        }
+
+        if (requestCode == SCAN_BARCODE_CODE && data != null) {
+            if (data.getExtras() != null) {
+                String result = data.getExtras().getString(CodeUtils.RESULT_STRING);
+                mBarcodeEditText.setText(result);
+                mBarcodeEditText.setSelection(result.length());
+                stepSend(result);
+            }
+        }
+    }
+
     @Override
     public boolean onKeyDown(int keyCode, KeyEvent event) {
         return false;

+ 14 - 0
app/src/main/java/com/uas/pda_mes_sa/global/GloableParams.java

@@ -254,6 +254,8 @@ public class GloableParams {
     public static String ADDRESS_COUNTING_GETCODEMSG;
     public static String ADDRESS_COUNTING_CONFIRMSTOCK;
     public static String ADDRESS_COUNTING_CLEARSTOCKDIFF;
+    public static String ADDRESS_WIPSTEPTURN_SEND;
+    public static String ADDRESS_WIPSTEPTURN_ACCEPT;
 
     //连接服务器请求地址
     private static final String ADDRESSTAIL_CONNECT_SERVER = "/api/pda/getAllMasters.action";
@@ -270,6 +272,16 @@ public class GloableParams {
     //获取应用版本信息
     private static final String ADDRESSTAIL_OUTMATERIAL_GETPDAVERSION = "/api/pda/outMaterial/getPdaVersion.action";
 
+    /**
+     * 工步移交
+     */
+    private static final String ADDRESSTAIL_WIPSTEPTURN_SEND = "/api/pdashop/wipStepTurn/send.action";
+
+    /**
+     * 工步接收
+     */
+    private static final String ADDRESSTAIL_WIPSTEPTURN_ACCEPT = "/api/pdashop/wipStepTurn/accept.action";
+
     /**
      * 出库暂存
      */
@@ -1133,5 +1145,7 @@ public class GloableParams {
         GloableParams.ADDRESS_COUNTING_GETCODEMSG = uriHead + GloableParams.ADDRESSTAIL_COUNTING_GETCODEMSG;
         GloableParams.ADDRESS_COUNTING_CONFIRMSTOCK = uriHead + GloableParams.ADDRESSTAIL_COUNTING_CONFIRMSTOCK;
         GloableParams.ADDRESS_COUNTING_CLEARSTOCKDIFF = uriHead + GloableParams.ADDRESSTAIL_COUNTING_CLEARSTOCKDIFF;
+        GloableParams.ADDRESS_WIPSTEPTURN_SEND = uriHead + GloableParams.ADDRESSTAIL_WIPSTEPTURN_SEND;
+        GloableParams.ADDRESS_WIPSTEPTURN_ACCEPT = uriHead + GloableParams.ADDRESSTAIL_WIPSTEPTURN_ACCEPT;
     }
 }

+ 49 - 2
app/src/main/res/layout/fragment_step_receive.xml

@@ -1,6 +1,53 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="vertical" android:layout_width="match_parent"
-    android:layout_height="match_parent">
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:padding="12dp">
 
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:gravity="center_vertical"
+        android:orientation="horizontal">
+
+        <LinearLayout
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:background="@drawable/bg_line_edittext">
+
+            <com.uas.pda_mes_sa.view.ClearableEditText
+                android:id="@+id/step_receive_barcode_et"
+                style="@style/EditTextStyle"
+                android:layout_weight="1"
+                android:background="@null"
+                android:focusable="true"
+                android:focusableInTouchMode="true"
+                android:hint="请采集批号"
+                android:imeOptions="actionSend"
+                android:textColor="@color/black" />
+
+            <ImageView
+                android:id="@+id/step_receive_scan_iv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="center"
+                android:layout_marginRight="10dp"
+                android:clickable="false"
+                android:src="@drawable/ic_edittext_scan" />
+        </LinearLayout>
+    </LinearLayout>
+
+    <TextView
+        android:id="@+id/step_receive_result_tv"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:padding="18dp"
+        android:textColor="@color/blue_800"
+        android:textSize="16sp"
+        android:textStyle="bold"
+        tools:text="采集结果是xxxxxxxxxxxxx" />
 </LinearLayout>

+ 55 - 2
app/src/main/res/layout/fragment_step_transfer.xml

@@ -1,6 +1,59 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="vertical" android:layout_width="match_parent"
-    android:layout_height="match_parent">
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:padding="12dp">
 
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:gravity="center_vertical"
+        android:orientation="horizontal">
+
+        <LinearLayout
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:background="@drawable/bg_line_edittext">
+
+            <com.uas.pda_mes_sa.view.ClearableEditText
+                android:id="@+id/step_transfer_barcode_et"
+                style="@style/EditTextStyle"
+                android:layout_weight="1"
+                android:background="@null"
+                android:focusable="true"
+                android:focusableInTouchMode="true"
+                android:hint="请采集批号"
+                android:imeOptions="actionSend"
+                android:textColor="@color/black" />
+
+            <ImageView
+                android:id="@+id/step_transfer_scan_iv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="center"
+                android:layout_marginRight="10dp"
+                android:clickable="false"
+                android:src="@drawable/ic_edittext_scan" />
+        </LinearLayout>
+
+        <CheckBox
+            android:id="@+id/step_transfer_cancel_cb"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="撤销" />
+    </LinearLayout>
+
+    <TextView
+        android:id="@+id/step_transfer_result_tv"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:padding="18dp"
+        android:textColor="@color/blue_800"
+        android:textSize="16sp"
+        android:textStyle="bold"
+        tools:text="采集结果是xxxxxxxxxxxxx" />
 </LinearLayout>

+ 2 - 2
build.gradle

@@ -44,8 +44,8 @@ ext {
             targetSdkVersion : 28,
             compileSdkVersion: 28,
             buildToolsVersion: "28.0.3",
-            versionCode      : 5,
-            versionName      : "v1.1.3"
+            versionCode      : 1,
+            versionName      : "v1.1.1"
     ]
 
     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 = 5;
-  public static final String VERSION_NAME = "v1.1.3";
+  public static final int VERSION_CODE = 1;
+  public static final String VERSION_NAME = "v1.1.1";
 }

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


+ 1 - 1
pda_libs/pulltoreflashlibrary/build/intermediates/incremental/packageDebugResources/compile-file-map.properties

@@ -1,4 +1,4 @@
-#Sun Apr 26 15:46:36 CST 2020
+#Tue Apr 28 09:54:26 CST 2020
 E\:\\Projects\\CompayProjects\\pda_mes_sa\\pda_libs\\pulltoreflashlibrary\\src\\main\\res\\drawable-mdpi\\default_ptr_rotate.png=E\:\\Projects\\CompayProjects\\pda_mes_sa\\pda_libs\\pulltoreflashlibrary\\build\\intermediates\\packaged_res\\debug\\drawable-mdpi-v4\\default_ptr_rotate.png
 E\:\\Projects\\CompayProjects\\pda_mes_sa\\pda_libs\\pulltoreflashlibrary\\src\\main\\res\\layout\\pull_to_refresh_header_horizontal.xml=E\:\\Projects\\CompayProjects\\pda_mes_sa\\pda_libs\\pulltoreflashlibrary\\build\\intermediates\\packaged_res\\debug\\layout\\pull_to_refresh_header_horizontal.xml
 E\:\\Projects\\CompayProjects\\pda_mes_sa\\pda_libs\\pulltoreflashlibrary\\src\\main\\res\\drawable-xhdpi\\default_ptr_flip.png=E\:\\Projects\\CompayProjects\\pda_mes_sa\\pda_libs\\pulltoreflashlibrary\\build\\intermediates\\packaged_res\\debug\\drawable-xhdpi-v4\\default_ptr_flip.png

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


BIN
pda_libs/pulltoreflashlibrary/build/intermediates/intermediate-jars/debug/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="5"
-    android:versionName="v1.1.3" >
+    android:versionCode="1"
+    android:versionName="v1.1.1" >
 
     <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":5,"versionName":"v1.1.3","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":1,"versionName":"v1.1.1","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/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="5"
-    android:versionName="v1.1.3" >
+    android:versionCode="1"
+    android:versionName="v1.1.1" >
 
     <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":5,"versionName":"v1.1.3","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":1,"versionName":"v1.1.1","enabled":true,"outputFile":"pulltoreflashlibrary-debug.aar","fullName":"debug","baseName":"debug"},"path":"AndroidManifest.xml","properties":{"packageId":"com.handmark.pulltorefresh.library","split":""}}]