|
|
@@ -2,20 +2,27 @@ package com.uas.equipment.fragment;
|
|
|
|
|
|
import android.annotation.SuppressLint;
|
|
|
import android.app.Activity;
|
|
|
+import android.app.AlertDialog;
|
|
|
+import android.content.DialogInterface;
|
|
|
import android.content.Intent;
|
|
|
import android.graphics.Color;
|
|
|
+import android.graphics.drawable.BitmapDrawable;
|
|
|
import android.os.Bundle;
|
|
|
+import android.os.Handler;
|
|
|
import android.support.annotation.Nullable;
|
|
|
import android.support.v7.widget.DefaultItemAnimator;
|
|
|
import android.support.v7.widget.DividerItemDecoration;
|
|
|
import android.support.v7.widget.LinearLayoutManager;
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
+import android.text.InputType;
|
|
|
import android.util.Log;
|
|
|
import android.util.SparseBooleanArray;
|
|
|
+import android.view.Gravity;
|
|
|
import android.view.KeyEvent;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
+import android.view.Window;
|
|
|
import android.view.inputmethod.EditorInfo;
|
|
|
import android.widget.AdapterView;
|
|
|
import android.widget.ArrayAdapter;
|
|
|
@@ -24,6 +31,7 @@ import android.widget.CheckBox;
|
|
|
import android.widget.CompoundButton;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
|
+import android.widget.PopupWindow;
|
|
|
import android.widget.Spinner;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
@@ -37,6 +45,7 @@ import com.uas.equipment.R;
|
|
|
import com.uas.equipment.activity.FunctionActivity;
|
|
|
import com.uas.equipment.bean.JsonStorateBean;
|
|
|
import com.uas.equipment.bean.MaintainitemBean;
|
|
|
+import com.uas.equipment.bean.PrintListBean;
|
|
|
import com.uas.equipment.camera.CaptureActivity;
|
|
|
import com.uas.equipment.camera.CodeUtils;
|
|
|
import com.uas.equipment.global.GloableParams;
|
|
|
@@ -53,10 +62,13 @@ import com.uas.equipment.util.VollyRequest;
|
|
|
import com.uas.equipment.view.ClearableEditText;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Collections;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
+import razerdp.basepopup.BasePopupWindow;
|
|
|
+
|
|
|
/**
|
|
|
* @author cjh
|
|
|
* @describe
|
|
|
@@ -88,6 +100,11 @@ public class StorageRechargeListFragment extends BaseFragment implements Adapter
|
|
|
private static final int SCAN_BARCODE_CODE = 111;
|
|
|
private String commit_maintenanceType;
|
|
|
|
|
|
+ private List<PrintListBean> mFilterStorageInBeans;
|
|
|
+ private List<String> linecodeBeanList;
|
|
|
+ private AlertDialog downloadDialog;
|
|
|
+ private TextView mProgress;
|
|
|
+
|
|
|
@Override
|
|
|
protected int getLayout() {
|
|
|
return R.layout.fragment_storage_recharge_list;
|
|
|
@@ -119,6 +136,7 @@ public class StorageRechargeListFragment extends BaseFragment implements Adapter
|
|
|
tv_de_name.setText("名称:"+de_name);
|
|
|
}
|
|
|
|
|
|
+ mFilterStorageInBeans = Collections.synchronizedList(new ArrayList<>());
|
|
|
spinner.setOnItemSelectedListener(this);
|
|
|
|
|
|
ce_de_code.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
|
|
@@ -221,7 +239,7 @@ public class StorageRechargeListFragment extends BaseFragment implements Adapter
|
|
|
});
|
|
|
|
|
|
}
|
|
|
- private List<String> linecodeBeanList;
|
|
|
+
|
|
|
//返回保养类型(下拉框的值)
|
|
|
public void getNewData(){
|
|
|
progressDialog.show();
|
|
|
@@ -244,8 +262,6 @@ public class StorageRechargeListFragment extends BaseFragment implements Adapter
|
|
|
String mi_calibration = FastjsonUtil.getText(dataObject, "MI_CALIBRATION");
|
|
|
String mi_ishalfmonth_user = FastjsonUtil.getText(dataObject, "MI_ISHALFMONTH_USER");
|
|
|
|
|
|
-
|
|
|
-
|
|
|
linecodeBeanList = new ArrayList<>();
|
|
|
linecodeBeanList.clear();
|
|
|
|
|
|
@@ -346,7 +362,9 @@ public class StorageRechargeListFragment extends BaseFragment implements Adapter
|
|
|
data.getString("MI_ID"),
|
|
|
data.getString("MI_ITEM"),
|
|
|
data.getString("MI_DETNO"),
|
|
|
- data.getString("MI_DESC"));
|
|
|
+ data.getString("MI_DESC"),
|
|
|
+ data.getString("MI_MAXVALUE"),
|
|
|
+ data.getString("MI_MINVALUE"));
|
|
|
mFeededList.add(bean);
|
|
|
}
|
|
|
setAdapter(mFeededList);
|
|
|
@@ -364,17 +382,18 @@ public class StorageRechargeListFragment extends BaseFragment implements Adapter
|
|
|
}
|
|
|
//提交保存
|
|
|
public void getNewCommitData(){//dc_remark dc_kind 主表formStore ----- DI_RESULT,DI_ITEM,DI_RESULT
|
|
|
- progressDialog.show();
|
|
|
+
|
|
|
// if (mi_item.isEmpty()||mi_detno.isEmpty()){
|
|
|
// CommonUtil.toastNoRepeat(mActivity, "请勾选项目名称");
|
|
|
// return;
|
|
|
// }
|
|
|
|
|
|
ArrayList<MaintainitemBean> selectedItem = myAdapter.getSelectedItem();
|
|
|
- for (int i=0;i<selectedItem.size();i++){
|
|
|
- MaintainitemBean maintainitemBean = selectedItem.get(i);
|
|
|
- Log.e("maintainitemBean====",maintainitemBean.getMi_item());
|
|
|
- }
|
|
|
+// if (selectedItem.size()!=mFeededList.size()){
|
|
|
+// CommonUtil.toastNoRepeat(mActivity, "必须勾选全部检验项目");
|
|
|
+// return;
|
|
|
+// }
|
|
|
+
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
JSONObject object_1 = new JSONObject();
|
|
|
@@ -389,16 +408,45 @@ public class StorageRechargeListFragment extends BaseFragment implements Adapter
|
|
|
object_2.put("DI_DETNO", mi_detno);//序号
|
|
|
ArrayList<JsonStorateBean> list=new ArrayList<>();
|
|
|
Map<String, String> map = new HashMap<String, String>();
|
|
|
+ list.clear();
|
|
|
for (int i=0;i<selectedItem.size();i++){
|
|
|
MaintainitemBean maintainitemBean = selectedItem.get(i);
|
|
|
- Log.e("maintainitemBean====",maintainitemBean.getMi_item());
|
|
|
+ if (!StringUtil.isEmpty(maintainitemBean.getMI_MAXVALUE()) && !StringUtil.isEmpty(maintainitemBean.getMI_MINVALUE())){
|
|
|
+ if (StringUtil.isEmpty(maintainitemBean.getDI_REMARK())){
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请填写点检值");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
// object_2.put("DI_ITEM", maintainitemBean.getMi_item());
|
|
|
// list.add(maintainitemBean.getMi_item());
|
|
|
- JsonStorateBean jsonStorateBean=new JsonStorateBean("OK",maintainitemBean.getMi_item());
|
|
|
+
|
|
|
+// JsonStorateBean jsonStorateBean=new JsonStorateBean("OK",maintainitemBean.getMi_item());
|
|
|
+ JsonStorateBean jsonStorateBean=new JsonStorateBean("OK",maintainitemBean.getMi_item(),maintainitemBean.getMI_DESC(),maintainitemBean.getDI_REMARK());
|
|
|
list.add(jsonStorateBean);
|
|
|
+
|
|
|
// map.put("DI_RESULT","OK");
|
|
|
// map.put("DI_ITEM",maintainitemBean.getMi_item());
|
|
|
}
|
|
|
+ JSONObject jsonObject3 = new JSONObject();
|
|
|
+ JSONArray jsonArray3 = new JSONArray();
|
|
|
+ ArrayList<PrintListBean> PrintListBeanlist=new ArrayList<>();
|
|
|
+ for (int o=0;o<mFilterStorageInBeans.size();o++){
|
|
|
+ PrintListBean printListBean = mFilterStorageInBeans.get(o);
|
|
|
+ if (StringUtil.isEmpty(printListBean.getDd_detail())){
|
|
|
+ printListBean.setDd_detail("");
|
|
|
+ }
|
|
|
+ if (StringUtil.isEmpty(printListBean.getDd_qty())){
|
|
|
+ printListBean.setDd_qty("");
|
|
|
+ }
|
|
|
+ PrintListBean printListBean1=new PrintListBean(printListBean.getDd_detail(),printListBean.getDd_qty());
|
|
|
+ PrintListBeanlist.add(printListBean1);
|
|
|
+ }
|
|
|
+
|
|
|
+ jsonArray3.add(PrintListBeanlist);
|
|
|
+ jsonObject3.put("param1",jsonArray3);
|
|
|
+ String substring3 = jsonArray3.toString().substring(0, jsonArray3.toString().length() - 1);//去除尾部
|
|
|
+ String substring13 = substring3.substring(1, substring3.length());//去除首部
|
|
|
+
|
|
|
// object_2.put("DI_ITEM", list);
|
|
|
// object_2.put("DI_ITEM", mi_item);//项目名称
|
|
|
// for (String o : map.keySet()) {
|
|
|
@@ -412,7 +460,7 @@ public class StorageRechargeListFragment extends BaseFragment implements Adapter
|
|
|
String substring = jsonArray2.toString().substring(0, jsonArray2.toString().length() - 1);//去除尾部
|
|
|
String substring1 = substring.substring(1, substring.length());//去除首部
|
|
|
Log.i("params===2===",substring1);
|
|
|
-
|
|
|
+ progressDialog.show();
|
|
|
Log.i("TESTJSON33", jsonObject.toString());
|
|
|
VollyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
.url(GloableParams.ASTATIONTHE_COMMIT_MAINITEM)
|
|
|
@@ -421,6 +469,7 @@ public class StorageRechargeListFragment extends BaseFragment implements Adapter
|
|
|
.addParam("de_code",de_code)
|
|
|
.addParam("formStore",jsonArray.toString())
|
|
|
.addParam("param",substring1)
|
|
|
+ .addParam("param1",substring13)
|
|
|
.build(), new HttpCallback() {
|
|
|
@Override
|
|
|
public void onSuccess(int flag, Object o) throws Exception {
|
|
|
@@ -428,6 +477,12 @@ public class StorageRechargeListFragment extends BaseFragment implements Adapter
|
|
|
tv_prompt.setVisibility(View.VISIBLE);
|
|
|
tv_prompt.setTextColor(Color.GREEN);
|
|
|
tv_prompt.setText("提交成功");
|
|
|
+
|
|
|
+ ce_de_code.setText("");
|
|
|
+ ce_de_code.requestFocus();
|
|
|
+ list.clear();
|
|
|
+ ck_all.setChecked(false);
|
|
|
+ showDownloadDialogture();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -438,8 +493,76 @@ public class StorageRechargeListFragment extends BaseFragment implements Adapter
|
|
|
tv_prompt.setText(failStr);
|
|
|
// CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
|
|
|
+ ce_de_code.setText("");
|
|
|
+ ce_de_code.requestFocus();
|
|
|
+ showDownloadDialog(failStr);
|
|
|
+
|
|
|
}
|
|
|
});
|
|
|
+ mFilterStorageInBeans.clear();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void showDownloadDialog(String failStr){
|
|
|
+ AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
|
|
+ builder.setTitle("提示");
|
|
|
+ final LayoutInflater inflater = LayoutInflater.from(mActivity);
|
|
|
+ View v = inflater.inflate(R.layout.progress, null);
|
|
|
+ mProgress = (TextView) v.findViewById(R.id.progress);
|
|
|
+
|
|
|
+ builder.setView(v);
|
|
|
+ mProgress.setTextColor(Color.RED);
|
|
|
+ mProgress.setText(failStr+"");
|
|
|
+ builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
+ dialog.dismiss();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ downloadDialog = builder.create();
|
|
|
+
|
|
|
+ builder.setCancelable(false);
|
|
|
+
|
|
|
+ downloadDialog.setCanceledOnTouchOutside(false);
|
|
|
+
|
|
|
+ downloadDialog.show();
|
|
|
+
|
|
|
+ }
|
|
|
+ Handler handler=new Handler();
|
|
|
+ Runnable runnable=new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ handler.postDelayed(this, 1000);
|
|
|
+ downloadDialog.dismiss();
|
|
|
+ handler.removeCallbacks(runnable);
|
|
|
+ }
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+ private void showDownloadDialogture(){
|
|
|
+ AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
|
|
|
+ builder.setTitle("提示");
|
|
|
+ final LayoutInflater inflater = LayoutInflater.from(mActivity);
|
|
|
+ View v = inflater.inflate(R.layout.progress, null);
|
|
|
+ mProgress = (TextView) v.findViewById(R.id.progress);
|
|
|
+
|
|
|
+ builder.setView(v);
|
|
|
+ mProgress.setTextColor(Color.GREEN);
|
|
|
+ mProgress.setText("提交成功");
|
|
|
+
|
|
|
+ downloadDialog = builder.create();
|
|
|
+
|
|
|
+ // builder.setCancelable(false);
|
|
|
+
|
|
|
+ // downloadDialog.setCanceledOnTouchOutside(false);
|
|
|
+
|
|
|
+ downloadDialog.show();
|
|
|
+ handler.postDelayed(runnable, 1000);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -624,6 +747,14 @@ public class StorageRechargeListFragment extends BaseFragment implements Adapter
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+ ((ListItemViewHolder) holder).iv_change.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ ce_de_code.clearFocus();
|
|
|
+ index_position_resource.clearFocus();
|
|
|
+ initEditPopupWindow(mList,i);
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -637,14 +768,103 @@ public class StorageRechargeListFragment extends BaseFragment implements Adapter
|
|
|
CheckBox checkBox;
|
|
|
TextView mainTitle;
|
|
|
TextView tv_mi_desc;
|
|
|
+ ImageView iv_change;
|
|
|
ListItemViewHolder(View view) {
|
|
|
super(view);
|
|
|
this.mainTitle = (TextView) view.findViewById(R.id.text);
|
|
|
this.tv_mi_desc = (TextView) view.findViewById(R.id.tv_mi_desc);
|
|
|
this.checkBox = (CheckBox) view.findViewById(R.id.select_checkbox);
|
|
|
+ this.iv_change = (ImageView) view.findViewById(R.id.iv_change);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * * 点检值改量
|
|
|
+ */
|
|
|
+ private PopupWindow editPW;
|
|
|
+ private void initEditPopupWindow(ArrayList<MaintainitemBean> mList,int i) {
|
|
|
+ View contView = LayoutInflater.from(mActivity).inflate(R.layout.index_edit_pup_remark_change, null);
|
|
|
+ ClearableEditText edit_et = (ClearableEditText) contView.findViewById(R.id.edit_et);
|
|
|
+ TextView sure_tv = (TextView) contView.findViewById(R.id.sure_tv);
|
|
|
+ TextView cancle_tv = (TextView) contView.findViewById(R.id.cancle_tv);
|
|
|
+ editPW = new PopupWindow(contView, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, true);
|
|
|
+ editPW.setTouchable(true);
|
|
|
+ editPW.setBackgroundDrawable(new BitmapDrawable());
|
|
|
+ editPW.setOnDismissListener(new BasePopupWindow.OnDismissListener() {
|
|
|
+ @Override
|
|
|
+ public void onDismiss() {
|
|
|
+ closeListPopupWindow();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ View parentView =mActivity.getWindow().findViewById(Window.ID_ANDROID_CONTENT);
|
|
|
+ editPW.showAtLocation(parentView, Gravity.CENTER, 0, 0);
|
|
|
+ CommonUtil.setBackgroundAlpha(mActivity, 0.5f);
|
|
|
+ edit_et.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
|
|
|
+ edit_et.setText(mList.get(i).getDI_REMARK());
|
|
|
+ edit_et.requestFocus();
|
|
|
+ edit_et.setSelection(edit_et.getText().toString().length());
|
|
|
+ //确定
|
|
|
+ sure_tv.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ if (edit_et.getText().toString().trim().isEmpty()){
|
|
|
+ edit_et.setText("0");
|
|
|
+ }
|
|
|
+ String trim = edit_et.getText().toString().trim();
|
|
|
+ MaintainitemBean maintainitemBean = mList.get(i);
|
|
|
+ if (!StringUtil.isEmpty(maintainitemBean.getMI_MAXVALUE())
|
|
|
+ &&!StringUtil.isEmpty(maintainitemBean.getMI_MINVALUE())){
|
|
|
+ //判断是否为整数
|
|
|
+ boolean numeric_remark = CommonUtil.isNumeric(trim);
|
|
|
+ boolean numeric_maxvalue = CommonUtil.isNumeric(maintainitemBean.getMI_MAXVALUE());
|
|
|
+ boolean numeric_minvalue = CommonUtil.isNumeric(maintainitemBean.getMI_MINVALUE());
|
|
|
+ //判断是否为小数
|
|
|
+ boolean isDouble_remark = CommonUtil.isDouble(trim);
|
|
|
+ boolean isDouble_maxvalue = CommonUtil.isDouble(maintainitemBean.getMI_MAXVALUE());
|
|
|
+ boolean isDouble_minvalue = CommonUtil.isDouble(maintainitemBean.getMI_MINVALUE());
|
|
|
+ if ((numeric_remark||isDouble_remark) && (numeric_maxvalue||isDouble_maxvalue) && (numeric_minvalue||isDouble_minvalue)){
|
|
|
+ double int_remark = Double.parseDouble(trim);
|
|
|
+ double int_maxvalue = Double.parseDouble(maintainitemBean.getMI_MAXVALUE());
|
|
|
+ double int_minvalue = Double.parseDouble(maintainitemBean.getMI_MINVALUE());
|
|
|
+ if (int_remark>=int_minvalue && int_remark<=int_maxvalue){
|
|
|
+ mList.get(i).setDI_REMARK(edit_et.getText().toString().trim());
|
|
|
+ myAdapter.setItemChecked(i, true);
|
|
|
+ myAdapter.notifyItemChanged(i);
|
|
|
+ }else {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity,"点检值不在范围内");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity,"值不为数字");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ mList.get(i).setDI_REMARK(edit_et.getText().toString().trim());
|
|
|
+ myAdapter.setItemChecked(i, true);
|
|
|
+ myAdapter.notifyItemChanged(i);
|
|
|
+ }
|
|
|
+ // myAdapter.notifyDataSetChanged();
|
|
|
+ closeListPopupWindow();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //取消
|
|
|
+ cancle_tv.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ closeListPopupWindow();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void closeListPopupWindow() {
|
|
|
+ if (editPW != null) {
|
|
|
+ editPW.dismiss();
|
|
|
+ editPW = null;
|
|
|
+ CommonUtil.setBackgroundAlpha(mActivity, 1f);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public void getNewData(String de_codes){
|
|
|
progressDialog.show();
|
|
|
VollyRequest.getInstance().stringRequest(new HttpParams.Builder()
|