Browse Source

储位信息核查

RaoMeng 4 years ago
parent
commit
cdc89c80f7

+ 27 - 0
app/src/main/java/com/uas/uaspda/adapter/WhCheckLocationAdapter.java

@@ -0,0 +1,27 @@
+package com.uas.uaspda.adapter;
+
+import android.support.annotation.Nullable;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.chad.library.adapter.base.BaseViewHolder;
+import com.uas.uaspda.R;
+import com.uas.uaspda.bean.StockAlreadyItemBean;
+import com.uas.uaspda.util.CommonUtil;
+
+import java.util.List;
+
+public class WhCheckLocationAdapter extends BaseQuickAdapter<StockAlreadyItemBean, BaseViewHolder> {
+
+    public WhCheckLocationAdapter(@Nullable List<StockAlreadyItemBean> data) {
+        super(R.layout.item_list_whcheck_location, data);
+    }
+
+    @Override
+    protected void convert(BaseViewHolder helper, StockAlreadyItemBean item) {
+        helper.setText(R.id.item_whcheck_location_barcode, item.getBI_BARCODE());
+        helper.setText(R.id.item_whcheck_location_outqty, CommonUtil.doubleFormat(item.getBI_OUTQTY()));
+        helper.setText(R.id.item_whcheck_location_prodcode, item.getBI_PRODCODE());
+        helper.setText(R.id.item_whcheck_location_detail, item.getPR_DETAIL());
+        helper.setText(R.id.item_whcheck_location_spec, item.getPR_SPEC());
+    }
+}

+ 15 - 10
app/src/main/java/com/uas/uaspda/fragment/WHCheckContentFragment.java

@@ -34,9 +34,9 @@ public class WHCheckContentFragment extends BaseFragment implements AdapterView.
         indexItemList = DataSourceManager.getDataSourceManager().getCheckContentIndexItemList();
         //->List
         lvIndex = (ListView) root.findViewById(R.id.lv_checkcontent_wh);
-        SimpleAdapter adapter = new SimpleAdapter(getActivity(),indexItemList,R.layout.item_list_withimg,
-                new String[]{DataSourceManager.KEY_GRID_ITEMIMG,DataSourceManager.KEY_GRID_ITEMNAME},
-                new int[]{R.id.itemImg,R.id.itemName});
+        SimpleAdapter adapter = new SimpleAdapter(getActivity(), indexItemList, R.layout.item_list_withimg,
+                new String[]{DataSourceManager.KEY_GRID_ITEMIMG, DataSourceManager.KEY_GRID_ITEMNAME},
+                new int[]{R.id.itemImg, R.id.itemName});
         lvIndex.setAdapter(adapter);
     }
 
@@ -54,36 +54,41 @@ public class WHCheckContentFragment extends BaseFragment implements AdapterView.
 
     @Override
     public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-        String selected = (String) ((HashMap)indexItemList.get(position)).get(DataSourceManager.KEY_GRID_ITEMNAME);
+        String selected = (String) ((HashMap) indexItemList.get(position)).get(DataSourceManager.KEY_GRID_ITEMNAME);
 
         Fragment fragment = null;
-        switch (selected){
+        switch (selected) {
             //物料库存核查
             case GloableParams.LISTNAME_WH_CHECKCONTENT_MAKEMATERIAL:
                 fragment = new WHCheckMakeMaterialFragment();
                 getFragmentManager().beginTransaction().addToBackStack(null)
-                        .replace(R.id.container_function_fragment,fragment).commit();
+                        .replace(R.id.container_function_fragment, fragment).commit();
                 break;
             //条码信息核查
             case GloableParams.LISTNAME_WH_CHECKCONTENT_BARCODE:
                 fragment = new WHCheckBarcodeFragment();
                 getFragmentManager().beginTransaction().addToBackStack(null)
-                        .replace(R.id.container_function_fragment,fragment).commit();
+                        .replace(R.id.container_function_fragment, fragment).commit();
                 break;
             //包装信息核查
             case GloableParams.LISTNAME_WH_CHECKCONTENT_PACKAGE:
                 getFragmentManager().beginTransaction().addToBackStack(null)
-                        .replace(R.id.container_function_fragment,new WHCheckPackageFragment()).commit();
+                        .replace(R.id.container_function_fragment, new WHCheckPackageFragment()).commit();
                 break;
             //工单完工品核查
             case GloableParams.LISTNAME_WH_CHECKCONTENT_MAKEFINISH:
                 getFragmentManager().beginTransaction().addToBackStack(null)
-                        .replace(R.id.container_function_fragment,new WHCheckMakeFinFragment()).commit();
+                        .replace(R.id.container_function_fragment, new WHCheckMakeFinFragment()).commit();
                 break;
             //订单完工品核查
             case GloableParams.LISTNAME_WH_CHECKCONTENT_ORDERFINISH:
                 getFragmentManager().beginTransaction().addToBackStack(null)
-                        .replace(R.id.container_function_fragment,new WHCheckOrderFinFragment()).commit();
+                        .replace(R.id.container_function_fragment, new WHCheckOrderFinFragment()).commit();
+                break;
+            //储位信息核查
+            case GloableParams.LISTNAME_WH_CHECKCONTENT_LOCATION:
+                getFragmentManager().beginTransaction().addToBackStack(null)
+                        .replace(R.id.container_function_fragment, new WHCheckLocationFragment()).commit();
                 break;
         }
 

+ 204 - 0
app/src/main/java/com/uas/uaspda/fragment/WHCheckLocationFragment.java

@@ -0,0 +1,204 @@
+package com.uas.uaspda.fragment;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+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.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.android.volley.Request;
+import com.uas.uaspda.R;
+import com.uas.uaspda.activity.FunctionActivity;
+import com.uas.uaspda.adapter.WhCheckLocationAdapter;
+import com.uas.uaspda.bean.StockAlreadyItemBean;
+import com.uas.uaspda.global.GloableParams;
+import com.uas.uaspda.listener.MyEditorActionListener;
+import com.uas.uaspda.tools.VolleyUtil;
+import com.uas.uaspda.util.CameraUtil;
+import com.uas.uaspda.util.CommonUtil;
+import com.uas.uaspda.util.FastjsonUtil;
+import com.uas.uaspda.util.HttpCallback;
+import com.uas.uaspda.util.HttpParams;
+import com.uas.uaspda.util.VolleyRequest;
+import com.uas.uaspda.view.ClearableEditText;
+import com.uas.uaspda.view.RecyclerItemDecoration;
+import com.uuzuche.lib_zxing.activity.CaptureActivity;
+import com.uuzuche.lib_zxing.activity.CodeUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class WHCheckLocationFragment extends BaseFragment {
+    private static final int SCAN_BARCODE_CODE = 403;
+    private ClearableEditText mLocationEditText;
+    private TextView mConfirmTextView, mLocationTextView;
+    private RecyclerView mRecyclerView;
+    private List<StockAlreadyItemBean> mResultList;
+    private WhCheckLocationAdapter mWhCheckLocationAdapter;
+    private ImageView mScanImageView;
+
+    @Override
+    protected int getLayout() {
+        return R.layout.fragment_whcheck_location;
+    }
+
+    @Override
+    protected void initViews() {
+        setTitle("储位信息核查");
+        ((FunctionActivity) mActivity).setScanIvVisible(true);
+
+        mLocationEditText = root.findViewById(R.id.et_collect);
+        mConfirmTextView = root.findViewById(R.id.btn_collect);
+
+        mScanImageView = (ImageView) mActivity.findViewById(R.id.btn_actionbar_scan_iv);
+        mLocationTextView = root.findViewById(R.id.whcheck_location_location_tv);
+        mRecyclerView = root.findViewById(R.id.whcheck_location_data_rv);
+        mRecyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
+        mRecyclerView.addItemDecoration(new RecyclerItemDecoration(1));
+        mResultList = new ArrayList<>();
+        mWhCheckLocationAdapter = new WhCheckLocationAdapter(mResultList);
+        mRecyclerView.setAdapter(mWhCheckLocationAdapter);
+
+        mLocationEditText.setHint("储位");
+        mLocationEditText.requestFocus();
+    }
+
+    @Override
+    protected void initEvents() {
+        CommonUtil.setEditorActionListener(mLocationEditText, new MyEditorActionListener() {
+            @Override
+            public void MyEditorAction(String text, int actionId, KeyEvent event) {
+                if (!TextUtils.isEmpty(text)) {
+                    searchLocation(text);
+                }
+            }
+        });
+
+        mConfirmTextView.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                String location = mLocationEditText.getText().toString().trim();
+                if (!TextUtils.isEmpty(location)) {
+                    searchLocation(location);
+                }
+            }
+        });
+
+
+        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));
+                }
+            }
+        });
+    }
+
+    private void searchLocation(String text) {
+        progressDialog.show();
+        mLocationEditText.setText("");
+        mLocationEditText.requestFocus();
+        mLocationTextView.setText(text);
+        mResultList.clear();
+        VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
+                .url(GloableParams.ADDRESS_CHECK_LOCATIONCHECK)
+                .method(Request.Method.POST)
+                .addParam("location", text)
+                .build(), new HttpCallback() {
+            @Override
+            public void onSuccess(int flag, Object o) throws Exception {
+                progressDialog.dismiss();
+                try {
+                    String result = o.toString();
+                    JSONObject resultObject = JSON.parseObject(result);
+                    JSONArray dataArray = resultObject.getJSONArray("data");
+                    if (dataArray != null && dataArray.size() > 0) {
+                        String location = null;
+                        for (int i = 0; i < dataArray.size(); i++) {
+                            JSONObject dataObject = dataArray.getJSONObject(i);
+                            if (dataObject != null) {
+                                StockAlreadyItemBean itemBean = new StockAlreadyItemBean();
+                                itemBean.setBI_BARCODE(FastjsonUtil.getText(dataObject, "BAR_CODE"));
+                                itemBean.setBI_OUTQTY(FastjsonUtil.getDouble(dataObject, "BAR_REMAIN"));
+                                itemBean.setBI_LOCATION(FastjsonUtil.getText(dataObject, "BAR_LOCATION"));
+                                itemBean.setPR_SPEC(FastjsonUtil.getText(dataObject, "PR_SPEC"));
+                                itemBean.setPR_DETAIL(FastjsonUtil.getText(dataObject, "PR_DETAIL"));
+                                itemBean.setBI_PRODCODE(FastjsonUtil.getText(dataObject, "BAR_PRODCODE"));
+                                if (TextUtils.isEmpty(location)) {
+                                    location = FastjsonUtil.getText(dataObject, "BAR_LOCATION");
+                                }
+                                mResultList.add(itemBean);
+                            }
+                        }
+                        mLocationTextView.setText(location);
+                    }
+                    mWhCheckLocationAdapter.notifyDataSetChanged();
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+
+            @Override
+            public void onFail(int flag, String failStr) throws Exception {
+                progressDialog.dismiss();
+                CommonUtil.toastNoRepeat(mActivity, failStr);
+                mWhCheckLocationAdapter.notifyDataSetChanged();
+                mLocationTextView.setText("");
+            }
+        });
+    }
+
+    @Override
+    protected void initDatas() {
+
+    }
+
+    @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);
+                mLocationEditText.setText(result);
+                mLocationEditText.setSelection(result.length());
+
+                searchLocation(result);
+            }
+        }
+    }
+
+    @Override
+    public boolean onKeyDown(int keyCode, KeyEvent event) {
+        return false;
+    }
+
+    @Override
+    public boolean onFragmentBackPressed() {
+        return false;
+    }
+
+
+    @Override
+    public void onDestroy() {
+        ((TextView) (getActivity().findViewById(R.id.tv_actionbar_withback))).setText(R.string.title_content_whmm);
+        ((FunctionActivity) mActivity).setScanIvVisible(false);
+        super.onDestroy();
+    }
+}

+ 16 - 3
app/src/main/java/com/uas/uaspda/global/GloableParams.java

@@ -221,6 +221,7 @@ public class GloableParams {
     public static String ADDRESS_SPM_MIXING;
     public static String ADDRESS_SPM_GETLINE;
     public static String ADDRESS_SMT_FORECASTDATACHECK;
+    public static String ADDRESS_CHECK_LOCATIONCHECK;
 
 
     //连接服务器请求地址
@@ -429,6 +430,10 @@ public class GloableParams {
     private static final String ADDRESSTAIL_CHECKMAKEFIN = "/api/pda/check/makeFinishCheck.action";
     // 货物查询:订单完工品核查页面
     private static final String ADDRESSTAIL_CHECKORDERFIN = "/api/pda/check/orderFinishCheck.action";
+    // 货物查询:储位信息查询
+    private static final String ADDRESSTAIL_CHECK_LOCATIONCHECK = "/api/pda/check/locationCheck.action";
+
+
     // 仓库管理:拆批合批,页面二:分拆批次页面
     private static final String ADDRESSTAIL_BARCODEENTEREVENT = "/api/pda/batch/getBarcodeData.action";
     private static final String ADDRESSTAIL_BREAKINGBTNCLICKEVENT = "/api/pda/batch/breakingBatch.action";
@@ -745,12 +750,19 @@ public class GloableParams {
     //-->仓库管理:货物核查
     public static final String LISTNAME_WH_CHECKCONTENT_MAKEMATERIAL = "物料库存核查";
     public static final String LISTNAME_WH_CHECKCONTENT_BARCODE = "条码信息核查";
+    public static final String LISTNAME_WH_CHECKCONTENT_LOCATION = "储位信息核查";
     public static final String LISTNAME_WH_CHECKCONTENT_PACKAGE = "包装信息核查";
     public static final String LISTNAME_WH_CHECKCONTENT_MAKEFINISH = "工单完工品核查";
     public static final String LISTNAME_WH_CHECKCONTENT_ORDERFINISH = "订单完工品核查";
-    public static final String[] mmindexListName = {LISTNAME_WH_CHECKCONTENT_MAKEMATERIAL, LISTNAME_WH_CHECKCONTENT_BARCODE,
-            LISTNAME_WH_CHECKCONTENT_PACKAGE, LISTNAME_WH_CHECKCONTENT_MAKEFINISH, LISTNAME_WH_CHECKCONTENT_ORDERFINISH};
-    public static final int[] mmindexListImg = {R.drawable.ic_menu_head, R.drawable.ic_menu_head,
+    public static final String[] mmindexListName = {
+            LISTNAME_WH_CHECKCONTENT_MAKEMATERIAL,
+            LISTNAME_WH_CHECKCONTENT_BARCODE,
+            LISTNAME_WH_CHECKCONTENT_LOCATION,
+            LISTNAME_WH_CHECKCONTENT_PACKAGE,
+            LISTNAME_WH_CHECKCONTENT_MAKEFINISH,
+            LISTNAME_WH_CHECKCONTENT_ORDERFINISH
+    };
+    public static final int[] mmindexListImg = {R.drawable.ic_menu_head, R.drawable.ic_menu_head, R.drawable.ic_menu_head,
             R.drawable.ic_menu_head, R.drawable.ic_menu_head, R.drawable.ic_menu_head};
     //INDEX:setting Index
 
@@ -980,5 +992,6 @@ public class GloableParams {
         GloableParams.ADDRESS_SPM_MIXING = uriHead + GloableParams.ADDRESSTAIL_SPM_MIXING;
         GloableParams.ADDRESS_SPM_GETLINE = uriHead + GloableParams.ADDRESSTAIL_SPM_GETLINE;
         GloableParams.ADDRESS_SMT_FORECASTDATACHECK = uriHead + GloableParams.ADDRESSTAIL_SMT_FORECASTDATACHECK;
+        GloableParams.ADDRESS_CHECK_LOCATIONCHECK = uriHead + GloableParams.ADDRESSTAIL_CHECK_LOCATIONCHECK;
     }
 }

+ 39 - 0
app/src/main/res/layout/fragment_whcheck_location.xml

@@ -0,0 +1,39 @@
+<?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="match_parent"
+    android:orientation="vertical">
+
+    <include layout="@layout/include_search" />
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal"
+        android:paddingLeft="8dp">
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="储位:"
+            android:textColor="@color/body_text_1"
+            android:textSize="16sp" />
+
+        <TextView
+            android:id="@+id/whcheck_location_location_tv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:textColor="@color/body_text_1"
+            android:textSize="16sp"
+            tools:text="YS1506002" />
+
+    </LinearLayout>
+
+    <android.support.v7.widget.RecyclerView
+        android:id="@+id/whcheck_location_data_rv"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:padding="8dp" />
+</LinearLayout>

+ 1 - 1
app/src/main/res/layout/fragment_whcheck_makematerial.xml

@@ -20,7 +20,7 @@
             android:layout_marginLeft="@dimen/space_left_8"
             android:layout_marginRight="@dimen/space_right_8"
             style="@style/PopWinEditTextStyle"
-            android:hint="储位"
+            android:hint="仓库"
             android:layout_weight="3"/>
         <TextView
             android:id="@+id/btn_search_whmm"

+ 89 - 0
app/src/main/res/layout/item_list_whcheck_location.xml

@@ -0,0 +1,89 @@
+<?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"
+    android:background="@drawable/selector_pop_item_bg"
+    android:orientation="vertical"
+    android:padding="@dimen/spacing_normal">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+
+        <TextView
+            android:id="@+id/item_whcheck_location_barcode"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:textStyle="bold"
+            tools:text="stock_task_prodcode" />
+
+        <TextView
+            android:id="@+id/item_whcheck_location_outqty"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:textStyle="bold"
+            tools:text="12" />
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="5dp">
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="料号:" />
+
+        <TextView
+            android:id="@+id/item_whcheck_location_prodcode"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            tools:text="12" />
+
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="5dp">
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="名称:" />
+
+        <TextView
+            android:id="@+id/item_whcheck_location_detail"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            tools:text="20" />
+
+    </LinearLayout>
+
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="5dp">
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="规格:" />
+
+        <TextView
+            android:id="@+id/item_whcheck_location_spec"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            tools:text="20" />
+
+    </LinearLayout>
+
+</LinearLayout>

+ 2 - 2
build.gradle

@@ -45,8 +45,8 @@ ext {
             targetSdkVersion : 28,
             compileSdkVersion: 28,
             buildToolsVersion: "28.0.3",
-            versionCode      : 14,
-            versionName      : "v3.0"
+            versionCode      : 15,
+            versionName      : "v3.1"
     ]
 
     depsVersion = [