|
|
|
@ -21,6 +21,7 @@ import com.example.beijing_daxing.base.MyResult;
|
|
|
|
|
import com.example.beijing_daxing.been.CheckTaskInfo;
|
|
|
|
|
import com.example.beijing_daxing.been.Stock;
|
|
|
|
|
import com.example.beijing_daxing.databinding.ActivityCheckListBinding;
|
|
|
|
|
import com.example.beijing_daxing.dialog.InPutDialog;
|
|
|
|
|
import com.example.beijing_daxing.uitls.SharedPreferencesUtils;
|
|
|
|
|
import com.google.gson.reflect.TypeToken;
|
|
|
|
|
import com.lzy.okgo.OkGo;
|
|
|
|
@ -29,11 +30,13 @@ import com.uhf.api.cls.Reader;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
public class CheckListActivity extends BaseActivity implements AdapterClickCall {
|
|
|
|
|
public class CheckListActivity extends BaseActivity implements CheckListAdapter.AdapterClickCall, InPutDialog.InPutDialogCall {
|
|
|
|
|
private CheckListAdapter adapter;
|
|
|
|
|
private List<CheckTaskInfo> list;
|
|
|
|
|
private ObservableBoolean createState;
|
|
|
|
|
private String[] stateList;
|
|
|
|
|
private InPutDialog inputDialog;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
@ -43,18 +46,28 @@ public class CheckListActivity extends BaseActivity implements AdapterClickCall
|
|
|
|
|
createState = new ObservableBoolean();
|
|
|
|
|
createState.set(false);
|
|
|
|
|
binding.setState(createState);
|
|
|
|
|
stateList = getResources().getStringArray(R.array.checkState);
|
|
|
|
|
binding.checkListState.setOnItemClickListener((parent, view, position, id) -> {
|
|
|
|
|
initRequest(stateList[position]);
|
|
|
|
|
inputDialog = new InPutDialog(this);
|
|
|
|
|
inputDialog.setInPutDialogCall(this);
|
|
|
|
|
stateList = getResources().getStringArray(R.array.checkState);
|
|
|
|
|
binding.checkListState.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
|
|
|
String state = stateList[position];
|
|
|
|
|
Log.e("TAG", "onItemSelected:" + state);
|
|
|
|
|
initRequest(state);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
private void initRequest(String state) {
|
|
|
|
|
OkGo.<MyResult>post(url + "/inspection/selectTask")
|
|
|
|
|
.params("state", SharedPreferencesUtils.getstring("user", ""))
|
|
|
|
|
.params("state", state)
|
|
|
|
|
.execute(new MyRecultCall(dialog, this) {
|
|
|
|
|
@SuppressLint("NotifyDataSetChanged")
|
|
|
|
|
@Override
|
|
|
|
@ -76,7 +89,6 @@ public class CheckListActivity extends BaseActivity implements AdapterClickCall
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void check_start(View view) {
|
|
|
|
|
OkGo.<MyResult>post(url + "/xj/createTask")
|
|
|
|
|
.params("user", SharedPreferencesUtils.getstring("user", ""))
|
|
|
|
@ -97,7 +109,6 @@ public class CheckListActivity extends BaseActivity implements AdapterClickCall
|
|
|
|
|
@Override
|
|
|
|
|
public void clickItem(int index) {
|
|
|
|
|
Intent intent = new Intent(this, CheckActivity.class);
|
|
|
|
|
|
|
|
|
|
CheckTaskInfo checkTaskInfo = list.get(index);
|
|
|
|
|
intent.putExtra("id", checkTaskInfo.getId());
|
|
|
|
|
intent.putExtra("inspectionId", checkTaskInfo.getInspectionId());
|
|
|
|
@ -105,6 +116,12 @@ public class CheckListActivity extends BaseActivity implements AdapterClickCall
|
|
|
|
|
intent.putExtra("backIndex", index);
|
|
|
|
|
startActivityForResult(intent, 1);
|
|
|
|
|
}
|
|
|
|
|
private int skipIndex;
|
|
|
|
|
@Override
|
|
|
|
|
public void clickItemSkip(int index) {
|
|
|
|
|
skipIndex=index;
|
|
|
|
|
inputDialog.show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@SuppressLint("NotifyDataSetChanged")
|
|
|
|
|
@Override
|
|
|
|
@ -114,9 +131,31 @@ public class CheckListActivity extends BaseActivity implements AdapterClickCall
|
|
|
|
|
if (requestCode == 1 && data != null) {
|
|
|
|
|
int index = data.getIntExtra("backIndex", 0);
|
|
|
|
|
Log.e("TAG", "onActivityResult:" + index);
|
|
|
|
|
list.get(index).setTaskState("完成");
|
|
|
|
|
list.get(index).setTaskState("已完成");
|
|
|
|
|
adapter.notifyDataSetChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void inPutDialogReculi(String name) {
|
|
|
|
|
CheckTaskInfo checkTaskInfo = list.get(skipIndex);
|
|
|
|
|
OkGo.<MyResult>post(url + "/inspection/skipTask")
|
|
|
|
|
.params("remark", name)
|
|
|
|
|
.params("tableId", checkTaskInfo.getId())
|
|
|
|
|
.execute(new MyRecultCall(dialog, this) {
|
|
|
|
|
@SuppressLint("NotifyDataSetChanged")
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(Response<MyResult> response) {
|
|
|
|
|
super.onSuccess(response);
|
|
|
|
|
MyResult body = response.body();
|
|
|
|
|
if (body.getCode() == 0) {
|
|
|
|
|
checkTaskInfo.setTaskState("跳过");
|
|
|
|
|
adapter.notifyDataSetChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
inputDialog.dismiss();
|
|
|
|
|
}
|
|
|
|
|
}
|