|
@@ -1,21 +1,16 @@
|
|
package com.fxy.tool;
|
|
package com.fxy.tool;
|
|
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.annotation.SuppressLint;
|
|
-import android.app.AlertDialog;
|
|
|
|
-import android.app.Dialog;
|
|
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.Context;
|
|
import android.content.Context;
|
|
-import android.content.DialogInterface;
|
|
|
|
import android.content.Intent;
|
|
import android.content.Intent;
|
|
import android.content.IntentFilter;
|
|
import android.content.IntentFilter;
|
|
-import android.os.Build;
|
|
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
import android.os.Handler;
|
|
import android.os.Handler;
|
|
import android.os.Message;
|
|
import android.os.Message;
|
|
import android.support.v7.widget.LinearLayoutManager;
|
|
import android.support.v7.widget.LinearLayoutManager;
|
|
import android.support.v7.widget.RecyclerView;
|
|
import android.support.v7.widget.RecyclerView;
|
|
import android.text.Editable;
|
|
import android.text.Editable;
|
|
-import android.text.InputType;
|
|
|
|
import android.text.TextWatcher;
|
|
import android.text.TextWatcher;
|
|
import android.view.KeyEvent;
|
|
import android.view.KeyEvent;
|
|
import android.view.View;
|
|
import android.view.View;
|
|
@@ -27,9 +22,6 @@ import android.widget.ImageView;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.RadioButton;
|
|
import android.widget.RadioButton;
|
|
import android.widget.TextView;
|
|
import android.widget.TextView;
|
|
-import android.widget.Toast;
|
|
|
|
-
|
|
|
|
-import androidx.annotation.RequiresApi;
|
|
|
|
|
|
|
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
|
import com.chad.library.adapter.base.BaseViewHolder;
|
|
import com.chad.library.adapter.base.BaseViewHolder;
|
|
@@ -43,15 +35,13 @@ import com.fxy.baselibrary.util.DateUtil;
|
|
import com.fxy.baselibrary.util.HideUtil;
|
|
import com.fxy.baselibrary.util.HideUtil;
|
|
import com.fxy.baselibrary.util.JsonUtil;
|
|
import com.fxy.baselibrary.util.JsonUtil;
|
|
import com.fxy.baselibrary.util.StringUtils;
|
|
import com.fxy.baselibrary.util.StringUtils;
|
|
-import com.fxy.baselibrary.views.MarqueeTextView;
|
|
|
|
import com.fxy.bean.ActionBean;
|
|
import com.fxy.bean.ActionBean;
|
|
import com.fxy.bean.ScanBean;
|
|
import com.fxy.bean.ScanBean;
|
|
-import com.fxy.common.CommonDialog;
|
|
|
|
import com.fxy.constant.BaseConfig;
|
|
import com.fxy.constant.BaseConfig;
|
|
import com.fxy.constant.EventCode;
|
|
import com.fxy.constant.EventCode;
|
|
-import com.fxy.constant.SPCache;
|
|
|
|
import com.fxy.net.MyDialogCallback;
|
|
import com.fxy.net.MyDialogCallback;
|
|
import com.fxy.net.Urls;
|
|
import com.fxy.net.Urls;
|
|
|
|
+import com.fxy.realm.ToolScanRealm;
|
|
import com.fxy.tool.bean.ToolBean;
|
|
import com.fxy.tool.bean.ToolBean;
|
|
import com.fxy.tool.bean.ToolDetailBean;
|
|
import com.fxy.tool.bean.ToolDetailBean;
|
|
import com.fxy.view.FloatingImageView;
|
|
import com.fxy.view.FloatingImageView;
|
|
@@ -60,20 +50,24 @@ import com.jaredrummler.materialspinner.MaterialSpinner;
|
|
import com.lzy.okgo.OkGo;
|
|
import com.lzy.okgo.OkGo;
|
|
import com.lzy.okgo.model.Response;
|
|
import com.lzy.okgo.model.Response;
|
|
|
|
|
|
-import org.json.JSONArray;
|
|
|
|
import org.json.JSONException;
|
|
import org.json.JSONException;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.Collections;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
-import java.util.Iterator;
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
+import java.util.Objects;
|
|
|
|
+import java.util.UUID;
|
|
|
|
|
|
import butterknife.BindView;
|
|
import butterknife.BindView;
|
|
import butterknife.ButterKnife;
|
|
import butterknife.ButterKnife;
|
|
import butterknife.OnClick;
|
|
import butterknife.OnClick;
|
|
import butterknife.Unbinder;
|
|
import butterknife.Unbinder;
|
|
|
|
+import io.realm.Realm;
|
|
|
|
+import io.realm.RealmQuery;
|
|
|
|
+import io.realm.RealmResults;
|
|
import sto.android.app.StoJNI;
|
|
import sto.android.app.StoJNI;
|
|
import sto.android.app.StoPdaKeyEvent;
|
|
import sto.android.app.StoPdaKeyEvent;
|
|
import sto.android.app.StoTongJNI;
|
|
import sto.android.app.StoTongJNI;
|
|
@@ -121,17 +115,14 @@ public class OrderToolMainActivity extends BaseActivity implements StoJNI.ScanC
|
|
private List<ToolBean> batchList = new ArrayList<>() ;
|
|
private List<ToolBean> batchList = new ArrayList<>() ;
|
|
private JSONObject batchDetails ;
|
|
private JSONObject batchDetails ;
|
|
//扫描数据
|
|
//扫描数据
|
|
- private List<ToolDetailBean> scanDataList = new ArrayList<>() ;
|
|
|
|
|
|
+ private List<ToolDetailBean> scanShowList = new ArrayList<>() ;
|
|
|
|
|
|
//扫描记录
|
|
//扫描记录
|
|
//private JSONObject scanOrderList = new JSONObject() ; citys = new String[jsonArray.length()][];
|
|
//private JSONObject scanOrderList = new JSONObject() ; citys = new String[jsonArray.length()][];
|
|
|
|
|
|
- //private List<ToolDetailBean>[] cacheList = [0][1];
|
|
|
|
- // private List<map<ToolDetailBean> cacheList55 = new ArrayList<>();
|
|
|
|
-
|
|
|
|
-// private List<ToolDetailBean>[] cacheList ;
|
|
|
|
|
|
+ private String scanBatch = "";
|
|
|
|
|
|
- private Map<String,List<ToolDetailBean>> cacheList = new HashMap<String,List<ToolDetailBean>>();
|
|
|
|
|
|
+ private Map<Integer,List<ToolDetailBean>> cacheList = new HashMap<>();
|
|
private Unbinder unbinder;
|
|
private Unbinder unbinder;
|
|
|
|
|
|
|
|
|
|
@@ -223,8 +214,8 @@ public class OrderToolMainActivity extends BaseActivity implements StoJNI.ScanC
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ //
|
|
|
|
+ scanBatch = UUID.randomUUID().toString();
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -268,13 +259,18 @@ public class OrderToolMainActivity extends BaseActivity implements StoJNI.ScanC
|
|
|
|
|
|
List<ToolDetailBean> tmpList = new ArrayList<>();
|
|
List<ToolDetailBean> tmpList = new ArrayList<>();
|
|
|
|
|
|
- if (cacheList.get(String.valueOf(position))!=null){
|
|
|
|
- tmpList = cacheList.get(String.valueOf(position));
|
|
|
|
|
|
+ if (cacheList.get(position)!=null){
|
|
|
|
+ tmpList = cacheList.get(position);
|
|
}else{
|
|
}else{
|
|
tmpList.clear();
|
|
tmpList.clear();
|
|
|
|
+ mAdapter.setEmptyView(emptyView);
|
|
}
|
|
}
|
|
|
|
|
|
- mAdapter.setNewData(tmpList);
|
|
|
|
|
|
+
|
|
|
|
+ scanShowList.clear();
|
|
|
|
+ scanShowList.addAll(tmpList);
|
|
|
|
+ Collections.reverse(scanShowList);
|
|
|
|
+ mAdapter.setNewData(scanShowList);
|
|
mAdapter.notifyDataSetChanged();
|
|
mAdapter.notifyDataSetChanged();
|
|
|
|
|
|
|
|
|
|
@@ -287,6 +283,8 @@ public class OrderToolMainActivity extends BaseActivity implements StoJNI.ScanC
|
|
|
|
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -303,9 +301,6 @@ public class OrderToolMainActivity extends BaseActivity implements StoJNI.ScanC
|
|
ActionBean bean = JsonUtil.getObject(response.body(), ActionBean.class);
|
|
ActionBean bean = JsonUtil.getObject(response.body(), ActionBean.class);
|
|
if(bean.code == 1){
|
|
if(bean.code == 1){
|
|
batchList = JsonUtil.jsonString2Beans(bean.data, ToolBean.class);
|
|
batchList = JsonUtil.jsonString2Beans(bean.data, ToolBean.class);
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
intSpinner();
|
|
intSpinner();
|
|
getDetails();
|
|
getDetails();
|
|
isVerify = batchList.get(0).getRules() == 1;
|
|
isVerify = batchList.get(0).getRules() == 1;
|
|
@@ -321,12 +316,27 @@ public class OrderToolMainActivity extends BaseActivity implements StoJNI.ScanC
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //查询
|
|
|
|
+
|
|
|
|
+// RealmQuery query = mRealm.where(ToolScanRealm.class);
|
|
|
|
+// RealmResults list = query.findAll();
|
|
|
|
+// if(list==null || list.size()==0){
|
|
|
|
+// XLog.e( "query: no data!" );
|
|
|
|
+// }else{
|
|
|
|
+// XLog.e("query: size: "+list.size());
|
|
|
|
+// ToolScanRealm tmpRealm = (ToolScanRealm) list.get(0);
|
|
|
|
+// XLog.e("query: "+tmpRealm.getNumber() );
|
|
|
|
+// }
|
|
|
|
+
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
batchList.size();
|
|
batchList.size();
|
|
XLog.e("请求批次信息错误:"+e.getMessage(),e);
|
|
XLog.e("请求批次信息错误:"+e.getMessage(),e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 获取批次详情
|
|
* 获取批次详情
|
|
*/
|
|
*/
|
|
@@ -341,12 +351,11 @@ public class OrderToolMainActivity extends BaseActivity implements StoJNI.ScanC
|
|
super.onSuccess(response);
|
|
super.onSuccess(response);
|
|
try {
|
|
try {
|
|
ActionBean bean = JsonUtil.getObject(response.body(), ActionBean.class);
|
|
ActionBean bean = JsonUtil.getObject(response.body(), ActionBean.class);
|
|
-
|
|
|
|
- if (StringUtils.isNotEmpty(bean.data)) {
|
|
|
|
- batchDetails = new JSONObject(bean.data);
|
|
|
|
- }
|
|
|
|
|
|
+ batchDetails = new JSONObject();
|
|
if(bean.code == 1){
|
|
if(bean.code == 1){
|
|
-
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(bean.data)) {
|
|
|
|
+ batchDetails = new JSONObject(bean.data);
|
|
|
|
+ }
|
|
}else{
|
|
}else{
|
|
showWarningToast(bean.msg);
|
|
showWarningToast(bean.msg);
|
|
}
|
|
}
|
|
@@ -387,10 +396,11 @@ public class OrderToolMainActivity extends BaseActivity implements StoJNI.ScanC
|
|
public void run() {
|
|
public void run() {
|
|
try {
|
|
try {
|
|
|
|
|
|
- ToolDetailBean toolDetailBean = cacheList.get(String.valueOf(batch_inx)).get(inx);
|
|
|
|
|
|
+ ToolDetailBean toolDetailBean = cacheList.get(batch_inx).get(inx);
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
jsonObject.put("batch_inx",batch_inx);
|
|
jsonObject.put("batch_inx",batch_inx);
|
|
jsonObject.put("inx",inx);
|
|
jsonObject.put("inx",inx);
|
|
|
|
+ jsonObject.put("realm_id",toolDetailBean.getRealmId());
|
|
jsonObject.put("id",toolDetailBean.getId());
|
|
jsonObject.put("id",toolDetailBean.getId());
|
|
jsonObject.put("rules",toolDetailBean.getRules());
|
|
jsonObject.put("rules",toolDetailBean.getRules());
|
|
jsonObject.put("tool_data_id",toolDetailBean.getToolDataId());
|
|
jsonObject.put("tool_data_id",toolDetailBean.getToolDataId());
|
|
@@ -412,17 +422,36 @@ public class OrderToolMainActivity extends BaseActivity implements StoJNI.ScanC
|
|
int push_status = bean.code == 1 ? 1 : 2;
|
|
int push_status = bean.code == 1 ? 1 : 2;
|
|
|
|
|
|
|
|
|
|
- List<ToolDetailBean> list = cacheList.get(String.valueOf(batch_inx));
|
|
|
|
|
|
+ List<ToolDetailBean> list = cacheList.get(batch_inx);
|
|
ToolDetailBean tmpBean = list.get(position);;
|
|
ToolDetailBean tmpBean = list.get(position);;
|
|
tmpBean.setPushStatus(push_status);
|
|
tmpBean.setPushStatus(push_status);
|
|
|
|
|
|
- cacheList.put(String.valueOf(batch_inx),list);
|
|
|
|
- updateResult(position);
|
|
|
|
|
|
+ cacheList.put(batch_inx,list);
|
|
|
|
+ updateResult(batch_inx,position);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 保存一下数据
|
|
|
|
+ mRealm.beginTransaction();
|
|
|
|
+ RealmQuery query = mRealm.where(ToolScanRealm.class);
|
|
|
|
+ RealmResults realList = query.equalTo("id",tmpBean.getRealmId()).findAll();
|
|
|
|
+ if(realList.size() > 0){
|
|
|
|
+ ToolScanRealm tmpRealm = (ToolScanRealm) realList.get(0);
|
|
|
|
+ tmpRealm.setPushStatus(push_status);
|
|
|
|
+ }
|
|
|
|
+ mRealm.commitTransaction();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if (bean.msg.equals("重复扫描")){
|
|
|
|
+ showRepeatToast("重复扫描");
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
showEmptyView("上传失败:"+e.getMessage());
|
|
showEmptyView("上传失败:"+e.getMessage());
|
|
|
|
+
|
|
|
|
+
|
|
XLog.e("获取批次详情解析错误",e.getMessage());
|
|
XLog.e("获取批次详情解析错误",e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -442,36 +471,46 @@ public class OrderToolMainActivity extends BaseActivity implements StoJNI.ScanC
|
|
@Override
|
|
@Override
|
|
public void handleMessage(Message msg) {
|
|
public void handleMessage(Message msg) {
|
|
ToolDetailBean tmpBean ;
|
|
ToolDetailBean tmpBean ;
|
|
- List<ToolDetailBean> list = cacheList.get(String.valueOf(batchIdx));
|
|
|
|
- if (list==null){
|
|
|
|
- list = new ArrayList<>();
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
switch (msg.what){
|
|
switch (msg.what){
|
|
//添加日志
|
|
//添加日志
|
|
case 1:
|
|
case 1:
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ List<ToolDetailBean> list = cacheList.get(batchIdx);
|
|
|
|
+ if (list==null){
|
|
|
|
+ list = new ArrayList<>();
|
|
|
|
+ }
|
|
int inx = list.size();
|
|
int inx = list.size();
|
|
|
|
|
|
|
|
|
|
tmpBean = JsonUtil.getObject(msg.obj.toString(), ToolDetailBean.class); ;
|
|
tmpBean = JsonUtil.getObject(msg.obj.toString(), ToolDetailBean.class); ;
|
|
list.add(tmpBean);
|
|
list.add(tmpBean);
|
|
- mAdapter.addData(inx,tmpBean);
|
|
|
|
- mAdapter.notifyDataSetChanged();
|
|
|
|
-
|
|
|
|
- cacheList.put(String.valueOf(batchIdx),list);
|
|
|
|
|
|
+ cacheList.put(batchIdx,list);
|
|
pushData(batchIdx,inx);
|
|
pushData(batchIdx,inx);
|
|
|
|
|
|
|
|
+ //倒序显示
|
|
|
|
+ scanShowList.clear();
|
|
|
|
+ scanShowList.addAll(cacheList.get(batchIdx));
|
|
|
|
+ Collections.reverse(scanShowList);
|
|
|
|
+ mAdapter.setNewData(scanShowList);
|
|
|
|
+ mAdapter.notifyDataSetChanged();
|
|
|
|
+
|
|
System.out.println("总条数:"+inx);
|
|
System.out.println("总条数:"+inx);
|
|
break;
|
|
break;
|
|
// 修改日志
|
|
// 修改日志
|
|
case 2:
|
|
case 2:
|
|
|
|
|
|
- int position = msg.arg1;
|
|
|
|
- tmpBean = list.get(position);
|
|
|
|
- mAdapter.setData(position,tmpBean);
|
|
|
|
- mAdapter.notifyItemChanged(position);
|
|
|
|
- System.out.println("当前:"+position);
|
|
|
|
|
|
+ int batch_inx = msg.arg1;
|
|
|
|
+
|
|
|
|
+ //倒序显示
|
|
|
|
+ List<ToolDetailBean> newList = cacheList.get(batch_inx);
|
|
|
|
+ //倒序显示
|
|
|
|
+ scanShowList.clear();
|
|
|
|
+ scanShowList.addAll(newList);
|
|
|
|
+ Collections.reverse(scanShowList);
|
|
|
|
+ mAdapter.setNewData(scanShowList);
|
|
|
|
+ mAdapter.notifyDataSetChanged();
|
|
|
|
+
|
|
|
|
+
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -485,10 +524,11 @@ public class OrderToolMainActivity extends BaseActivity implements StoJNI.ScanC
|
|
resultHandler.sendMessage(msg);
|
|
resultHandler.sendMessage(msg);
|
|
}
|
|
}
|
|
|
|
|
|
- private void updateResult(int inx){
|
|
|
|
|
|
+ private void updateResult(int batch_inx,int inx){
|
|
Message msg = new Message();
|
|
Message msg = new Message();
|
|
msg.what = 2;
|
|
msg.what = 2;
|
|
- msg.arg1 = inx;
|
|
|
|
|
|
+ msg.arg1 = batch_inx;
|
|
|
|
+ msg.arg2 = inx;
|
|
msg.obj = "";
|
|
msg.obj = "";
|
|
resultHandler.sendMessage(msg);
|
|
resultHandler.sendMessage(msg);
|
|
}
|
|
}
|
|
@@ -673,6 +713,7 @@ public class OrderToolMainActivity extends BaseActivity implements StoJNI.ScanC
|
|
|
|
|
|
|
|
|
|
public void doVerify() {
|
|
public void doVerify() {
|
|
|
|
+
|
|
//校验数据
|
|
//校验数据
|
|
if (!validate()){
|
|
if (!validate()){
|
|
return;
|
|
return;
|
|
@@ -681,8 +722,9 @@ public class OrderToolMainActivity extends BaseActivity implements StoJNI.ScanC
|
|
try {
|
|
try {
|
|
String number = etOrderNo.getText().toString().trim();
|
|
String number = etOrderNo.getText().toString().trim();
|
|
JSONObject param = new JSONObject();
|
|
JSONObject param = new JSONObject();
|
|
- param.put("number",number);
|
|
|
|
- param.put("is_verify",isVerify);
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ String realmId = UUID.randomUUID().toString();
|
|
|
|
|
|
|
|
|
|
int tool_data_id = 0;
|
|
int tool_data_id = 0;
|
|
@@ -693,21 +735,46 @@ public class OrderToolMainActivity extends BaseActivity implements StoJNI.ScanC
|
|
|
|
|
|
JSONObject tmpObject = batchDetails.getJSONObject(number.toUpperCase());
|
|
JSONObject tmpObject = batchDetails.getJSONObject(number.toUpperCase());
|
|
if (tmpObject.has("scan_date") && !tmpObject.getString("scan_date").equals("")){
|
|
if (tmpObject.has("scan_date") && !tmpObject.getString("scan_date").equals("")){
|
|
- showWarningToast("订单已扫描");
|
|
|
|
|
|
+ showRepeatToast("订单已扫描");
|
|
return ;
|
|
return ;
|
|
};
|
|
};
|
|
id = tmpObject.getInt("id");
|
|
id = tmpObject.getInt("id");
|
|
}
|
|
}
|
|
|
|
|
|
tool_data_id = batchList.get(batchIdx).getId();
|
|
tool_data_id = batchList.get(batchIdx).getId();
|
|
|
|
+
|
|
|
|
+ param.put("realm_id",realmId);
|
|
|
|
+ param.put("number",number);
|
|
|
|
+ param.put("is_verify",isVerify);
|
|
param.put("tool_data_id",tool_data_id);
|
|
param.put("tool_data_id",tool_data_id);
|
|
param.put("id",id);
|
|
param.put("id",id);
|
|
param.put("rules",rules);
|
|
param.put("rules",rules);
|
|
param.put("scan_date",scan_date);
|
|
param.put("scan_date",scan_date);
|
|
|
|
+ addResult(param.toString());
|
|
|
|
|
|
|
|
+// if (cacheList.get(batchIdx)!=null && cacheList.get(batchIdx).size()<50000){
|
|
|
|
+// for (int u=0;u<5000;u++){
|
|
|
|
+// param.put("number",number+u);
|
|
|
|
+// addResult(param.toString());
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
|
|
|
|
|
|
- addResult(param.toString());
|
|
|
|
|
|
+
|
|
|
|
+ //同步操作写法一:
|
|
|
|
+ mRealm.beginTransaction();
|
|
|
|
+ //会创建对象和user表
|
|
|
|
+ ToolScanRealm toolScan = mRealm.createObject(ToolScanRealm.class,realmId);
|
|
|
|
+ //会自动更新表
|
|
|
|
+ toolScan.setScanBatch(scanBatch);
|
|
|
|
+ toolScan.setNumber(number);
|
|
|
|
+ toolScan.setToolDataId(tool_data_id);
|
|
|
|
+ toolScan.setDetailsId(id);
|
|
|
|
+ toolScan.setRules(rules);
|
|
|
|
+ toolScan.setScanDate(scan_date);
|
|
|
|
+ //提交事务,操作就被执行
|
|
|
|
+ mRealm.commitTransaction();
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -730,6 +797,9 @@ public class OrderToolMainActivity extends BaseActivity implements StoJNI.ScanC
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* 校验必录
|
|
* 校验必录
|
|
*/
|
|
*/
|
|
@@ -745,11 +815,11 @@ public class OrderToolMainActivity extends BaseActivity implements StoJNI.ScanC
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
ToolBean toolBean = batchList.get(batchIdx);
|
|
ToolBean toolBean = batchList.get(batchIdx);
|
|
- if (toolBean.getRules()==1 && cacheList.get(String.valueOf(batchIdx)) != null){
|
|
|
|
|
|
+ if (toolBean.getRules()==1 && cacheList.get(batchIdx) != null){
|
|
String number = etOrderNo.getText().toString().trim();
|
|
String number = etOrderNo.getText().toString().trim();
|
|
- for (int i = 0; i <cacheList.get(String.valueOf(batchIdx)).size(); i++){
|
|
|
|
- if (cacheList.get(String.valueOf(batchIdx)).get(i).getNumber().toUpperCase().equals(number)){
|
|
|
|
- showWarningToast("订单已扫描");
|
|
|
|
|
|
+ for (int i = 0; i <cacheList.get(batchIdx).size(); i++){
|
|
|
|
+ if (cacheList.get(batchIdx).get(i).getNumber().toUpperCase().equals(number)){
|
|
|
|
+ showRepeatToast("订单已扫描");
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -793,13 +863,15 @@ public class OrderToolMainActivity extends BaseActivity implements StoJNI.ScanC
|
|
emptyView = this.getLayoutInflater().inflate(R.layout.pager_empty, (ViewGroup) recyclerView.getParent(), false);
|
|
emptyView = this.getLayoutInflater().inflate(R.layout.pager_empty, (ViewGroup) recyclerView.getParent(), false);
|
|
errorView = this.getLayoutInflater().inflate(R.layout.pager_error, (ViewGroup) recyclerView.getParent(), false);
|
|
errorView = this.getLayoutInflater().inflate(R.layout.pager_error, (ViewGroup) recyclerView.getParent(), false);
|
|
notDataView = emptyView;
|
|
notDataView = emptyView;
|
|
-
|
|
|
|
- mAdapter = new FinishWorkAdapter(new ArrayList<ToolDetailBean>());
|
|
|
|
|
|
+ mAdapter = new FinishWorkAdapter(scanShowList);
|
|
mAdapter.setEmptyView(emptyView);
|
|
mAdapter.setEmptyView(emptyView);
|
|
mAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
|
|
mAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
|
|
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
|
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
|
recyclerView.setAdapter(mAdapter);
|
|
recyclerView.setAdapter(mAdapter);
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
//清除订单信息
|
|
//清除订单信息
|
|
@@ -833,7 +905,7 @@ public class OrderToolMainActivity extends BaseActivity implements StoJNI.ScanC
|
|
|
|
|
|
int num = 0;
|
|
int num = 0;
|
|
|
|
|
|
- for (String key : cacheList.keySet()) {
|
|
|
|
|
|
+ for (int key : cacheList.keySet()) {
|
|
|
|
|
|
if (cacheList.get(key)!=null){
|
|
if (cacheList.get(key)!=null){
|
|
for (int j=0;j<cacheList.get(key).size();j++){
|
|
for (int j=0;j<cacheList.get(key).size();j++){
|
|
@@ -964,6 +1036,8 @@ public class OrderToolMainActivity extends BaseActivity implements StoJNI.ScanC
|
|
super.onPause();
|
|
super.onPause();
|
|
//销毁在onResume()方法中的广播
|
|
//销毁在onResume()方法中的广播
|
|
try {
|
|
try {
|
|
|
|
+
|
|
|
|
+
|
|
//停止扫描
|
|
//停止扫描
|
|
Integer is_broadcast = scanBean.getIsBroadcast();//是否广播
|
|
Integer is_broadcast = scanBean.getIsBroadcast();//是否广播
|
|
if (is_broadcast==0){
|
|
if (is_broadcast==0){
|