修改巡检

idata
wanghao 6 months ago
parent 463421cb32
commit 92eb1b4214

@ -5,6 +5,7 @@ import androidx.databinding.DataBindingUtil;
import androidx.databinding.ObservableBoolean;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
@ -22,6 +23,7 @@ import com.example.beijing_daxing.been.Stock;
import com.example.beijing_daxing.databinding.ActivityCheckBinding;
import com.example.beijing_daxing.dialog.InPutDialog;
import com.example.beijing_daxing.dialog.TakePictureDialog;
import com.example.beijing_daxing.uitls.HexAscii;
import com.example.beijing_daxing.uitls.SharedPreferencesUtils;
import com.google.gson.reflect.TypeToken;
import com.lzy.okgo.OkGo;
@ -45,8 +47,9 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
private ObservableBoolean state;
private ObservableBoolean checkState;
private InPutDialog inputDialog;
private boolean sanType;
private TakePictureDialog takeDialog;
private long id;
private long inspectionId;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -58,32 +61,35 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
binding.setAdapter(adapter);
binding.setState(state);
binding.setCheckState(checkState);
selectList = Arrays.asList(getResources().getStringArray(R.array.check_item));
// binding.checkItemSelect.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
// @Override
// public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
// var selectItem = selectList.get(position);
// state.set(selectItem.equals("正常"));
// }
//
// @Override
// public void onNothingSelected(AdapterView<?> parent) {
//
// }
// });
initRequest(getIntent().getIntExtra("id",0));
/*selectList = Arrays.asList(getResources().getStringArray(R.array.check_item));
binding.checkItemSelect.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
var selectItem = selectList.get(position);
state.set(selectItem.equals("正常"));
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});*/
Intent intent = getIntent();
id = intent.getLongExtra("id", 0);
inspectionId = intent.getLongExtra("inspectionId", 0);
String code = intent.getStringExtra("code");
initRequest(code);
inputDialog = new InPutDialog(this);
inputDialog.setInPutDialogCall(this);
tagList = new ArrayList<>();
takeDialog=new TakePictureDialog(this);
takeDialog = new TakePictureDialog(this);
takeDialog.setCall(this);
}
// 初始化数据
private void initRequest(int id) {
OkGo.<MyResult>post(url + "/xj/select")
.params("id", id)
.execute(new MyRecultCall(dialog, this) {
private void initRequest(String code) {
OkGo.<MyResult>post(url + "/inspection/select").params("code", code).execute(new MyRecultCall(dialog, this) {
@SuppressLint("NotifyDataSetChanged")
@Override
public void onSuccess(Response<MyResult> response) {
super.onSuccess(response);
@ -108,29 +114,18 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
private int subIndex = -1;
// 扫描到返回数据
@SuppressLint("NotifyDataSetChanged")
@Override
protected void sanRfid(List<Reader.TAGINFO> epcs) {
// var text = epcs.get(0);
// binding.checkEpc.setText(text);
// Stock stock = new Stock();
// stock.setEpcCode(text);
// var index = list.indexOf(stock);
// if (index == -1) {
// Toast.makeText(this, "轮挡扫描错误", Toast.LENGTH_SHORT).show();
// return;
// }
// subIndex = index;
epcs.forEach(t -> {
var epc= Tools.Bytes2HexString(t.EpcId,t.EpcId.length);
var epc = Tools.Bytes2HexString(t.EpcId, t.EpcId.length);
if (tagList.contains(t)) {
return;
}
tagList.add(epc);
var stock = new Stock();
stock.setEpcCode(epc);
stock.setEpcCode(HexAscii.hex2Str(epc));
var index = list.indexOf(stock);
if (index != -1) {
list.get(index).setState("正常");
@ -140,15 +135,19 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
}
//提交数据
// 完成巡检,提交数据
public void check_submit(View view) {
var type = list.stream().anyMatch(t -> t.getState().equals("未检"));
if (type) {
Toast.makeText(this, "未检完全部轮挡,不允许提交", Toast.LENGTH_SHORT).show();
return;
}
OkGo.<MyResult>post(url + "/xj/submit").tag(this).params("json", gson.toJson(list)).params("user", SharedPreferencesUtils.getstring("user", "test-user")).execute(new MyRecultCall(dialog, this) {
OkGo.<MyResult>post(url + "/xj/submit").tag(this)
.params("tableId", id)
.params("json", gson.toJson(list))
.params("inspectionId",inspectionId)
.addFileParams("files",files)
.execute(new MyRecultCall(dialog, this) {
@Override
public void onSuccess(Response<MyResult> response) {
super.onSuccess(response);
@ -177,6 +176,7 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
}
@SuppressLint("NotifyDataSetChanged")
@Override
public void inPutDialogReculi(String name) {
var stock = list.get(tag);
@ -204,6 +204,7 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
super.handleMessage(msg);
}
};
private Runnable runnable = new Runnable() {
@Override
public void run() {
@ -214,26 +215,28 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
};
// 拍照
public void check_tackPhoto(View view){
public void check_tackPhoto(View view) {
teke_photo();
}
// 显示拍的照片
public void check_showPhoto(View view){
public void check_showPhoto(View view) {
takeDialog.setBitmaps(bitmaps, files);
takeDialog.show();
}
private List<File> files=new ArrayList<>();
private List<Bitmap> bitmaps=new ArrayList<>();
private List<File> files = new ArrayList<>();
private List<Bitmap> bitmaps = new ArrayList<>();
@Override
public void takePhotoCall(File outputImage, Bitmap bitmap) {
files.add(outputImage);
bitmaps.add(bitmap);
binding. confirmPictureNumber2.setText(bitmaps.size() + "");
binding.confirmPictureNumber2.setText(bitmaps.size() + "");
}
@Override
public void returnListSize(int size) {
binding. confirmPictureNumber2.setText(bitmaps.size() + "");
binding.confirmPictureNumber2.setText(bitmaps.size() + "");
}
}

@ -7,6 +7,7 @@ import androidx.databinding.ObservableBoolean;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
@ -35,7 +36,6 @@ public class CheckListActivity extends BaseActivity implements AdapterClickCall
super.onCreate(savedInstanceState);
ActivityCheckListBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_check_list);
adapter = new CheckListAdapter(this,this);
binding.setAdapter(adapter);
createState=new ObservableBoolean();
createState.set(false);
@ -90,7 +90,11 @@ public class CheckListActivity extends BaseActivity implements AdapterClickCall
@Override
public void clickItem(int index) {
Intent intent=new Intent(this,CheckActivity.class);
intent.putExtra("id",list.get(index).getId());
CheckTaskInfo checkTaskInfo = list.get(index);
intent.putExtra("id", checkTaskInfo.getId());
intent.putExtra("inspectionId", checkTaskInfo.getInspectionId());
intent.putExtra("code",checkTaskInfo.getLocationCode());
startActivity(intent);
}
}

@ -5,10 +5,29 @@ import androidx.databinding.BaseObservable;
public class CheckTaskInfo extends BaseObservable {
private int index;
private Long id;
private Long areaId;
private Long inspectionId;
private String locationCode;
private String areaName;
private String taskState;
public Long getInspectionId() {
return inspectionId;
}
public void setInspectionId(Long inspectionId) {
this.inspectionId = inspectionId;
}
public Long getAreaId() {
return areaId;
}
public void setAreaId(Long areaId) {
this.areaId = areaId;
}
public String getTaskState() {
return taskState;
}

@ -1,6 +1,7 @@
package com.example.beijing_daxing.dialog;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
@ -70,10 +71,10 @@ public class TakePictureDialog extends Dialog implements PictureAdapter.ViewOnCl
call.returnListSize(bitmaps.size());
dismiss();
});
pictureRecyclerview.setLayoutManager(new GridLayoutManager(context, 3));
// LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
// linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
// pictureRecyclerview.setLayoutManager(linearLayoutManager);
// pictureRecyclerview.setLayoutManager(new GridLayoutManager(context, 3));
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
pictureRecyclerview.setLayoutManager(linearLayoutManager);
}
@ -85,6 +86,7 @@ public class TakePictureDialog extends Dialog implements PictureAdapter.ViewOnCl
Log.e("TAG", "show");
}
@SuppressLint("NotifyDataSetChanged")
@Override
public void onclickCall(int position) {
Log.e("TAG", "在dialog中删除的id:" + position);

@ -33,22 +33,52 @@
android:layout_height="45dp"
android:text="轮挡巡检" />
<TextView
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="未巡检轮挡情况" />
android:layout_height="42dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:layout_marginTop="2dp">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="450dp"
android:adapter="@{adapter}"
android:padding="10dp"
android:layout_weight="1"
android:background="@color/white"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<TextView
style="@style/item_text_style"
android:layout_width="200dp"
android:layout_height="match_parent"
android:text="轮挡RFID" />
<View
android:layout_width="1dp"
android:layout_height="28dp"
android:layout_gravity="center"
android:layout_marginTop="2dp"
android:background="@color/white" />
<TextView
style="@style/item_text_style"
android:layout_width="120dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="巡检状态" />
<View
android:layout_width="1dp"
android:layout_height="28dp"
android:layout_gravity="center"
android:layout_marginTop="2dp"
android:background="@color/white" />
<TextView
android:id="@+id/item_check_click"
style="@style/item_text_style"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:letterSpacing="0.1"
android:text="操作"
android:textColor="@color/blue"
/>
</LinearLayout>
<!-- <LinearLayout
<!-- <LinearLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginTop="10dp">
@ -120,13 +150,19 @@
android:onClick="check_stock"
android:text="单次提交" />-->
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="450dp"
android:layout_weight="1"
android:adapter="@{adapter}"
android:background="@color/white"
android:padding="5dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="20dp"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<Button
@ -139,28 +175,27 @@
android:onClick="offCheckRead"
android:text='@{checkState?"停止读取":"开始扫描"}'
android:textSize="20sp" />
<Button
style="@style/button_style1"
android:layout_width="match_parent"
<ImageButton
android:layout_width="100dp"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:backgroundTint="#009688"
android:onClick="check_submit"
android:text="完成巡检" />
android:layout_marginEnd="5dp"
android:src="@mipmap/icon_cromer"
android:onClick="check_tackPhoto"/>
<FrameLayout
android:layout_width="80dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp">
android:layout_weight="1"
<ImageView
android:layout_marginLeft="10dp">
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@mipmap/icon_cromer"
android:onClick="check_tackPhoto"/>
android:onClick="check_showPhoto"
android:text="查看照片"/>
<TextView
android:id="@+id/confirm_picture_number2"
@ -172,9 +207,20 @@
android:text="0"
android:textColor="@color/white"
android:textSize="18sp"
android:onClick="check_showPhoto"/>
/>
</FrameLayout>
</LinearLayout>
<Button
style="@style/button_style1"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="10dp"
android:backgroundTint="#009688"
android:onClick="check_submit"
android:text="完成巡检" />
</LinearLayout>
</layout>

@ -12,117 +12,117 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/info_text_bg"
android:orientation="vertical"
android:layout_marginTop="5dp"
android:padding="8dp">
android:background="#EAEDFD"
android:orientation="vertical"
android:padding="2dp">
<TextView
style="@style/item_text_style1"
android:layout_width="match_parent"
android:layout_height="30dp"
android:text="@{item.epcCode}" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginTop="2dp">
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="30dp"-->
<!-- android:layout_marginTop="2dp">-->
<!-- <TextView-->
<!-- style="@style/item_text_style"-->
<!-- android:layout_width="100dp"-->
<!-- android:layout_height="match_parent"-->
<!-- android:text="机位编码:" />-->
<!-- <TextView-->
<!-- style="@style/item_text_style"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:gravity="left|center"-->
<!-- android:text="@{item.locationCode}" />-->
<!-- </LinearLayout>-->
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="30dp"-->
<!-- android:layout_marginTop="2dp">-->
<!-- <TextView-->
<!-- style="@style/item_text_style"-->
<!-- android:layout_width="100dp"-->
<!-- android:layout_height="match_parent"-->
<!-- android:text="入场时间:" />-->
<!-- <TextView-->
<!-- style="@style/item_text_style"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:gravity="left|center"-->
<!-- android:text="@{item.createTime}" />-->
<!-- </LinearLayout>-->
<TextView
style="@style/item_text_style"
android:layout_width="100dp"
android:layout_height="match_parent"
android:text="机位编码:" />
<TextView
style="@style/item_text_style"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left|center"
android:text="@{item.locationCode}" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginTop="2dp">
<TextView
style="@style/item_text_style"
android:layout_width="100dp"
android:layout_height="match_parent"
android:text="入场时间:" />
android:layout_height="42dp">
<TextView
style="@style/item_text_style"
android:layout_width="match_parent"
android:layout_width="200dp"
android:layout_height="match_parent"
android:gravity="left|center"
android:text="@{item.createTime}" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:visibility='@{(item.state.equals("跳过") || item.state.equals("异常")) ?View.VISIBLE : View.GONE }'
android:layout_marginTop="2dp">
android:text="@{item.epcCode}" />
<View
android:layout_width="1dp"
android:layout_height="28dp"
android:layout_gravity="center"
android:layout_marginTop="2dp"
android:background="@color/white" />
<TextView
style="@style/item_text_style"
android:layout_width="100dp"
android:layout_width="120dp"
android:layout_height="match_parent"
android:text='@{item.state+"原因:"}' />
android:text="@{item.state}" />
<View
android:layout_width="1dp"
android:layout_height="28dp"
android:layout_gravity="center"
android:layout_marginTop="2dp"
android:background="@color/white" />
<TextView
android:id="@+id/item_check_click"
style="@style/item_text_style"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left|center"
android:text="@{item.remark}" />
android:letterSpacing="0.1"
android:text="跳过巡检"
android:textColor="@color/blue"
android:visibility='@{item.state.equals("未检") ? View.VISIBLE :View.GONE}' />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_height="1dp"
android:layout_gravity="center"
android:layout_marginTop="2dp"
android:background="@color/bg1" />
android:background="@color/white" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="42dp"
android:layout_marginTop="2dp">
android:layout_height="30dp"
android:visibility='@{(item.state.equals("跳过") || item.state.equals("异常")) ?View.VISIBLE : View.GONE }'>
<TextView
style="@style/item_text_style"
android:layout_width="100dp"
android:layout_height="match_parent"
android:text="巡检状态:" />
android:text='@{item.state+"原因:"}' />
<TextView
style="@style/item_text_style"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="left|center"
android:text="@{item.state}" />
<View
android:layout_width="1dp"
android:layout_height="28dp"
android:layout_gravity="center"
android:layout_marginTop="2dp"
android:background="@color/bg1" />
<TextView
android:id="@+id/item_check_click"
style="@style/item_text_style"
android:layout_width="100dp"
android:layout_height="match_parent"
android:letterSpacing="0.5"
android:visibility='@{item.state.equals("未检") ? View.VISIBLE :View.GONE}'
android:text="跳过"
android:textColor="@color/blue" />
android:paddingLeft="5dp"
android:text="@{item.remark}" />
</LinearLayout>

@ -2,18 +2,22 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="200dp"
android:layout_height="200dp">
android:layout_height="match_parent"
android:layout_marginLeft="10dp">
<ImageView
android:id="@+id/item_photoImg"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent" />
<TextView
android:id="@+id/item_photoButton"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:gravity="center"
android:textSize="29sp"
android:textSize="39sp"
android:textColor="@color/red"
android:textStyle="bold"
android:text="×" />
</FrameLayout>
Loading…
Cancel
Save