增加 - 通知跳转查询数据
parent
ecdd0d15a9
commit
6d749568ef
@ -0,0 +1,70 @@
|
||||
package com.example.aucma_mes;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import com.example.aucma_mes.adapter.RecordAdapter;
|
||||
import com.example.aucma_mes.base.BaseActivity;
|
||||
import com.example.aucma_mes.databinding.ActivityInfoListBinding;
|
||||
import com.example.aucma_mes.entity.RecordExceptionProcess;
|
||||
import com.example.aucma_mes.entity.Result;
|
||||
import com.example.aucma_mes.utils.MyRecultCall;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.model.Response;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class InfoListActivity extends BaseActivity {
|
||||
private ActivityInfoListBinding binding;
|
||||
private RecordAdapter adapter;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = DataBindingUtil.setContentView(this, R.layout.activity_info_list);
|
||||
adapter=new RecordAdapter(this);
|
||||
binding.setAdapter(adapter);
|
||||
infoSelect( "2" );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void sanInfo(String code) {
|
||||
|
||||
}
|
||||
|
||||
public void infoSelect(View view) {
|
||||
var s = binding.infoSpinner.getSelectedItem().toString();
|
||||
infoSelect(s.equals("否") ? "2" : "1");
|
||||
}
|
||||
|
||||
private void infoSelect(String inspectionUserFlag) {
|
||||
|
||||
OkGo.<Result>post(url + "/api/downgradeQuery")
|
||||
.tag(this)
|
||||
.params("inspectionUserFlag",inspectionUserFlag )
|
||||
.execute(new MyRecultCall(dialog, this) {
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
@Override
|
||||
public void onSuccess(Response<Result> response) {
|
||||
super.onSuccess(response);
|
||||
var body = response.body();
|
||||
if (body.getCode()==200){
|
||||
List<RecordExceptionProcess> list=gson.fromJson(gson.toJson(body.getData()),new TypeToken< List<RecordExceptionProcess>>(){}.getType());
|
||||
adapter.setList(list);
|
||||
adapter.notifyDataSetChanged();
|
||||
if (list==null||list.isEmpty()){
|
||||
binding.setListNumbre(0);
|
||||
return;
|
||||
}
|
||||
binding.setListNumbre(list.size());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -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<RecordAdapter.CheckAdapterVH> {
|
||||
private Context context;
|
||||
private List<RecordExceptionProcess> list;
|
||||
private LayoutInflater from;
|
||||
|
||||
|
||||
public RecordAdapter(Context context) {
|
||||
this.context = context;
|
||||
from = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
public void setList(List<RecordExceptionProcess> 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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/blue" />
|
||||
<corners android:radius="10dp" />
|
||||
|
||||
|
||||
</shape>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#74DEE3E6" />
|
||||
<corners android:radius="5dp" />
|
||||
<stroke android:width="1dp"/>
|
||||
|
||||
|
||||
</shape>
|
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
<variable
|
||||
name="adapter"
|
||||
type="com.example.aucma_mes.adapter.RecordAdapter" />
|
||||
<variable
|
||||
name="listNumbre"
|
||||
type="int" />
|
||||
</data>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/grey"
|
||||
tools:context=".InfoListActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="43dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:background="@color/white"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/text_style1"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/grey"
|
||||
android:text="是否已降级:" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/info_spinner"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:entries="@array/yn"
|
||||
android:spinnerMode="dropdown"
|
||||
android:layout_weight="1"
|
||||
android:textAlignment="center" />
|
||||
|
||||
<Button
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/button_1"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp"
|
||||
android:onClick="infoSelect"
|
||||
android:text="查询" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20dp"
|
||||
android:textColor="@color/blue"
|
||||
android:text='@{"待降级数量:"+listNumbre}' />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:adapter="@{adapter}"
|
||||
android:padding="5dp"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
android:background="@color/white" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</layout>
|
@ -0,0 +1,104 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<data>
|
||||
<variable
|
||||
name="item"
|
||||
type="com.example.aucma_mes.entity.RecordExceptionProcess" />
|
||||
</data>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="@drawable/item_1"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginTop="1dp"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
style="@style/item_text_style"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="match_parent"
|
||||
android:text="箱体码" />
|
||||
|
||||
<View
|
||||
android:layout_width="2dp"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
android:background="@color/white" />
|
||||
|
||||
<TextView
|
||||
style="@style/item_text_style"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
|
||||
android:text="@{item.boxBarcode}" />
|
||||
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:background="@color/white" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginTop="1dp"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
style="@style/item_text_style"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="match_parent"
|
||||
android:text="型号" />
|
||||
|
||||
<View
|
||||
android:layout_width="2dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white" />
|
||||
|
||||
<TextView
|
||||
style="@style/item_text_style"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="@{item.materialModel}" />
|
||||
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:background="@color/white" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginTop="1dp"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
style="@style/item_text_style"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="match_parent"
|
||||
android:text="班组" />
|
||||
|
||||
<View
|
||||
android:layout_width="2dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white" />
|
||||
|
||||
<TextView
|
||||
style="@style/item_text_style"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="@{item.teamName}" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</layout>
|
Loading…
Reference in New Issue