完成 巡检

bgs_it_pm
wanghao 1 year ago
parent cabb1bd15a
commit cd03058083

@ -50,6 +50,7 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
private TakePictureDialog takeDialog; private TakePictureDialog takeDialog;
private long id; private long id;
private long inspectionId; private long inspectionId;
private int backIndex;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -76,6 +77,7 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
});*/ });*/
Intent intent = getIntent(); Intent intent = getIntent();
id = intent.getLongExtra("id", 0); id = intent.getLongExtra("id", 0);
backIndex = intent.getIntExtra("backIndex", 0);
inspectionId = intent.getLongExtra("inspectionId", 0); inspectionId = intent.getLongExtra("inspectionId", 0);
String code = intent.getStringExtra("code"); String code = intent.getStringExtra("code");
initRequest(code); initRequest(code);
@ -146,12 +148,17 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
.params("tableId", id) .params("tableId", id)
.params("json", gson.toJson(list)) .params("json", gson.toJson(list))
.params("inspectionId",inspectionId) .params("inspectionId",inspectionId)
.params("user", SharedPreferencesUtils.getstring("user",""))
.addFileParams("files",files) .addFileParams("files",files)
.execute(new MyRecultCall(dialog, this) { .execute(new MyRecultCall(dialog, this) {
@Override @Override
public void onSuccess(Response<MyResult> response) { public void onSuccess(Response<MyResult> response) {
super.onSuccess(response); super.onSuccess(response);
Toast.makeText(CheckActivity.this, "提交成功", Toast.LENGTH_SHORT).show(); Toast.makeText(CheckActivity.this, "提交成功", Toast.LENGTH_SHORT).show();
Intent resultIntent = new Intent();
resultIntent.putExtra("backIndex", backIndex);
files.forEach(File::delete);
setResult(RESULT_OK, resultIntent);
finish(); finish();
} }
}); });

@ -31,20 +31,21 @@ public class CheckListActivity extends BaseActivity implements AdapterClickCall
private CheckListAdapter adapter; private CheckListAdapter adapter;
private List<CheckTaskInfo> list; private List<CheckTaskInfo> list;
private ObservableBoolean createState; private ObservableBoolean createState;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
ActivityCheckListBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_check_list); ActivityCheckListBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_check_list);
adapter = new CheckListAdapter(this,this); adapter = new CheckListAdapter(this, this);
binding.setAdapter(adapter); binding.setAdapter(adapter);
createState=new ObservableBoolean(); createState = new ObservableBoolean();
createState.set(false); createState.set(false);
binding.setState(createState); binding.setState(createState);
initRequest(); initRequest();
} }
private void initRequest() { private void initRequest() {
OkGo.<MyResult>post(url+"/inspection/selectTask") OkGo.<MyResult>post(url + "/inspection/selectTask")
.params("user", SharedPreferencesUtils.getstring("user", "")) .params("user", SharedPreferencesUtils.getstring("user", ""))
.execute(new MyRecultCall(dialog, this) { .execute(new MyRecultCall(dialog, this) {
@SuppressLint("NotifyDataSetChanged") @SuppressLint("NotifyDataSetChanged")
@ -52,12 +53,13 @@ public class CheckListActivity extends BaseActivity implements AdapterClickCall
public void onSuccess(Response<MyResult> response) { public void onSuccess(Response<MyResult> response) {
super.onSuccess(response); super.onSuccess(response);
MyResult body = response.body(); MyResult body = response.body();
if (body.getCode()==0){ if (body.getCode() == 0) {
createState.set(false); createState.set(false);
list=gson.fromJson(body.getData().toString(),new TypeToken<List<CheckTaskInfo>>(){}.getType()); list = gson.fromJson(body.getData().toString(), new TypeToken<List<CheckTaskInfo>>() {
}.getType());
adapter.setList(list); adapter.setList(list);
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
}else { } else {
createState.set(true); createState.set(true);
} }
@ -89,12 +91,27 @@ public class CheckListActivity extends BaseActivity implements AdapterClickCall
@Override @Override
public void clickItem(int index) { public void clickItem(int index) {
Intent intent=new Intent(this,CheckActivity.class); Intent intent = new Intent(this, CheckActivity.class);
CheckTaskInfo checkTaskInfo = list.get(index); CheckTaskInfo checkTaskInfo = list.get(index);
intent.putExtra("id", checkTaskInfo.getId()); intent.putExtra("id", checkTaskInfo.getId());
intent.putExtra("inspectionId", checkTaskInfo.getInspectionId()); intent.putExtra("inspectionId", checkTaskInfo.getInspectionId());
intent.putExtra("code",checkTaskInfo.getLocationCode()); intent.putExtra("code", checkTaskInfo.getLocationCode());
startActivity(intent); intent.putExtra("backIndex", index);
startActivityForResult(intent, 1);
}
@SuppressLint("NotifyDataSetChanged")
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 1 && data != null) {
int index = data.getIntExtra("backIndex", 0);
Log.e("TAG", "onActivityResult:" + index);
list.get(index).setTaskState("完成");
adapter.notifyDataSetChanged();
}
} }
} }

@ -175,7 +175,8 @@ public abstract class BaseActivity extends AppCompatActivity {
@Override @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) { protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
if (requestCode == CAMERA_PHOTO && resultCode == RESULT_OK) {
Bitmap bitmap = null; Bitmap bitmap = null;
try { try {
Log.e("TAG", "onActivityResult:" + img_uri.getPath()); Log.e("TAG", "onActivityResult:" + img_uri.getPath());

@ -39,7 +39,7 @@ import okhttp3.OkHttpClient;
public class MyApplication extends Application { public class MyApplication extends Application {
MyApplication application; MyApplication application;
// public static UHFRManager uhfLongerManager; public static UHFRManager uhfLongerManager;
@Override @Override
public void onCreate() { public void onCreate() {
@ -60,18 +60,18 @@ public class MyApplication extends Application {
.init(this); .init(this);
} }
// public static UHFRManager getUhfLongerManager() { public static UHFRManager getUhfLongerManager() {
// if (uhfLongerManager==null){ if (uhfLongerManager==null){
// try { try {
// uhfLongerManager = UHFRManager.getInstance(); uhfLongerManager = UHFRManager.getInstance();
// uhfLongerManager.setPower(33,33); uhfLongerManager.setPower(33,33);
// } catch (Exception e) { } catch (Exception e) {
// e.printStackTrace(); e.printStackTrace();
// } }
// } }
//
// return uhfLongerManager; return uhfLongerManager;
// } }
// OKGO 初始化 // OKGO 初始化
private void okGoBase() { private void okGoBase() {
OkHttpClient.Builder builder = new OkHttpClient.Builder(); OkHttpClient.Builder builder = new OkHttpClient.Builder();

@ -49,9 +49,9 @@
<TextView <TextView
style="@style/item_text_style" style="@style/item_text_style"
android:layout_width="match_parent" android:layout_width="115dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1"
android:text="机坪" android:text="机坪"
/> />
@ -63,9 +63,9 @@
<TextView <TextView
style="@style/item_text_style" style="@style/item_text_style"
android:layout_width="match_parent" android:layout_width="115dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1"
android:text="机位编码" android:text="机位编码"
/> />
@ -90,7 +90,7 @@
style="@style/item_text_style" style="@style/item_text_style"
android:layout_width="63dp" android:layout_width="63dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:textColor="#E71717" /> android:text="操作" />
</LinearLayout> </LinearLayout>

@ -32,9 +32,8 @@
<TextView <TextView
style="@style/item_text_style" style="@style/item_text_style"
android:layout_width="match_parent" android:layout_width="115dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1"
android:text="@{vm.areaName}" android:text="@{vm.areaName}"
/> />
@ -45,9 +44,9 @@
<TextView <TextView
style="@style/item_text_style" style="@style/item_text_style"
android:layout_width="match_parent" android:layout_width="115dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1"
android:text="@{vm.locationCode}" android:text="@{vm.locationCode}"
/> />
@ -76,6 +75,8 @@
android:layout_width="63dp" android:layout_width="63dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:src="@mipmap/ic_start" android:src="@mipmap/ic_start"
android:visibility='@{vm.taskState.equals("待完成")?View.VISIBLE:View.GONE}'
android:padding="5dp"/> android:padding="5dp"/>
</LinearLayout> </LinearLayout>
</layout> </layout>
Loading…
Cancel
Save