|
|
@@ -0,0 +1,588 @@
|
|
|
+package com.uas.zhongkelihan_devices_manager.fragment;
|
|
|
+
|
|
|
+import android.app.Activity;
|
|
|
+import android.content.Intent;
|
|
|
+import android.graphics.drawable.BitmapDrawable;
|
|
|
+import android.os.Bundle;
|
|
|
+import android.support.v4.app.Fragment;
|
|
|
+import android.text.TextUtils;
|
|
|
+import android.view.KeyEvent;
|
|
|
+import android.view.View;
|
|
|
+import android.widget.Button;
|
|
|
+import android.widget.CheckBox;
|
|
|
+import android.widget.CompoundButton;
|
|
|
+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.JSONObject;
|
|
|
+import com.android.volley.Request;
|
|
|
+import com.bin.david.form.core.SmartTable;
|
|
|
+import com.bin.david.form.data.column.Column;
|
|
|
+import com.bin.david.form.data.table.TableData;
|
|
|
+import com.uas.zhongkelihan_devices_manager.R;
|
|
|
+import com.uas.zhongkelihan_devices_manager.activity.FunctionActivity;
|
|
|
+import com.uas.zhongkelihan_devices_manager.bean.CountingData;
|
|
|
+import com.uas.zhongkelihan_devices_manager.global.GloableParams;
|
|
|
+import com.uas.zhongkelihan_devices_manager.listener.MyEditorActionListener;
|
|
|
+import com.uas.zhongkelihan_devices_manager.util.CameraUtil;
|
|
|
+import com.uas.zhongkelihan_devices_manager.util.CommonUtil;
|
|
|
+import com.uas.zhongkelihan_devices_manager.util.FastjsonUtil;
|
|
|
+import com.uas.zhongkelihan_devices_manager.util.FragmentUtils;
|
|
|
+import com.uas.zhongkelihan_devices_manager.util.HttpCallback;
|
|
|
+import com.uas.zhongkelihan_devices_manager.util.HttpParams;
|
|
|
+import com.uas.zhongkelihan_devices_manager.util.VolleyRequest;
|
|
|
+import com.uas.zhongkelihan_devices_manager.view.ClearableEditText;
|
|
|
+import com.uuzuche.lib_zxing.activity.CaptureActivity;
|
|
|
+import com.uuzuche.lib_zxing.activity.CodeUtils;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by RaoMeng on 2019/3/23
|
|
|
+ * Desc: 盘点采集页面
|
|
|
+ */
|
|
|
+public class InventoryCollectFragment extends BaseFragment implements View.OnClickListener {
|
|
|
+ private static final int SCAN_BARCODE_CODE = 101;
|
|
|
+ private ClearableEditText mTagEditText, mBarcodeEditText,cet_liaohao,cet_chuweibianhao;
|
|
|
+ private ImageView mScanImageView;
|
|
|
+ private TextView mResultTextView, mNumTextView, mClassTextView, tvPiInoutno;
|
|
|
+ private Button mMoreButton;
|
|
|
+ private PopupWindow mMenuPopupWindow;
|
|
|
+ private String pi_inoutno, pi_id, pi_class;
|
|
|
+ private CheckBox cb_caiji;
|
|
|
+ private boolean isChecked = false;
|
|
|
+
|
|
|
+ private SmartTable mSmartTable;
|
|
|
+ private Column<String> DE_CODE, DE_NAME, DE_CURRENTCENTERNAME, DE_MANAGEMAN,
|
|
|
+ DE_STOCKQTY, DE_CHECKQTY, DE_SPEC;
|
|
|
+
|
|
|
+ private Column<Long> mPosColumn;
|
|
|
+ private TableData<CountingData> mTableData;
|
|
|
+ private List<CountingData> mStockTaskMultipleBeans;
|
|
|
+ private CheckBox mCheckBox;
|
|
|
+ private String bar_remain;
|
|
|
+ private TextView tv_chaxun;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected int getLayout() {
|
|
|
+ return R.layout.fragment_inventory_collect;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initViews() {
|
|
|
+ ((FunctionActivity) getActivity()).setTitle("盘点作业");
|
|
|
+// ((FunctionActivity) getActivity()).setMoreBtnVisible(true);
|
|
|
+
|
|
|
+ mMoreButton = mActivity.findViewById(R.id.btn_actionbar_more);
|
|
|
+ mTagEditText = root.findViewById(R.id.inventory_collect_tag_et);
|
|
|
+ mBarcodeEditText = root.findViewById(R.id.inventory_collect_barcode_et);
|
|
|
+ mScanImageView = root.findViewById(R.id.inventory_collect_scan_iv);
|
|
|
+ mResultTextView = root.findViewById(R.id.inventory_collect_result_tv);
|
|
|
+ mNumTextView = root.findViewById(R.id.inventory_collect_num_tv);
|
|
|
+ mClassTextView = root.findViewById(R.id.inventory_collect_class_tv);
|
|
|
+ cb_caiji = root.findViewById(R.id.cb_caiji);
|
|
|
+ tvPiInoutno = mActivity.findViewById(R.id.tv_pi_inoutno);
|
|
|
+ cet_liaohao = mActivity.findViewById(R.id.cet_liaohao);
|
|
|
+ cet_chuweibianhao = mActivity.findViewById(R.id.cet_chuweibianhao);
|
|
|
+ tv_chaxun = mActivity.findViewById(R.id.tv_chaxun);
|
|
|
+
|
|
|
+ mBarcodeEditText.requestFocus();
|
|
|
+
|
|
|
+ mCheckBox = root.findViewById(R.id.stock_data_summary_cb);
|
|
|
+ mSmartTable = root.findViewById(R.id.st_data);
|
|
|
+ CommonUtil.getDefaultTable(mActivity, mSmartTable);
|
|
|
+ mPosColumn = new Column<Long>("序号", "POS");
|
|
|
+ mPosColumn.setFixed(true);
|
|
|
+
|
|
|
+ DE_CODE = new Column<String>("设备编号", "DE_CODE");
|
|
|
+ DE_NAME = new Column<String>("设备名称", "DE_NAME");
|
|
|
+ DE_CURRENTCENTERNAME = new Column<String>("使用部门", "DE_CURRENTCENTERNAME");
|
|
|
+ DE_MANAGEMAN = new Column<String>("管理员", "DE_MANAGEMAN");
|
|
|
+ DE_STOCKQTY = new Column<String>("账面库存", "DE_STOCKQTY");
|
|
|
+ DE_CHECKQTY = new Column<String>("实盘库存", "DE_CHECKQTY");
|
|
|
+ DE_SPEC = new Column<String>("设备规格", "DE_SPEC");
|
|
|
+
|
|
|
+// ST_WHCODE = new Column<String>("仓库", "ST_WHCODE");
|
|
|
+// STD_PRODCODE = new Column<String>("料号", "STD_PRODCODE");
|
|
|
+// PR_DETAIL = new Column<String>("名称", "PR_DETAIL");
|
|
|
+// BAR_LOCATION = new Column<String>("储位", "BAR_LOCATION");
|
|
|
+// STD_BATCHQTY = new Column<Double>("账面库存", "STD_BATCHQTY", new IFormat<Double>() {
|
|
|
+// @Override
|
|
|
+// public String format(Double aDouble) {
|
|
|
+// return CommonUtil.doubleFormat(aDouble);
|
|
|
+// }
|
|
|
+// });
|
|
|
+// STD_ACTQTY = new Column<Double>("实盘库存", "STD_ACTQTY", new IFormat<Double>() {
|
|
|
+// @Override
|
|
|
+// public String format(Double aDouble) {
|
|
|
+// return CommonUtil.doubleFormat(aDouble);
|
|
|
+// }
|
|
|
+// });
|
|
|
+// PR_SPEC = new Column<String>("规格", "PR_SPEC");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initEvents() {
|
|
|
+ mMoreButton.setOnClickListener(this);
|
|
|
+ mScanImageView.setOnClickListener(this);
|
|
|
+ cb_caiji.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
+ @Override
|
|
|
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
|
+ InventoryCollectFragment.this.isChecked = isChecked;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // mTagEditText.setOnFocusChangeListener(new View.OnFocusChangeListen) {
|
|
|
+ // @Override
|
|
|
+ // public void onFocusChange(View v, boolean hasFocus) {
|
|
|
+ // if (!hasFocus) {
|
|
|
+ // String tag = mTagEditText.getText().toString().trim();
|
|
|
+ // SharedPreUtil.saveString(mActivity, Constants.FLAG.INVENTORY_DC_TIME_CACHE, tag);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ //
|
|
|
+ // CommonUtil.setEditorActionListener(mTagEditText, new MyEditorActionListener() {
|
|
|
+ // @Override
|
|
|
+ // public void MyEditorAction(String text, int actionId, KeyEvent event) {
|
|
|
+ // SharedPreUtil.saveString(mActivity, Constants.FLAG.INVENTORY_DC_TIME_CACHE, text);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+
|
|
|
+ CommonUtil.setEditorActionListener(mBarcodeEditText, new MyEditorActionListener() {
|
|
|
+ @Override
|
|
|
+ public void MyEditorAction(String text, int actionId, KeyEvent event) {
|
|
|
+ getBarcodedata();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ mCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
+ @Override
|
|
|
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
|
+ getDataList();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ tv_chaxun.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ getDataList();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void getBarcodedata() {
|
|
|
+ String barcode = mBarcodeEditText.getText().toString().trim();
|
|
|
+ if (TextUtils.isEmpty(barcode)) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请采集条码");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ progressDialog.show();
|
|
|
+ if (isChecked) {
|
|
|
+ VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_BARSTOCK_GETBARCODEINFO)
|
|
|
+ .method(Request.Method.GET)
|
|
|
+ .tag(TAG + "getbarcodeinfo")
|
|
|
+ .flag(0)
|
|
|
+ .addParam("inoutno", pi_inoutno)
|
|
|
+ //.addParam("deadline", deadLine)
|
|
|
+ .addParam("barcode", barcode)
|
|
|
+ .addParam("iscancel", isChecked + "")
|
|
|
+ .addParam("prodcode", cet_liaohao.getText().toString().trim())
|
|
|
+ .addParam("location", cet_chuweibianhao.getText().toString().trim())
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ try {
|
|
|
+ mBarcodeEditText.setText("");
|
|
|
+ String result = o.toString();
|
|
|
+ JSONObject resultObject = JSON.parseObject(result);
|
|
|
+ JSONObject dataObject = resultObject.getJSONObject("data");
|
|
|
+ if (dataObject != null) {
|
|
|
+ String type = FastjsonUtil.getText(dataObject, "BI_TYPE");
|
|
|
+ String prompt = "采集成功!";
|
|
|
+ if (!"超期".equals(type)) {
|
|
|
+ mResultTextView.setTextColor(mActivity.getResources().getColor(R.color.black));
|
|
|
+ prompt = "采集成功!";
|
|
|
+ } else {
|
|
|
+ mResultTextView.setTextColor(mActivity.getResources().getColor(R.color.red));
|
|
|
+ prompt = "采集成功!已超期";
|
|
|
+ }
|
|
|
+ mResultTextView.setVisibility(View.VISIBLE);
|
|
|
+ mResultTextView.setText(prompt
|
|
|
+ + "\n设备名称:" + FastjsonUtil.getText(dataObject, "BI_PRODCODE")
|
|
|
+ // + "\n品牌:" + FastjsonUtil.getText(dataObject, "BI_BRAND")
|
|
|
+ // + "\nLOTNO:" + FastjsonUtil.getText(dataObject, "BI_LOTNO")
|
|
|
+ // + "\nDC:" + FastjsonUtil.getText(dataObject, "BI_DATECODE")
|
|
|
+ + "\n型号:" + FastjsonUtil.getText(dataObject, "PR_ORISPECCODE")
|
|
|
+ + "\n设备编号:" + FastjsonUtil.getText(dataObject, "BI_BARCODE")
|
|
|
+ + "\n数量:" + FastjsonUtil.getText(dataObject, "BI_INQTY")
|
|
|
+ );
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ mBarcodeEditText.setText("");
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ mResultTextView.setVisibility(View.VISIBLE);
|
|
|
+ mResultTextView.setText(failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_GET_BARCODE_DATA)
|
|
|
+ .method(Request.Method.GET)
|
|
|
+ .tag(TAG + "getbarcodeinfo")
|
|
|
+ .flag(0)
|
|
|
+ .addParam("barcode", barcode)
|
|
|
+ .addParam("code", pi_inoutno)
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ bar_remain = "";
|
|
|
+ try {
|
|
|
+ String result = o.toString();
|
|
|
+ JSONObject resultObject = JSON.parseObject(result);
|
|
|
+ JSONObject dataObject = resultObject.getJSONObject("data");
|
|
|
+ if (dataObject != null) {
|
|
|
+ bar_remain = FastjsonUtil.getText(dataObject, "BAR_REMAIN");
|
|
|
+ }
|
|
|
+
|
|
|
+ setEnterNumber(barcode, bar_remain);
|
|
|
+
|
|
|
+// View dialogView = View.inflate(getActivity(), R.layout.dialog_confirm_quantity, null);
|
|
|
+// final EditText modifyEditText = dialogView.findViewById(R.id.recharge_modify_et);
|
|
|
+//
|
|
|
+// TextView tv_uninventoried_quantity = dialogView.findViewById(R.id.tv_uninventoried_quantity);
|
|
|
+// TextView tv_material_no = dialogView.findViewById(R.id.tv_material_no);
|
|
|
+// TextView tv_material_name = dialogView.findViewById(R.id.tv_material_name);
|
|
|
+// TextView tv_material_specification = dialogView.findViewById(R.id.tv_material_specification);
|
|
|
+//
|
|
|
+// tv_uninventoried_quantity.setText(FastjsonUtil.getText(dataObject, "UNQTY"));
|
|
|
+// tv_material_no.setText(FastjsonUtil.getText(dataObject, "BAR_PRODCODE"));
|
|
|
+// tv_material_name.setText(FastjsonUtil.getText(dataObject, "PR_DETAIL"));
|
|
|
+// tv_material_specification.setText(FastjsonUtil.getText(dataObject, "PR_SPEC"));
|
|
|
+// modifyEditText.setText(bar_remain);
|
|
|
+// modifyEditText.setSelection(modifyEditText.getText().length());
|
|
|
+//
|
|
|
+// alertDialog = new AlertDialog.Builder(getActivity())
|
|
|
+// .setTitle("确认数量")
|
|
|
+// .setNegativeButton(R.string.cancel, null)
|
|
|
+// .setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
|
|
|
+// @Override
|
|
|
+// public void onClick(DialogInterface dialog, int which) {
|
|
|
+// double quantity = 0;
|
|
|
+// try {
|
|
|
+// quantity = Double.parseDouble(TextUtils.isEmpty(modifyEditText.getText().toString().trim())?"0":modifyEditText.getText().toString().trim());
|
|
|
+// } catch (Exception e) {
|
|
|
+// CommonUtil.toastNoRepeat(getActivity(), "请输入正确的数字");
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// //setEnterNumber(barcode, modifyEditText);
|
|
|
+// }
|
|
|
+// })
|
|
|
+// .setView(dialogView)
|
|
|
+// .create();
|
|
|
+// // 禁用屏幕外点击
|
|
|
+// alertDialog.setCancelable(false);
|
|
|
+// alertDialog.setCanceledOnTouchOutside(false);
|
|
|
+// alertDialog.show();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ mBarcodeEditText.setText("");
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ mResultTextView.setVisibility(View.VISIBLE);
|
|
|
+ mResultTextView.setText(failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setEnterNumber(String barcode, String bar_remain) {
|
|
|
+ progressDialog.show();
|
|
|
+ VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_BARSTOCK_GETBARCODEINFO)
|
|
|
+ .method(Request.Method.GET)
|
|
|
+ .tag(TAG + "getbarcodeinfo")
|
|
|
+ .flag(0)
|
|
|
+ .addParam("inoutno", pi_inoutno)
|
|
|
+ //.addParam("deadline", deadLine)
|
|
|
+ .addParam("barcode", barcode)
|
|
|
+ .addParam("iscancel", isChecked + "")
|
|
|
+ .addParam("bar_remain", bar_remain)
|
|
|
+ .addParam("prodcode", cet_liaohao.getText().toString().trim())
|
|
|
+ .addParam("location", cet_chuweibianhao.getText().toString().trim())
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ try {
|
|
|
+ mBarcodeEditText.setText("");
|
|
|
+ String result = o.toString();
|
|
|
+ JSONObject resultObject = JSON.parseObject(result);
|
|
|
+ JSONObject dataObject = resultObject.getJSONObject("data");
|
|
|
+ if (dataObject != null) {
|
|
|
+ String type = FastjsonUtil.getText(dataObject, "BI_TYPE");
|
|
|
+ String prompt = "采集成功!";
|
|
|
+ if (!"超期".equals(type)) {
|
|
|
+ mResultTextView.setTextColor(mActivity.getResources().getColor(R.color.black));
|
|
|
+ prompt = "采集成功!";
|
|
|
+ } else {
|
|
|
+ mResultTextView.setTextColor(mActivity.getResources().getColor(R.color.red));
|
|
|
+ prompt = "采集成功!已超期";
|
|
|
+ }
|
|
|
+
|
|
|
+ mResultTextView.setVisibility(View.VISIBLE);
|
|
|
+ mResultTextView.setText(prompt
|
|
|
+ + "\n设备名称:" + FastjsonUtil.getText(dataObject, "BI_PRODCODE")
|
|
|
+ // + "\n品牌:" + FastjsonUtil.getText(dataObject, "BI_BRAND")
|
|
|
+ // + "\nLOTNO:" + FastjsonUtil.getText(dataObject, "BI_LOTNO")
|
|
|
+ // + "\nDC:" + FastjsonUtil.getText(dataObject, "BI_DATECODE")
|
|
|
+ + "\n型号:" + FastjsonUtil.getText(dataObject, "PR_ORISPECCODE")
|
|
|
+ + "\n设备编号:" + FastjsonUtil.getText(dataObject, "BI_BARCODE")
|
|
|
+ + "\n数量:" + FastjsonUtil.getText(dataObject, "BI_INQTY")
|
|
|
+ );
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ mBarcodeEditText.setText("");
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ mResultTextView.setVisibility(View.VISIBLE);
|
|
|
+ mResultTextView.setText(failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initDatas() {
|
|
|
+ Bundle bundle = getArguments();
|
|
|
+ if (bundle != null) {
|
|
|
+ pi_inoutno = bundle.getString("pi_inoutno");
|
|
|
+ pi_id = bundle.getString("pi_id");
|
|
|
+ pi_class = bundle.getString("pi_class");
|
|
|
+
|
|
|
+ mNumTextView.setText(pi_inoutno);
|
|
|
+// mClassTextView.setText(pi_class);
|
|
|
+ mClassTextView.setText("设备盘点单");
|
|
|
+ }
|
|
|
+
|
|
|
+ // String deadLine = SharedPreUtil.getString(mActivity, Constants.FLAG.INVENTORY_DC_TIME_CACHE, "");
|
|
|
+ // if (!TextUtils.isEmpty(deadLine)) {
|
|
|
+ // mTagEditText.setText(deadLine);
|
|
|
+ // mBarcodeEditText.requestFocus();
|
|
|
+ // } else {
|
|
|
+ // mTagEditText.requestFocus();
|
|
|
+ // }
|
|
|
+
|
|
|
+ if (pi_inoutno != null) {
|
|
|
+ tvPiInoutno.setText(pi_inoutno);
|
|
|
+ }
|
|
|
+
|
|
|
+ mStockTaskMultipleBeans = new ArrayList<>();
|
|
|
+ setTableData(mStockTaskMultipleBeans);
|
|
|
+ getDataList();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void getDataList() {
|
|
|
+ progressDialog.show();
|
|
|
+ mStockTaskMultipleBeans.clear();
|
|
|
+ VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_GET_PRE_MATERIAL_LIST)
|
|
|
+ .method(Request.Method.POST)
|
|
|
+ .addParam("code", pi_id)
|
|
|
+ .addParam("showall", mCheckBox.isChecked() ? "-1" : "0")
|
|
|
+ .addParam("prodcode", cet_liaohao.getText().toString().trim())
|
|
|
+ .addParam("location", cet_chuweibianhao.getText().toString().trim())
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ try {
|
|
|
+ String result = o.toString();
|
|
|
+ JSONObject resultObject = JSON.parseObject(result);
|
|
|
+ com.alibaba.fastjson.JSONArray dataArray = resultObject.getJSONArray("data");
|
|
|
+ if (dataArray != null && dataArray.size() > 0) {
|
|
|
+ for (int i = 0; i < dataArray.size(); i++) {
|
|
|
+ JSONObject dataObject = dataArray.getJSONObject(i);
|
|
|
+ if (dataObject != null) {
|
|
|
+ CountingData countingData = new CountingData();
|
|
|
+ countingData.setDE_CODE(FastjsonUtil.getText(dataObject, "DE_CODE"));
|
|
|
+ countingData.setDE_NAME(FastjsonUtil.getText(dataObject, "DE_NAME"));
|
|
|
+ countingData.setDE_CURRENTCENTERNAME(FastjsonUtil.getText(dataObject, "DE_CURRENTCENTERNAME"));
|
|
|
+ countingData.setDE_MANAGEMAN(FastjsonUtil.getText(dataObject, "DE_MANAGEMAN"));
|
|
|
+ countingData.setDE_STOCKQTY(FastjsonUtil.getText(dataObject, "DE_STOCKQTY"));
|
|
|
+ countingData.setDE_CHECKQTY(FastjsonUtil.getText(dataObject, "DE_CHECKQTY"));
|
|
|
+ countingData.setDE_SPEC(FastjsonUtil.getText(dataObject, "DE_SPEC"));
|
|
|
+ countingData.setPOS(i + 1);
|
|
|
+ mStockTaskMultipleBeans.add(countingData);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ setTableData(mStockTaskMultipleBeans);
|
|
|
+ } catch (Exception e) {
|
|
|
+ setTableData(mStockTaskMultipleBeans);
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ setTableData(mStockTaskMultipleBeans);
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setTableData(List<CountingData> filterTableData) {
|
|
|
+ mTableData = new TableData<CountingData>("出库单列表", filterTableData,
|
|
|
+ mPosColumn,DE_CODE,DE_NAME,DE_CURRENTCENTERNAME,DE_MANAGEMAN,DE_STOCKQTY,
|
|
|
+ DE_CHECKQTY,DE_SPEC);
|
|
|
+ mSmartTable.setTableData(mTableData);
|
|
|
+ mSmartTable.postDelayed(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ mSmartTable.postInvalidate();
|
|
|
+ }
|
|
|
+ }, 100);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ switch (v.getId()) {
|
|
|
+ case R.id.btn_actionbar_more:
|
|
|
+ showMoreMenu();
|
|
|
+ break;
|
|
|
+ case R.id.pop_inventory_collect_menu_1:
|
|
|
+ closeMenuPopupWindow();
|
|
|
+ Fragment fragment = new InventoryDetailListFragment();
|
|
|
+ Bundle bundle = new Bundle();
|
|
|
+ bundle.putString("pi_inoutno", pi_inoutno);
|
|
|
+ bundle.putString("piid", pi_id);
|
|
|
+ fragment.setArguments(bundle);
|
|
|
+ FragmentUtils.switchFragment(this, fragment);
|
|
|
+ break;
|
|
|
+ case R.id.pop_inventory_collect_menu_2:
|
|
|
+ closeMenuPopupWindow();
|
|
|
+ fragment = new InventorySummaryListFragment();
|
|
|
+ bundle = new Bundle();
|
|
|
+ bundle.putString("pi_inoutno", pi_inoutno);
|
|
|
+ bundle.putString("piid", pi_id);
|
|
|
+ fragment.setArguments(bundle);
|
|
|
+ FragmentUtils.switchFragment(this, fragment);
|
|
|
+ break;
|
|
|
+ case R.id.inventory_collect_scan_iv:
|
|
|
+ if (CameraUtil.hasCamera()) {
|
|
|
+ if (root.findFocus() != null) {
|
|
|
+ Intent intent = new Intent();
|
|
|
+ intent.setClass(mActivity, CaptureActivity.class);
|
|
|
+ startActivityForResult(intent, SCAN_BARCODE_CODE);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, getString(R.string.no_camera_detected));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 展示扩展菜单
|
|
|
+ */
|
|
|
+ private void showMoreMenu() {
|
|
|
+ View view = View.inflate(getActivity(), R.layout.pop_inventory_collect_menu, null);
|
|
|
+ Button detailBtn = (Button) view.findViewById(R.id.pop_inventory_collect_menu_1);
|
|
|
+ Button summaryBtn = (Button) view.findViewById(R.id.pop_inventory_collect_menu_2);
|
|
|
+
|
|
|
+ detailBtn.setOnClickListener(this);
|
|
|
+ summaryBtn.setOnClickListener(this);
|
|
|
+ detailBtn.setVisibility(View.GONE);
|
|
|
+
|
|
|
+ mMenuPopupWindow = new PopupWindow(view, LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT, true);
|
|
|
+ mMenuPopupWindow.setBackgroundDrawable(new BitmapDrawable());
|
|
|
+ mMenuPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
|
|
|
+ @Override
|
|
|
+ public void onDismiss() {
|
|
|
+ closeMenuPopupWindow();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ CommonUtil.setBackgroundAlpha(getActivity(), 0.5f);
|
|
|
+ mMenuPopupWindow.showAsDropDown(mMoreButton);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void closeMenuPopupWindow() {
|
|
|
+ if (mMenuPopupWindow != null) {
|
|
|
+ mMenuPopupWindow.dismiss();
|
|
|
+ CommonUtil.setBackgroundAlpha(mActivity, 1f);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onHiddenChanged(boolean hidden) {
|
|
|
+ super.onHiddenChanged(hidden);
|
|
|
+ if (!hidden) {
|
|
|
+ ((FunctionActivity) getActivity()).setTitle("盘点作业");
|
|
|
+// ((FunctionActivity) getActivity()).setMoreBtnVisible(true);
|
|
|
+ mBarcodeEditText.requestFocus();
|
|
|
+ } else {
|
|
|
+// ((FunctionActivity) getActivity()).setMoreBtnVisible(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
+ super.onActivityResult(requestCode, resultCode, data);
|
|
|
+ if (resultCode != Activity.RESULT_OK) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (requestCode == SCAN_BARCODE_CODE && data != null) {
|
|
|
+ if (data.getExtras() != null) {
|
|
|
+ String result = data.getExtras().getString(CodeUtils.RESULT_STRING);
|
|
|
+ mBarcodeEditText.setText(result);
|
|
|
+ mBarcodeEditText.setSelection(result.length());
|
|
|
+ if (result.length() > 13){
|
|
|
+ getBarcodedata();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean onFragmentBackPressed() {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onDestroyView() {
|
|
|
+ super.onDestroyView();
|
|
|
+// ((FunctionActivity) getActivity()).setMoreBtnVisible(false);
|
|
|
+ }
|
|
|
+}
|