@ -0,0 +1,137 @@
|
|||||||
|
package com.example.beijing_daxing;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.databinding.ObservableBoolean;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Message;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.example.beijing_daxing.adapter.OutAdapter;
|
||||||
|
import com.example.beijing_daxing.adapter.StoreCheckAdapter;
|
||||||
|
import com.example.beijing_daxing.base.BaseActivity;
|
||||||
|
import com.example.beijing_daxing.base.MyRecultCall;
|
||||||
|
import com.example.beijing_daxing.base.MyResult;
|
||||||
|
import com.example.beijing_daxing.been.Stock;
|
||||||
|
import com.example.beijing_daxing.databinding.ActivityFpOutBinding;
|
||||||
|
import com.example.beijing_daxing.uitls.SharedPreferencesUtils;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
import com.lzy.okgo.OkGo;
|
||||||
|
import com.lzy.okgo.model.Response;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class FpOutActivity extends BaseActivity {
|
||||||
|
private ObservableBoolean checkState;
|
||||||
|
private List<Stock> list;
|
||||||
|
private OutAdapter adapter;
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
ActivityFpOutBinding binding= DataBindingUtil. setContentView(this,R.layout.activity_fp_out);
|
||||||
|
checkState=new ObservableBoolean();
|
||||||
|
binding.setCheckState(checkState);
|
||||||
|
adapter = new OutAdapter(this);
|
||||||
|
binding.setAdapter(adapter);
|
||||||
|
initRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> tagList;
|
||||||
|
@Override
|
||||||
|
protected void sanRfid(List<String> epcs) {
|
||||||
|
epcs.forEach(t -> {
|
||||||
|
if (tagList.contains(t)){
|
||||||
|
tagList.add(t);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var stock = new Stock();
|
||||||
|
stock.setEpcCode(t);
|
||||||
|
var index = list.indexOf(stock);
|
||||||
|
if (index != -1) {
|
||||||
|
list.get(index).setState("Y");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
private void initRequest() {
|
||||||
|
OkGo.<MyResult>post(url + "/fpout/select").tag(this).execute(new MyRecultCall(dialog, this) {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Response<MyResult> response) {
|
||||||
|
super.onSuccess(response);
|
||||||
|
var body = response.body();
|
||||||
|
if (body.getCode() == 0) {
|
||||||
|
list = gson.fromJson(body.getData().toString(), new TypeToken<List<Stock>>() {
|
||||||
|
}.getType());
|
||||||
|
tagList=new ArrayList<>();
|
||||||
|
adapter.setList(list);
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
} else {
|
||||||
|
Toast.makeText(FpOutActivity.this, body.getMsg(), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public void fp_out_read(View view) {
|
||||||
|
var b = checkState.get();
|
||||||
|
if (b) {
|
||||||
|
handler.removeCallbacks(runnable);
|
||||||
|
} else {
|
||||||
|
handler.postDelayed(runnable, 0);
|
||||||
|
}
|
||||||
|
checkState.set(!b);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fp_out_submit(View view) {
|
||||||
|
if (list.stream().anyMatch(t -> t.getState().equals("N"))){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
handler.removeCallbacks(runnable);
|
||||||
|
|
||||||
|
OkGo.<MyResult>post(url+"/fpout/submit")
|
||||||
|
.tag(this)
|
||||||
|
.params("user", SharedPreferencesUtils.getstring("user","test"))
|
||||||
|
.params("json",gson.toJson(list))
|
||||||
|
.execute(new MyRecultCall(dialog,this){
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Response<MyResult> response) {
|
||||||
|
super.onSuccess(response);
|
||||||
|
var body = response.body();
|
||||||
|
if (body.getCode()==0){
|
||||||
|
finish();
|
||||||
|
Toast.makeText(FpOutActivity.this, "提交成功", Toast.LENGTH_SHORT).show();
|
||||||
|
}else {
|
||||||
|
Toast.makeText(FpOutActivity.this, body.getMsg(), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("HandlerLeak")
|
||||||
|
private Handler handler = new Handler() {
|
||||||
|
@Override
|
||||||
|
public void handleMessage(@NonNull Message msg) {
|
||||||
|
super.handleMessage(msg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
private Runnable runnable = new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
sendBroadcast(broadcastIntent);
|
||||||
|
handler.postDelayed(runnable, 1000);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
handler.removeCallbacks(runnable);
|
||||||
|
handler=null;
|
||||||
|
runnable=null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,65 @@
|
|||||||
|
package com.example.beijing_daxing.adapter;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.example.beijing_daxing.R;
|
||||||
|
import com.example.beijing_daxing.been.Stock;
|
||||||
|
import com.example.beijing_daxing.databinding.ItemOutBinding;
|
||||||
|
import com.example.beijing_daxing.databinding.ItemStoreCheckBinding;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wanghao
|
||||||
|
* @date 2024/1/19 14:32
|
||||||
|
*/
|
||||||
|
public class OutAdapter extends RecyclerView.Adapter<OutAdapter.MyViewHoder> {
|
||||||
|
private Context context;
|
||||||
|
private List<Stock> list;
|
||||||
|
private LayoutInflater inflater;
|
||||||
|
|
||||||
|
public OutAdapter(Context context) {
|
||||||
|
this.context = context;
|
||||||
|
inflater = LayoutInflater.from(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setList(List<Stock> list) {
|
||||||
|
this.list = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MyViewHoder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
|
ItemOutBinding binding = DataBindingUtil.inflate(inflater, R.layout.item_out, parent, false);
|
||||||
|
return new MyViewHoder(binding);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(MyViewHoder holder, int position) {
|
||||||
|
var binding = holder.getBinding();
|
||||||
|
binding.setItem(list.get(position));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return list==null?0:list.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MyViewHoder extends RecyclerView.ViewHolder {
|
||||||
|
private ItemOutBinding binding;
|
||||||
|
|
||||||
|
public MyViewHoder( ItemOutBinding binding) {
|
||||||
|
super(binding.getRoot());
|
||||||
|
this.binding = binding;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemOutBinding getBinding() {
|
||||||
|
return binding;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
package com.example.beijing_daxing.dialog;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.databinding.DataBindingUtil;
|
||||||
|
|
||||||
|
import com.example.beijing_daxing.R;
|
||||||
|
import com.example.beijing_daxing.databinding.DialogInputBinding;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wanghao
|
||||||
|
* @date 2024/2/21 14:33
|
||||||
|
*/
|
||||||
|
public class InPutDialog extends Dialog {
|
||||||
|
private InPutDialogCall inPutDialogCall;
|
||||||
|
private DialogInputBinding binding;
|
||||||
|
|
||||||
|
public void setInPutDialogCall(InPutDialogCall inPutDialogCall) {
|
||||||
|
this.inPutDialogCall = inPutDialogCall;
|
||||||
|
}
|
||||||
|
|
||||||
|
public InPutDialog(@NonNull Context context) {
|
||||||
|
super(context, R.style.dialog);
|
||||||
|
binding = DataBindingUtil.inflate(LayoutInflater.from(context),
|
||||||
|
R.layout.dialog_input, null, false);
|
||||||
|
setContentView(binding.getRoot());
|
||||||
|
binding.dialogFalse.setOnClickListener(v -> dismiss());
|
||||||
|
binding.dialogTrue.setOnClickListener(v -> {
|
||||||
|
inPutDialogCall.inPutDialogReculi( binding.inputDialogText.getText().toString().trim());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public interface InPutDialogCall {
|
||||||
|
void inPutDialogReculi(String name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show() {
|
||||||
|
super.show(); binding.inputDialogText.setText(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 2.9 KiB |
@ -0,0 +1,64 @@
|
|||||||
|
<?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="checkState"
|
||||||
|
type="androidx.databinding.ObservableBoolean" />
|
||||||
|
<variable
|
||||||
|
name="adapter"
|
||||||
|
type="com.example.beijing_daxing.adapter.OutAdapter" />
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:context=".FpOutActivity">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/title_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
android:text="废品出库" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:adapter="@{adapter}"
|
||||||
|
android:background="@color/white"
|
||||||
|
android:padding="10dp"
|
||||||
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="55dp"
|
||||||
|
android:layout_margin="20dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_marginEnd="15dp"
|
||||||
|
android:backgroundTint="@{checkState?@color/yellow:@color/black}"
|
||||||
|
android:onClick="fp_out_read"
|
||||||
|
android:text='@{checkState?"停止扫描":"自动扫描"}'
|
||||||
|
android:textSize="18sp" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginStart="20dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:onClick="fp_out_submit"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:text="提交出库" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</layout>
|
||||||
@ -0,0 +1,71 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<data>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="246dp"
|
||||||
|
android:background="@drawable/info_text_bg"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:letterSpacing="0.2"
|
||||||
|
android:text="输入提示"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="23sp" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/input_dialog_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:layout_margin="20dp"
|
||||||
|
android:background="@drawable/san_text_bg"
|
||||||
|
android:hint="输入巡检跳过原因"
|
||||||
|
android:gravity="center" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/bg1" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="55dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/dialog_false"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textColor="@color/yellow"
|
||||||
|
android:letterSpacing="1"
|
||||||
|
android:text="取消" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="2dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:background="@color/bg1" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/dialog_true"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textColor="@color/blue"
|
||||||
|
android:letterSpacing="1"
|
||||||
|
android:text="确定" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</layout>
|
||||||
@ -0,0 +1,62 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<variable
|
||||||
|
name="item"
|
||||||
|
type="com.example.beijing_daxing.been.Stock" />
|
||||||
|
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:background='@{item.state.equals("Y")?@color/green:@color/item_bg}'
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/item_index"
|
||||||
|
style="@style/item_text_style"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text='@{String.valueOf(item.index)}' />
|
||||||
|
|
||||||
|
<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="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:minHeight="45dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@{item.epcCode}" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="2dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/white" />
|
||||||
|
<TextView
|
||||||
|
style="@style/item_text_style"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text="@{item.locationCode}" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</layout>
|
||||||
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
|
||||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
|
||||||
</adaptive-icon>
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
|
||||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
|
||||||
</adaptive-icon>
|
|
||||||
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 982 B |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 7.6 KiB |