From 2f266b78f38c9adc20656766ec6caf91cf4338ff Mon Sep 17 00:00:00 2001
From: wangh <123456>
Date: Fri, 1 Dec 2023 17:36:10 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20-=20=E7=BB=91=E5=AE=9A?=
=?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=89=A9=E6=96=99=E5=90=8D=E7=A7=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/build.gradle | 3 +
app/src/main/AndroidManifest.xml | 4 +-
.../example/aucma_mes/BindingActivity.java | 101 +++++++++----
.../com/example/aucma_mes/CheckActivity.java | 141 +++++++++++-------
.../example/aucma_mes/HomePageActivity.java | 31 ++--
.../com/example/aucma_mes/MainActivity.java | 5 +-
.../com/example/aucma_mes/RepairActivity.java | 82 +++++++++-
.../aucma_mes/adapter/RepairAdapter.java | 78 ++++++++++
.../example/aucma_mes/base/BaseActivity.java | 1 +
.../example/aucma_mes/entity/DefectBeen.java | 61 +++++++-
.../example/aucma_mes/entity/RegisterPda.java | 8 +
.../aucma_mes/entity/RepairMeasures.java | 38 +++++
.../example/aucma_mes/utils/MyRecultCall.java | 13 ++
.../example/aucma_mes/vm/CheckViewModel.java | 37 +----
.../com/example/aucma_mes/vm/RepairVm.java | 55 +++++++
app/src/main/res/layout/activity_binding.xml | 60 ++++++--
app/src/main/res/layout/activity_check.xml | 75 ++++------
app/src/main/res/layout/activity_repair.xml | 62 ++++----
app/src/main/res/layout/item_repair.xml | 51 +++++++
19 files changed, 661 insertions(+), 245 deletions(-)
create mode 100644 app/src/main/java/com/example/aucma_mes/adapter/RepairAdapter.java
create mode 100644 app/src/main/java/com/example/aucma_mes/entity/RepairMeasures.java
create mode 100644 app/src/main/java/com/example/aucma_mes/vm/RepairVm.java
create mode 100644 app/src/main/res/layout/item_repair.xml
diff --git a/app/build.gradle b/app/build.gradle
index e9b977d..c9c8490 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -47,5 +47,8 @@ dependencies {
implementation 'com.lzy.net:okgo:3.0.4'
// https://mvnrepository.com/artifact/com.google.code.gson/gson
implementation 'com.google.code.gson:gson:2.10.1'
+ // https://mvnrepository.com/artifact/com.contrarywind/Android-PickerView
+ implementation 'com.contrarywind:Android-PickerView:4.1.9'
+
}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index c5226a3..a817741 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -20,8 +20,7 @@
android:exported="false" />
+ android:exported="false" />
-
diff --git a/app/src/main/java/com/example/aucma_mes/BindingActivity.java b/app/src/main/java/com/example/aucma_mes/BindingActivity.java
index 0308f56..a2703cd 100644
--- a/app/src/main/java/com/example/aucma_mes/BindingActivity.java
+++ b/app/src/main/java/com/example/aucma_mes/BindingActivity.java
@@ -11,6 +11,7 @@ import android.widget.Toast;
import com.example.aucma_mes.base.BaseActivity;
import com.example.aucma_mes.databinding.ActivityBindingBinding;
import com.example.aucma_mes.entity.Result;
+import com.example.aucma_mes.utils.MyRecultCall;
import com.example.aucma_mes.utils.SharedPreferencesUtils;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
@@ -19,14 +20,20 @@ import com.lzy.okgo.model.Response;
public class BindingActivity extends BaseActivity {
public ObservableField boxCode;
+ public ObservableField materialName;
public ObservableField innerCode;
+ public String title;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ getSupportActionBar().hide();
ActivityBindingBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_binding);
boxCode = new ObservableField<>();
+ materialName = new ObservableField<>();
innerCode = new ObservableField<>();
+ title = getIntent().getStringExtra("title");
+ binding.setTitle(title);
binding.setTest(this);
binding.button2.setOnClickListener(t -> {
boxCode.set(null);
@@ -38,11 +45,24 @@ public class BindingActivity extends BaseActivity {
@Override
protected void sanInfo(String code) {
- Log.e("TAG", "sanInfo:" + code);
- if (boxCode.get() == null) {
- boxCode.set(code);
+
+ char c = code.charAt(0);
+ if (title.equals("壳胆绑定")) {
+ if (c == 'B') {
+ boxCode.set(code);
+ selectGoodsName(code);
+ } else if (c == 'L') {
+ innerCode.set(code);
+ } else {
+ Toast.makeText(this, "条码格式不对", Toast.LENGTH_SHORT).show();
+ }
} else {
- innerCode.set(code);
+ if (c == 'B') {
+ boxCode.set(code);
+ selectGoodsName(code);
+ } else {
+ innerCode.set(code);
+ }
}
@@ -53,33 +73,28 @@ public class BindingActivity extends BaseActivity {
if (boxCode.get() == null || innerCode.get() == null) return;
dialog.show();
- OkGo.post(url + "/api/boxBanding")
- .tag(this)
- .headers("Authorization",SharedPreferencesUtils.getstring("token",""))
- .params("boxCode", boxCode.get())
- .params("innerCode", innerCode.get())
- .params("loginName", SharedPreferencesUtils.getstring("loginName", ""))
- .execute(new StringCallback() {
- @Override
- public void onSuccess(Response response) {
- dialog.dismiss();
-
- Result result = gson.fromJson(response.body(), Result.class);
- if (result.getCode() == 200) {
- Toast.makeText(BindingActivity.this, "绑定成功", Toast.LENGTH_SHORT).show();
- boxCode.set("");
- innerCode.set("");
- } else {
- Toast.makeText(BindingActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show();
- }
- }
-
- @Override
- public void onError(Response response) {
- super.onError(response);
- Toast.makeText(BindingActivity.this, "网路连接错误", Toast.LENGTH_SHORT).show();
- }
- });
+ String s = title.equals("壳胆绑定") ? "/api/boxBanding" : "/api/barCodeBanding";
+ OkGo.post(url + s).tag(this).headers("Authorization", SharedPreferencesUtils.getstring("token", "")).params("boxCode", boxCode.get()).params("innerCode", innerCode.get()).params("loginName", SharedPreferencesUtils.getstring("loginName", "")).execute(new StringCallback() {
+ @Override
+ public void onSuccess(Response response) {
+ dialog.dismiss();
+
+ Result result = gson.fromJson(response.body(), Result.class);
+ if (result.getCode() == 200) {
+ Toast.makeText(BindingActivity.this, "绑定成功", Toast.LENGTH_SHORT).show();
+ boxCode.set("");
+ innerCode.set("");
+ } else {
+ Toast.makeText(BindingActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show();
+ }
+ }
+
+ @Override
+ public void onError(Response response) {
+ super.onError(response);
+ Toast.makeText(BindingActivity.this, "网路连接错误", Toast.LENGTH_SHORT).show();
+ }
+ });
}
public void click2(View view) {
@@ -87,4 +102,28 @@ public class BindingActivity extends BaseActivity {
boxCode.set(null);
innerCode.set(null);
}
+
+ private String codeTag = "";
+
+ private void selectGoodsName(String code) {
+ if (codeTag.equals(code)) return;
+ codeTag = code;
+ OkGo.post(url + "/api/selectGoodsName")
+ .tag(this)
+ .headers("Authorization", SharedPreferencesUtils.getstring("token", ""))
+ .params("code", code)
+ .execute(new MyRecultCall(dialog,this){
+ @Override
+ public void onSuccess(Response response) {
+ super.onSuccess(response);
+ Result result = response.body();
+ if (result.getCode()==200){
+ Toast.makeText(BindingActivity.this, "查询成功", Toast.LENGTH_SHORT).show();
+ materialName.set(result.getData().toString());
+ }else {
+ Toast.makeText(BindingActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show();
+ }
+ }
+ });
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/aucma_mes/CheckActivity.java b/app/src/main/java/com/example/aucma_mes/CheckActivity.java
index 81a8a30..abc6b82 100644
--- a/app/src/main/java/com/example/aucma_mes/CheckActivity.java
+++ b/app/src/main/java/com/example/aucma_mes/CheckActivity.java
@@ -3,6 +3,7 @@ package com.example.aucma_mes;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
+import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
@@ -12,6 +13,9 @@ import android.widget.ListPopupWindow;
import android.widget.Spinner;
import android.widget.Toast;
+import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
+import com.bigkoo.pickerview.listener.OnOptionsSelectListener;
+import com.bigkoo.pickerview.view.OptionsPickerView;
import com.example.aucma_mes.adapter.CheckAdapter;
import com.example.aucma_mes.base.BaseActivity;
import com.example.aucma_mes.databinding.ActivityCheckBinding;
@@ -32,15 +36,20 @@ import java.util.List;
import okhttp3.RequestBody;
-public class CheckActivity extends BaseActivity implements CheckAdapter.CheckItemClickCall, AdapterView.OnItemClickListener {
+public class CheckActivity extends BaseActivity implements CheckAdapter.CheckItemClickCall/*, AdapterView.OnItemClickListener*/, OnOptionsSelectListener {
private ActivityCheckBinding binding;
private CheckViewModel checkViewModel;
- private ListPopupWindow listPopupWindow;
+ // private ListPopupWindow listPopupWindow;
private CheckAdapter checkAdapter;
private List list;
private List submitList;
- private List defectBeens;
+ private OptionsPickerView opv;
+
+
+ private List options1;
+ private List> options2;
+ private List>> options3;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -48,15 +57,14 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
binding = DataBindingUtil.setContentView(this, R.layout.activity_check);
checkViewModel = new CheckViewModel();
binding.setVm(checkViewModel);
-
checkAdapter = new CheckAdapter(this, this);
submitList = new ArrayList<>();
checkAdapter.setList(submitList);
binding.recyclerView.setAdapter(checkAdapter);
- listPopupWindow = new ListPopupWindow(this);
- listPopupWindow.setAnchorView(binding.selectDefect);
- listPopupWindow.setOnItemClickListener(this);
String stationCode = getIntent().getStringExtra("stationCode");
+// 三联
+ opv = new OptionsPickerBuilder(this, this).build();
+
OkGo.get(url + "/base/qualityInspectionItem/getQualityDefects/" + stationCode).tag(this).headers("Authorization", SharedPreferencesUtils.getstring("token", "")).execute(new MyRecultCall(dialog, this) {
@Override
public void onSuccess(Response response) {
@@ -67,31 +75,50 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
Toast.makeText(CheckActivity.this, "请求成功", Toast.LENGTH_SHORT).show();
list = gson.fromJson(body.getData().toString(), new TypeToken>() {
}.getType());
- defectBeens = new ArrayList<>(list.size());
-
- list.stream().forEach(t -> defectBeens.add(t.qualityDefectName));
- listPopupWindow.setAdapter(new ArrayAdapter(CheckActivity.this, androidx.appcompat.R.layout.support_simple_spinner_dropdown_item, defectBeens));
+ 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);
+ }
+ });
+// Log.e("TAG", "options1:" + options1.toString());
+// Log.e("TAG", "options2:" + options2.toString());
+// Log.e("TAG", "options3:" + options3.toString());
+ opv.setPicker(options1, options2, options3);
} else {
Toast.makeText(CheckActivity.this, body.getMsg(), Toast.LENGTH_SHORT).show();
}
}
});
- OkGo.get(url + "/system/dict/data/type/treatment_measures").tag(this)
- .headers("Authorization", SharedPreferencesUtils.getstring("token", ""))
- .execute(new MyRecultCall(dialog, this) {
- @Override
- public void onSuccess(Response response) {
- super.onSuccess(response);
- Result body = response.body();
- List dictBeenList = gson.fromJson(gson.toJson(body.getData()),
- new TypeToken>() {
- }.getType());
-
- checkViewModel.setDictBeenList(dictBeenList);
- }
- });
}
@Override
@@ -99,40 +126,34 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
checkViewModel.setCode(code);
}
+ //弹出框
public void checkSelect(View view) {
- listPopupWindow.show();
+ opv.show();
+
}
+ //提交
public void checkSubmint(View view) {
- String s = binding.checkSpinner1.getSelectedItem().toString();
- if (s.equals("返修") && submitList.isEmpty()) {
- return;
- }
- checkViewModel.setMeasure(s);
- String s1 = binding.checkSpinner2.getSelectedItem().toString();
- checkViewModel.setOffline(s1);
checkViewModel.setList(submitList);
checkViewModel.setUserName(SharedPreferencesUtils.getstring("userName", "pda01"));
- OkGo.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 response) {
- super.onSuccess(response);
- Result result = response.body();
- if (result.getCode() == 200) {
- Toast.makeText(CheckActivity.this, "提交成功", Toast.LENGTH_SHORT).show();
- checkViewModel.setCode(null);
- submitList.clear();
- checkAdapter.notifyDataSetChanged();
- } else {
- Toast.makeText(CheckActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show();
- }
- }
- });
+ OkGo.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 response) {
+ super.onSuccess(response);
+ Result result = response.body();
+ if (result.getCode() == 200) {
+ Toast.makeText(CheckActivity.this, "提交成功", Toast.LENGTH_SHORT).show();
+ checkViewModel.setCode(null);
+ submitList.clear();
+ checkAdapter.notifyDataSetChanged();
+ } else {
+ Toast.makeText(CheckActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show();
+ }
+ }
+ });
}
+ // 删除缺陷
@Override
public void onClick(int positon) {
Log.e("TAG", "列表点击:" + positon);
@@ -140,16 +161,22 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
checkAdapter.notifyDataSetChanged();
}
+
@Override
- public void onItemClick(AdapterView> parent, View view, int position, long id) {
- checkViewModel.setDefect(defectBeens.get(position));
- DefectBeen defectBeen = list.get(position);
- if (submitList.contains(defectBeen)) {
+ public void onOptionsSelect(int options1, int options2, int options3, View v) {
+
+ String defectName = this.options3.get(options1).get(options2).get(options3);
+ checkViewModel.setDefect(defectName);
+ DefectBeen defectBeen = new DefectBeen();
+ defectBeen.setQualityDefectName(defectName);
+
+ DefectBeen defectBeen1 = list.get(list.indexOf(defectBeen));
+
+ if (submitList.contains(defectBeen1)) {
Toast.makeText(this, "已经添加了", Toast.LENGTH_SHORT).show();
return;
}
- submitList.add(defectBeen);
+ submitList.add(defectBeen1);
checkAdapter.notifyDataSetChanged();
- listPopupWindow.dismiss();
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/aucma_mes/HomePageActivity.java b/app/src/main/java/com/example/aucma_mes/HomePageActivity.java
index d72859d..9e8e139 100644
--- a/app/src/main/java/com/example/aucma_mes/HomePageActivity.java
+++ b/app/src/main/java/com/example/aucma_mes/HomePageActivity.java
@@ -53,29 +53,34 @@ public class HomePageActivity extends AppCompatActivity {
// return;
// }
intent = new Intent(this, CheckActivity.class);
- intent.putExtra("stationCode", "1006");
+ intent.putExtra("stationCode", "2001");
startActivity(intent);
});
binding.homeButton2.setOnClickListener(v -> {
- if (!roles.contains("shell_bile_binding")) {
- Toast.makeText(this, "暂无权限", Toast.LENGTH_SHORT).show();
- return;
- }
+// if (!roles.contains("shell_bile_binding")) {
+// Toast.makeText(this, "暂无权限", Toast.LENGTH_SHORT).show();
+// return;
+// }
intent = new Intent(this, BindingActivity.class);
intent.putExtra("title", "壳胆绑定");
startActivity(intent);
});
binding.homeButton3.setOnClickListener(v -> {
- if (!roles.contains("quality_repair")) {
- Toast.makeText(this, "暂无权限", Toast.LENGTH_SHORT).show();
- return;
- }
+// if (!roles.contains("quality_repair")) {
+// Toast.makeText(this, "暂无权限", Toast.LENGTH_SHORT).show();
+// return;
+// }
+ intent = new Intent(this, RepairActivity.class);
+ startActivity(intent);
});
binding.homeButton4.setOnClickListener(v -> {
- if (!roles.contains("barcode_binding")) {
- Toast.makeText(this, "暂无权限", Toast.LENGTH_SHORT).show();
- return;
- }
+// if (!roles.contains("barcode_binding")) {
+// Toast.makeText(this, "暂无权限", Toast.LENGTH_SHORT).show();
+// return;
+// }
+ intent = new Intent(this, BindingActivity.class);
+ intent.putExtra("title", "条码绑定");
+ startActivity(intent);
});
binding.homeButton5.setOnClickListener(v -> {
infoDialog.show();
diff --git a/app/src/main/java/com/example/aucma_mes/MainActivity.java b/app/src/main/java/com/example/aucma_mes/MainActivity.java
index 776b062..83e4315 100644
--- a/app/src/main/java/com/example/aucma_mes/MainActivity.java
+++ b/app/src/main/java/com/example/aucma_mes/MainActivity.java
@@ -48,8 +48,8 @@ private boolean loginState=false;
user.setPassword("aucma@123");
getSupportActionBar().hide(); // 隐藏原生标题栏
binding.setUser(user);
- Toast.makeText(this, getMacAddress()+"可以使用", Toast.LENGTH_SHORT).show();
- OkGo.get(url + "/system/dict/data/type/treatment_measures").tag(this)
+// Toast.makeText(this, getMacAddress()+"可以使用", Toast.LENGTH_SHORT).show();
+ OkGo.get(url + "/report/pdaRecord/getPdaRecord").tag(this)
.headers("Authorization", SharedPreferencesUtils.getstring("token", ""))
.execute(new MyRecultCall(dialog, this) {
@Override
@@ -58,6 +58,7 @@ private boolean loginState=false;
Result result = response.body();
if (result.getCode()==200){
List pdaList=gson.fromJson(gson.toJson( result.getData()),new TypeToken< List>(){}.getType());
+// Log.e("TAG", "onSuccess:" + pdaList.toString());
RegisterPda registerPda=new RegisterPda();
registerPda.setSerialCode(getMacAddress());
int index = pdaList.indexOf(registerPda);
diff --git a/app/src/main/java/com/example/aucma_mes/RepairActivity.java b/app/src/main/java/com/example/aucma_mes/RepairActivity.java
index 8758230..3f3229c 100644
--- a/app/src/main/java/com/example/aucma_mes/RepairActivity.java
+++ b/app/src/main/java/com/example/aucma_mes/RepairActivity.java
@@ -4,16 +4,94 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.Toast;
+import com.example.aucma_mes.adapter.CheckAdapter;
+import com.example.aucma_mes.adapter.RepairAdapter;
+import com.example.aucma_mes.base.BaseActivity;
import com.example.aucma_mes.databinding.ActivityMainBinding;
import com.example.aucma_mes.databinding.ActivityRepairBinding;
+import com.example.aucma_mes.entity.DefectBeen;
+import com.example.aucma_mes.entity.RepairMeasures;
+import com.example.aucma_mes.entity.Result;
+import com.example.aucma_mes.utils.MyRecultCall;
+import com.example.aucma_mes.utils.SharedPreferencesUtils;
+import com.example.aucma_mes.vm.RepairVm;
+import com.google.gson.reflect.TypeToken;
+import com.lzy.okgo.OkGo;
+import com.lzy.okgo.model.Response;
-public class RepairActivity extends AppCompatActivity {
+import java.util.ArrayList;
+import java.util.List;
+
+public class RepairActivity extends BaseActivity implements CheckAdapter.CheckItemClickCall {
+ private ActivityRepairBinding binding;
+ private RepairVm repairVm;
+ private RepairAdapter adapter;
+
+ private List defectBeens;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- ActivityRepairBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_repair);
+ binding = DataBindingUtil.setContentView(this, R.layout.activity_repair);
+ adapter = new RepairAdapter(this);
+ repairVm = new RepairVm();
+ binding.setVm(repairVm);
+ binding.recyclerView.setAdapter(adapter);
+ OkGo.get(url + "/report/repairMeasures/getRepairMeasures").tag(this)
+ .headers("Authorization", SharedPreferencesUtils.getstring("token", ""))
+ .execute(new MyRecultCall(dialog, this) {
+ @Override
+ public void onSuccess(Response response) {
+ Result result = response.body();
+ if (result.getCode()==200){
+ Log.e("TAG", "真实类型:" + result.getData().getClass());
+ List repairList=gson.fromJson(gson.toJson(result.getData())
+ ,new TypeToken< List>(){}.getType());
+ repairVm.setRepairList(repairList);
+
+ }else {
+ Toast.makeText(RepairActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show();
+ }
+ }
+ });
+ }
+
+ @Override
+ protected void sanInfo(String code) {
+ repairVm.setCode(code);
+ OkGo.post(url + "/api/findCheckInfoByCode").tag(this)
+ .headers("Authorization", SharedPreferencesUtils.getstring("token", ""))
+ .params("code",code)
+ .execute(new MyRecultCall(dialog, this) {
+ @Override
+ public void onSuccess(Response response) {
+ Result result = response.body();
+ if (result.getCode()==200){
+
+ defectBeens = gson.fromJson(result.getData().toString()
+ ,new TypeToken>(){}.getType());
+ adapter.setList(defectBeens);
+ adapter.notifyDataSetChanged();
+ }else {
+ Toast.makeText(RepairActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show();
+ repairSubmit(null);
+ }
+ }
+ });
+ }
+
+ public void repairSubmit(View view) {
+ defectBeens.clear();
+ adapter.notifyDataSetChanged();
+ repairVm.setCode(null);
+ }
+
+ @Override
+ public void onClick(int positon) {
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/aucma_mes/adapter/RepairAdapter.java b/app/src/main/java/com/example/aucma_mes/adapter/RepairAdapter.java
new file mode 100644
index 0000000..2a728ab
--- /dev/null
+++ b/app/src/main/java/com/example/aucma_mes/adapter/RepairAdapter.java
@@ -0,0 +1,78 @@
+package com.example.aucma_mes.adapter;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.databinding.DataBindingUtil;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.example.aucma_mes.BR;
+import com.example.aucma_mes.R;
+import com.example.aucma_mes.databinding.ItemLayoutBinding;
+import com.example.aucma_mes.databinding.ItemRepairBinding;
+import com.example.aucma_mes.entity.DefectBeen;
+
+import java.util.List;
+
+/**
+ * @author wanghao
+ * @date 2023/11/17 17:15
+ */
+public class RepairAdapter extends RecyclerView.Adapter {
+ private Context context;
+ private List list;
+ private LayoutInflater from;
+
+
+ public RepairAdapter(Context context) {
+ this.context = context;
+ from = LayoutInflater.from(context);
+ }
+
+ public void setList(List list) {
+ this.list = list;
+ }
+
+ @NonNull
+ @Override
+ public CheckAdapterVH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ ItemRepairBinding inflate1 = DataBindingUtil.inflate(from, R.layout.item_repair, parent, false);
+ return new CheckAdapterVH(inflate1);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull CheckAdapterVH holder, int position) {
+ DefectBeen defectBeen = list.get(position);
+ defectBeen.setIndex(position + 1);
+ ItemRepairBinding databing = holder.getInflate1();
+ databing.setVariable(BR.item, defectBeen);
+ databing.executePendingBindings();
+ }
+
+ @Override
+ public int getItemCount() {
+ return list == null ? 0 : list.size();
+ }
+
+ static class CheckAdapterVH extends RecyclerView.ViewHolder {
+ private ItemRepairBinding inflate1;
+
+ public ItemRepairBinding getInflate1() {
+ return inflate1;
+ }
+
+ public CheckAdapterVH(ItemRepairBinding inflate1) {
+ super(inflate1.getRoot());
+ this.inflate1 = inflate1;
+ }
+
+
+ }
+
+ public interface CheckItemClickCall {
+ void onClick(int positon);
+ }
+
+}
diff --git a/app/src/main/java/com/example/aucma_mes/base/BaseActivity.java b/app/src/main/java/com/example/aucma_mes/base/BaseActivity.java
index e63b770..77e71e2 100644
--- a/app/src/main/java/com/example/aucma_mes/base/BaseActivity.java
+++ b/app/src/main/java/com/example/aucma_mes/base/BaseActivity.java
@@ -19,6 +19,7 @@ import okhttp3.MediaType;
public abstract class BaseActivity extends AppCompatActivity {
private MyBroad receiver;
+// public static String url="http://192.168.137.1:8080";
public static String url="http://172.20.10.2:8080";
public ProgressDialog dialog;
public Gson gson;
diff --git a/app/src/main/java/com/example/aucma_mes/entity/DefectBeen.java b/app/src/main/java/com/example/aucma_mes/entity/DefectBeen.java
index 2423a4e..b60b8c8 100644
--- a/app/src/main/java/com/example/aucma_mes/entity/DefectBeen.java
+++ b/app/src/main/java/com/example/aucma_mes/entity/DefectBeen.java
@@ -9,22 +9,22 @@ import java.util.Objects;
* @date 2023/11/17 17:00
*/
public class DefectBeen extends BaseObservable {
+
+
+
public int index;
+ public int objId;
+ private String materialCategories;
+ private String materialSubclass;
public String qualityDefectCode;
public String qualityDefectName;
- private String stationCode;//检测项编号 TEST_ITEM_CODE
+
+
public void setIndex(int index) {
this.index = index;
}
- public String getStationCode() {
- return stationCode;
- }
-
- public void setStationCode(String stationCode) {
- this.stationCode = stationCode;
- }
@Override
public boolean equals(Object o) {
@@ -40,4 +40,49 @@ public class DefectBeen extends BaseObservable {
public int hashCode() {
return qualityDefectName != null ? qualityDefectName.hashCode() : 0;
}
+
+ public int getObjId() {
+ return objId;
+ }
+
+ public void setObjId(int objId) {
+ this.objId = objId;
+ }
+
+ public int getIndex() {
+ return index;
+ }
+
+ public String getMaterialCategories() {
+ return materialCategories;
+ }
+
+ public void setMaterialCategories(String materialCategories) {
+ this.materialCategories = materialCategories;
+ }
+
+ public String getMaterialSubclass() {
+ return materialSubclass;
+ }
+
+ public void setMaterialSubclass(String materialSubclass) {
+ this.materialSubclass = materialSubclass;
+ }
+
+ public String getQualityDefectCode() {
+ return qualityDefectCode;
+ }
+
+ public void setQualityDefectCode(String qualityDefectCode) {
+ this.qualityDefectCode = qualityDefectCode;
+ }
+
+ public String getQualityDefectName() {
+ return qualityDefectName;
+ }
+
+ public void setQualityDefectName(String qualityDefectName) {
+ this.qualityDefectName = qualityDefectName;
+ }
+
}
diff --git a/app/src/main/java/com/example/aucma_mes/entity/RegisterPda.java b/app/src/main/java/com/example/aucma_mes/entity/RegisterPda.java
index ac7e8ee..0990579 100644
--- a/app/src/main/java/com/example/aucma_mes/entity/RegisterPda.java
+++ b/app/src/main/java/com/example/aucma_mes/entity/RegisterPda.java
@@ -42,4 +42,12 @@ public class RegisterPda {
public int hashCode() {
return serialCode != null ? serialCode.hashCode() : 0;
}
+
+ @Override
+ public String toString() {
+ return "RegisterPda{" +
+ "pdaName='" + pdaName + '\'' +
+ ", serialCode='" + serialCode + '\'' +
+ '}';
+ }
}
diff --git a/app/src/main/java/com/example/aucma_mes/entity/RepairMeasures.java b/app/src/main/java/com/example/aucma_mes/entity/RepairMeasures.java
new file mode 100644
index 0000000..8605d25
--- /dev/null
+++ b/app/src/main/java/com/example/aucma_mes/entity/RepairMeasures.java
@@ -0,0 +1,38 @@
+package com.example.aucma_mes.entity;
+
+import java.util.Objects;
+
+/**
+ * @author wanghao
+ * @date 2023/11/23 9:57
+ */
+public class RepairMeasures {
+// "repairCode": "6001",
+//"repairName": "返回生产线"
+ private String repairCode;
+ private String repairName;
+
+ public String getRepairCode() {
+ return repairCode;
+ }
+
+ public void setRepairCode(String repairCode) {
+ this.repairCode = repairCode;
+ }
+
+ public String getRepairName() {
+ return repairName;
+ }
+
+ public void setRepairName(String repairName) {
+ this.repairName = repairName;
+ }
+
+ @Override
+ public String toString() {
+ return "RepairMeasures{" +
+ "repairCode='" + repairCode + '\'' +
+ ", repairName='" + repairName + '\'' +
+ '}';
+ }
+}
diff --git a/app/src/main/java/com/example/aucma_mes/utils/MyRecultCall.java b/app/src/main/java/com/example/aucma_mes/utils/MyRecultCall.java
index 96eba36..ac60a62 100644
--- a/app/src/main/java/com/example/aucma_mes/utils/MyRecultCall.java
+++ b/app/src/main/java/com/example/aucma_mes/utils/MyRecultCall.java
@@ -2,6 +2,8 @@ package com.example.aucma_mes.utils;
import android.app.ProgressDialog;
import android.content.Context;
+import android.util.Log;
+import android.widget.Toast;
import com.example.aucma_mes.entity.Result;
import com.google.gson.Gson;
@@ -36,17 +38,28 @@ public class MyRecultCall extends AbsCallback {
@Override
public void onSuccess(Response response) {
dialog.dismiss();
+ Log.e("网络请求情况", "onSuccess:");
}
@Override
public void onError(Response response) {
super.onError(response);
dialog.dismiss();
+ Log.e("网络请求情况", "onError:" );
+ Toast.makeText(context, "网络连接错误", Toast.LENGTH_SHORT).show();
}
@Override
public void onStart(Request request) {
super.onStart(request);
dialog.show();
+ Log.e("网络请求情况", "onStart:" );
+ }
+
+ @Override
+ public void onFinish() {
+ super.onFinish();
+ dialog.dismiss();
+ Log.e("网络请求情况", "onFinish:" );
}
}
diff --git a/app/src/main/java/com/example/aucma_mes/vm/CheckViewModel.java b/app/src/main/java/com/example/aucma_mes/vm/CheckViewModel.java
index c5ab0ee..1d26dfd 100644
--- a/app/src/main/java/com/example/aucma_mes/vm/CheckViewModel.java
+++ b/app/src/main/java/com/example/aucma_mes/vm/CheckViewModel.java
@@ -18,31 +18,18 @@ import java.util.List;
*/
public class CheckViewModel extends BaseObservable {
public String code;//产品条码
+ public String name;//产品型号
public String defect;
- public List stringList;
+
private List list;//缺陷列表
private String measure;//处理措施TREATMENT_MEASURE
+ private String measureName;//处理措施TREATMENT_MEASURE
+
- private String offline;
private String processCode;
private String userName;
- public List dictBeenList;
-
-
- public List getDictBeenList() {
- return dictBeenList;
- }
-
-
-
- public void setDictBeenList(List dictBeenList) {
- this.dictBeenList = dictBeenList;
- stringList=new ArrayList<>(dictBeenList.size());
- dictBeenList.forEach(t->stringList.add(t.getDictLabel()));
- notifyChange();
- }
public String getProcessCode() {
return processCode;
@@ -65,22 +52,6 @@ public class CheckViewModel extends BaseObservable {
return measure;
}
- public void setMeasure(String measure) {
- this.measure =dictBeenList.get(stringList.indexOf(measure)).getDictValue() ;
- }
-
- public String getOffline() {
- return offline;
- }
-
- public void setOffline(String offline) {
- if (offline.equals("是")) {
- this.offline = "Y";
- } else {
- this.offline = "N";
- }
-
- }
public String getCode() {
return code;
diff --git a/app/src/main/java/com/example/aucma_mes/vm/RepairVm.java b/app/src/main/java/com/example/aucma_mes/vm/RepairVm.java
new file mode 100644
index 0000000..0ee33c8
--- /dev/null
+++ b/app/src/main/java/com/example/aucma_mes/vm/RepairVm.java
@@ -0,0 +1,55 @@
+package com.example.aucma_mes.vm;
+
+import android.util.Log;
+import android.view.View;
+import android.widget.AdapterView;
+
+import androidx.databinding.BaseObservable;
+
+import com.example.aucma_mes.adapter.CheckAdapter;
+import com.example.aucma_mes.entity.RepairMeasures;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author wanghao
+ * @date 2023/11/23 10:01
+ */
+public class RepairVm extends BaseObservable {
+ public String code;//扫描条码
+ private String repairCode;//处理措施
+
+ public List stringList;
+ private List repairList;
+
+ public void onItemClick(AdapterView> parent, View view, int position, long id) {
+ Log.e("TAG", "返修选中措施:" + position);
+ this.repairCode = repairList.get(position).getRepairCode();
+ }
+ public void setRepairList(List repairList) {
+ this.repairList = repairList;
+ stringList = new ArrayList<>(repairList.size());
+ repairList.forEach(t -> stringList.add(t.getRepairName()));
+ notifyChange();
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ notifyChange();
+ }
+
+ public String getRepairCode() {
+ return repairCode;
+ }
+
+ public void setRepairCode(String name) {
+ int i = stringList.indexOf(name);
+ this.repairCode = repairList.get(i).getRepairCode();
+
+ }
+}
diff --git a/app/src/main/res/layout/activity_binding.xml b/app/src/main/res/layout/activity_binding.xml
index 627c3f8..9ccb0fe 100644
--- a/app/src/main/res/layout/activity_binding.xml
+++ b/app/src/main/res/layout/activity_binding.xml
@@ -10,24 +10,35 @@
name="test"
type="com.example.aucma_mes.BindingActivity" />
+
-
+
+
+ android:layout_marginEnd="4dp">
+
+
+
+
+
+
+
+
+
+ android:layout_marginEnd="4dp">
+ android:text='@{(title.equals("壳胆绑定"))? "内胆码:":"SN 码:"}' />
+ android:layout_margin="20dp">
-
+
diff --git a/app/src/main/res/layout/activity_check.xml b/app/src/main/res/layout/activity_check.xml
index 12fdbbb..41a90ff 100644
--- a/app/src/main/res/layout/activity_check.xml
+++ b/app/src/main/res/layout/activity_check.xml
@@ -35,6 +35,30 @@
android:layout_height="match_parent"
android:text="@={vm.code}" />
+
+
+
+
+
+
+
+
+
-
-
-
-
-
- />
-
-
-
-
-
-
-
diff --git a/app/src/main/res/layout/activity_repair.xml b/app/src/main/res/layout/activity_repair.xml
index ce21d90..8f9f237 100644
--- a/app/src/main/res/layout/activity_repair.xml
+++ b/app/src/main/res/layout/activity_repair.xml
@@ -3,10 +3,17 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
+
+
+
+
+ android:layout_height="match_parent"
+ android:text="@={vm.code}" />
@@ -44,8 +52,10 @@
@@ -54,7 +64,7 @@
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="48dp"
- android:layout_marginTop="12dp"
+ android:layout_marginTop="8dp"
android:layout_marginEnd="4dp"
android:background="@color/white"
android:orientation="horizontal"
@@ -67,43 +77,33 @@
android:layout_height="match_parent"
android:background="@color/grey"
android:text="处置措施:" />
-
+
-
-
-
-
-
-
-
+
diff --git a/app/src/main/res/layout/item_repair.xml b/app/src/main/res/layout/item_repair.xml
new file mode 100644
index 0000000..0debe45
--- /dev/null
+++ b/app/src/main/res/layout/item_repair.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file