|
|
|
|
@ -22,6 +22,7 @@ import com.example.aucma_mes.adapter.RepaitSubmintInfoAdapter;
|
|
|
|
|
import com.example.aucma_mes.base.BaseActivity;
|
|
|
|
|
import com.example.aucma_mes.databinding.ActivityCheckBinding;
|
|
|
|
|
import com.example.aucma_mes.dialog.RepairSubmintInfoDialog;
|
|
|
|
|
import com.example.aucma_mes.entity.CheckSum;
|
|
|
|
|
import com.example.aucma_mes.entity.DefectBeen;
|
|
|
|
|
import com.example.aucma_mes.entity.DictBeen;
|
|
|
|
|
import com.example.aucma_mes.entity.Result;
|
|
|
|
|
@ -52,10 +53,24 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
|
|
|
|
|
private List<List<String>> options2;
|
|
|
|
|
private List<List<List<String>>> options3;
|
|
|
|
|
private List<DefectBeen> topDefects;
|
|
|
|
|
|
|
|
|
|
private String stationCode;
|
|
|
|
|
private CheckSum checkSum;
|
|
|
|
|
@Override
|
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
initView();
|
|
|
|
|
Intent intent = getIntent();
|
|
|
|
|
stationCode = intent.getStringExtra("stationCode");
|
|
|
|
|
// 查询检测
|
|
|
|
|
initStationSum();
|
|
|
|
|
checkViewModel.setStationCode(stationCode);
|
|
|
|
|
binding.setTitle("质量检测 - " + intent.getStringExtra("stationName"));
|
|
|
|
|
// 三联
|
|
|
|
|
initOptionpb(stationCode);
|
|
|
|
|
tipDialog = new RepairSubmintInfoDialog(this, this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void initView() {
|
|
|
|
|
binding = DataBindingUtil.setContentView(this, R.layout.activity_check);
|
|
|
|
|
checkViewModel = new CheckViewModel();
|
|
|
|
|
getSupportActionBar().hide();
|
|
|
|
|
@ -64,13 +79,28 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
|
|
|
|
|
submitList = new ArrayList<>();
|
|
|
|
|
checkAdapter.setList(submitList);
|
|
|
|
|
binding.recyclerView.setAdapter(checkAdapter);
|
|
|
|
|
Intent intent = getIntent();
|
|
|
|
|
String stationCode = intent.getStringExtra("stationCode");
|
|
|
|
|
checkViewModel.setStationCode(stationCode);
|
|
|
|
|
binding.setTitle("质量检测 - "+ intent.getStringExtra("stationName"));
|
|
|
|
|
// 三联
|
|
|
|
|
initOptionpb(stationCode);
|
|
|
|
|
tipDialog = new RepairSubmintInfoDialog(this, this);
|
|
|
|
|
checkSum=new CheckSum();
|
|
|
|
|
binding.setSum(checkSum);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void initStationSum() {
|
|
|
|
|
OkGo.<Result>post(url + "/api/pdaQueryQuantityNumber").tag(this)
|
|
|
|
|
.headers("Authorization", SharedPreferencesUtils.getstring("token", ""))
|
|
|
|
|
.params("stationCode", stationCode).execute(new MyRecultCall(dialog, this) {
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(Response<Result> response) {
|
|
|
|
|
super.onSuccess(response);
|
|
|
|
|
Result result = response.body();
|
|
|
|
|
if (result.getCode() == 200) {
|
|
|
|
|
var data = result.getData();
|
|
|
|
|
if (data !=null){
|
|
|
|
|
CheckSum checkSum1= gson.fromJson(data.toString(),CheckSum.class);
|
|
|
|
|
checkSum.setQUANTITY_SUM(checkSum1.getQUANTITY_SUM());
|
|
|
|
|
checkSum.setREPAIR_SUM(checkSum1.getREPAIR_SUM());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 扫码
|
|
|
|
|
@ -121,29 +151,29 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
|
|
|
|
|
if (checkViewModel.getName() == null || checkViewModel.getName().isEmpty()) return;
|
|
|
|
|
checkViewModel.setList(submitList);
|
|
|
|
|
checkViewModel.setMeasure(submitList.isEmpty() ? "3" : "1");
|
|
|
|
|
checkViewModel.setUserName(SharedPreferencesUtils.getstring("pdaName", "pda01"));
|
|
|
|
|
checkViewModel.setTeamCode(SharedPreferencesUtils.getstring("teamCode",null));
|
|
|
|
|
checkViewModel.setUserName(SharedPreferencesUtils.getstring("loginName", "pda01"));
|
|
|
|
|
checkViewModel.setTeamCode(SharedPreferencesUtils.getstring("teamCode", null));
|
|
|
|
|
OkGo.<Result>post(url + "/api/checkSubmit").tag(this)
|
|
|
|
|
.headers("Authorization", SharedPreferencesUtils.getstring("token", ""))
|
|
|
|
|
.upRequestBody(RequestBody.create(JSON, gson.toJson(checkViewModel)))
|
|
|
|
|
.execute(new MyRecultCall(dialog, this) {
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(Response<Result> response) {
|
|
|
|
|
super.onSuccess(response);
|
|
|
|
|
Result result = response.body();
|
|
|
|
|
if (result.getCode() == 200) {
|
|
|
|
|
Toast.makeText(CheckActivity.this, "提交成功", Toast.LENGTH_SHORT).show();
|
|
|
|
|
checkViewModel.setCode(null);
|
|
|
|
|
checkViewModel.setName(null);
|
|
|
|
|
checkViewModel.setDefect(null);
|
|
|
|
|
checkViewModel.setButtonVisbleState(false);
|
|
|
|
|
submitList.clear();
|
|
|
|
|
checkAdapter.notifyDataSetChanged();
|
|
|
|
|
} else {
|
|
|
|
|
Toast.makeText(CheckActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(Response<Result> response) {
|
|
|
|
|
super.onSuccess(response);
|
|
|
|
|
Result result = response.body();
|
|
|
|
|
if (result.getCode() == 200) {
|
|
|
|
|
Toast.makeText(CheckActivity.this, "提交成功", Toast.LENGTH_SHORT).show();
|
|
|
|
|
checkViewModel.setCode(null);
|
|
|
|
|
checkViewModel.setName(null);
|
|
|
|
|
checkViewModel.setDefect(null);
|
|
|
|
|
checkViewModel.setButtonVisbleState(false);
|
|
|
|
|
submitList.clear();
|
|
|
|
|
checkAdapter.notifyDataSetChanged();
|
|
|
|
|
} else {
|
|
|
|
|
Toast.makeText(CheckActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 删除缺陷
|
|
|
|
|
@ -159,55 +189,55 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
|
|
|
|
|
opv = new OptionsPickerBuilder(this, this).build();
|
|
|
|
|
OkGo.<Result>get(url + "/base/qualityInspectionItem/getQualityDefects/" + stationCode).tag(this)
|
|
|
|
|
.headers("Authorization", SharedPreferencesUtils.getstring("token", "")).execute(new MyRecultCall(dialog, this) {
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(Response<Result> response) {
|
|
|
|
|
super.onSuccess(response);
|
|
|
|
|
Result body = response.body();
|
|
|
|
|
Log.e("TAG", "onSuccess:" + body.toString());
|
|
|
|
|
if (body.getCode() == 200) {
|
|
|
|
|
Toast.makeText(CheckActivity.this, "请求成功", Toast.LENGTH_SHORT).show();
|
|
|
|
|
list = gson.fromJson(gson.toJson(body.getData()), new TypeToken<List<DefectBeen>>() {
|
|
|
|
|
}.getType());
|
|
|
|
|
if (list == null || list.isEmpty()) {
|
|
|
|
|
Toast.makeText(CheckActivity.this, "缺陷列表没有维护", Toast.LENGTH_SHORT).show();
|
|
|
|
|
return;
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(Response<Result> response) {
|
|
|
|
|
super.onSuccess(response);
|
|
|
|
|
Result body = response.body();
|
|
|
|
|
Log.e("TAG", "onSuccess:" + body.toString());
|
|
|
|
|
if (body.getCode() == 200) {
|
|
|
|
|
Toast.makeText(CheckActivity.this, "请求成功", Toast.LENGTH_SHORT).show();
|
|
|
|
|
list = gson.fromJson(gson.toJson(body.getData()), new TypeToken<List<DefectBeen>>() {
|
|
|
|
|
}.getType());
|
|
|
|
|
if (list == null || list.isEmpty()) {
|
|
|
|
|
Toast.makeText(CheckActivity.this, "缺陷列表没有维护", Toast.LENGTH_SHORT).show();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
options1 = new ArrayList<>();
|
|
|
|
|
options2 = new ArrayList<>();
|
|
|
|
|
options3 = new ArrayList<>();
|
|
|
|
|
list.forEach(defect -> {
|
|
|
|
|
String materialCategories = defect.getMaterialCategories();
|
|
|
|
|
String materialSubclass = defect.getMaterialSubclass();
|
|
|
|
|
String qualityDefectName = defect.getQualityDefectName();
|
|
|
|
|
|
|
|
|
|
if (!options1.contains(materialCategories)) {
|
|
|
|
|
options1.add(materialCategories);
|
|
|
|
|
}
|
|
|
|
|
int index1 = options1.indexOf(materialCategories);
|
|
|
|
|
if (options2.size() <= index1) {
|
|
|
|
|
options2.add(new ArrayList<>());
|
|
|
|
|
}
|
|
|
|
|
if (!options2.get(index1).contains(materialSubclass)) {
|
|
|
|
|
options2.get(index1).add(materialSubclass);
|
|
|
|
|
}
|
|
|
|
|
int index2 = options2.get(index1).indexOf(materialSubclass);
|
|
|
|
|
if (options3.size() <= index1) {
|
|
|
|
|
options3.add(new ArrayList<>());
|
|
|
|
|
}
|
|
|
|
|
if (options3.get(index1).size() <= index2) {
|
|
|
|
|
options3.get(index1).add(new ArrayList<>());
|
|
|
|
|
}
|
|
|
|
|
if (!options3.get(index1).get(index2).contains(qualityDefectName)) {
|
|
|
|
|
options3.get(index1).get(index2).add(qualityDefectName);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
opv.setPicker(options1, options2, options3);
|
|
|
|
|
} else {
|
|
|
|
|
Toast.makeText(CheckActivity.this, body.getMsg(), Toast.LENGTH_SHORT).show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
options1 = new ArrayList<>();
|
|
|
|
|
options2 = new ArrayList<>();
|
|
|
|
|
options3 = new ArrayList<>();
|
|
|
|
|
list.forEach(defect -> {
|
|
|
|
|
String materialCategories = defect.getMaterialCategories();
|
|
|
|
|
String materialSubclass = defect.getMaterialSubclass();
|
|
|
|
|
String qualityDefectName = defect.getQualityDefectName();
|
|
|
|
|
|
|
|
|
|
if (!options1.contains(materialCategories)) {
|
|
|
|
|
options1.add(materialCategories);
|
|
|
|
|
}
|
|
|
|
|
int index1 = options1.indexOf(materialCategories);
|
|
|
|
|
if (options2.size() <= index1) {
|
|
|
|
|
options2.add(new ArrayList<>());
|
|
|
|
|
}
|
|
|
|
|
if (!options2.get(index1).contains(materialSubclass)) {
|
|
|
|
|
options2.get(index1).add(materialSubclass);
|
|
|
|
|
}
|
|
|
|
|
int index2 = options2.get(index1).indexOf(materialSubclass);
|
|
|
|
|
if (options3.size() <= index1) {
|
|
|
|
|
options3.add(new ArrayList<>());
|
|
|
|
|
}
|
|
|
|
|
if (options3.get(index1).size() <= index2) {
|
|
|
|
|
options3.get(index1).add(new ArrayList<>());
|
|
|
|
|
}
|
|
|
|
|
if (!options3.get(index1).get(index2).contains(qualityDefectName)) {
|
|
|
|
|
options3.get(index1).get(index2).add(qualityDefectName);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
opv.setPicker(options1, options2, options3);
|
|
|
|
|
} else {
|
|
|
|
|
Toast.makeText(CheckActivity.this, body.getMsg(), Toast.LENGTH_SHORT).show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 三联添加
|
|
|
|
|
|