|
|
|
@ -5,6 +5,7 @@ import androidx.databinding.DataBindingUtil;
|
|
|
|
|
import androidx.databinding.ObservableBoolean;
|
|
|
|
|
|
|
|
|
|
import android.annotation.SuppressLint;
|
|
|
|
|
import android.content.Intent;
|
|
|
|
|
import android.graphics.Bitmap;
|
|
|
|
|
import android.os.Bundle;
|
|
|
|
|
import android.os.Handler;
|
|
|
|
@ -22,6 +23,7 @@ import com.example.beijing_daxing.been.Stock;
|
|
|
|
|
import com.example.beijing_daxing.databinding.ActivityCheckBinding;
|
|
|
|
|
import com.example.beijing_daxing.dialog.InPutDialog;
|
|
|
|
|
import com.example.beijing_daxing.dialog.TakePictureDialog;
|
|
|
|
|
import com.example.beijing_daxing.uitls.HexAscii;
|
|
|
|
|
import com.example.beijing_daxing.uitls.SharedPreferencesUtils;
|
|
|
|
|
import com.google.gson.reflect.TypeToken;
|
|
|
|
|
import com.lzy.okgo.OkGo;
|
|
|
|
@ -45,8 +47,9 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
|
|
|
|
|
private ObservableBoolean state;
|
|
|
|
|
private ObservableBoolean checkState;
|
|
|
|
|
private InPutDialog inputDialog;
|
|
|
|
|
private boolean sanType;
|
|
|
|
|
private TakePictureDialog takeDialog;
|
|
|
|
|
private long id;
|
|
|
|
|
private long inspectionId;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
@ -58,32 +61,35 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
|
|
|
|
|
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) {
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
initRequest(getIntent().getIntExtra("id",0));
|
|
|
|
|
/*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) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});*/
|
|
|
|
|
Intent intent = getIntent();
|
|
|
|
|
id = intent.getLongExtra("id", 0);
|
|
|
|
|
inspectionId = intent.getLongExtra("inspectionId", 0);
|
|
|
|
|
String code = intent.getStringExtra("code");
|
|
|
|
|
initRequest(code);
|
|
|
|
|
inputDialog = new InPutDialog(this);
|
|
|
|
|
inputDialog.setInPutDialogCall(this);
|
|
|
|
|
tagList = new ArrayList<>();
|
|
|
|
|
takeDialog=new TakePictureDialog(this);
|
|
|
|
|
takeDialog = new TakePictureDialog(this);
|
|
|
|
|
takeDialog.setCall(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 初始化数据
|
|
|
|
|
private void initRequest(int id) {
|
|
|
|
|
OkGo.<MyResult>post(url + "/xj/select")
|
|
|
|
|
.params("id", id)
|
|
|
|
|
.execute(new MyRecultCall(dialog, this) {
|
|
|
|
|
private void initRequest(String code) {
|
|
|
|
|
OkGo.<MyResult>post(url + "/inspection/select").params("code", code).execute(new MyRecultCall(dialog, this) {
|
|
|
|
|
@SuppressLint("NotifyDataSetChanged")
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(Response<MyResult> response) {
|
|
|
|
|
super.onSuccess(response);
|
|
|
|
@ -108,29 +114,18 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
|
|
|
|
|
private int subIndex = -1;
|
|
|
|
|
|
|
|
|
|
// 扫描到返回数据
|
|
|
|
|
@SuppressLint("NotifyDataSetChanged")
|
|
|
|
|
@Override
|
|
|
|
|
protected void sanRfid(List<Reader.TAGINFO> 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;
|
|
|
|
|
|
|
|
|
|
epcs.forEach(t -> {
|
|
|
|
|
var epc= Tools.Bytes2HexString(t.EpcId,t.EpcId.length);
|
|
|
|
|
var epc = Tools.Bytes2HexString(t.EpcId, t.EpcId.length);
|
|
|
|
|
if (tagList.contains(t)) {
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
tagList.add(epc);
|
|
|
|
|
|
|
|
|
|
var stock = new Stock();
|
|
|
|
|
stock.setEpcCode(epc);
|
|
|
|
|
stock.setEpcCode(HexAscii.hex2Str(epc));
|
|
|
|
|
var index = list.indexOf(stock);
|
|
|
|
|
if (index != -1) {
|
|
|
|
|
list.get(index).setState("正常");
|
|
|
|
@ -140,15 +135,19 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//提交数据
|
|
|
|
|
// 完成巡检,提交数据
|
|
|
|
|
public void check_submit(View view) {
|
|
|
|
|
|
|
|
|
|
var type = list.stream().anyMatch(t -> t.getState().equals("未检"));
|
|
|
|
|
if (type) {
|
|
|
|
|
Toast.makeText(this, "未检完全部轮挡,不允许提交", Toast.LENGTH_SHORT).show();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
OkGo.<MyResult>post(url + "/xj/submit").tag(this).params("json", gson.toJson(list)).params("user", SharedPreferencesUtils.getstring("user", "test-user")).execute(new MyRecultCall(dialog, this) {
|
|
|
|
|
OkGo.<MyResult>post(url + "/xj/submit").tag(this)
|
|
|
|
|
.params("tableId", id)
|
|
|
|
|
.params("json", gson.toJson(list))
|
|
|
|
|
.params("inspectionId",inspectionId)
|
|
|
|
|
.addFileParams("files",files)
|
|
|
|
|
.execute(new MyRecultCall(dialog, this) {
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(Response<MyResult> response) {
|
|
|
|
|
super.onSuccess(response);
|
|
|
|
@ -177,6 +176,7 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressLint("NotifyDataSetChanged")
|
|
|
|
|
@Override
|
|
|
|
|
public void inPutDialogReculi(String name) {
|
|
|
|
|
var stock = list.get(tag);
|
|
|
|
@ -204,6 +204,7 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
|
|
|
|
|
super.handleMessage(msg);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private Runnable runnable = new Runnable() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
@ -214,26 +215,28 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 拍照
|
|
|
|
|
public void check_tackPhoto(View view){
|
|
|
|
|
public void check_tackPhoto(View view) {
|
|
|
|
|
teke_photo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 显示拍的照片
|
|
|
|
|
public void check_showPhoto(View view){
|
|
|
|
|
public void check_showPhoto(View view) {
|
|
|
|
|
takeDialog.setBitmaps(bitmaps, files);
|
|
|
|
|
takeDialog.show();
|
|
|
|
|
}
|
|
|
|
|
private List<File> files=new ArrayList<>();
|
|
|
|
|
private List<Bitmap> bitmaps=new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
private List<File> files = new ArrayList<>();
|
|
|
|
|
private List<Bitmap> bitmaps = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void takePhotoCall(File outputImage, Bitmap bitmap) {
|
|
|
|
|
files.add(outputImage);
|
|
|
|
|
bitmaps.add(bitmap);
|
|
|
|
|
binding. confirmPictureNumber2.setText(bitmaps.size() + "");
|
|
|
|
|
binding.confirmPictureNumber2.setText(bitmaps.size() + "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void returnListSize(int size) {
|
|
|
|
|
binding. confirmPictureNumber2.setText(bitmaps.size() + "");
|
|
|
|
|
|
|
|
|
|
binding.confirmPictureNumber2.setText(bitmaps.size() + "");
|
|
|
|
|
}
|
|
|
|
|
}
|