Переглянути джерело

增加入库明细查询查询功能

songw 2 місяців тому
батько
коміт
3b0c31fc0c

+ 272 - 0
app/src/main/java/com/uas/pda_smart_com/fragment/InventoryDetailsQueryFragment.java

@@ -0,0 +1,272 @@
+package com.uas.pda_smart_com.fragment;
+
+import android.os.Bundle;
+import android.view.KeyEvent;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ListView;
+import android.widget.TextView;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.android.volley.Request;
+import com.android.volley.toolbox.StringRequest;
+import com.handmark.pulltorefresh.library.PullToRefreshBase;
+import com.handmark.pulltorefresh.library.PullToRefreshListView;
+import com.uas.pda_smart_com.R;
+import com.uas.pda_smart_com.activity.FunctionActivity;
+import com.uas.pda_smart_com.adapter.StorageRechargeInspectionAdapter;
+import com.uas.pda_smart_com.bean.StorageRechargeInspectionBean;
+import com.uas.pda_smart_com.global.GloableParams;
+import com.uas.pda_smart_com.listener.MyEditorActionListener;
+import com.uas.pda_smart_com.util.CommonUtil;
+import com.uas.pda_smart_com.util.Constants;
+import com.uas.pda_smart_com.util.FastjsonUtil;
+import com.uas.pda_smart_com.util.FragmentUtils;
+import com.uas.pda_smart_com.util.HttpCallback;
+import com.uas.pda_smart_com.util.HttpParams;
+import com.uas.pda_smart_com.util.JsonUtils;
+import com.uas.pda_smart_com.util.VolleyRequest;
+import com.uas.pda_smart_com.view.ClearableEditText;
+import com.uas.pda_smart_com.view.EmptyLayout;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class InventoryDetailsQueryFragment extends BaseFragment implements HttpCallback {
+    private final int RECHARGE_GETLIST_NEEDGET = 31;
+
+    private String mCaller;
+    private ClearableEditText mSearchEditText;
+    private TextView mSearchButton;
+    private PullToRefreshListView mPullToRefreshListView;
+    private StringRequest mStringRequest;
+    private String mKeyword = "";
+    private int mPageIndex = 1, mPageSize = 10;
+    private EmptyLayout mEmptyLayout;
+    private List<StorageRechargeInspectionBean> mStorageRechargeInspectionBeans;
+    private StorageRechargeInspectionAdapter mStorageRechargeInspectionAdapter;
+
+    @Override
+    protected int getLayout() {
+        return R.layout.fragment_storage_recharge_list;
+    }
+
+    @Override
+    protected void initViews() {
+        Bundle arguments = getArguments();
+        if (arguments != null) {
+            mCaller = arguments.getString(Constants.FLAG.FLAG_RECHARGE_CALLER);
+
+            if ("AcceptNotify!Have".equals(mCaller)) {
+                FunctionActivity.setTitle("已转收料");
+            } else if ("AcceptNotify!Need".equals(mCaller)) {
+                FunctionActivity.setTitle("未转收料");
+            }
+        }
+
+        mSearchEditText = root.findViewById(R.id.storage_recharge_search_cet);
+        mSearchButton = root.findViewById(R.id.storage_recharge_search_btn);
+        mPullToRefreshListView = root.findViewById(R.id.storage_recharge_list_lv);
+        mPullToRefreshListView.setMode(PullToRefreshBase.Mode.BOTH);
+        mStorageRechargeInspectionBeans = new ArrayList<>();
+        mStorageRechargeInspectionAdapter = new StorageRechargeInspectionAdapter(mActivity, mStorageRechargeInspectionBeans);
+        mStorageRechargeInspectionAdapter.setItemType(StorageRechargeInspectionAdapter.TYPE_STORAGE_RECHARGE);
+        mPullToRefreshListView.setAdapter(mStorageRechargeInspectionAdapter);
+
+        mEmptyLayout = new EmptyLayout(mActivity, mPullToRefreshListView.getRefreshableView());
+        mEmptyLayout.setShowLoadingButton(false);
+        mEmptyLayout.setShowEmptyButton(false);
+        mEmptyLayout.setShowErrorButton(false);
+        mEmptyLayout.setEmptyMessage("数据为空");
+    }
+
+    @Override
+    protected void initEvents() {
+        CommonUtil.setEditorActionListener(mSearchEditText, new MyEditorActionListener() {
+            @Override
+            public void MyEditorAction(String text, int actionId, KeyEvent event) {
+                mPageIndex = 1;
+                mKeyword = text;
+                progressDialog.show();
+                getList();
+            }
+        });
+
+        mSearchButton.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                mPageIndex = 1;
+                mKeyword = mSearchEditText.getText().toString().trim();
+                progressDialog.show();
+                getList();
+            }
+        });
+
+        mPullToRefreshListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() {
+            @Override
+            public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) {
+                mPageIndex = 1;
+                getList();
+            }
+
+            @Override
+            public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) {
+                mPageIndex++;
+                getList();
+            }
+        });
+
+        mPullToRefreshListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+            @Override
+            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+                final int reallyPosition = (int) parent.getItemIdAtPosition(position);
+                StorageRechargeInspectionBean storageRechargeInspectionBean = mStorageRechargeInspectionBeans.get(reallyPosition);
+                StorageRechargeDetailFragment fragment = new StorageRechargeDetailFragment();
+
+                fragment.setOnRechargeSuccessListener(new StorageRechargeDetailFragment.OnRechargeSuccessListener() {
+                    @Override
+                    public void onRechargeSuccess() {
+                        mStorageRechargeInspectionBeans.remove(reallyPosition);
+                        mStorageRechargeInspectionAdapter.notifyDataSetChanged();
+                    }
+                });
+                Bundle bundle = new Bundle();
+                bundle.putSerializable(Constants.FLAG.FLAG_RECHARGE_DETAIL, storageRechargeInspectionBean);
+                fragment.setArguments(bundle);
+
+                FragmentUtils.switchFragment(InventoryDetailsQueryFragment.this, fragment);
+            }
+        });
+    }
+
+    @Override
+    protected void initDatas() {
+        mKeyword = "";
+        mPageIndex = 1;
+        progressDialog.show();
+        getList();
+    }
+
+    private void getList() {
+        String url = GloableParams.ADDRESS_INVENTORY_DETAILS_QUERY + "?caller=" + mCaller
+                + "&code=" + mKeyword + "&page=" + mPageIndex + "&pageSize=" + mPageSize;
+        VolleyRequest.getInstance().stringRequest(mStringRequest,
+                new HttpParams.Builder()
+                        .url(url)
+                        .method(Request.Method.GET)
+                        .tag(TAG + "getRechargeList")
+                        .flag(RECHARGE_GETLIST_NEEDGET)
+                        .build(), this);
+    }
+
+    @Override
+    public void onHiddenChanged(boolean hidden) {
+        super.onHiddenChanged(hidden);
+        if (hidden) {
+
+        } else {
+            if ("AcceptNotify!Have".equals(mCaller)) {
+                FunctionActivity.setTitle("已转收料");
+            } else if ("AcceptNotify!Need".equals(mCaller)) {
+                FunctionActivity.setTitle("未转收料");
+            }
+        }
+    }
+
+    @Override
+    public void onSuccess(int flag, Object o) throws Exception {
+        progressDialog.dismiss();
+        if (mPullToRefreshListView.isRefreshing()) {
+            mPullToRefreshListView.onRefreshComplete();
+        }
+        try {
+            if (mPageIndex == 1) {
+                mStorageRechargeInspectionBeans.clear();
+            }
+            if (o != null) {
+                String result = o.toString();
+                if (JsonUtils.validate(result)) {
+                    JSONObject resultObject = JSON.parseObject(result);
+                    JSONArray dataArray = resultObject.getJSONArray("data");
+                    if (dataArray != null) {
+                        for (int i = 0; i < dataArray.size(); i++) {
+                            JSONObject dataObject = dataArray.getJSONObject(i);
+                            if (dataObject != null) {
+                                JSONObject mainObject = dataObject.getJSONObject("main");
+
+                                StorageRechargeInspectionBean storageRechargeInspectionBean = new StorageRechargeInspectionBean();
+                                storageRechargeInspectionBean.setId(FastjsonUtil.getLong(mainObject, "AN_ID"));
+                                storageRechargeInspectionBean.setCode(FastjsonUtil.getText(mainObject, "AN_CODE"));
+                                storageRechargeInspectionBean.setBillClass(FastjsonUtil.getText(mainObject, ""));
+                                storageRechargeInspectionBean.setDate(FastjsonUtil.getLong(mainObject, "AN_DATE"));
+                                storageRechargeInspectionBean.setStates(FastjsonUtil.getText(mainObject, "AN_STATUS"));
+                                storageRechargeInspectionBean.setRecorder(FastjsonUtil.getText(mainObject, "AN_RECORDER"));
+                                storageRechargeInspectionBean.setVendcode(FastjsonUtil.getText(mainObject, "AN_VENDCODE"));
+                                storageRechargeInspectionBean.setVendname(FastjsonUtil.getText(mainObject, "AN_VENDNAME"));
+                                storageRechargeInspectionBean.setDetailJson(FastjsonUtil.getText(dataObject, "detail"));
+                                storageRechargeInspectionBean.setSlipable(FastjsonUtil.getBoolean(dataObject, "ifShowButton"));
+                                storageRechargeInspectionBean.setAN_INDATE(FastjsonUtil.getText(mainObject, "AN_INDATE"));
+
+                                mStorageRechargeInspectionBeans.add(storageRechargeInspectionBean);
+                            }
+                        }
+
+                        mStorageRechargeInspectionAdapter.notifyDataSetChanged();
+                        if (mStorageRechargeInspectionBeans.size() == 0) {
+                            mEmptyLayout.showEmpty();
+                        }
+                    } else {
+                        mStorageRechargeInspectionAdapter.notifyDataSetChanged();
+                        if (mStorageRechargeInspectionBeans.size() == 0) {
+                            mEmptyLayout.showEmpty();
+                        }
+                    }
+                } else {
+                    mStorageRechargeInspectionAdapter.notifyDataSetChanged();
+                    if (mStorageRechargeInspectionBeans.size() == 0) {
+                        mEmptyLayout.showEmpty();
+                    }
+                }
+            } else {
+                mStorageRechargeInspectionAdapter.notifyDataSetChanged();
+                if (mStorageRechargeInspectionBeans.size() == 0) {
+                    mEmptyLayout.showEmpty();
+                }
+            }
+        } catch (Exception e) {
+            mStorageRechargeInspectionAdapter.notifyDataSetChanged();
+            if (mStorageRechargeInspectionBeans.size() == 0) {
+                mEmptyLayout.showEmpty();
+            }
+        }
+    }
+
+    @Override
+    public void onFail(int flag, String failStr) throws Exception {
+        progressDialog.dismiss();
+        if (mPullToRefreshListView.isRefreshing()) {
+            mPullToRefreshListView.onRefreshComplete();
+        }
+        if (mPageIndex == 1) {
+            mStorageRechargeInspectionBeans.clear();
+            mEmptyLayout.setErrorMessage(failStr);
+            mEmptyLayout.showError();
+            mStorageRechargeInspectionAdapter.notifyDataSetChanged();
+        } else {
+            mPageIndex--;
+            CommonUtil.toastNoRepeat(mActivity, failStr);
+        }
+    }
+
+    @Override
+    public boolean onKeyDown(int keyCode, KeyEvent event) {
+        return false;
+    }
+
+    @Override
+    public boolean onFragmentBackPressed() {
+        return false;
+    }
+}

+ 4 - 0
app/src/main/java/com/uas/pda_smart_com/fragment/StorageInFragment.java

@@ -104,6 +104,10 @@ public class StorageInFragment extends BaseFragment implements View.OnClickListe
                         //入库采集
                         mFragment = new JltStorageInFilterListFragment();
                         break;
+                    case GloableParams.MENU_STORAGE_INVENTORY_DETAILS_QUERY:
+                        //入库明细查询
+                        mFragment = new InventoryDetailsQueryFragment();
+                        break;
                     default:
                         break;
                 }

+ 10 - 2
app/src/main/java/com/uas/pda_smart_com/global/GloableParams.java

@@ -247,6 +247,7 @@ public class GloableParams {
     public static String ADDRESS_PUTMATERIAL_TOADOPTPROMPT;
     public static String ADDRESS_DOCUMENTLIBRARY_AUTIQC;
     public static String ADDRESS_TURNPURCBARCODE;
+    public static String ADDRESS_INVENTORY_DETAILS_QUERY;
 
 
 
@@ -688,6 +689,9 @@ public class GloableParams {
     //切换账套
     private static final String ADDRESSTAIL_CHANGE_MASTER = "/api/pda/changeMaster.action";
 
+    //入库明细查询
+    private static final String ADDRESSTAIL_INVENTORY_DETAILS_QUERY = "/api/pda/acceptNToVerify/getProdiodetail.action";
+
     /***********************************************************************************************/
     /*界面文字和图片资源,控制后续数据一致*/
     //主界面
@@ -790,18 +794,21 @@ public class GloableParams {
     public static final String MENU_STORAGE_BARCODE_IN = "条码入库";
     public static final String MENU_STORAGE_BARCODE_INFO_COLLECT = "条码信息采集";
     public static final String MENU_STORAGE_BARCODECJI_IN = "入库采集";
+    public static final String MENU_STORAGE_INVENTORY_DETAILS_QUERY = "入库明细查询";
 
     public static final String[] storageInMenuNames = {
             MENU_STORAGE_RECHARGE, MENU_STORAGE_INSPECTION, MENU_STORAGE_IQC_STORAGE_IN,
             MENU_STORAGE_MATERIAL_STORAGE_IN, MENU_STORAGE_PRODUCT_STORAGE_IN,
             MENU_STORAGE_RANDOM_CHECK, MENU_STORAGE_BARCODE_IN, MENU_STORAGE_BARCODE_INFO_COLLECT,
-            MENU_STORAGE_BARCODECJI_IN};
+            MENU_STORAGE_BARCODECJI_IN, MENU_STORAGE_INVENTORY_DETAILS_QUERY};
     public static final int[] storageInMenuImgs = {
             R.drawable.ic_storage_recharge, R.drawable.ic_storage_inspection, R.drawable.ic_storage_iqc,
             R.drawable.ic_storage_material_in, R.drawable.ic_storage_finish_in,
             R.drawable.ic_storage_random_check, R.drawable.ic_storage_barcode_in,
             R.drawable.ic_barcode_info_collect,
-            R.drawable.ic_storage_barcode_in};
+            R.drawable.ic_storage_barcode_in,
+            R.drawable.rukumingxichaxun
+    };
 
     //-->SMT校验
     public static final String LISTNAME_SCMAKE_SMTCHECK_FELOA = "飞达+站位";
@@ -1082,6 +1089,7 @@ public class GloableParams {
         GloableParams.ADDRESS_PUTMATERIAL_TOADOPTPROMPT = uriHead + GloableParams.ADDRESSTAIL_PDAIO_GET_TOADOPTPROMPT;
         GloableParams.ADDRESS_DOCUMENTLIBRARY_AUTIQC= uriHead + GloableParams.ADDRESSTAIL_RECHARGE_AUTIQC;
         GloableParams.ADDRESS_TURNPURCBARCODE= uriHead + GloableParams.ADDRESSTAIL_IQC_GETLIST_TURNPURCBARCODE;
+        GloableParams.ADDRESS_INVENTORY_DETAILS_QUERY= uriHead + GloableParams.ADDRESSTAIL_INVENTORY_DETAILS_QUERY;
 
 
 

BIN
app/src/main/res/drawable-xhdpi/rukumingxichaxun.png


+ 6 - 2
build.gradle

@@ -3,6 +3,10 @@
 
 buildscript {
     repositories {
+        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
+        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
+        maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
+        maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
         maven { url "https://jitpack.io" }
         mavenCentral()
         google()
@@ -50,8 +54,8 @@ ext {
             targetSdkVersion : 28,
             compileSdkVersion: 28,
             buildToolsVersion: "28.0.3",
-            versionCode      : 29,
-            versionName      : "v2.2.7"
+            versionCode      : 30,
+            versionName      : "v2.2.8"
     ]
 
     depsVersion = [