From 6d749568ef473196106405fa1585f1adc129cb9e Mon Sep 17 00:00:00 2001
From: wangh <123456>
Date: Thu, 9 May 2024 17:34:49 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20-=20=E9=80=9A=E7=9F=A5?=
=?UTF-8?q?=E8=B7=B3=E8=BD=AC=E6=9F=A5=E8=AF=A2=E6=95=B0=E6=8D=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/build.gradle | 4 +-
app/src/main/AndroidManifest.xml | 8 +-
.../example/aucma_mes/InfoListActivity.java | 70 ++++++++++++
.../com/example/aucma_mes/MainActivity.java | 8 +-
.../aucma_mes/adapter/RecordAdapter.java | 75 +++++++++++++
.../example/aucma_mes/base/BaseActivity.java | 4 +-
.../entity/RecordExceptionProcess.java | 35 ++++++
.../example/aucma_mes/service/MyService.java | 6 +
app/src/main/res/drawable/button_1.xml | 7 ++
app/src/main/res/drawable/item_1.xml | 8 ++
.../main/res/layout/activity_info_list.xml | 73 ++++++++++++
app/src/main/res/layout/item_info.xml | 104 ++++++++++++++++++
app/src/main/res/values/arrays.xml | 1 +
13 files changed, 393 insertions(+), 10 deletions(-)
create mode 100644 app/src/main/java/com/example/aucma_mes/InfoListActivity.java
create mode 100644 app/src/main/java/com/example/aucma_mes/adapter/RecordAdapter.java
create mode 100644 app/src/main/java/com/example/aucma_mes/entity/RecordExceptionProcess.java
create mode 100644 app/src/main/res/drawable/button_1.xml
create mode 100644 app/src/main/res/drawable/item_1.xml
create mode 100644 app/src/main/res/layout/activity_info_list.xml
create mode 100644 app/src/main/res/layout/item_info.xml
diff --git a/app/build.gradle b/app/build.gradle
index fa113b4..bbb73c4 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -10,8 +10,8 @@ android {
applicationId "com.example.aucma_mes"
minSdk 24
targetSdk 33
- versionCode 11
- versionName "1.11"
+ versionCode 12
+ versionName "1.12"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 388ebd9..099e2d1 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -5,7 +5,6 @@
-
+
+
+ android:exported="true" />
post(url + "/api/downgradeQuery")
+ .tag(this)
+ .params("inspectionUserFlag",inspectionUserFlag )
+ .execute(new MyRecultCall(dialog, this) {
+ @SuppressLint("NotifyDataSetChanged")
+ @Override
+ public void onSuccess(Response response) {
+ super.onSuccess(response);
+ var body = response.body();
+ if (body.getCode()==200){
+ List list=gson.fromJson(gson.toJson(body.getData()),new TypeToken< List>(){}.getType());
+ adapter.setList(list);
+ adapter.notifyDataSetChanged();
+ if (list==null||list.isEmpty()){
+ binding.setListNumbre(0);
+ return;
+ }
+ binding.setListNumbre(list.size());
+ }
+
+
+ }
+ });
+ }
+}
\ No newline at end of file
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 5978fa8..de982f1 100644
--- a/app/src/main/java/com/example/aucma_mes/MainActivity.java
+++ b/app/src/main/java/com/example/aucma_mes/MainActivity.java
@@ -125,10 +125,10 @@ public class MainActivity extends BaseActivity {
// 登录
public void login(View view) {
- if (!loginState) {
- Toast.makeText(this, "设备未注册,不允许登录", Toast.LENGTH_SHORT).show();
- return;
- }
+ // if (!loginState) {
+ // Toast.makeText(this, "设备未注册,不允许登录", Toast.LENGTH_SHORT).show();
+ // return;
+ // }
String teamCode = user.getTeamCode();
if (teamCode==null||teamCode.isEmpty()) return;
dialog.show();
diff --git a/app/src/main/java/com/example/aucma_mes/adapter/RecordAdapter.java b/app/src/main/java/com/example/aucma_mes/adapter/RecordAdapter.java
new file mode 100644
index 0000000..a383700
--- /dev/null
+++ b/app/src/main/java/com/example/aucma_mes/adapter/RecordAdapter.java
@@ -0,0 +1,75 @@
+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.ItemInfoBinding;
+import com.example.aucma_mes.databinding.ItemRepairBinding;
+import com.example.aucma_mes.entity.DefectBeen;
+import com.example.aucma_mes.entity.RecordExceptionProcess;
+
+import java.util.List;
+
+/**
+ * @author wanghao
+ * @date 2023/11/17 17:15
+ */
+public class RecordAdapter extends RecyclerView.Adapter {
+ private Context context;
+ private List list;
+ private LayoutInflater from;
+
+
+ public RecordAdapter(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) {
+ ItemInfoBinding inflate1 = DataBindingUtil.inflate(from, R.layout.item_info, parent, false);
+ return new CheckAdapterVH(inflate1);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull CheckAdapterVH holder, int position) {
+ var defectBeen = list.get(position);
+ var 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 final ItemInfoBinding inflate1;
+
+ public ItemInfoBinding getInflate1() {
+ return inflate1;
+ }
+
+ public CheckAdapterVH(ItemInfoBinding inflate1) {
+ super(inflate1.getRoot());
+ this.inflate1 = inflate1;
+ }
+
+
+ }
+
+
+}
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 7682b20..4b7248f 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
@@ -26,8 +26,8 @@ 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://10.100.72.10:8080";
+ public static String url="http://192.168.137.1:8080";
+ // public static String url = "http://10.100.72.10:8080";
public ProgressDialog dialog;
public Gson gson;
public MediaType JSON = MediaType.parse("application/json; charset=utf-8");
diff --git a/app/src/main/java/com/example/aucma_mes/entity/RecordExceptionProcess.java b/app/src/main/java/com/example/aucma_mes/entity/RecordExceptionProcess.java
new file mode 100644
index 0000000..7c6dabb
--- /dev/null
+++ b/app/src/main/java/com/example/aucma_mes/entity/RecordExceptionProcess.java
@@ -0,0 +1,35 @@
+package com.example.aucma_mes.entity;
+
+/**
+ * @author wanghao
+ * @date 2024/5/9 16:50
+ */
+public class RecordExceptionProcess {
+// 箱体码:boxBarcode型号:materialModel班组:teamName
+
+ private String boxBarcode, materialModel, teamName;
+
+ public String getBoxBarcode() {
+ return boxBarcode;
+ }
+
+ public void setBoxBarcode(String boxBarcode) {
+ this.boxBarcode = boxBarcode;
+ }
+
+ public String getMaterialModel() {
+ return materialModel;
+ }
+
+ public void setMaterialModel(String materialModel) {
+ this.materialModel = materialModel;
+ }
+
+ public String getTeamName() {
+ return teamName;
+ }
+
+ public void setTeamName(String teamName) {
+ this.teamName = teamName;
+ }
+}
diff --git a/app/src/main/java/com/example/aucma_mes/service/MyService.java b/app/src/main/java/com/example/aucma_mes/service/MyService.java
index b4810c5..7a5ec51 100644
--- a/app/src/main/java/com/example/aucma_mes/service/MyService.java
+++ b/app/src/main/java/com/example/aucma_mes/service/MyService.java
@@ -2,6 +2,7 @@ package com.example.aucma_mes.service;
import android.app.NotificationChannel;
import android.app.NotificationManager;
+import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
@@ -11,6 +12,7 @@ import android.util.Log;
import androidx.core.app.NotificationCompat;
+import com.example.aucma_mes.InfoListActivity;
import com.example.aucma_mes.R;
import com.example.aucma_mes.base.BaseActivity;
import com.example.aucma_mes.entity.Result;
@@ -85,12 +87,16 @@ public class MyService extends Service {
NotificationChannel channel = new NotificationChannel("channel_id", "channel_name", NotificationManager.IMPORTANCE_DEFAULT);
notificationManager.createNotificationChannel(channel);
}
+ // 创建跳转Intent
+ Intent intent = new Intent(this, InfoListActivity.class);
+ PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
// 创建通知
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "channel_id")
.setSmallIcon(R.mipmap.logo2)
.setContentTitle(title)
.setContentText(content)
+ .setContentIntent(pendingIntent) // 设置点击通知后跳转的Intent
// .setStyle(new NotificationCompat.BigTextStyle()
// .bigText("这里是非常长的文本内容,可以显示多行文本。"))
.setAutoCancel(true);
diff --git a/app/src/main/res/drawable/button_1.xml b/app/src/main/res/drawable/button_1.xml
new file mode 100644
index 0000000..8bf18b4
--- /dev/null
+++ b/app/src/main/res/drawable/button_1.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/item_1.xml b/app/src/main/res/drawable/item_1.xml
new file mode 100644
index 0000000..ef8d953
--- /dev/null
+++ b/app/src/main/res/drawable/item_1.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_info_list.xml b/app/src/main/res/layout/activity_info_list.xml
new file mode 100644
index 0000000..4b8c100
--- /dev/null
+++ b/app/src/main/res/layout/activity_info_list.xml
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_info.xml b/app/src/main/res/layout/item_info.xml
new file mode 100644
index 0000000..a87b3bf
--- /dev/null
+++ b/app/src/main/res/layout/item_info.xml
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
index 06bb35a..2f0f47e 100644
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -10,4 +10,5 @@
- 是
+
\ No newline at end of file