浏览代码

成品检验新需求:检验项目列表提交

RaoMeng 5 年之前
父节点
当前提交
c9803a5ee2

+ 61 - 0
app/src/main/java/com/uas/pda_smart_sa/adapter/SpotCheckAdapter.java

@@ -0,0 +1,61 @@
+package com.uas.pda_smart_sa.adapter;
+
+import android.content.Intent;
+import android.support.annotation.Nullable;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.widget.EditText;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.chad.library.adapter.base.BaseViewHolder;
+import com.uas.pda_smart_sa.R;
+import com.uas.pda_smart_sa.bean.SpotCheckBean;
+
+import java.util.List;
+
+public class SpotCheckAdapter extends BaseQuickAdapter<SpotCheckBean, BaseViewHolder> {
+    public SpotCheckAdapter(@Nullable List<SpotCheckBean> data) {
+        super(R.layout.item_product_check_table, data);
+    }
+
+    @Override
+    protected void convert(BaseViewHolder helper, SpotCheckBean item) {
+        helper.setText(R.id.spot_check_table_name_tv, item.getCheckname());
+        helper.setText(R.id.spot_check_table_checknum_et, item.getChecknum());
+        helper.setText(R.id.spot_check_table_ngnum_et, item.getNgnum());
+
+        ((EditText) helper.getView(R.id.spot_check_table_checknum_et)).addTextChangedListener(new TextWatcher() {
+            @Override
+            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+
+            }
+
+            @Override
+            public void onTextChanged(CharSequence s, int start, int before, int count) {
+
+            }
+
+            @Override
+            public void afterTextChanged(Editable s) {
+                item.setChecknum(s.toString());
+            }
+        });
+
+        ((EditText) helper.getView(R.id.spot_check_table_ngnum_et)).addTextChangedListener(new TextWatcher() {
+            @Override
+            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+
+            }
+
+            @Override
+            public void onTextChanged(CharSequence s, int start, int before, int count) {
+
+            }
+
+            @Override
+            public void afterTextChanged(Editable s) {
+                item.setNgnum(s.toString());
+            }
+        });
+    }
+}

+ 36 - 0
app/src/main/java/com/uas/pda_smart_sa/bean/SpotCheckBean.java

@@ -0,0 +1,36 @@
+package com.uas.pda_smart_sa.bean;
+
+import com.alibaba.fastjson.annotation.JSONField;
+
+public class SpotCheckBean {
+    @JSONField(name = "checkname")
+    private String checkname;
+    @JSONField(name = "checknum")
+    private String checknum;
+    @JSONField(name = "ngnum")
+    private String ngnum;
+
+    public String getCheckname() {
+        return checkname;
+    }
+
+    public void setCheckname(String checkname) {
+        this.checkname = checkname;
+    }
+
+    public String getChecknum() {
+        return checknum;
+    }
+
+    public void setChecknum(String checknum) {
+        this.checknum = checknum;
+    }
+
+    public String getNgnum() {
+        return ngnum;
+    }
+
+    public void setNgnum(String ngnum) {
+        this.ngnum = ngnum;
+    }
+}

+ 65 - 12
app/src/main/java/com/uas/pda_smart_sa/fragment/ProductCheckFragment.java

@@ -10,10 +10,14 @@ import android.view.View;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.TextView;
+import android.widget.Toast;
 
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.android.volley.Request;
+import com.uas.pda_smart_sa.adapter.SpotCheckAdapter;
+import com.uas.pda_smart_sa.bean.SpotCheckBean;
 import com.uas.pda_smart_sa.listener.MyEditorActionListener;
 import com.uas.pda_smart_sa.R;
 import com.uas.pda_smart_sa.adapter.CommonFormAdapter;
@@ -36,7 +40,7 @@ import java.util.List;
  * Desc: 成品检验
  */
 public class ProductCheckFragment extends BaseFragment implements View.OnClickListener {
-    private ClearableEditText mBoxEditText;
+    private ClearableEditText mBoxEditText, mRealNumEditText;
     private ImageView mScanImageView;
     private RecyclerView mRecyclerView;
     private TextView mQualifiedTv, mUnqualifiedTv;
@@ -45,6 +49,10 @@ public class ProductCheckFragment extends BaseFragment implements View.OnClickLi
     private List<CaptionValueBean> mCaptionValueBeans;
     private ProductUnqualifiedPop mUnqualifiedPop;
     private String mBoxcode;
+    private RecyclerView mSpotCheckRecyclerView;
+    private LinearLayout mSpotCheckLinearLayout;
+    private List<SpotCheckBean> mSpotCheckBeans;
+    private SpotCheckAdapter mSpotCheckAdapter;
 
     @Override
     protected int getLayout() {
@@ -61,11 +69,18 @@ public class ProductCheckFragment extends BaseFragment implements View.OnClickLi
         mOperatorLl = root.findViewById(R.id.product_check_operator_ll);
         mQualifiedTv = root.findViewById(R.id.product_check_qualified_tv);
         mUnqualifiedTv = root.findViewById(R.id.product_check_unqualified_tv);
+        mSpotCheckLinearLayout = root.findViewById(R.id.product_check_spotcheck_ll);
+        mRealNumEditText = root.findViewById(R.id.product_check_realnum_et);
         mRecyclerView = root.findViewById(R.id.product_check_result_rv);
         mRecyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
         mCaptionValueBeans = new ArrayList<>();
         mCommonFormAdapter = new CommonFormAdapter(mCaptionValueBeans);
         mRecyclerView.setAdapter(mCommonFormAdapter);
+        mSpotCheckRecyclerView = root.findViewById(R.id.product_check_spotcheck_rv);
+        mSpotCheckRecyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
+        mSpotCheckBeans = new ArrayList<>();
+        mSpotCheckAdapter = new SpotCheckAdapter(mSpotCheckBeans);
+        mSpotCheckRecyclerView.setAdapter(mSpotCheckAdapter);
     }
 
     @Override
@@ -88,6 +103,9 @@ public class ProductCheckFragment extends BaseFragment implements View.OnClickLi
     }
 
     private void getBoxInfo() {
+        mOperatorLl.setVisibility(View.GONE);
+        mRealNumEditText.setText("");
+        mSpotCheckLinearLayout.setVisibility(View.GONE);
         String boxCode = mBoxEditText.getText().toString().trim();
         if (TextUtils.isEmpty(boxCode)) {
             return;
@@ -95,6 +113,7 @@ public class ProductCheckFragment extends BaseFragment implements View.OnClickLi
         mBoxcode = boxCode;
         progressDialog.show();
         mCaptionValueBeans.clear();
+        mSpotCheckBeans.clear();
 
         VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
                 .url(GloableParams.ADDRESS_OUTFINISH_GETCHECKBOXCODE)
@@ -112,15 +131,34 @@ public class ProductCheckFragment extends BaseFragment implements View.OnClickLi
                     JSONObject dataObject = resultObject.getJSONObject("data");
                     mOperatorLl.setVisibility(View.VISIBLE);
                     if (dataObject != null) {
-                        mBoxcode = FastjsonUtil.getText(dataObject, "BOXCODE");
-                        mCaptionValueBeans.add(new CaptionValueBean("箱号", mBoxcode));
-                        mCaptionValueBeans.add(new CaptionValueBean("产品编号", FastjsonUtil.getText(dataObject, "PRCODE")));
-                        mCaptionValueBeans.add(new CaptionValueBean("产品名称", FastjsonUtil.getText(dataObject, "PRDETAIL")));
-                        mCaptionValueBeans.add(new CaptionValueBean("产品规格", FastjsonUtil.getText(dataObject, "PRSPEC")));
+                        if (!TextUtils.isEmpty(FastjsonUtil.getText(dataObject, "BOXCODE"))) {
+                            mBoxcode = FastjsonUtil.getText(dataObject, "BOXCODE");
+                        }
+                        mCaptionValueBeans.add(new CaptionValueBean("型号", FastjsonUtil.getText(dataObject, "ORISPECCODE")));
                         mCaptionValueBeans.add(new CaptionValueBean("包数", FastjsonUtil.getText(dataObject, "BOXNUMBER")));
-                        mCaptionValueBeans.add(new CaptionValueBean("总数量", FastjsonUtil.getText(dataObject, "QTY")));
+                        mCaptionValueBeans.add(new CaptionValueBean("数量", FastjsonUtil.getText(dataObject, "QTY")));
+                        mCaptionValueBeans.add(new CaptionValueBean("批号", FastjsonUtil.getText(dataObject, "LOTNO")));
+                        String stachecknum = FastjsonUtil.getText(dataObject, "STACHECKNUM");
+                        mCaptionValueBeans.add(new CaptionValueBean("标准抽样数", stachecknum));
 
                         mCommonFormAdapter.notifyDataSetChanged();
+
+                        mRealNumEditText.setText(stachecknum);
+                        JSONArray checkitems = dataObject.getJSONArray("CHECKITEMS");
+                        if (checkitems != null && checkitems.size() > 0) {
+                            mSpotCheckLinearLayout.setVisibility(View.VISIBLE);
+                            for (int i = 0; i < checkitems.size(); i++) {
+                                String checkname = checkitems.getString(i);
+                                SpotCheckBean spotCheckBean = new SpotCheckBean();
+                                spotCheckBean.setCheckname(checkname);
+                                spotCheckBean.setChecknum(stachecknum);
+
+                                mSpotCheckBeans.add(spotCheckBean);
+                            }
+                        } else {
+                            mSpotCheckLinearLayout.setVisibility(View.GONE);
+                        }
+                        mSpotCheckAdapter.notifyDataSetChanged();
                     }
                 } catch (Exception e) {
                     mOperatorLl.setVisibility(View.GONE);
@@ -148,10 +186,11 @@ public class ProductCheckFragment extends BaseFragment implements View.OnClickLi
                 CommonUtil.scanBarcode(mActivity, this, 0x11);
                 break;
             case R.id.product_check_qualified_tv:
-                checkBoxCode(false, "");
+                checkBoxCode(false);
                 break;
             case R.id.product_check_unqualified_tv:
-                if (mUnqualifiedPop == null) {
+                checkBoxCode(true);
+                /*if (mUnqualifiedPop == null) {
                     mUnqualifiedPop = new ProductUnqualifiedPop(mActivity);
                     mUnqualifiedPop.setOnConfirmListener(new ProductUnqualifiedPop.OnConfirmListener() {
                         @Override
@@ -160,21 +199,35 @@ public class ProductCheckFragment extends BaseFragment implements View.OnClickLi
                         }
                     });
                 }
-                mUnqualifiedPop.showPopupWindow();
+                mUnqualifiedPop.showPopupWindow();*/
                 break;
             default:
                 break;
         }
     }
 
-    private void checkBoxCode(boolean isNg, String ngReason) {
+    private void checkBoxCode(boolean isNg) {
+        String realnum = mRealNumEditText.getText().toString();
+        if (TextUtils.isEmpty(realnum)) {
+            CommonUtil.toastNoRepeat(mActivity, "请输入实际抽样数");
+            return;
+        }
+        for (int i = 0; i < mSpotCheckBeans.size(); i++) {
+            SpotCheckBean spotCheckBean = mSpotCheckBeans.get(i);
+            if (TextUtils.isEmpty(spotCheckBean.getChecknum())) {
+                CommonUtil.toastNoRepeat(mActivity,
+                        "请输入[" + spotCheckBean.getCheckname() + "]的抽检数");
+                return;
+            }
+        }
         progressDialog.show();
         VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
                 .url(GloableParams.ADDRESS_OUTFINISH_CHECKBOXCODENG)
                 .method(Request.Method.POST)
                 .addParam("boxCode", mBoxcode)
                 .addParam("isNg", Boolean.toString(isNg))
-                .addParam("ngReason", ngReason)
+                .addParam("realCheckNum", realnum)
+                .addParam("checkItems", JSON.toJSONString(mSpotCheckBeans))
                 .build(), new HttpCallback() {
             @Override
             public void onSuccess(int flag, Object o) throws Exception {

+ 12 - 0
app/src/main/res/drawable/shape_table_head_left.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:right="-1dp">
+        <shape android:shape="rectangle">
+            <stroke
+                android:width="1dp"
+                android:color="@color/black" />
+
+            <solid android:color="@color/white" />
+        </shape>
+    </item>
+</layer-list>

+ 12 - 0
app/src/main/res/drawable/shape_table_head_right.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item>
+        <shape android:shape="rectangle">
+            <stroke
+                android:width="1dp"
+                android:color="@color/black" />
+
+            <solid android:color="@color/white" />
+        </shape>
+    </item>
+</layer-list>

+ 90 - 4
app/src/main/res/layout/fragment_product_check.xml

@@ -39,12 +39,98 @@
         android:orientation="vertical"
         android:visibility="gone">
 
-        <android.support.v7.widget.RecyclerView
-            android:id="@+id/product_check_result_rv"
+        <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="0dp"
-            android:layout_marginTop="16dp"
-            android:layout_weight="1" />
+            android:layout_weight="1"
+            android:orientation="vertical">
+
+            <android.support.v7.widget.RecyclerView
+                android:id="@+id/product_check_result_rv"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="16dp" />
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:padding="4dp">
+
+                <TextView
+                    style="@style/CaptionText"
+                    android:text="实际抽样数:" />
+
+                <com.uas.pda_smart_sa.view.ClearableEditText
+                    android:id="@+id/product_check_realnum_et"
+                    style="@style/EditTextLineStyle"
+                    android:inputType="number"
+                    android:minHeight="32dp"
+                    tools:text="value" />
+            </LinearLayout>
+
+
+            <LinearLayout
+                android:id="@+id/product_check_spotcheck_ll"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:orientation="vertical"
+                android:visibility="gone">
+
+                <TextView
+                    style="@style/CaptionText"
+                    android:layout_marginTop="8dp"
+                    android:padding="4dp"
+                    android:text="抽检项目"
+                    android:textColor="@color/black" />
+
+                <LinearLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginTop="10dp">
+
+                    <TextView
+                        android:layout_width="0dp"
+                        android:layout_height="wrap_content"
+                        android:layout_weight="1"
+                        android:background="@drawable/shape_table_head_left"
+                        android:gravity="center"
+                        android:maxLines="1"
+                        android:padding="4dp"
+                        android:singleLine="true"
+                        android:text="抽检项目"
+                        android:textColor="@color/black" />
+
+                    <TextView
+                        android:layout_width="0dp"
+                        android:layout_height="wrap_content"
+                        android:layout_weight="1"
+                        android:background="@drawable/shape_table_head_left"
+                        android:gravity="center"
+                        android:maxLines="1"
+                        android:padding="4dp"
+                        android:singleLine="true"
+                        android:text="抽检数"
+                        android:textColor="@color/black" />
+
+                    <TextView
+                        android:layout_width="0dp"
+                        android:layout_height="wrap_content"
+                        android:layout_weight="1"
+                        android:background="@drawable/shape_table_head_right"
+                        android:gravity="center"
+                        android:maxLines="1"
+                        android:padding="4dp"
+                        android:singleLine="true"
+                        android:text="不合格数"
+                        android:textColor="@color/black" />
+                </LinearLayout>
+
+                <android.support.v7.widget.RecyclerView
+                    android:id="@+id/product_check_spotcheck_rv"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent" />
+            </LinearLayout>
+        </LinearLayout>
 
         <LinearLayout
             android:layout_width="match_parent"

+ 51 - 0
app/src/main/res/layout/item_product_check_table.xml

@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content">
+
+    <TextView
+        android:id="@+id/spot_check_table_name_tv"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:background="@drawable/shape_table_head_left"
+        android:gravity="center"
+        android:maxLines="1"
+        android:padding="6dp"
+        android:singleLine="true"
+        android:text="抽检项目"
+        android:textColor="#333333"
+        android:textSize="14sp" />
+
+    <EditText
+        android:id="@+id/spot_check_table_checknum_et"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+
+        android:background="@drawable/shape_table_head_left"
+        android:gravity="center"
+        android:inputType="number"
+        android:maxLines="1"
+        android:padding="6dp"
+        android:singleLine="true"
+        android:textColor="#333333"
+        android:textSize="14sp"
+        tools:text="抽检数" />
+
+    <EditText
+        android:id="@+id/spot_check_table_ngnum_et"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:background="@drawable/shape_table_head_right"
+        android:gravity="center"
+        android:inputType="number"
+        android:maxLines="1"
+        android:padding="6dp"
+        android:singleLine="true"
+        android:textColor="#333333"
+        android:textSize="14sp"
+        tools:text="不合格数" />
+</LinearLayout>