|
|
@@ -2,8 +2,8 @@ package com.uas.uas_mes_stw.fragment;
|
|
|
|
|
|
import android.app.Dialog;
|
|
|
import android.content.DialogInterface;
|
|
|
-import android.os.Bundle;
|
|
|
import android.support.v7.app.AlertDialog;
|
|
|
+import android.util.Log;
|
|
|
import android.view.KeyEvent;
|
|
|
import android.view.View;
|
|
|
import android.widget.AdapterView;
|
|
|
@@ -21,11 +21,11 @@ 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.StorageInAddBarcodeAdapter;
|
|
|
-import com.uas.uas_mes_stw.adapter.StorageInAddQuantityAdapter;
|
|
|
import com.uas.uas_mes_stw.adapter.StorageSearchModeAdapter;
|
|
|
import com.uas.uas_mes_stw.bean.StorageInBarcodeBean;
|
|
|
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.FastjsonUtil;
|
|
|
import com.uas.uas_mes_stw.util.HttpCallback;
|
|
|
@@ -35,29 +35,31 @@ import com.uas.uas_mes_stw.view.ClearableEditText;
|
|
|
import com.uas.uas_mes_stw.view.EmptyLayout;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
- * @author cjh
|
|
|
+ * @author RaoMeng
|
|
|
* @describe
|
|
|
- * @date 2022/7/12 15:21
|
|
|
+ * @date 2018/6/22 10:51
|
|
|
*/
|
|
|
public class StorageInAddBarcodeListFragment extends BaseFragment implements HttpCallback {
|
|
|
+ private final int FLAG_GET_BARCODE_DETAIL = 201;
|
|
|
+ private final int FLAG_DELETE_BARCODE = 202;
|
|
|
+
|
|
|
public static final int PAGE_OUT_BARCODE_DETAIL = 111;
|
|
|
public static final int PAGE_OUT_QUANTITY_SUM = 112;
|
|
|
public static final int PAGE_IN_BARCODE_DETAIL = 113;
|
|
|
public static final int PAGE_IN_QUANTITY_SUM = 114;
|
|
|
|
|
|
- private final int FLAG_GET_BARCODE_DETAIL = 201;
|
|
|
- private final int FLAG_DELETE_BARCODE = 202;
|
|
|
+
|
|
|
|
|
|
private PullToRefreshListView mRefreshListView;
|
|
|
private ClearableEditText mSearchEt;
|
|
|
private TextView mSearchBtn, mClearTextView, mSearchModeView;
|
|
|
private LinearLayout mSearchLl;
|
|
|
private EmptyLayout mEmptyLayout;
|
|
|
- private int mWhichPage;
|
|
|
- private long mPiId;
|
|
|
private StringRequest mStringRequest;
|
|
|
private int mPageIndex = 1, mPageSize = 20;
|
|
|
private String mKeyword = "";
|
|
|
@@ -67,13 +69,15 @@ public class StorageInAddBarcodeListFragment extends BaseFragment implements Htt
|
|
|
private StorageSearchModeAdapter mModeAdapter;
|
|
|
|
|
|
private StorageInAddBarcodeAdapter mStorageInAddBarcodeAdapter;
|
|
|
- private StorageInAddQuantityAdapter mStorageInAddQuantityAdapter;
|
|
|
|
|
|
private List<StorageInBarcodeBean> mStorageInBarcodeBeans;
|
|
|
private JSONArray mQuantityArray;
|
|
|
private int mSelectionPosition = -1;
|
|
|
|
|
|
private OnDeleteSuccessListener mOnDeleteSuccessListener;
|
|
|
+ private String mPiid;
|
|
|
+ private String pi_class;
|
|
|
+ private TextView clean_all;
|
|
|
|
|
|
public void setOnDeleteSuccessListener(OnDeleteSuccessListener onDeleteSuccessListener) {
|
|
|
mOnDeleteSuccessListener = onDeleteSuccessListener;
|
|
|
@@ -86,12 +90,8 @@ public class StorageInAddBarcodeListFragment extends BaseFragment implements Htt
|
|
|
|
|
|
@Override
|
|
|
protected void initViews() {
|
|
|
- Bundle arguments = getArguments();
|
|
|
- if (arguments != null) {
|
|
|
- mWhichPage = arguments.getInt("whichPage");
|
|
|
- mPiId = arguments.getLong("piid");
|
|
|
- }
|
|
|
-
|
|
|
+ mPiid = SharedPreUtil.getString(mActivity, "pi_id", null);
|
|
|
+ pi_class = SharedPreUtil.getString(mActivity, "pi_class", null);
|
|
|
mRefreshListView = root.findViewById(R.id.storage_in_add_barcode_list_lv);
|
|
|
mRefreshListView.setMode(PullToRefreshBase.Mode.BOTH);
|
|
|
mEmptyLayout = new EmptyLayout(mActivity, mRefreshListView.getRefreshableView());
|
|
|
@@ -99,7 +99,9 @@ public class StorageInAddBarcodeListFragment extends BaseFragment implements Htt
|
|
|
mEmptyLayout.setShowEmptyButton(false);
|
|
|
mEmptyLayout.setShowErrorButton(false);
|
|
|
mEmptyLayout.setEmptyMessage("数据为空");
|
|
|
-
|
|
|
+ ((FunctionActivity) getActivity()).setSubmitBtnVisible(false);
|
|
|
+ clean_all = root.findViewById(R.id.clean_all);
|
|
|
+ clean_all.setVisibility(View.VISIBLE);
|
|
|
mSearchLl = root.findViewById(R.id.storage_in_add_barcode_list_search_ll);
|
|
|
mSearchEt = root.findViewById(R.id.storage_in_add_barcode_list_search_cet);
|
|
|
mSearchBtn = root.findViewById(R.id.storage_in_add_barcode_list_search_tv);
|
|
|
@@ -116,26 +118,15 @@ public class StorageInAddBarcodeListFragment extends BaseFragment implements Htt
|
|
|
mModeListView.setAdapter(mModeAdapter);
|
|
|
|
|
|
mModeDialog = new AlertDialog.Builder(mActivity).setView(historyView).create();
|
|
|
-
|
|
|
- if (mWhichPage == PAGE_IN_BARCODE_DETAIL || mWhichPage == PAGE_OUT_BARCODE_DETAIL) {
|
|
|
+ //入库采集--->条码明细||出库备料--->条码明细
|
|
|
FunctionActivity.setTitle("条码明细");
|
|
|
mSearchLl.setVisibility(View.VISIBLE);
|
|
|
- ((FunctionActivity) getActivity()).setSubmitBtnVisible(true);
|
|
|
-
|
|
|
mStorageInBarcodeBeans = new ArrayList<>();
|
|
|
mStorageInAddBarcodeAdapter = new StorageInAddBarcodeAdapter(mActivity, mStorageInBarcodeBeans);
|
|
|
- mStorageInAddBarcodeAdapter.setWhichPage(mWhichPage);
|
|
|
+ mStorageInAddBarcodeAdapter.setWhichPage(111);
|
|
|
mRefreshListView.setAdapter(mStorageInAddBarcodeAdapter);
|
|
|
- } else if (mWhichPage == PAGE_IN_QUANTITY_SUM || mWhichPage == PAGE_OUT_QUANTITY_SUM) {
|
|
|
- FunctionActivity.setTitle("数量汇总");
|
|
|
- mSearchLl.setVisibility(View.GONE);
|
|
|
- ((FunctionActivity) getActivity()).setSubmitBtnVisible(false);
|
|
|
-
|
|
|
- mQuantityArray = new JSONArray();
|
|
|
- mStorageInAddQuantityAdapter = new StorageInAddQuantityAdapter(mActivity, mQuantityArray);
|
|
|
- mStorageInAddQuantityAdapter.setWhichPage(mWhichPage);
|
|
|
- mRefreshListView.setAdapter(mStorageInAddQuantityAdapter);
|
|
|
- }
|
|
|
+ //入库采集--->数量汇总||出库备料--->数量汇总
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -157,7 +148,7 @@ public class StorageInAddBarcodeListFragment extends BaseFragment implements Htt
|
|
|
mRefreshListView.getRefreshableView().setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
|
|
|
@Override
|
|
|
public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {
|
|
|
- if (mWhichPage == PAGE_IN_BARCODE_DETAIL || mWhichPage == PAGE_OUT_BARCODE_DETAIL) {
|
|
|
+ //入库采集--->条码明细||出库备料--->条码明细
|
|
|
mSelectionPosition = (int) adapterView.getItemIdAtPosition(i);
|
|
|
new AlertDialog.Builder(mActivity)
|
|
|
.setMessage("确定删除该条明细?")
|
|
|
@@ -171,13 +162,11 @@ public class StorageInAddBarcodeListFragment extends BaseFragment implements Htt
|
|
|
}
|
|
|
}).create().show();
|
|
|
return true;
|
|
|
- } else {
|
|
|
- return false;
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- mClearTextView.setOnClickListener(new View.OnClickListener() {
|
|
|
+ clean_all.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
new AlertDialog.Builder(mActivity)
|
|
|
@@ -245,40 +234,25 @@ public class StorageInAddBarcodeListFragment extends BaseFragment implements Htt
|
|
|
|
|
|
private void getDataList() {
|
|
|
String url = "";
|
|
|
- switch (mWhichPage) {
|
|
|
- case PAGE_IN_BARCODE_DETAIL:
|
|
|
- String mode = mSearchModeView.getText().toString();
|
|
|
- if ("条码号".equals(mode)) {
|
|
|
- mode = "barcode";
|
|
|
- } else if ("料号".equals(mode)) {
|
|
|
- mode = "prod";
|
|
|
- }
|
|
|
- url = GloableParams.ADDRESS_PDAIO_IN_GETBARCODEDETAIL + "?piid=" + mPiId + "&page=" + mPageIndex
|
|
|
- + "&pageSize=" + mPageSize + "&condition=" + mKeyword + "&kind=" + mode;
|
|
|
- break;
|
|
|
- case PAGE_IN_QUANTITY_SUM:
|
|
|
- url = GloableParams.ADDRESS_PDAIO_IN_GETPRODINOUTQTYSUM + "?piid=" + mPiId + "&page=" + mPageIndex
|
|
|
- + "&pageSize=" + mPageSize + "&condition=" + mKeyword;
|
|
|
- break;
|
|
|
- case PAGE_OUT_BARCODE_DETAIL:
|
|
|
- mode = mSearchModeView.getText().toString();
|
|
|
- if ("条码号".equals(mode)) {
|
|
|
- mode = "barcode";
|
|
|
- } else if ("料号".equals(mode)) {
|
|
|
- mode = "prod";
|
|
|
- }
|
|
|
- url = GloableParams.ADDRESS_PDAIO_OUT_GETBARCODEDETAIL + "?piid=" + mPiId + "&page=" + mPageIndex
|
|
|
- + "&pageSize=" + mPageSize + "&condition=" + mKeyword + "&kind=" + mode;
|
|
|
- break;
|
|
|
- case PAGE_OUT_QUANTITY_SUM:
|
|
|
- url = GloableParams.ADDRESS_PDAIO_OUT_GETPRODINOUTQTYSUM + "?piid=" + mPiId + "&page=" + mPageIndex
|
|
|
- + "&pageSize=" + mPageSize + "&condition=" + mKeyword;
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
+ String mode = mSearchModeView.getText().toString();
|
|
|
+ if ("条码号".equals(mode)) {
|
|
|
+ mode = "barcode";
|
|
|
+ } else if ("料号".equals(mode)) {
|
|
|
+ mode = "prod";
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+ Integer integer = Integer.valueOf(mPiid);
|
|
|
+ Log.e("integer",integer+"");
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ params.put("piid", integer);
|
|
|
+// params.put("caller", "BarInFinish");
|
|
|
+ params.put("page", mPageIndex + "");
|
|
|
+ params.put("pageSize", mPageSize + "");
|
|
|
+ params.put("condition",mSearchEt.getText().toString().trim());
|
|
|
+ params.put("kind",mode);
|
|
|
+// params.put("piclass", pi_class);
|
|
|
+ params.put("terms", "");
|
|
|
+// params.put("currentMaster", DataUtils.getMaster(mActivity));
|
|
|
+ url = FastjsonUtil.param2Url(GloableParams.ADDRESS_PDAIO_IN_GETBARCODEDETAIL, params);
|
|
|
VollyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
new HttpParams.Builder()
|
|
|
.url(url)
|
|
|
@@ -358,81 +332,44 @@ public class StorageInAddBarcodeListFragment extends BaseFragment implements Htt
|
|
|
}
|
|
|
|
|
|
private void analysisBarcodeDetail(Object o) {
|
|
|
- if (mPageIndex == 1) {
|
|
|
- switch (mWhichPage) {
|
|
|
- case PAGE_IN_BARCODE_DETAIL:
|
|
|
- case PAGE_OUT_BARCODE_DETAIL:
|
|
|
- mStorageInBarcodeBeans.clear();
|
|
|
- break;
|
|
|
- case PAGE_IN_QUANTITY_SUM:
|
|
|
- case PAGE_OUT_QUANTITY_SUM:
|
|
|
- mQuantityArray.clear();
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ mStorageInBarcodeBeans.clear();
|
|
|
String result = o.toString();
|
|
|
JSONObject resultObject = JSON.parseObject(result);
|
|
|
JSONArray dataArray = resultObject.getJSONArray("data");
|
|
|
if (dataArray != null) {
|
|
|
- switch (mWhichPage) {
|
|
|
- case PAGE_IN_BARCODE_DETAIL:
|
|
|
- case PAGE_OUT_BARCODE_DETAIL:
|
|
|
- for (int i = 0; i < dataArray.size(); i++) {
|
|
|
- JSONObject dataObject = dataArray.getJSONObject(i);
|
|
|
- if (dataObject != null) {
|
|
|
- StorageInBarcodeBean storageInBarcodeBean = new StorageInBarcodeBean();
|
|
|
-
|
|
|
- storageInBarcodeBean.setBI_BARCODE(FastjsonUtil.getText(dataObject, "BI_BARCODE"));
|
|
|
- storageInBarcodeBean.setBI_PRODCODE(FastjsonUtil.getText(dataObject, "BI_PRODCODE"));
|
|
|
- storageInBarcodeBean.setBI_INQTY(FastjsonUtil.getDouble(dataObject, "BI_INQTY"));
|
|
|
- storageInBarcodeBean.setBI_OUTQTY(FastjsonUtil.getDouble(dataObject, "BI_OUTQTY"));
|
|
|
- storageInBarcodeBean.setBI_INOUTNO(FastjsonUtil.getText(dataObject, "BI_INOUTNO"));
|
|
|
- storageInBarcodeBean.setBI_WHCODE(FastjsonUtil.getText(dataObject, "BI_WHCODE"));
|
|
|
- storageInBarcodeBean.setBI_BRAND(FastjsonUtil.getText(dataObject, "BI_BRAND"));
|
|
|
- storageInBarcodeBean.setBI_ORDERCODE(FastjsonUtil.getText(dataObject, "BI_ORDERCODE"));
|
|
|
- storageInBarcodeBean.setEM_NAME(FastjsonUtil.getText(dataObject, "EM_NAME"));
|
|
|
- storageInBarcodeBean.setBI_ID(FastjsonUtil.getLong(dataObject, "BI_ID"));
|
|
|
- storageInBarcodeBean.setBI_DATECODE(FastjsonUtil.getText(dataObject, "BI_DATECODE"));
|
|
|
- storageInBarcodeBean.setBI_LOTNO(FastjsonUtil.getText(dataObject, "BI_LOTNO"));
|
|
|
- storageInBarcodeBean.setBI_STATUS(FastjsonUtil.getText(dataObject, "BI_STATUS"));
|
|
|
- storageInBarcodeBean.setRN(FastjsonUtil.getInt(dataObject, "RN"));
|
|
|
-
|
|
|
- mStorageInBarcodeBeans.add(storageInBarcodeBean);
|
|
|
- }
|
|
|
- }
|
|
|
+ for (int i = 0; i < dataArray.size(); i++) {
|
|
|
+ JSONObject dataObject = dataArray.getJSONObject(i);
|
|
|
+ if (dataObject != null) {
|
|
|
+ StorageInBarcodeBean storageInBarcodeBean = new StorageInBarcodeBean();
|
|
|
+ storageInBarcodeBean.setBI_BARCODE(FastjsonUtil.getText(dataObject, "BI_BARCODE"));
|
|
|
+ storageInBarcodeBean.setBI_PRODCODE(FastjsonUtil.getText(dataObject, "BI_PRODCODE"));
|
|
|
+ storageInBarcodeBean.setBI_INQTY(FastjsonUtil.getText(dataObject, "BI_INQTY"));
|
|
|
+ storageInBarcodeBean.setBI_OUTQTY(FastjsonUtil.getDouble(dataObject, "BI_OUTQTY"));
|
|
|
+ storageInBarcodeBean.setBI_INOUTNO(FastjsonUtil.getText(dataObject, "BI_INOUTNO"));
|
|
|
+ storageInBarcodeBean.setBI_WHCODE(FastjsonUtil.getText(dataObject, "BI_WHCODE"));
|
|
|
+ storageInBarcodeBean.setBI_BRAND(FastjsonUtil.getText(dataObject, "BI_BRAND"));
|
|
|
+ storageInBarcodeBean.setBI_ORDERCODE(FastjsonUtil.getText(dataObject, "BI_ORDERCODE"));
|
|
|
+ storageInBarcodeBean.setEM_NAME(FastjsonUtil.getText(dataObject, "EM_NAME"));
|
|
|
+ storageInBarcodeBean.setBI_ID(FastjsonUtil.getLong(dataObject, "BI_ID"));
|
|
|
+ storageInBarcodeBean.setBI_DATECODE(FastjsonUtil.getText(dataObject, "BI_DATECODE"));
|
|
|
+ storageInBarcodeBean.setBI_LOTNO(FastjsonUtil.getText(dataObject, "BI_LOTNO"));
|
|
|
+ storageInBarcodeBean.setBI_STATUS(FastjsonUtil.getText(dataObject, "BI_STATUS"));
|
|
|
+ storageInBarcodeBean.setPR_DETAIL(FastjsonUtil.getText(dataObject, "PR_DETAIL"));
|
|
|
+ storageInBarcodeBean.setPR_SPEC(FastjsonUtil.getText(dataObject, "PR_SPEC"));
|
|
|
+// storageInBarcodeBean.setBI_LOCATION(FastjsonUtil.getText(dataObject, "BI_LOCATION"));
|
|
|
+ storageInBarcodeBean.setRN(FastjsonUtil.getInt(dataObject, "RN"));
|
|
|
+
|
|
|
+ mStorageInBarcodeBeans.add(storageInBarcodeBean);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- mStorageInAddBarcodeAdapter.notifyDataSetChanged();
|
|
|
- if (mStorageInBarcodeBeans.size() == 0) {
|
|
|
- mEmptyLayout.showEmpty();
|
|
|
- }
|
|
|
- break;
|
|
|
- case PAGE_IN_QUANTITY_SUM:
|
|
|
- case PAGE_OUT_QUANTITY_SUM:
|
|
|
- mQuantityArray.addAll(dataArray);
|
|
|
- mStorageInAddQuantityAdapter.notifyDataSetChanged();
|
|
|
- if (mQuantityArray.size() == 0) {
|
|
|
- mEmptyLayout.showEmpty();
|
|
|
- }
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
+ mStorageInAddBarcodeAdapter.notifyDataSetChanged();
|
|
|
+ if (mStorageInBarcodeBeans.size() == 0) {
|
|
|
+ mEmptyLayout.showEmpty();
|
|
|
}
|
|
|
} else {
|
|
|
if (mPageIndex == 1) {
|
|
|
- switch (mWhichPage) {
|
|
|
- case PAGE_IN_BARCODE_DETAIL:
|
|
|
- case PAGE_OUT_BARCODE_DETAIL:
|
|
|
- mStorageInAddBarcodeAdapter.notifyDataSetChanged();
|
|
|
- break;
|
|
|
- case PAGE_IN_QUANTITY_SUM:
|
|
|
- case PAGE_OUT_QUANTITY_SUM:
|
|
|
- mStorageInAddQuantityAdapter.notifyDataSetChanged();
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
+ mStorageInAddBarcodeAdapter.notifyDataSetChanged();
|
|
|
mEmptyLayout.showEmpty();
|
|
|
} else {
|
|
|
mPageIndex--;
|
|
|
@@ -448,19 +385,15 @@ public class StorageInAddBarcodeListFragment extends BaseFragment implements Htt
|
|
|
} else if ("料号".equals(mode)) {
|
|
|
mode = "prod";
|
|
|
}
|
|
|
- String url = GloableParams.ADDRESS_PDAIO_IN_DELETEBARCODE;
|
|
|
- if (mWhichPage == PAGE_IN_BARCODE_DETAIL) {
|
|
|
- url = GloableParams.ADDRESS_PDAIO_IN_DELETEBARCODE;
|
|
|
- } else if (mWhichPage == PAGE_OUT_BARCODE_DETAIL) {
|
|
|
- url = GloableParams.ADDRESS_PDAIO_OUT_DELETEBARCODE;
|
|
|
- }
|
|
|
+ String url = "";
|
|
|
+ url = GloableParams.ADDRESS_PDAIO_IN_DELETEBARCODE;
|
|
|
VollyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
new HttpParams.Builder()
|
|
|
.url(url)
|
|
|
.method(Request.Method.POST)
|
|
|
.flag(FLAG_DELETE_BARCODE)
|
|
|
.tag(TAG + "deletebarcode")
|
|
|
- .addParam("piid", mPiId + "")
|
|
|
+ .addParam("piid", mPiid + "")
|
|
|
.addParam("type", type)
|
|
|
.addParam("biid", biid)
|
|
|
.addParam("condition", condition)
|