|
|
@@ -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);
|
|
|
+ }
|
|
|
+}
|