|
|
|
@ -25,10 +25,12 @@ import com.google.gson.reflect.TypeToken;
|
|
|
|
|
import com.lzy.okgo.OkGo;
|
|
|
|
|
import com.lzy.okgo.model.Response;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class CheckActivity extends BaseActivity implements AdapterClickCall, InPutDialog.InPutDialogCall {
|
|
|
|
|
private ActivityCheckBinding binding;
|
|
|
|
|
private CheckAdapter adapter;
|
|
|
|
@ -37,6 +39,7 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
|
|
|
|
|
private ObservableBoolean state;
|
|
|
|
|
private ObservableBoolean checkState;
|
|
|
|
|
private InPutDialog inputDialog;
|
|
|
|
|
private boolean sanType;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
@ -45,26 +48,27 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
|
|
|
|
|
adapter = new CheckAdapter(this, this);
|
|
|
|
|
state = new ObservableBoolean();
|
|
|
|
|
checkState = new ObservableBoolean();
|
|
|
|
|
|
|
|
|
|
binding.setAdapter(adapter);
|
|
|
|
|
binding.setState(state);
|
|
|
|
|
binding.setCheckState(checkState);
|
|
|
|
|
selectList = Arrays.asList(getResources().getStringArray(R.array.check_item));
|
|
|
|
|
binding.checkItemSelect.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
|
|
|
var selectItem = selectList.get(position);
|
|
|
|
|
state.set(selectItem.equals("正常"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// binding.checkItemSelect.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
|
// @Override
|
|
|
|
|
// public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
|
|
|
// var selectItem = selectList.get(position);
|
|
|
|
|
// state.set(selectItem.equals("正常"));
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// @Override
|
|
|
|
|
// public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
initRequest();
|
|
|
|
|
inputDialog = new InPutDialog(this);
|
|
|
|
|
inputDialog.setInPutDialogCall(this);
|
|
|
|
|
|
|
|
|
|
tagList = new ArrayList<>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 初始化数据
|
|
|
|
@ -90,20 +94,39 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<String> tagList;
|
|
|
|
|
private int subIndex = -1;
|
|
|
|
|
// 扫描一个验证
|
|
|
|
|
|
|
|
|
|
// 扫描到返回数据
|
|
|
|
|
@Override
|
|
|
|
|
protected void sanRfid(List<String> epcs) {
|
|
|
|
|
var text = epcs.get(0);
|
|
|
|
|
binding.checkEpc.setText(text);
|
|
|
|
|
Stock stock = new Stock();
|
|
|
|
|
stock.setEpcCode(text);
|
|
|
|
|
var index = list.indexOf(stock);
|
|
|
|
|
if (index == -1) {
|
|
|
|
|
Toast.makeText(this, "轮挡扫描错误", Toast.LENGTH_SHORT).show();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
subIndex = index;
|
|
|
|
|
|
|
|
|
|
// var text = epcs.get(0);
|
|
|
|
|
// binding.checkEpc.setText(text);
|
|
|
|
|
// Stock stock = new Stock();
|
|
|
|
|
// stock.setEpcCode(text);
|
|
|
|
|
// var index = list.indexOf(stock);
|
|
|
|
|
// if (index == -1) {
|
|
|
|
|
// Toast.makeText(this, "轮挡扫描错误", Toast.LENGTH_SHORT).show();
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// subIndex = index;
|
|
|
|
|
|
|
|
|
|
epcs.forEach(t -> {
|
|
|
|
|
if (tagList.contains(t)) {
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
tagList.add(t);
|
|
|
|
|
var stock = new Stock();
|
|
|
|
|
stock.setEpcCode(t);
|
|
|
|
|
var index = list.indexOf(stock);
|
|
|
|
|
if (index != -1) {
|
|
|
|
|
list.get(index).setState("正常");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
adapter.notifyDataSetChanged();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//提交数据
|
|
|
|
@ -124,15 +147,15 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// 一条数据保存
|
|
|
|
|
public void check_stock(View view) {
|
|
|
|
|
if (subIndex == -1) return;
|
|
|
|
|
var stock = list.get(subIndex);
|
|
|
|
|
stock.setState(binding.checkItemSelect.getSelectedItem().toString());
|
|
|
|
|
stock.setRemark(binding.checkRemark.getText().toString());
|
|
|
|
|
adapter.notifyItemChanged(subIndex);
|
|
|
|
|
binding.checkRemark.setText(null);
|
|
|
|
|
binding.checkEpc.setText(null);
|
|
|
|
|
}
|
|
|
|
|
// public void check_stock(View view) {
|
|
|
|
|
// if (subIndex == -1) return;
|
|
|
|
|
// var stock = list.get(subIndex);
|
|
|
|
|
// stock.setState(binding.checkItemSelect.getSelectedItem().toString());
|
|
|
|
|
// stock.setRemark(binding.checkRemark.getText().toString());
|
|
|
|
|
// adapter.notifyItemChanged(subIndex);
|
|
|
|
|
// binding.checkRemark.setText(null);
|
|
|
|
|
// binding.checkEpc.setText(null);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
private int tag;
|
|
|
|
|
|
|
|
|
@ -151,6 +174,7 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
|
|
|
|
|
inputDialog.dismiss();
|
|
|
|
|
adapter.notifyDataSetChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 持续扫描按钮
|
|
|
|
|
public void offCheckRead(View view) {
|
|
|
|
|
var b = checkState.get();
|
|
|
|
|