Bläddra i källkod

修改完成入库查询明细接口功能

songw 2 månader sedan
förälder
incheckning
57b66ac997

+ 88 - 0
app/src/main/java/com/uas/pda_smart_com/adapter/InventoryDetailsQueryAdapter.java

@@ -0,0 +1,88 @@
+package com.uas.pda_smart_com.adapter;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.TextView;
+
+import com.uas.pda_smart_com.R;
+import com.uas.pda_smart_com.bean.InventoryDetailsQueryBean;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class InventoryDetailsQueryAdapter extends BaseAdapter {
+
+    private List<InventoryDetailsQueryBean> objects = new ArrayList<InventoryDetailsQueryBean>();
+
+    private Context context;
+    private LayoutInflater layoutInflater;
+
+    public InventoryDetailsQueryAdapter(Context context, List<InventoryDetailsQueryBean> objects) {
+        this.context = context;
+        this.layoutInflater = LayoutInflater.from(context);
+        this.objects = objects;
+    }
+
+    @Override
+    public int getCount() {
+        return objects.size();
+    }
+
+    @Override
+    public InventoryDetailsQueryBean getItem(int position) {
+        return objects.get(position);
+    }
+
+    @Override
+    public long getItemId(int position) {
+        return position;
+    }
+
+    @Override
+    public View getView(int position, View convertView, ViewGroup parent) {
+        if (convertView == null) {
+            convertView = layoutInflater.inflate(R.layout.itme_list_inventory_details_query, null);
+            convertView.setTag(new ViewHolder(convertView));
+        }
+        initializeViews((InventoryDetailsQueryBean) getItem(position), (ViewHolder) convertView.getTag());
+        return convertView;
+    }
+
+    private void initializeViews(InventoryDetailsQueryBean object, ViewHolder holder) {
+        //返回字段pd_piclass 单据类型,pd_inoutno 单据编号,pd_prodcode 物料编号,pd_inqty 入库数量,pi_date
+        // 入库日期,pi_title 供应商,pr_detail 物料名称,pr_spec 物料规格
+        holder.tv_pd_piclass.setText(object.getPD_PICLASS());
+        holder.tv_pd_inoutno.setText(object.getPD_INOUTNO());
+        holder.tv_pd_prodcode.setText(object.getPD_PRODCODE());
+        holder.tv_pd_inqty.setText(String.valueOf(object.getPD_INQTY()));
+        holder.tv_pi_date.setText(object.getPI_DATE());
+        holder.tv_pi_title.setText(object.getPI_TITLE());
+        holder.tv_pr_detail.setText(object.getPR_DETAIL());
+        holder.tv_pr_spec.setText(object.getPR_SPEC());
+    }
+
+    protected class ViewHolder {
+        private TextView tv_pd_piclass;
+        private TextView tv_pd_inoutno;
+        private TextView tv_pd_prodcode;
+        private TextView tv_pd_inqty;
+        private TextView tv_pi_date;
+        private TextView tv_pi_title;
+        private TextView tv_pr_detail;
+        private TextView tv_pr_spec;
+
+        public ViewHolder(View view) {
+            tv_pd_piclass = (TextView) view.findViewById(R.id.tv_pd_piclass);
+            tv_pd_inoutno = (TextView) view.findViewById(R.id.tv_pd_inoutno);
+            tv_pd_prodcode = (TextView) view.findViewById(R.id.tv_pd_prodcode);
+            tv_pd_inqty = (TextView) view.findViewById(R.id.tv_pd_inqty);
+            tv_pi_date = (TextView) view.findViewById(R.id.tv_pi_date);
+            tv_pi_title = (TextView) view.findViewById(R.id.tv_pi_title);
+            tv_pr_detail = (TextView) view.findViewById(R.id.tv_pr_detail);
+            tv_pr_spec = (TextView) view.findViewById(R.id.tv_pr_spec);
+        }
+    }
+}

+ 63 - 54
app/src/main/java/com/uas/pda_smart_com/fragment/InventoryDetailsQueryFragment.java

@@ -16,14 +16,13 @@ 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.adapter.InventoryDetailsQueryAdapter;
+import com.uas.pda_smart_com.bean.InventoryDetailsQueryBean;
 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;
@@ -45,8 +44,8 @@ public class InventoryDetailsQueryFragment extends BaseFragment implements HttpC
     private String mKeyword = "";
     private int mPageIndex = 1, mPageSize = 10;
     private EmptyLayout mEmptyLayout;
-    private List<StorageRechargeInspectionBean> mStorageRechargeInspectionBeans;
-    private StorageRechargeInspectionAdapter mStorageRechargeInspectionAdapter;
+    private List<InventoryDetailsQueryBean> inventoryDetailsQueryBeans;
+    private InventoryDetailsQueryAdapter inventoryDetailsQueryAdapter;
 
     @Override
     protected int getLayout() {
@@ -70,10 +69,10 @@ public class InventoryDetailsQueryFragment extends BaseFragment implements HttpC
         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);
+        inventoryDetailsQueryBeans = new ArrayList<>();
+        inventoryDetailsQueryAdapter = new InventoryDetailsQueryAdapter(mActivity, inventoryDetailsQueryBeans);
+//        inventoryDetailsQueryAdapter.setItemType(StorageRechargeInspectionAdapter.TYPE_STORAGE_RECHARGE);
+        mPullToRefreshListView.setAdapter(inventoryDetailsQueryAdapter);
 
         mEmptyLayout = new EmptyLayout(mActivity, mPullToRefreshListView.getRefreshableView());
         mEmptyLayout.setShowLoadingButton(false);
@@ -121,22 +120,22 @@ public class InventoryDetailsQueryFragment extends BaseFragment implements HttpC
         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);
+//                final int reallyPosition = (int) parent.getItemIdAtPosition(position);
+//                InventoryDetailsQueryBean inventoryDetailsQueryBean = inventoryDetailsQueryBeans.get(reallyPosition);
+//                StorageRechargeDetailFragment fragment = new StorageRechargeDetailFragment();
+//
+//                fragment.setOnRechargeSuccessListener(new StorageRechargeDetailFragment.OnRechargeSuccessListener() {
+//                    @Override
+//                    public void onRechargeSuccess() {
+//                        inventoryDetailsQueryBeans.remove(reallyPosition);
+//                        inventoryDetailsQueryAdapter.notifyDataSetChanged();
+//                    }
+//                });
+//                Bundle bundle = new Bundle();
+//                bundle.putSerializable(Constants.FLAG.FLAG_RECHARGE_DETAIL, inventoryDetailsQueryBean);
+//                fragment.setArguments(bundle);
+//
+//                FragmentUtils.switchFragment(InventoryDetailsQueryFragment.this, fragment);
             }
         });
     }
@@ -145,8 +144,8 @@ public class InventoryDetailsQueryFragment extends BaseFragment implements HttpC
     protected void initDatas() {
         mKeyword = "";
         mPageIndex = 1;
-        progressDialog.show();
-        getList();
+//        progressDialog.show();
+//        getList();
     }
 
     private void getList() {
@@ -183,7 +182,7 @@ public class InventoryDetailsQueryFragment extends BaseFragment implements HttpC
         }
         try {
             if (mPageIndex == 1) {
-                mStorageRechargeInspectionBeans.clear();
+                inventoryDetailsQueryBeans.clear();
             }
             if (o != null) {
                 String result = o.toString();
@@ -194,50 +193,60 @@ public class InventoryDetailsQueryFragment extends BaseFragment implements HttpC
                         for (int i = 0; i < dataArray.size(); i++) {
                             JSONObject dataObject = dataArray.getJSONObject(i);
                             if (dataObject != null) {
-                                JSONObject mainObject = dataObject.getJSONObject("main");
+//                                JSONObject mainObject = dataObject.getJSONObject("main");
+                                //   private String PD_PICLASS;
+                                //    private String PD_INOUTNO;
+                                //    private String PD_PRODCODE;
+                                //    private int PD_INQTY;
+                                //    private String PI_DATE;
+                                //    private String PI_TITLE;
+                                //    private String PR_DETAIL;
+                                //    private String PR_SPEC;
+                                //    private int RN;
+
+                                //    //返回字段pd_piclass 单据类型,pd_inoutno 单据编号,pd_prodcode 物料编号,pd_inqty 入库数量,pi_date
+                                //    入库日期,pi_title 供应商,pr_detail 物料名称,pr_spec 物料规格
 
-                                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);
+                                InventoryDetailsQueryBean inventoryDetailsQueryBean = new InventoryDetailsQueryBean();
+                                inventoryDetailsQueryBean.setPD_PICLASS(FastjsonUtil.getText(dataObject, "PD_PICLASS"));
+                                inventoryDetailsQueryBean.setPD_INOUTNO(FastjsonUtil.getText(dataObject, "PD_INOUTNO"));
+                                inventoryDetailsQueryBean.setPD_PRODCODE(FastjsonUtil.getText(dataObject, "PD_PRODCODE"));
+                                inventoryDetailsQueryBean.setPD_INQTY(FastjsonUtil.getInt(dataObject, "PD_INQTY"));
+                                inventoryDetailsQueryBean.setPI_DATE(FastjsonUtil.getText(dataObject, "PI_DATE"));
+                                inventoryDetailsQueryBean.setPI_TITLE(FastjsonUtil.getText(dataObject, "PI_TITLE"));
+                                inventoryDetailsQueryBean.setPR_DETAIL(FastjsonUtil.getText(dataObject, "PR_DETAIL"));
+                                inventoryDetailsQueryBean.setPR_SPEC(FastjsonUtil.getText(dataObject, "PR_SPEC"));
+                                inventoryDetailsQueryBean.setRN(FastjsonUtil.getInt(dataObject, "RN"));
+                                inventoryDetailsQueryBeans.add(inventoryDetailsQueryBean);
                             }
                         }
 
-                        mStorageRechargeInspectionAdapter.notifyDataSetChanged();
-                        if (mStorageRechargeInspectionBeans.size() == 0) {
+                        inventoryDetailsQueryAdapter.notifyDataSetChanged();
+                        if (inventoryDetailsQueryBeans.size() == 0) {
                             mEmptyLayout.showEmpty();
                         }
                     } else {
-                        mStorageRechargeInspectionAdapter.notifyDataSetChanged();
-                        if (mStorageRechargeInspectionBeans.size() == 0) {
+                        inventoryDetailsQueryAdapter.notifyDataSetChanged();
+                        if (inventoryDetailsQueryBeans.size() == 0) {
                             mEmptyLayout.showEmpty();
                         }
                     }
                 } else {
-                    mStorageRechargeInspectionAdapter.notifyDataSetChanged();
-                    if (mStorageRechargeInspectionBeans.size() == 0) {
+                    inventoryDetailsQueryAdapter.notifyDataSetChanged();
+                    if (inventoryDetailsQueryBeans.size() == 0) {
                         mEmptyLayout.showEmpty();
                     }
                 }
             } else {
-                mStorageRechargeInspectionAdapter.notifyDataSetChanged();
-                if (mStorageRechargeInspectionBeans.size() == 0) {
+                inventoryDetailsQueryAdapter.notifyDataSetChanged();
+                if (inventoryDetailsQueryBeans.size() == 0) {
                     mEmptyLayout.showEmpty();
                 }
             }
         } catch (Exception e) {
-            mStorageRechargeInspectionAdapter.notifyDataSetChanged();
-            if (mStorageRechargeInspectionBeans.size() == 0) {
+            inventoryDetailsQueryAdapter.notifyDataSetChanged();
+            if (inventoryDetailsQueryBeans.size() == 0) {
                 mEmptyLayout.showEmpty();
             }
         }
@@ -250,10 +259,10 @@ public class InventoryDetailsQueryFragment extends BaseFragment implements HttpC
             mPullToRefreshListView.onRefreshComplete();
         }
         if (mPageIndex == 1) {
-            mStorageRechargeInspectionBeans.clear();
+            inventoryDetailsQueryBeans.clear();
             mEmptyLayout.setErrorMessage(failStr);
             mEmptyLayout.showError();
-            mStorageRechargeInspectionAdapter.notifyDataSetChanged();
+            inventoryDetailsQueryAdapter.notifyDataSetChanged();
         } else {
             mPageIndex--;
             CommonUtil.toastNoRepeat(mActivity, failStr);

+ 184 - 0
app/src/main/res/layout/itme_list_inventory_details_query.xml

@@ -0,0 +1,184 @@
+<?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">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="@color/white"
+        android:orientation="horizontal"
+        android:padding="4dp">
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="8dp"
+            android:layout_weight="4"
+            android:text="单据类型:"
+            android:textSize="14sp" />
+
+        <TextView
+            android:id="@+id/tv_pd_piclass"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="6"
+            android:textColor="@color/black"
+            android:textSize="14sp"
+            tools:text="2018-01-21" />
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="8dp"
+            android:layout_weight="4"
+            android:text="单据编号:"
+            android:textSize="14sp" />
+
+        <TextView
+            android:id="@+id/tv_pd_inoutno"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="6"
+            android:textColor="@color/black"
+            android:textSize="14sp"
+            tools:text="2018-01-21" />
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="@color/white"
+        android:orientation="horizontal"
+        android:padding="4dp">
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="8dp"
+            android:layout_weight="4"
+            android:text="物料编号:"
+            android:textSize="14sp" />
+
+        <TextView
+            android:id="@+id/tv_pd_prodcode"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="6"
+            android:textColor="@color/black"
+            android:textSize="14sp"
+            tools:text="2018-01-21" />
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="8dp"
+            android:layout_weight="4"
+            android:text="入库数量:"
+            android:textSize="14sp" />
+
+        <TextView
+            android:id="@+id/tv_pd_inqty"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="6"
+            android:textColor="@color/black"
+            android:textSize="14sp"
+            tools:text="2018-01-21" />
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="@color/white"
+        android:orientation="horizontal"
+        android:padding="4dp">
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="8dp"
+            android:layout_weight="1"
+            android:text="入库日期:"
+            android:textSize="14sp" />
+
+        <TextView
+            android:id="@+id/tv_pi_date"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="4"
+            android:textColor="@color/black"
+            android:textSize="14sp"
+            tools:text="" />
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="@color/white"
+        android:orientation="horizontal"
+        android:padding="4dp">
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="8dp"
+            android:layout_weight="1"
+            android:text="供应商:"
+            android:textSize="14sp" />
+
+        <TextView
+            android:id="@+id/tv_pi_title"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="4"
+            android:textColor="@color/black"
+            android:textSize="14sp"
+            tools:text="2018-01-21" />
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="@color/white"
+        android:orientation="horizontal"
+        android:padding="4dp">
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="8dp"
+            android:layout_weight="4"
+            android:text="物料名称:"
+            android:textSize="14sp" />
+
+        <TextView
+            android:id="@+id/tv_pr_detail"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="6"
+            android:textColor="@color/black"
+            android:textSize="14sp"
+            tools:text="2018-01-21" />
+
+        <TextView
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="8dp"
+            android:layout_weight="4"
+            android:text="物料规格:"
+            android:textSize="14sp" />
+
+        <TextView
+            android:id="@+id/tv_pr_spec"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="6"
+            android:textColor="@color/black"
+            android:textSize="14sp"
+            tools:text="2018-01-21" />
+    </LinearLayout>
+</LinearLayout>

+ 2 - 2
build.gradle

@@ -54,8 +54,8 @@ ext {
             targetSdkVersion : 28,
             compileSdkVersion: 28,
             buildToolsVersion: "28.0.3",
-            versionCode      : 31,
-            versionName      : "v2.2.9"
+            versionCode      : 32,
+            versionName      : "v2.3.0"
     ]
 
     depsVersion = [