|
|
@@ -12,12 +12,14 @@ import android.widget.CheckBox;
|
|
|
import android.widget.ImageView;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.android.volley.Request;
|
|
|
import com.uas.uaspda.R;
|
|
|
import com.uas.uaspda.activity.FunctionActivity;
|
|
|
import com.uas.uaspda.adapter.CommonFormAdapter;
|
|
|
import com.uas.uaspda.bean.CaptionValueBean;
|
|
|
+import com.uas.uaspda.bean.LineCodeEntity;
|
|
|
import com.uas.uaspda.global.GloableParams;
|
|
|
import com.uas.uaspda.listener.MyEditorActionListener;
|
|
|
import com.uas.uaspda.util.CameraUtil;
|
|
|
@@ -27,6 +29,7 @@ import com.uas.uaspda.util.HttpCallback;
|
|
|
import com.uas.uaspda.util.HttpParams;
|
|
|
import com.uas.uaspda.util.VolleyRequest;
|
|
|
import com.uas.uaspda.view.ClearableEditText;
|
|
|
+import com.uas.uaspda.view.business.CommonSelectPop;
|
|
|
import com.uuzuche.lib_zxing.activity.CaptureActivity;
|
|
|
import com.uuzuche.lib_zxing.activity.CodeUtils;
|
|
|
|
|
|
@@ -45,8 +48,9 @@ public class SolderChargingFragment extends BaseFragment {
|
|
|
private Button mConfirmButton;
|
|
|
private List<CaptionValueBean> mCaptionValueBeans;
|
|
|
private CommonFormAdapter mFormAdapter;
|
|
|
- private ImageView mScanImageView;
|
|
|
+ private ImageView mScanImageView, mLineSelectIv;
|
|
|
private int mFocusId;
|
|
|
+ private CommonSelectPop mLineSelectPop;
|
|
|
|
|
|
@Override
|
|
|
protected int getLayout() {
|
|
|
@@ -64,6 +68,7 @@ public class SolderChargingFragment extends BaseFragment {
|
|
|
mLinecodeEditText = root.findViewById(R.id.solder_charging_linecode_et);
|
|
|
mCheckBox = root.findViewById(R.id.solder_charging_runout_cb);
|
|
|
mConfirmButton = root.findViewById(R.id.solder_charging_confirm_btn);
|
|
|
+ mLineSelectIv = root.findViewById(R.id.solder_charging_linecode_select_iv);
|
|
|
mRecyclerView = root.findViewById(R.id.solder_charging_data_rv);
|
|
|
mRecyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
|
|
|
mCaptionValueBeans = new ArrayList<>();
|
|
|
@@ -72,6 +77,8 @@ public class SolderChargingFragment extends BaseFragment {
|
|
|
mRecyclerView.setAdapter(mFormAdapter);
|
|
|
|
|
|
mBarcodeEditText.requestFocus();
|
|
|
+
|
|
|
+ mLineSelectPop = new CommonSelectPop(mActivity, "选择线别");
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -116,6 +123,67 @@ public class SolderChargingFragment extends BaseFragment {
|
|
|
confirmCharging(barcode);
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ mLineSelectIv.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ requestLines();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ mLineSelectPop.setOnDataSelectListener(new CommonSelectPop.OnDataSelectListener() {
|
|
|
+ @Override
|
|
|
+ public void onDataSelect(int position, Object data) {
|
|
|
+ mLinecodeEditText.setText(((LineCodeEntity) data).getLI_CODE());
|
|
|
+ mLineSelectPop.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void requestLines() {
|
|
|
+ progressDialog.show();
|
|
|
+ VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_SPM_GETLINE)
|
|
|
+ .method(Request.Method.POST)
|
|
|
+ .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);
|
|
|
+ JSONArray dataArray = resultObject.getJSONArray("data");
|
|
|
+ List<LineCodeEntity> lineCodeEntities = new ArrayList<>();
|
|
|
+ if (dataArray != null) {
|
|
|
+ for (int i = 0; i < dataArray.size(); i++) {
|
|
|
+ JSONObject dataObject = dataArray.getJSONObject(i);
|
|
|
+ if (dataObject != null) {
|
|
|
+ LineCodeEntity lineCodeEntity = new LineCodeEntity();
|
|
|
+ lineCodeEntity.setLI_CODE(FastjsonUtil.getText(dataObject, "LI_CODE"));
|
|
|
+ lineCodeEntity.setLI_NAME(FastjsonUtil.getText(dataObject, "LI_NAME"));
|
|
|
+
|
|
|
+ lineCodeEntities.add(lineCodeEntity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (lineCodeEntities.size() == 0) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "线别数据为空");
|
|
|
+ } else {
|
|
|
+ mLineSelectPop.setData(lineCodeEntities);
|
|
|
+ mLineSelectPop.showPopupWindow();
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
private void confirmCharging(String barcode) {
|