Browse Source

新增领料详情界面

ChengJH 1 year ago
parent
commit
c97d7b0361

+ 71 - 0
app/src/main/java/com/uas/uas_mes_stw/bean/MakerecordBean.java

@@ -0,0 +1,71 @@
+package com.uas.uas_mes_stw.bean;
+
+/**
+ * Created by cjh-sail on 2024-08-26
+ */
+public class MakerecordBean {
+    private String PD_ID;
+    private String PR_SPEC;
+    private String PR_DETAIL;
+    private String PD_OUTQTY;
+    private String PD_PRODCODE;
+    private String MBR_DELETE;
+
+    public MakerecordBean(String PD_ID, String PR_SPEC, String PR_DETAIL, String PD_OUTQTY, String PD_PRODCODE, String MBR_DELETE) {
+        this.PD_ID = PD_ID;
+        this.PR_SPEC = PR_SPEC;
+        this.PR_DETAIL = PR_DETAIL;
+        this.PD_OUTQTY = PD_OUTQTY;
+        this.PD_PRODCODE = PD_PRODCODE;
+        this.MBR_DELETE = MBR_DELETE;
+    }
+    public MakerecordBean(){}
+
+    public String getPD_ID() {
+        return PD_ID;
+    }
+
+    public void setPD_ID(String PD_ID) {
+        this.PD_ID = PD_ID;
+    }
+
+    public String getPR_SPEC() {
+        return PR_SPEC;
+    }
+
+    public void setPR_SPEC(String PR_SPEC) {
+        this.PR_SPEC = PR_SPEC;
+    }
+
+    public String getPR_DETAIL() {
+        return PR_DETAIL;
+    }
+
+    public void setPR_DETAIL(String PR_DETAIL) {
+        this.PR_DETAIL = PR_DETAIL;
+    }
+
+    public String getPD_OUTQTY() {
+        return PD_OUTQTY;
+    }
+
+    public void setPD_OUTQTY(String PD_OUTQTY) {
+        this.PD_OUTQTY = PD_OUTQTY;
+    }
+
+    public String getPD_PRODCODE() {
+        return PD_PRODCODE;
+    }
+
+    public void setPD_PRODCODE(String PD_PRODCODE) {
+        this.PD_PRODCODE = PD_PRODCODE;
+    }
+
+    public String getMBR_DELETE() {
+        return MBR_DELETE;
+    }
+
+    public void setMBR_DELETE(String MBR_DELETE) {
+        this.MBR_DELETE = MBR_DELETE;
+    }
+}

+ 2 - 0
app/src/main/java/com/uas/uas_mes_stw/fragment/JltStorageInFilterListFragment.java

@@ -239,6 +239,8 @@ public class JltStorageInFilterListFragment extends BaseFragment implements OnCo
             }
         });
 
+
+
         mNumColumn.setOnColumnItemClickListener(this);
         mClassColumn.setOnColumnItemClickListener(this);
         mSupplierColumn.setOnColumnItemClickListener(this);

+ 0 - 1
app/src/main/java/com/uas/uas_mes_stw/fragment/LoginFragment.java

@@ -158,7 +158,6 @@ public class LoginFragment extends BaseFragment implements AdapterView.OnItemSel
 
     @Override
     protected void initViews() {
-        String name = "用来测试提到代码";
         pageType = VolleyUtil.FRAGMENT_LOGIN;
 
         //获取组件

+ 164 - 49
app/src/main/java/com/uas/uas_mes_stw/fragment/MateriaialequisitionApplictionDetailFragment.java

@@ -8,25 +8,36 @@ import android.graphics.Color;
 import android.graphics.drawable.BitmapDrawable;
 import android.os.Bundle;
 import android.support.v4.app.Fragment;
+import android.support.v4.content.ContextCompat;
 import android.support.v7.app.AlertDialog;
 import android.view.KeyEvent;
 import android.view.View;
+import android.view.WindowManager;
 import android.widget.Button;
-import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.PopupWindow;
 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.bin.david.form.core.SmartTable;
+import com.bin.david.form.core.TableConfig;
+import com.bin.david.form.data.CellInfo;
+import com.bin.david.form.data.column.Column;
+import com.bin.david.form.data.format.bg.BaseCellBackgroundFormat;
+import com.bin.david.form.data.style.FontStyle;
+import com.bin.david.form.data.table.TableData;
+import com.bin.david.form.listener.OnColumnItemClickListener;
 import com.uas.uas_mes_stw.R;
 import com.uas.uas_mes_stw.activity.FunctionActivity;
 import com.uas.uas_mes_stw.bean.Addbean;
 import com.uas.uas_mes_stw.bean.CloseListbean;
+import com.uas.uas_mes_stw.bean.MakerecordBean;
 import com.uas.uas_mes_stw.bean.StorageInBillBean;
 import com.uas.uas_mes_stw.global.GloableParams;
-import com.uas.uas_mes_stw.listener.MyEditorActionListener;
 import com.uas.uas_mes_stw.tools.SharedPreUtil;
 import com.uas.uas_mes_stw.util.CameraUtil;
 import com.uas.uas_mes_stw.util.CommonUtil;
@@ -35,13 +46,15 @@ import com.uas.uas_mes_stw.util.FragmentUtils;
 import com.uas.uas_mes_stw.util.HttpCallback;
 import com.uas.uas_mes_stw.util.HttpParams;
 import com.uas.uas_mes_stw.util.VollyRequest;
-import com.uas.uas_mes_stw.view.ClearableEditText;
 import com.uuzuche.lib_zxing.activity.CaptureActivity;
 import com.uuzuche.lib_zxing.activity.CodeUtils;
 
 import org.greenrobot.eventbus.EventBus;
 import org.greenrobot.eventbus.Subscribe;
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
 import java.util.Objects;
 
 /**
@@ -49,7 +62,7 @@ import java.util.Objects;
  * @describe 入库条码采集页面
  * @date 2018/6/20 16:20
  */
-public class MateriaialequisitionApplictionDetailFragment extends BaseFragment implements View.OnClickListener {
+public class MateriaialequisitionApplictionDetailFragment extends BaseFragment implements View.OnClickListener, OnColumnItemClickListener<String> {
     private static final int FLAG_SPLITE_PLATE = 25;
 
     private static final int SCAN_BARCODE_CODE = 121;
@@ -60,7 +73,6 @@ public class MateriaialequisitionApplictionDetailFragment extends BaseFragment i
 
     private String pi_id;
     private int mWhichPage;
-    private ClearableEditText storage_in_add_detail_barcode_et;
     private Button goodin_add_detail_commit_btn;
     private TextView storage_in_add_detail_result_tv;
     private LinearLayout line_gongvisbie;
@@ -75,10 +87,14 @@ public class MateriaialequisitionApplictionDetailFragment extends BaseFragment i
     private TextView tv_cangku;
     private String pi_whname;
     private Button mMoreBtn;
-    private ImageView storage_in_add_detail_scan_iv;
     private OnStorageInAddListener mOnStorageInAddListener;
     private String pi_class;
     private String pi_type;
+    private SmartTable mSmartTable;
+    private List<MakerecordBean> mFilterStorageInBeans;
+    private TableData<MakerecordBean> mTableData;
+    Column<String> va_classColumn,va_vendnameColumn,va_vendcodeColumn,va_inmancolumn,va_DELETEColumn;
+    private Button btn_select;
 
     @Override
     public void onDestroyView() {
@@ -99,15 +115,13 @@ public class MateriaialequisitionApplictionDetailFragment extends BaseFragment i
     }
     @Override
     protected int getLayout() {
-        return R.layout.goodbad_in_add_detail;
+        return R.layout.materiaialequisitionapplictiondetail_fragment;
     }
 
     @Override
     protected void initViews() {
         ((FunctionActivity) getActivity()).setMoreBtnVisible(true);
         ((FunctionActivity) getActivity()).setListIconIvVisible(false);
-        storage_in_add_detail_barcode_et = mActivity.findViewById(R.id.storage_in_add_detail_barcode_et);
-        storage_in_add_detail_scan_iv = mActivity.findViewById(R.id.storage_in_add_detail_scan_iv);
         goodin_add_detail_commit_btn = mActivity.findViewById(R.id.goodin_add_detail_commit_btn);
         storage_in_add_detail_result_tv = mActivity.findViewById(R.id.storage_in_add_detail_result_tv);
         tv_inoutno = mActivity.findViewById(R.id.tv_inoutno);
@@ -119,7 +133,8 @@ public class MateriaialequisitionApplictionDetailFragment extends BaseFragment i
         tv_qty = mActivity.findViewById(R.id.tv_qty);
         tv_accumulativetotal = mActivity.findViewById(R.id.tv_accumulativetotal);
         mMoreBtn = (Button)mActivity.findViewById(R.id.btn_actionbar_more);
-        storage_in_add_detail_barcode_et.requestFocus();
+        mSmartTable = mActivity.findViewById(R.id.addgrant);
+        btn_select = mActivity.findViewById(R.id.btn_select);
         Bundle arguments = getArguments();
         if (arguments != null) {
             pi_inoutno = arguments.getString("pi_inoutno");
@@ -140,29 +155,68 @@ public class MateriaialequisitionApplictionDetailFragment extends BaseFragment i
 
     @Override
     protected void initEvents() {
+        mFilterStorageInBeans = Collections.synchronizedList(new ArrayList<>());
+        WindowManager wm = mActivity.getWindowManager();
+        int screenWith = wm.getDefaultDisplay().getWidth();
+        mSmartTable.getConfig().setMinTableWidth(screenWith)
+                .setShowXSequence(false)
+                .setShowYSequence(false)
+                .setShowTableTitle(false)
+                .setFixedTitle(true)
+                .setVerticalPadding(CommonUtil.dip2px(mActivity, 12))
+                .setColumnTitleVerticalPadding(CommonUtil.dip2px(mActivity, 12))
+                .setHorizontalPadding(CommonUtil.dip2px(mActivity, 10))
+                .setSequenceHorizontalPadding(CommonUtil.dip2px(mActivity, 10))
+                .setColumnTitleHorizontalPadding(CommonUtil.dip2px(mActivity, 10))
+                .setColumnTitleStyle(new FontStyle(CommonUtil.sp2px(mActivity, 15), Color.parseColor("#000000")))
+                .setContentCellBackgroundFormat(new BaseCellBackgroundFormat<CellInfo>() {
+                    @Override
+                    public int getBackGroundColor(CellInfo cellInfo) {
+                        if (cellInfo.row % 2 == 0) {
+                            return ContextCompat.getColor(mActivity, R.color.blue_50);
+                        }
+                        return TableConfig.INVALID_COLOR;
+                    }
+                });
+
+
+
+        va_vendnameColumn = new Column<String>("物料编号", "PD_PRODCODE");
+        va_vendnameColumn.setFixed(true);
+        va_vendcodeColumn = new Column<String>("名称", "PR_DETAIL");
+        va_classColumn = new Column<String>("数量", "PD_OUTQTY");
+        va_inmancolumn = new Column<String>("规格", "PR_SPEC");
+        va_DELETEColumn = new Column<String>("操作", "MBR_DELETE");
+
+
+
+
+
+
+
+
         mMoreBtn.setOnClickListener(this);
-        storage_in_add_detail_scan_iv.setOnClickListener(this);
         goodin_add_detail_commit_btn.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
                 getNewProdinout();
             }
         });
-
-        CommonUtil.setEditorActionListener(storage_in_add_detail_barcode_et, new MyEditorActionListener() {
+        btn_select.setOnClickListener(new View.OnClickListener() {
             @Override
-            public void MyEditorAction(String text, int actionId, KeyEvent event) {
-                getBarcodeInfo(text);
+            public void onClick(View v) {
+                getWllist();
             }
         });
+
         getProdiodetail();
     }
     private void getProdiodetail() {
         progressDialog.show();
         VollyRequest.getInstance().stringRequest(mStringRequest,
                 new HttpParams.Builder()
-                        .url(GloableParams.ADDRESS_PDAIO_IN_GETBARCODEINFO)
-                        .method(Request.Method.GET)
+                        .url(GloableParams.ADDRESS_COMMON_GETPRODIODETAIL)
+                        .method(Request.Method.POST)
                         .tag(TAG + "getMaCode")
                         .flag(0)
                         .addParam("piid", pi_id)//必填单据类型
@@ -171,28 +225,30 @@ public class MateriaialequisitionApplictionDetailFragment extends BaseFragment i
                     @Override
                     public void onSuccess(int flag, Object o) throws Exception {
                         progressDialog.dismiss();
-                        Boolean isSuccess = FastjsonUtil.getBoolean(o.toString(),"success");
-                        if (isSuccess){
-                            JSONObject dataObject = FastjsonUtil.getJSONObject(o.toString(),"data");
-                            if (dataObject == null){
-
-                            }else {
-                                String bi_barcode = dataObject.getString("BI_BARCODE") == null ? "" : dataObject.getString("BI_BARCODE");
-                                String bi_prodcode = dataObject.getString("bi_prodcode") == null ? "" : dataObject.getString("bi_prodcode");
-                                String pr_detail = dataObject.getString("PR_DETAIL") == null ? "" : dataObject.getString("PR_DETAIL");
-                                String pr_spec = dataObject.getString("PR_SPEC") == null ? "" : dataObject.getString("PR_SPEC");
-                                String bi_ordercode = dataObject.getString("BI_ORDERCODE") == null ? "" : dataObject.getString("BI_ORDERCODE");
-                                String bi_inqty = dataObject.getString("BI_INQTY") == null ? "" : dataObject.getString("BI_INQTY");
-                                String sumqty = dataObject.getString("SUMQTY") == null ? "" : dataObject.getString("SUMQTY");
-                                tv_batchnumber.setText(bi_barcode);
-                                tv_objectid.setText(bi_prodcode+" "+pr_detail+" "+pr_spec);
-                                tv_workorder.setText(bi_ordercode);
-                                tv_qty.setText(bi_inqty);
-                                tv_accumulativetotal.setText(sumqty);
-                                storage_in_add_detail_barcode_et.setText("");
-                                storage_in_add_detail_barcode_et.requestFocus();
+                        mFilterStorageInBeans.clear();
+                        String result = o.toString();
+                        JSONObject resultObject = JSON.parseObject(result);
+                        JSONArray dataArray = resultObject.getJSONArray("data");
+                        List<MakerecordBean> list=new ArrayList<>();
+                        list.clear();
+                        if (dataArray != null && dataArray.size() > 0) {
+                            for (int i = 0; i < dataArray.size(); i++) {
+                                JSONObject dataObject = dataArray.getJSONObject(i);
+                                if (dataObject != null) {
+                                    MakerecordBean jltStorageInBean = new MakerecordBean();
+                                    jltStorageInBean.setPD_ID(FastjsonUtil.getText(dataObject, "PD_ID"));
+                                    jltStorageInBean.setPD_OUTQTY(FastjsonUtil.getText(dataObject, "PD_OUTQTY"));
+                                    jltStorageInBean.setPD_PRODCODE(FastjsonUtil.getText(dataObject, "PD_PRODCODE"));
+                                    jltStorageInBean.setPR_DETAIL(FastjsonUtil.getText(dataObject, "PR_DETAIL"));
+                                    jltStorageInBean.setPR_SPEC(FastjsonUtil.getText(dataObject, "PR_SPEC"));
+                                    jltStorageInBean.setMBR_DELETE("删除");
+                                    list.add(jltStorageInBean);
+                                }
                             }
                         }
+
+                        mFilterStorageInBeans = list;//PI_INOUTNO
+                        setFilterTableData(mFilterStorageInBeans);
                     }
                     @SuppressLint("SetTextI18n")
                     @Override
@@ -201,16 +257,55 @@ public class MateriaialequisitionApplictionDetailFragment extends BaseFragment i
                         storage_in_add_detail_result_tv.setVisibility(View.VISIBLE);
                         line_gongvisbie.setVisibility(View.VISIBLE);
                         storage_in_add_detail_result_tv.setTextColor(Color.RED);
-                        storage_in_add_detail_result_tv.setText("采集失败!"
-                                +"\n生产批号:"+storage_in_add_detail_barcode_et.getText().toString().trim()
-                                +"\n失败原因"+failStr);
+                        storage_in_add_detail_result_tv.setText(failStr);
 //                        CommonUtil.toastNoRepeat(mActivity, failStr);
                         line_gongvisbie.setVisibility(View.GONE);
-                        storage_in_add_detail_barcode_et.setText("");
-                        storage_in_add_detail_barcode_et.requestFocus();
+                        setFilterTableData(mFilterStorageInBeans);
                     }
                 });
     }
+    private void getWllist() {
+        progressDialog.show();
+        VollyRequest.getInstance().stringRequest(mStringRequest,
+                new HttpParams.Builder()
+                        .url(GloableParams.ADDRESS_COMMON_GETWLLIST)
+                        .method(Request.Method.POST)
+                        .tag(TAG + "getMaCode")
+                        .flag(0)
+                        .addParam("whcode", pi_whcode)//必填仓库编号
+                        .build(), new HttpCallback() {
+                    @SuppressLint("SetTextI18n")
+                    @Override
+                    public void onSuccess(int flag, Object o) throws Exception {
+                        progressDialog.dismiss();
+                        //跳转到修改界面
+//                        MaterialSelection materialSelection=new MaterialSelection();
+//                        Bundle bundle = new Bundle();
+//                        bundle.putString("obkectdata", o.toString());
+//                        materialSelection.setArguments(bundle);
+//                        FragmentUtils.switchFragment(MateriaialequisitionApplictionDetailFragment.this, materialSelection);
+
+                    }
+                    @SuppressLint("SetTextI18n")
+                    @Override
+                    public void onFail(int flag, String failStr) throws Exception {
+                        progressDialog.dismiss();
+                    }
+                });
+    }
+    private void setFilterTableData(List<MakerecordBean> filterTableData) {
+        mTableData = new TableData<MakerecordBean>("收料单列表", filterTableData,
+                va_vendnameColumn,va_vendcodeColumn,va_inmancolumn,va_classColumn,va_DELETEColumn);
+        mSmartTable.setTableData(mTableData);
+//        mSmartTable.requestLayout();
+        mSmartTable.postDelayed(new Runnable() {
+            @Override
+            public void run() {
+                mSmartTable.postInvalidate();
+            }
+        }, 100);
+
+    }
     private void getBarcodeInfo(String text) {
         progressDialog.show();
         VollyRequest.getInstance().stringRequest(mStringRequest,
@@ -248,8 +343,6 @@ public class MateriaialequisitionApplictionDetailFragment extends BaseFragment i
                                 tv_workorder.setText(bi_ordercode);
                                 tv_qty.setText(bi_inqty);
                                 tv_accumulativetotal.setText(sumqty);
-                                storage_in_add_detail_barcode_et.setText("");
-                                storage_in_add_detail_barcode_et.requestFocus();
                             }
                         }
                     }
@@ -260,13 +353,9 @@ public class MateriaialequisitionApplictionDetailFragment extends BaseFragment i
                         storage_in_add_detail_result_tv.setVisibility(View.VISIBLE);
                         line_gongvisbie.setVisibility(View.VISIBLE);
                         storage_in_add_detail_result_tv.setTextColor(Color.RED);
-                        storage_in_add_detail_result_tv.setText("采集失败!"
-                                +"\n生产批号:"+storage_in_add_detail_barcode_et.getText().toString().trim()
-                                +"\n失败原因"+failStr);
+                        storage_in_add_detail_result_tv.setText(failStr);
 //                        CommonUtil.toastNoRepeat(mActivity, failStr);
                         line_gongvisbie.setVisibility(View.GONE);
-                        storage_in_add_detail_barcode_et.setText("");
-                        storage_in_add_detail_barcode_et.requestFocus();
                     }
                 });
     }
@@ -563,7 +652,27 @@ public class MateriaialequisitionApplictionDetailFragment extends BaseFragment i
         }
     }
 
+    public void geDeleteData(String mbr_id){
+        VollyRequest.getInstance().stringRequest(new HttpParams.Builder()
+                .url(GloableParams.ADDRESS_COMMON_DELETEPRODIODETAIL)
+                .method(Request.Method.POST)
+                .addParam("pdid", mbr_id)
+                .build(), new HttpCallback() {
+            @Override
+            public void onSuccess(int flag, Object o) throws Exception {
+                progressDialog.dismiss();
+                CommonUtil.toastYESRepeat(mActivity, "删除成功");
+                getProdiodetail();
+            }
+
+            @Override
+            public void onFail(int flag, String failStr) throws Exception {
+                progressDialog.dismiss();
+                CommonUtil.toastNoRepeat(mActivity, failStr);
 
+            }
+        });
+    }
 
     @Override
     public void onHiddenChanged(boolean hidden) {
@@ -596,6 +705,12 @@ public class MateriaialequisitionApplictionDetailFragment extends BaseFragment i
 //        }
     }
 
+    @Override
+    public void onClick(Column<String> column, String value, String s, int position) {
+        String dc_id = mFilterStorageInBeans.get(position).getPD_ID();
+        geDeleteData(dc_id);
+    }
+
     public interface OnStorageInAddListener {
         void onStorageInAdd();
     }

+ 6 - 8
app/src/main/java/com/uas/uas_mes_stw/fragment/MaterialRequisitionApplicationFragment.java

@@ -6,7 +6,6 @@ import android.content.Intent;
 import android.graphics.drawable.BitmapDrawable;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
-import android.support.v4.app.Fragment;
 import android.support.v7.widget.DividerItemDecoration;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
@@ -184,7 +183,7 @@ public class MaterialRequisitionApplicationFragment extends BaseFragment impleme
         mListImageView.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
-                GoodBadAddListFragment storageInAddListFragment = new GoodBadAddListFragment();
+                MaterialRequisitionListFragment storageInAddListFragment = new MaterialRequisitionListFragment();
                 Bundle bundle = new Bundle();
                 bundle.putString("pi_class", "其它出库单");
                 bundle.putInt("whichPage", StorageInAddListFragment.PAGE_STORAGE_ADD);
@@ -355,6 +354,7 @@ public class MaterialRequisitionApplicationFragment extends BaseFragment impleme
             rv_line_ip_port_data.setAdapter(ipAndResourcesPortAdapter);;
         }
 
+
     }
 
     private void initresourcesPopupWindow() {
@@ -636,12 +636,10 @@ public class MaterialRequisitionApplicationFragment extends BaseFragment impleme
         progressDialog.show();
         VollyRequest.getInstance().stringRequest(mStringRequest,
                 new HttpParams.Builder()
-//                        .url(GloableParams.ADDRESS_OUTMATERIAL_NEWPRODINOUT)
-                        .url(GloableParams.ADDRESS_PICKING_CONFIRM)
+                        .url(GloableParams.ADDRESS_COMMON_NEWPRODOUT)
                         .method(Request.Method.POST)
                         .tag(TAG + "getMaCode")
                         .flag(0)
-//                        .addParam("pi_class", "其他出库单")//必填单据类型
                         .addParam("pi_type", maFunName)//必填单据类型
                         .addParam("pi_whcode",sc_code)//必填 仓库
                         .build(), new HttpCallback() {
@@ -661,6 +659,7 @@ public class MaterialRequisitionApplicationFragment extends BaseFragment impleme
                                 String pi_whcode = dataObject.getString("PI_WHCODE") == null ? "" : dataObject.getString("PI_WHCODE");
                                 String pi_whname = dataObject.getString("PI_WHNAME") == null ? "" : dataObject.getString("PI_WHNAME");
                                 jumpToStorageInAddDetail(pi_id,pi_inoutno,pi_whcode,pi_whname);
+
                             }
                         }
                     }
@@ -674,9 +673,7 @@ public class MaterialRequisitionApplicationFragment extends BaseFragment impleme
 
     }
     private void jumpToStorageInAddDetail(String pi_id, String pi_inoutno, String pi_whcode,String pi_whname) {
-//        MateriaialequisitionApplictionDetailFragment mFragment = new MateriaialequisitionApplictionDetailFragment();
-
-        Fragment mFragment = new MaterialSelection();
+        MateriaialequisitionApplictionDetailFragment mFragment = new MateriaialequisitionApplictionDetailFragment();
         Bundle bundle = new Bundle();
         bundle.putString("pi_class", "其它出库单");
         bundle.putString("pi_id", pi_id);
@@ -685,6 +682,7 @@ public class MaterialRequisitionApplicationFragment extends BaseFragment impleme
         bundle.putString("pi_whname", pi_whname);
 
         mFragment.setArguments(bundle);
+
         FragmentUtils.switchFragment(MaterialRequisitionApplicationFragment.this, mFragment);
     }
 

+ 625 - 0
app/src/main/java/com/uas/uas_mes_stw/fragment/MaterialRequisitionListFragment.java

@@ -0,0 +1,625 @@
+package com.uas.uas_mes_stw.fragment;
+
+import android.app.Dialog;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.support.v7.app.AlertDialog;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+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.uas_mes_stw.R;
+import com.uas.uas_mes_stw.activity.FunctionActivity;
+import com.uas.uas_mes_stw.adapter.StorageInAddAdapter;
+import com.uas.uas_mes_stw.application.PdaApplication;
+import com.uas.uas_mes_stw.bean.Addbean;
+import com.uas.uas_mes_stw.bean.CloseListbean;
+import com.uas.uas_mes_stw.bean.StorageInBillBean;
+import com.uas.uas_mes_stw.global.GloableParams;
+import com.uas.uas_mes_stw.listener.MyEditorActionListener;
+import com.uas.uas_mes_stw.tools.SharedPreUtil;
+import com.uas.uas_mes_stw.util.CommonUtil;
+import com.uas.uas_mes_stw.util.Constants;
+import com.uas.uas_mes_stw.util.FastjsonUtil;
+import com.uas.uas_mes_stw.util.FragmentUtils;
+import com.uas.uas_mes_stw.util.HttpCallback;
+import com.uas.uas_mes_stw.util.HttpParams;
+import com.uas.uas_mes_stw.util.LogUtil;
+import com.uas.uas_mes_stw.util.VolleyRequest;
+import com.uas.uas_mes_stw.util.VollyRequest;
+import com.uas.uas_mes_stw.view.ClearableEditText;
+import com.uas.uas_mes_stw.view.EmptyLayout;
+
+import org.greenrobot.eventbus.EventBus;
+
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author RaoMeng
+ * @describe 入库管理列表页面
+ * @date 2018/6/20 16:20
+ */
+public class MaterialRequisitionListFragment extends BaseFragment implements HttpCallback {
+    public static final int PAGE_STORAGE_ADD = 401;
+    public static final int PAGE_STORAGE_DETAIL = 402;
+    public static final int PAGE_STORAGE_FUNACTION = 405;
+    public static final int PAGE_OUT_DETAIL = 403;
+    public static final int PAGE_OUT_HISTORY = 404;
+
+    private final int FLAG_REQUEST_STORAGE_LIST = 301;
+    private final int FLAG_PRODIO_DELETE = 302;
+
+    private LinearLayout mSearchLl;
+    private ClearableEditText mSearchEt;
+    private TextView mSearchBtn;
+    private PullToRefreshListView mRefreshListView;
+    private List<StorageInBillBean> mStorageInBillBeans;
+    private StorageInAddAdapter mStorageInAddAdapter;
+    private EmptyLayout mEmptyLayout;
+    private int mPageIndex = 1, mPageSize = 20;
+    private StringRequest mStringRequest;
+    private String mKeyword = "";
+    private int mSelectionPosition, mWhichPage;
+    private OnListSelectListener mOnListSelectListener;
+    private ImageView mFilterImageView;
+    private Dialog mModeDialog;
+    private CheckBox mMode1CheckBox, mMode2CheckBox, mMode3CheckBox;
+    private Button mAddButton;
+    private String piclass;
+    private String pi_type;
+
+    public void setOnListSelectListener(OnListSelectListener onListSelectListener) {
+        mOnListSelectListener = onListSelectListener;
+    }
+
+    @Override
+    protected int getLayout() {
+        return R.layout.fragment_storage_in_add_list;
+    }
+
+    @Override
+    protected void initViews() {
+        ((FunctionActivity) getActivity()).setScanIvVisible(true);
+        pi_type = SharedPreUtil.getString(mActivity, "pi_type", null);
+        Bundle arguments = getArguments();
+        if (arguments != null) {
+            mWhichPage = arguments.getInt("whichPage");
+            piclass = arguments.getString("pi_class");
+        }
+        if (mWhichPage == PAGE_STORAGE_FUNACTION
+                || mWhichPage == PAGE_STORAGE_ADD
+                || mWhichPage == PAGE_STORAGE_DETAIL) {
+            FunctionActivity.setTitle("入库单列表");//("+pi_type+")
+        } else if (mWhichPage == PAGE_OUT_DETAIL) {
+            FunctionActivity.setTitle("出库单列表");
+        } else if (mWhichPage == PAGE_OUT_HISTORY) {
+            FunctionActivity.setTitle("备货历史");
+        }
+
+        mFilterImageView = (ImageView) getActivity().findViewById(R.id.btn_actionbar_scan_iv);
+        mFilterImageView.setBackgroundResource(R.drawable.ic_advanced_filter);
+
+        View modeView = View.inflate(mActivity, R.layout.pop_storage_list_mode, null);
+        mMode1CheckBox = modeView.findViewById(R.id.storage_list_mode1);
+        mMode2CheckBox = modeView.findViewById(R.id.storage_list_mode2);
+        mMode3CheckBox = modeView.findViewById(R.id.storage_list_mode3);
+        initFilterCheck();
+
+        mModeDialog = new AlertDialog.Builder(mActivity).setView(modeView)
+                .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
+                    @Override
+                    public void onClick(DialogInterface dialog, int which) {
+                        initFilterCheck();
+                    }
+                })
+                .setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
+                    @Override
+                    public void onClick(DialogInterface dialogInterface, int i) {
+                        PdaApplication.putDataCache2Map("storageListMode1", mMode1CheckBox.isChecked());
+                        PdaApplication.putDataCache2Map("storageListMode2", mMode2CheckBox.isChecked());
+                        PdaApplication.putDataCache2Map("storageListMode3", mMode3CheckBox.isChecked());
+                        initEditHint();
+
+                        progressDialog.show();
+                        mKeyword = mSearchEt.getText().toString().trim();
+                        mPageIndex = 1;
+                        requestStorageList();
+                    }
+                }).create();
+
+        mSearchLl = root.findViewById(R.id.storage_in_add_list_search_ll);
+        mSearchEt = root.findViewById(R.id.storage_in_add_list_search_cet);
+        mSearchEt.requestFocus();
+        initEditHint();
+        mAddButton = root.findViewById(R.id.storage_in_add_list_add_btn);
+        mSearchBtn = root.findViewById(R.id.storage_in_add_list_search_tv);
+        mRefreshListView = root.findViewById(R.id.storage_in_add_list_lv);
+        mRefreshListView.setMode(PullToRefreshBase.Mode.BOTH);
+        mEmptyLayout = new EmptyLayout(mActivity, mRefreshListView.getRefreshableView());
+        mEmptyLayout.setShowLoadingButton(false);
+        mEmptyLayout.setShowEmptyButton(false);
+        mEmptyLayout.setShowErrorButton(false);
+        mEmptyLayout.setEmptyMessage("数据为空");
+
+        mStorageInBillBeans = new ArrayList<>();
+        mStorageInAddAdapter = new StorageInAddAdapter(mActivity, mStorageInBillBeans);
+        mRefreshListView.setAdapter(mStorageInAddAdapter);
+    }
+
+    private void initFilterCheck() {
+        Object storageListMode1 = PdaApplication.getDataCacheFromMap("storageListMode1");
+        Object storageListMode2 = PdaApplication.getDataCacheFromMap("storageListMode2");
+        Object storageListMode3 = PdaApplication.getDataCacheFromMap("storageListMode3");
+        if (storageListMode1 == null) {
+            mMode1CheckBox.setChecked(false);
+        } else {
+            mMode1CheckBox.setChecked((Boolean) storageListMode1);
+        }
+        if (storageListMode2 == null) {
+            mMode2CheckBox.setChecked(false);
+        } else {
+            mMode2CheckBox.setChecked((Boolean) storageListMode2);
+        }
+        /*if (storageListMode3 == null) {
+            mMode3CheckBox.setChecked(false);
+        } else {
+            mMode3CheckBox.setChecked((Boolean) storageListMode3);
+        }*/
+        if (mWhichPage == PAGE_STORAGE_FUNACTION
+                || mWhichPage == PAGE_STORAGE_ADD
+                || mWhichPage == PAGE_STORAGE_DETAIL) {
+            mMode3CheckBox.setChecked(false);
+            mMode3CheckBox.setVisibility(View.GONE);
+        } else {
+            mMode3CheckBox.setChecked(true);
+        }
+    }
+
+    private void initEditHint() {
+        String searchHint = "";
+        if ((mMode1CheckBox.isChecked())) {
+            searchHint += "当前登录人/";
+        }
+        if ((mMode2CheckBox.isChecked())) {
+            searchHint += "仓库管理员/";
+        }
+        if ((mMode3CheckBox.isChecked())) {
+            searchHint += "备货员为当前登录人/";
+        }
+
+        if (TextUtils.isEmpty(searchHint)) {
+            searchHint = "请输入搜索条件";
+        } else {
+            searchHint = searchHint.substring(0, searchHint.length() - 1);
+            searchHint = "按" + searchHint + "搜索";
+        }
+
+        mSearchEt.setHint(searchHint);
+
+        /*if (mMode1CheckBox.isChecked()) {
+            if (mMode2CheckBox.isChecked()) {
+                mSearchEt.setHint("按当前登录人员以及仓库管理员搜索");
+            } else {
+                mSearchEt.setHint("按当前登录人员搜索");
+            }
+        } else if (mMode2CheckBox.isChecked()) {
+            mSearchEt.setHint("按仓库管理员搜索");
+        } else {
+            mSearchEt.setHint("请输入搜索条件");
+        }*/
+    }
+
+    @Override
+    protected void initEvents() {
+        mRefreshListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() {
+            @Override
+            public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) {
+                mPageIndex = 1;
+                requestStorageList();
+            }
+
+            @Override
+            public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) {
+                mPageIndex++;
+                requestStorageList();
+            }
+        });
+
+        CommonUtil.setEditorActionListener(mSearchEt, new MyEditorActionListener() {
+            @Override
+            public void MyEditorAction(String text, int actionId, KeyEvent event) {
+                progressDialog.show();
+                mKeyword = text;
+                mPageIndex = 1;
+                requestStorageList();
+            }
+        });
+
+        mSearchBtn.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                progressDialog.show();
+                mKeyword = mSearchEt.getText().toString().trim();
+                mPageIndex = 1;
+                requestStorageList();
+            }
+        });
+
+        mRefreshListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+            @Override
+            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
+                int realPosition = (int) adapterView.getItemIdAtPosition(i);
+                StorageInBillBean storageInBillBean = mStorageInBillBeans.get(realPosition);
+                String pi_class = storageInBillBean.getPI_CLASS();
+                Log.e("pi_class",pi_class);
+                if (mWhichPage == PAGE_STORAGE_FUNACTION) {
+                    getActivity().getSupportFragmentManager().popBackStack();
+                    Fragment mFragment = new StorageInAddDetailFragment();
+                    Bundle bundle = new Bundle();
+                    bundle.putString("pi_class", storageInBillBean.getPI_CLASS());
+                    bundle.putString("pi_whcode", storageInBillBean.getPI_WHCODE());
+                    bundle.putString("pi_cardcode", storageInBillBean.getPI_CARDCODE());
+                    bundle.putLong("pi_id", storageInBillBean.getPI_ID());
+                    bundle.putString("pi_inoutno", storageInBillBean.getPI_INOUTNO());
+                    mFragment.setArguments(bundle);
+                    FragmentUtils.switchFragment(MaterialRequisitionListFragment.this, mFragment);
+                } else if (mWhichPage == PAGE_STORAGE_ADD) {
+//                    if (mOnListSelectListener != null) {
+                    EventBus.getDefault().post(new CloseListbean("关闭入库采集页面"));
+                    Fragment fragment = new GoodOrBadAddDetailFragment();
+                    Bundle bundle = new Bundle();
+                    bundle.putString("pi_class", storageInBillBean.getPI_CLASS());
+                    bundle.putString("pi_whcode", storageInBillBean.getPI_WHCODE());
+                    bundle.putString("pi_cardcode", storageInBillBean.getPI_CARDCODE());
+                    bundle.putString("pi_id", storageInBillBean.getPI_ID()+"");
+                    bundle.putString("pi_inoutno", storageInBillBean.getPI_INOUTNO());
+                    bundle.putString("pi_status", storageInBillBean.getPI_STATUS());
+                    bundle.putString("pi_invostatus", storageInBillBean.getPI_INVOSTATUS());
+                    bundle.putString("pi_whname", storageInBillBean.getPI_WHNAME());
+                    fragment.setArguments(bundle);
+                    FragmentUtils.switchFragment(MaterialRequisitionListFragment.this, fragment);
+//                        mOnListSelectListener.onListSelect(storageInBillBean);
+
+//                    }
+//                    Fragment mFragment = new StorageInAddDetailFragment();
+//                    Bundle bundle = new Bundle();
+//                    bundle.putString("pi_class", storageInBillBean.getPI_CLASS());
+//                    bundle.putString("pi_whcode", storageInBillBean.getPI_WHCODE());
+//                    bundle.putString("pi_cardcode", storageInBillBean.getPI_CARDCODE());
+//                    bundle.putLong("pi_id", storageInBillBean.getPI_ID());
+//                    bundle.putString("pi_inoutno", storageInBillBean.getPI_INOUTNO());
+//                    mFragment.setArguments(bundle);
+//                    getActivity().getSupportFragmentManager().popBackStack();
+//                    FragmentUtils.switchFragment(StorageInAddListFragment.this, mFragment);
+                } else if (mWhichPage == PAGE_STORAGE_DETAIL) {
+                    if (mOnListSelectListener != null) {
+                        mOnListSelectListener.onListSelect(storageInBillBean);
+                        getActivity().getSupportFragmentManager().popBackStack();
+                    }
+                } else if (mWhichPage == PAGE_OUT_DETAIL) {
+                    if (mOnListSelectListener != null) {
+                        getActivity().getSupportFragmentManager().popBackStack();
+                        mOnListSelectListener.onListSelect(storageInBillBean);
+                    }
+                } else if (mWhichPage == PAGE_OUT_HISTORY) {
+                    return;
+                }
+            }
+        });
+
+        mRefreshListView.getRefreshableView().setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
+            @Override
+            public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {
+                mSelectionPosition = (int) adapterView.getItemIdAtPosition(i);
+                String message = "";
+                if (mWhichPage == PAGE_STORAGE_FUNACTION
+                        || mWhichPage == PAGE_STORAGE_ADD
+                        || mWhichPage == PAGE_STORAGE_DETAIL) {
+                    message = "确定删除该条入库单?";
+                    new AlertDialog.Builder(mActivity)
+                            .setMessage(message)
+                            .setNegativeButton(R.string.cancel, null)
+                            .setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
+                                @Override
+                                public void onClick(DialogInterface dialogInterface, int i) {
+                                    dialogInterface.dismiss();
+                                    progressDialog.show();
+                                    deleteBill();
+                                }
+                            }).create().show();
+                    return true;
+                } else {
+                    return false;
+                }
+            }
+        });
+
+        mFilterImageView.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                if (mModeDialog != null) {
+                    mModeDialog.show();
+                }
+            }
+        });
+
+        if (mModeDialog != null) {
+            mModeDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
+                @Override
+                public void onDismiss(DialogInterface dialog) {
+                    initFilterCheck();
+                }
+            });
+        }
+
+        mAddButton.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                EventBus.getDefault().post(new Addbean("关闭页面"));
+                GoodOrBadFragment mFragment = new GoodOrBadFragment();
+                Bundle bundle = new Bundle();
+                bundle.putString("pi_class",piclass);
+                mFragment.setArguments(bundle);
+                FragmentUtils.switchFragment(MaterialRequisitionListFragment.this, mFragment);
+            }
+        });
+    }
+
+    private void jumpToStorageInAddDetail(String pi_class, String pi_whcode, String pi_cardcode, String pi_id, String pi_inoutno, String pi_status, String pi_invostatus, int whichPage) {
+        StorageInAddDetailFragment mFragment = new StorageInAddDetailFragment();
+        Bundle bundle = new Bundle();
+        bundle.putString("pi_class", pi_class);
+        bundle.putString("pi_whcode", pi_whcode);
+        bundle.putString("pi_cardcode", pi_cardcode);
+        bundle.putString("pi_id", pi_id);
+        bundle.putString("pi_inoutno", pi_inoutno);
+        bundle.putString("pi_status", pi_status);
+        bundle.putString("pi_invostatus", pi_invostatus);
+        bundle.putInt("whichPage", whichPage);
+        mFragment.setArguments(bundle);
+
+        FragmentUtils.switchFragment(MaterialRequisitionListFragment.this, mFragment);
+    }
+
+    private void deleteBill() {
+        VolleyRequest.getInstance().stringRequest(mStringRequest,
+                new HttpParams.Builder()
+                        .url(GloableParams.ADDRESS_PDAIO_IN_DELETEINOUTANDDETAIL)
+                        .flag(FLAG_PRODIO_DELETE)
+                        .tag(TAG + "deleteinoutanddetail")
+                        .method(Request.Method.POST)
+                        .addParam("piid", mStorageInBillBeans.get(mSelectionPosition).getPI_ID() + "")
+                        .build(), MaterialRequisitionListFragment.this);
+    }
+
+    @Override
+    public void onHiddenChanged(boolean hidden) {
+        super.onHiddenChanged(hidden);
+        if (hidden) {
+            ((FunctionActivity) getActivity()).setScanIvVisible(false);
+            ((FunctionActivity) getActivity()).setMoreBtnVisible(false);
+            ((FunctionActivity) getActivity()).setListIconIvVisible(false);
+        } else {
+            ((FunctionActivity) getActivity()).setScanIvVisible(true);
+            ((FunctionActivity) getActivity()).setMoreBtnVisible(false);
+            ((FunctionActivity) getActivity()).setListIconIvVisible(false);
+            mFilterImageView = (ImageView) getActivity().findViewById(R.id.btn_actionbar_scan_iv);
+            mFilterImageView.setBackgroundResource(R.drawable.ic_advanced_filter);
+            if (mWhichPage == PAGE_STORAGE_FUNACTION
+                    || mWhichPage == PAGE_STORAGE_ADD
+                    || mWhichPage == PAGE_STORAGE_DETAIL) {
+                FunctionActivity.setTitle("入库单列表");//("+pi_type+")
+            } else if (mWhichPage == PAGE_OUT_DETAIL) {
+                FunctionActivity.setTitle("出库单列表");
+            } else if (mWhichPage == PAGE_OUT_HISTORY) {
+                FunctionActivity.setTitle("备货历史");
+            }
+            progressDialog.show();
+            mKeyword = mSearchEt.getText().toString().trim();
+            mPageIndex = 1;
+            requestStorageList();
+        }
+    }
+
+    @Override
+    protected void initDatas() {
+        progressDialog.show();
+
+
+        requestStorageList();
+    }
+
+    private void requestStorageList() {
+        try {
+            if (pi_type.equals("良品")){
+                pi_type="";
+            }
+            String emname = SharedPreUtil.getString(mActivity, Constants.FLAG.CACHE_USER_EMNAME, "");
+            String terms = "";
+
+            if (mMode1CheckBox.isChecked()) {
+                terms += "and pi_recordman=\'" + emname + "\' ";
+            }
+            if (mMode2CheckBox.isChecked()) {
+                terms += "and pi_cgy=\'" + emname + "\' ";
+            }
+            if (mMode3CheckBox.isChecked()) {
+                terms += "and pi_stockname_user=\'" + emname + "\' ";
+            }
+
+
+            if (mMode1CheckBox.isChecked()) {
+                if (mMode2CheckBox.isChecked()) {
+                    terms = "and pi_recordman=\'" + emname + "\' and " + "pi_cgy=\'" + emname + "\'";
+                } else {
+                    mSearchEt.setHint("按当前登录人员搜索");
+                    terms = "and pi_recordman=\'" + emname + "\'";
+                }
+            } else if (mMode2CheckBox.isChecked()) {
+                terms = "and pi_cgy=\'" + emname + "\'";
+            } else {
+                terms = "";
+            }
+
+            String url = GloableParams.ADDRESS_OUTMATERIAL_GETPRODINOUTLIST;
+            VollyRequest.getInstance().stringRequest(mStringRequest,
+                    new HttpParams.Builder()
+                            .url(url + "?condition=" + mKeyword
+                                    + "&page=" + mPageIndex
+                                    + "&pageSize=" + mPageSize
+                                    + "&piclass=" + URLEncoder.encode(piclass, "UTF-8")
+                                    + "&terms=" + URLEncoder.encode(terms, "UTF-8")
+                                    + "&pi_type=" + URLEncoder.encode(pi_type, "UTF-8"))
+                            .method(Request.Method.GET)
+                            .flag(FLAG_REQUEST_STORAGE_LIST)
+                            .tag(TAG + "etprodinoutlist")
+                            .build(), MaterialRequisitionListFragment.this);
+        } catch (Exception e) {
+
+        }
+    }
+
+    @Override
+    public void onSuccess(int flag, Object o) throws Exception {
+        try {
+            progressDialog.dismiss();
+            if (mRefreshListView.isRefreshing()) {
+                mRefreshListView.onRefreshComplete();
+            }
+            String result = o.toString();
+            switch (flag) {
+                case FLAG_REQUEST_STORAGE_LIST:
+                    if (mPageIndex == 1) {
+                        mStorageInBillBeans.clear();
+                    }
+                    analysisStorageList(result);
+                    break;
+                case FLAG_PRODIO_DELETE:
+                    CommonUtil.toastNoRepeat(mActivity, "单据删除成功!");
+                    try {
+                        if (mStorageInBillBeans.size() > mSelectionPosition) {
+                            mStorageInBillBeans.remove(mSelectionPosition);
+                            mStorageInAddAdapter.notifyDataSetChanged();
+                        }
+                    } catch (Exception e) {
+                        LogUtil.e("StorageInAddListFragment=====",e.getMessage());
+                    }
+                    break;
+                default:
+                    break;
+            }
+        } catch (Exception e) {
+
+        }
+    }
+
+    @Override
+    public void onFail(int flag, String failStr) throws Exception {
+        try {
+            progressDialog.dismiss();
+            if (mRefreshListView.isRefreshing()) {
+                mRefreshListView.onRefreshComplete();
+            }
+            switch (flag) {
+                case FLAG_REQUEST_STORAGE_LIST:
+                    if (mPageIndex == 1) {
+                        mEmptyLayout.setErrorMessage(failStr);
+                        mEmptyLayout.showError();
+                    } else {
+                        mPageIndex--;
+                        CommonUtil.toastNoRepeat(mActivity, failStr);
+                    }
+                    break;
+                case FLAG_PRODIO_DELETE:
+                    CommonUtil.toastNoRepeat(mActivity, failStr);
+                    break;
+                default:
+                    break;
+            }
+        } catch (Exception e) {
+
+        }
+    }
+
+    private void analysisStorageList(String 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) {
+                    StorageInBillBean storageInBillBean = new StorageInBillBean();
+
+                    storageInBillBean.setPI_ID(FastjsonUtil.getLong(dataObject, "PI_ID"));
+                    storageInBillBean.setPI_INOUTNO(FastjsonUtil.getText(dataObject, "PI_INOUTNO"));
+                    storageInBillBean.setPI_CLASS(FastjsonUtil.getText(dataObject, "PI_CLASS"));
+                    storageInBillBean.setPI_WHCODE(FastjsonUtil.getText(dataObject, "PI_WHCODE"));
+                    storageInBillBean.setPI_WHNAME(FastjsonUtil.getText(dataObject, "PI_WHNAME"));
+                    storageInBillBean.setPI_CARDCODE(FastjsonUtil.getText(dataObject, "PI_CARDCODE"));
+                    storageInBillBean.setPI_TITLE(FastjsonUtil.getText(dataObject, "PI_TITLE"));
+                    storageInBillBean.setPI_STATUS(FastjsonUtil.getText(dataObject, "PI_STATUS"));
+                    storageInBillBean.setPI_PDASTATUS(FastjsonUtil.getText(dataObject, "PI_PDASTATUS"));
+                    storageInBillBean.setPI_INVOSTATUS(FastjsonUtil.getText(dataObject, "PI_INVOSTATUS"));
+                    storageInBillBean.setPI_RECORDMAN(FastjsonUtil.getText(dataObject, "PI_RECORDMAN"));
+                    storageInBillBean.setPI_RECORDDATE(FastjsonUtil.getLong(dataObject, "PI_RECORDDATE"));
+                    storageInBillBean.setRN(FastjsonUtil.getInt(dataObject, "RN"));
+
+                    mStorageInBillBeans.add(storageInBillBean);
+                }
+            }
+
+            mStorageInAddAdapter.notifyDataSetChanged();
+            if (mStorageInBillBeans.size() == 0) {
+                mEmptyLayout.showEmpty();
+            }
+        } else {
+            if (mPageIndex == 1) {
+                mStorageInAddAdapter.notifyDataSetChanged();
+                mEmptyLayout.showEmpty();
+            } else {
+                CommonUtil.toastNoRepeat(mActivity, "没有更多数据");
+            }
+        }
+    }
+
+    @Override
+    public void onDestroyView() {
+        super.onDestroyView();
+        ((FunctionActivity) getActivity()).setScanIvVisible(false);
+        ((FunctionActivity) getActivity()).setMoreBtnVisible(false);
+        ((FunctionActivity) getActivity()).setListIconIvVisible(false);
+        ((TextView) (getActivity().findViewById(R.id.tv_actionbar_withback))).setText(getString(R.string.title_storage_in));
+    }
+
+    @Override
+    public boolean onKeyDown(int keyCode, KeyEvent event) {
+        return false;
+    }
+
+    @Override
+    public boolean onFragmentBackPressed() {
+        return false;
+    }
+
+    public interface OnListSelectListener {
+        void onListSelect(StorageInBillBean storageInBillBean);
+    }
+}

+ 44 - 24
app/src/main/java/com/uas/uas_mes_stw/fragment/MaterialSelection.java

@@ -1,28 +1,14 @@
 package com.uas.uas_mes_stw.fragment;
 
 import android.content.Context;
-import android.content.Intent;
 import android.graphics.Color;
-import android.graphics.drawable.BitmapDrawable;
 import android.os.Bundle;
 import android.os.Handler;
-import android.support.v4.app.FragmentManager;
 import android.support.v4.content.ContextCompat;
-import android.support.v7.widget.DividerItemDecoration;
-import android.support.v7.widget.LinearLayoutManager;
-import android.text.Editable;
-import android.text.TextUtils;
-import android.text.TextWatcher;
-import android.view.Gravity;
 import android.view.KeyEvent;
-import android.view.LayoutInflater;
 import android.view.View;
-import android.view.Window;
 import android.view.WindowManager;
 import android.widget.Button;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.PopupWindow;
 import android.widget.TextView;
 
 import com.alibaba.fastjson.JSON;
@@ -41,31 +27,22 @@ import com.bin.david.form.data.style.FontStyle;
 import com.bin.david.form.data.table.TableData;
 import com.bin.david.form.listener.OnColumnClickListener;
 import com.bin.david.form.listener.OnColumnItemClickListener;
-import com.chad.library.adapter.base.BaseQuickAdapter;
 import com.scwang.smartrefresh.layout.SmartRefreshLayout;
 import com.scwang.smartrefresh.layout.api.RefreshLayout;
 import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener;
 import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
 import com.uas.uas_mes_stw.R;
-import com.uas.uas_mes_stw.bean.JLTStorageInBean;
 import com.uas.uas_mes_stw.bean.MaterialBean;
 import com.uas.uas_mes_stw.global.GloableParams;
-import com.uas.uas_mes_stw.util.CameraUtil;
 import com.uas.uas_mes_stw.util.CommonUtil;
 import com.uas.uas_mes_stw.util.FastjsonUtil;
 import com.uas.uas_mes_stw.util.HttpCallback;
 import com.uas.uas_mes_stw.util.HttpParams;
-import com.uas.uas_mes_stw.util.StringUtil;
 import com.uas.uas_mes_stw.util.VollyRequest;
-import com.uas.uas_mes_stw.view.ClearableEditText;
-import com.uuzuche.lib_zxing.activity.CaptureActivity;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import cc.cloudist.acplibrary.ACProgressFlower;
-import razerdp.basepopup.BasePopupWindow;
-
 public class MaterialSelection extends BaseFragment implements OnColumnItemClickListener<String> {
 
     private TextView tv_inoutno,tv_cangku;
@@ -220,7 +197,50 @@ public class MaterialSelection extends BaseFragment implements OnColumnItemClick
 
     @Override
     protected void initDatas() {
-        getInDataForm();
+//        getInDataForm();
+        Bundle arguments = getArguments();
+        String obkectdata = arguments.getString("obkectdata");
+        setData(obkectdata);
+
+    }
+    private void setData(String result){
+        try {
+            JSONObject resultObject = JSON.parseObject(result);
+            JSONArray dataArray = resultObject.getJSONArray("data");
+            List<MaterialBean> list = new ArrayList<>();
+            if (dataArray != null && dataArray.size() > 0) {
+                for (int i = 0; i < dataArray.size(); i++) {
+                    JSONObject dataObject = dataArray.getJSONObject(i);
+                    if (dataObject != null) {
+                        MaterialBean materialBean = new MaterialBean();
+                        materialBean.setPD_ID(FastjsonUtil.getText(dataObject, "PD_ID"));
+                        materialBean.setPR_DETAIL(FastjsonUtil.getText(dataObject, "PD_PRODCODE"));
+                        materialBean.setPD_OUTQTY(FastjsonUtil.getText(dataObject, "PD_OUTQTY"));
+                        materialBean.setPR_DETAIL(FastjsonUtil.getText(dataObject, "PR_DETAIL"));
+                        materialBean.setPR_SPEC(FastjsonUtil.getText(dataObject, "PR_SPEC"));
+                        list.add(materialBean);
+                    }
+                }
+            }
+            if (list.size() > 0) {
+                mMaterialBeans.addAll(list);
+                st_list.addData(list, true);
+                new Handler().postDelayed(new Runnable() {
+                    @Override
+                    public void run() {
+                        st_list.postInvalidate();
+                    }
+                }, 100);
+                progressDialog.dismiss();
+                //                                mRefreshLayout.finishRefresh(0);
+                //                                mRefreshLayout.finishLoadMore(0);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            progressDialog.dismiss();
+//                                mRefreshLayout.finishRefresh(0);
+//                                mRefreshLayout.finishLoadMore(0);
+        }
     }
 
     private StringRequest mStringRequest;

+ 14 - 10
app/src/main/java/com/uas/uas_mes_stw/global/GloableParams.java

@@ -300,8 +300,10 @@ public class GloableParams {
     public static String ADDRESS_COMMON_SCANENDTRANS;
     public static String ADDRESS_COMMON_GETLOCATIONPROD;
     public static String ADDRESS_COMMON_GETPRODIODETAIL;
-    public static String ADDRESS_PICKING_CONFIRM;
-    public static String ADDRESS_PICKING_DOCUMENT_DETAILS;
+    public static String ADDRESS_COMMON_DELETEPRODIODETAIL;
+    public static String ADDRESS_COMMON_GETWLLIST;
+    public static String ADDRESS_COMMON_NEWPRODOUT;
+    public static String ADDRESS_PICKING_DOCUMENT_DETAILS;//未写具体接口
 
 
 
@@ -840,15 +842,13 @@ public class GloableParams {
     private static final String ADDRESSTAIL_COUNTING_GETPRODINOUTLIST = "/api/pdaio/pdaioIn/getProdinoutList.action";
     private static final String ADDRESSTAIL_COMMON_DBFIND = "/mobile/common/dbfind.action";
 
-    //领料确认按钮点击事件
-    private static final String ADDRESSTAIL_NEWPRODOUT = "/api/pdaio/pdaioIn/newProdout.action";
-    //领料单单据明细列表接口
-    private static final String ADDRESSTAIL_PICKING_DOCUMENT_DETAILS = "/api/pdaio/pdaioIn/getProdiodetail.action";
-
     /**
      * 领料
      */
+    private static final String ADDRESSTAIL_COMMON_NEWPRODOUT = "//api/pdaio/pdaioIn/newProdout.action";
     private static final String ADDRESSTAIL_COMMON_GETPRODIODETAIL = "/api/pdaio/pdaioIn/getProdiodetail.action";
+    private static final String ADDRESSTAIL_COMMON_DELETEPRODIODETAIL = "/api/pdaio/pdaioIn/deleteProdiodetail.action";
+    private static final String ADDRESSTAIL_COMMON_GETWLLIST = "/api/pdaio/pdaioIn/getWllist.action";
 
 
 
@@ -1004,7 +1004,7 @@ public class GloableParams {
     public static final int[] shopfloorInMenuImgs = {
             R.drawable.mainmenu_outinstorage,
             R.drawable.storage_msd_manager,
-            R.drawable.storage_msd_manager
+            R.drawable.iv_mqad
 
     };
 
@@ -1346,8 +1346,12 @@ public class GloableParams {
         GloableParams.ADDRESS_COMMON_SCANENDTRANS = uriHead + GloableParams.ADDRESSTAIL_PAD_SCANENDTRANS;
         GloableParams.ADDRESS_COMMON_GETLOCATIONPROD = uriHead + GloableParams.ADDRESSTAIL_PAD_GETLOCATIONPROD;
         GloableParams.ADDRESS_COMMON_GETPRODIODETAIL = uriHead + GloableParams.ADDRESSTAIL_COMMON_GETPRODIODETAIL;
-        GloableParams.ADDRESS_PICKING_CONFIRM = uriHead + GloableParams.ADDRESSTAIL_NEWPRODOUT;
-        GloableParams.ADDRESS_PICKING_DOCUMENT_DETAILS = uriHead + GloableParams.ADDRESSTAIL_PICKING_DOCUMENT_DETAILS;
+        GloableParams.ADDRESS_COMMON_DELETEPRODIODETAIL = uriHead + GloableParams.ADDRESSTAIL_COMMON_DELETEPRODIODETAIL;
+        GloableParams.ADDRESS_COMMON_GETWLLIST = uriHead + GloableParams.ADDRESSTAIL_COMMON_GETWLLIST;
+        GloableParams.ADDRESS_COMMON_NEWPRODOUT = uriHead + GloableParams.ADDRESSTAIL_COMMON_NEWPRODOUT;
+
+
+
 
 
 

+ 49 - 1
app/src/main/java/com/uas/uas_mes_stw/util/CommonUtil.java

@@ -24,6 +24,7 @@ import android.text.style.AbsoluteSizeSpan;
 import android.text.style.ForegroundColorSpan;
 import android.util.DisplayMetrics;
 import android.util.TypedValue;
+import android.view.Gravity;
 import android.view.KeyEvent;
 import android.view.View;
 import android.view.ViewGroup;
@@ -531,7 +532,54 @@ public class CommonUtil {
             oldMsg = content;
         }
     }
-
+    /**
+     * 防止重复弹出Toast
+     *
+     * @param context
+     * @param content
+     */
+    public static void toastYESRepeat(Context context, String content) {
+        if (content != null) {
+            if (!content.equals(oldMsg)) {
+                textYESToast(context, content, 3000);
+//                Toast.makeText(context, content, Toast.LENGTH_LONG).show();
+                time = System.currentTimeMillis();
+            } else {
+                if ((System.currentTimeMillis() - time) > 3000) {
+                    textYESToast(context, content, 3000);
+//                    Toast.makeText(context, content, Toast.LENGTH_LONG).show();
+                    time = System.currentTimeMillis();
+                }
+            }
+            oldMsg = content;
+        }
+    }
+    public static void textYESToast(Context context, String content, int duration) {
+        Toast toast = new Toast(context);
+        //显示的时间
+        toast.setDuration(duration);
+        //显示的位置
+//        toast.setGravity(Gravity.CENTER, 0, 0);
+
+        //自定义toast布局
+        LinearLayout toastLayout = new LinearLayout(context);
+        toastLayout.setGravity(Gravity.CENTER_VERTICAL);
+        toastLayout.setOrientation(LinearLayout.HORIZONTAL);
+
+        //添加TextView
+        TextView toastText = new TextView(context);
+//        toastText.setBackgroundColor(context.getResources().getColor(R.color.toast_bg));
+        toastText.setText(content);
+        toastText.setPadding(18, 10, 18, 10);
+        toastText.setBackgroundResource(R.drawable.shape_customer_toast);
+        toastText.setTextColor(context.getResources().getColor(R.color.green));
+        toastText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
+        toastLayout.addView(toastText);
+
+//        toastLayout.setBackgroundColor(context.getResources().getColor(R.color.toast_bg));
+        toast.setView(toastLayout);
+        toast.show();
+    }
     /**
      * 访问出错的提示
      *

BIN
app/src/main/res/drawable/iv_mqad.png


+ 6 - 0
app/src/main/res/drawable/shape_customer_toast.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+       android:shape="rectangle">
+    <corners android:radius="16dp" />
+    <solid android:color="@color/toast_bg" />
+</shape>

+ 204 - 0
app/src/main/res/layout/materiaialequisitionapplictiondetail_fragment.xml

@@ -0,0 +1,204 @@
+<?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:background="#F2F2F2"
+    android:orientation="vertical">
+
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="@color/white"
+        android:orientation="vertical"
+        android:layout_weight="1"
+        android:padding="16dp">
+        <LinearLayout
+            android:orientation="horizontal"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content">
+            <LinearLayout
+                android:orientation="horizontal"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1">
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="单号:">
+                </TextView>
+                <TextView
+                    android:id="@+id/tv_inoutno"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="WR4567876578767">
+                </TextView>
+            </LinearLayout>
+            <LinearLayout
+                android:orientation="horizontal"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1">
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="仓库:">
+                </TextView>
+                <TextView
+                    android:id="@+id/tv_cangku"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="CIM良品">
+                </TextView>
+            </LinearLayout>
+
+        </LinearLayout>
+
+
+        <TextView
+            android:id="@+id/storage_in_add_detail_result_tv"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="16dp"
+            android:textColor="#2475FC"
+            android:textSize="16sp"
+            tools:text="采集成功!"
+            android:visibility="gone"/>
+        <Button
+            android:id="@+id/btn_select"
+            style="@style/ButtonStyle"
+            android:layout_width="match_parent"
+            android:layout_marginBottom="@dimen/dp_10"
+            android:text="领料物料选择" />
+
+        <LinearLayout
+            android:visibility="gone"
+            android:id="@+id/line_gongvisbie"
+            android:orientation="vertical"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            >
+
+            <LinearLayout
+                android:orientation="horizontal"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content">
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textSize="16sp"
+                    android:text="批号:">
+                </TextView>
+                <TextView
+                    android:id="@+id/tv_batchnumber"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textSize="16sp"
+                    android:text="">
+                </TextView>
+            </LinearLayout>
+            <LinearLayout
+                android:orientation="horizontal"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content">
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textSize="16sp"
+                    android:text="料号:">
+                </TextView>
+                <TextView
+                    android:id="@+id/tv_objectid"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textSize="16sp"
+                    android:text="">
+                </TextView>
+            </LinearLayout>
+            <LinearLayout
+                android:orientation="horizontal"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content">
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textSize="16sp"
+                    android:text="工单:">
+                </TextView>
+                <TextView
+                    android:id="@+id/tv_workorder"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textSize="16sp"
+                    android:text="">
+                </TextView>
+            </LinearLayout>
+            <LinearLayout
+                android:orientation="horizontal"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content">
+                <LinearLayout
+                    android:orientation="horizontal"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content">
+                    <TextView
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:textSize="16sp"
+                        android:textColor="#2475FC"
+                        android:text="数量:">
+                    </TextView>
+                    <TextView
+                        android:id="@+id/tv_qty"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:textSize="16sp"
+                        android:textColor="#2475FC"
+                        android:text="">
+                    </TextView>
+                </LinearLayout>
+                <LinearLayout
+                    android:orientation="horizontal"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginLeft="@dimen/dp_10">
+                    <TextView
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:textSize="16sp"
+                        android:textColor="#2475FC"
+                        android:text="累计扫码:">
+                    </TextView>
+                    <TextView
+                        android:id="@+id/tv_accumulativetotal"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:textSize="16sp"
+                        android:textColor="#2475FC"
+                        android:text="">
+                    </TextView>
+                </LinearLayout>
+            </LinearLayout>
+
+
+        </LinearLayout>
+
+        <com.bin.david.form.core.SmartTable
+            android:id="@+id/addgrant"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_weight="1" />
+
+    </LinearLayout>
+
+    <Button
+        android:id="@+id/goodin_add_detail_commit_btn"
+        style="@style/ButtonStyle"
+        android:layout_width="match_parent"
+        android:layout_marginBottom="@dimen/dp_10"
+        android:text="确认入库"
+        android:visibility="gone"/>
+
+</LinearLayout>

+ 1 - 1
app/src/main/res/values/color.xml

@@ -104,5 +104,5 @@
     <color name="me_menu_item_normal">#FAF9F9</color>
     <color name="me_menu_item_press">#DFDEDE</color>
     <color name="yellow_stop">#FFC107</color>
-
+    <color name="toast_bg">#60808080</color><!--自定义toast背景色-->
 </resources>