|
|
|
|
@ -36,14 +36,15 @@ import java.util.Map;
|
|
|
|
|
import okhttp3.RequestBody;
|
|
|
|
|
|
|
|
|
|
public class CreateWorkOrderActivity extends BaseActivity {
|
|
|
|
|
private final Handler handler = new Handler(Looper.getMainLooper());
|
|
|
|
|
private TipResultDialog tipDialog;
|
|
|
|
|
private ActivityCreateWorkOrderBinding binding;
|
|
|
|
|
private ListPopupWindow lpw;
|
|
|
|
|
private boolean isSearch = false;
|
|
|
|
|
private List<BaseCar> baseCarList;
|
|
|
|
|
private Map<String, Object> submitMap;
|
|
|
|
|
private final Handler handler = new Handler(Looper.getMainLooper());
|
|
|
|
|
private Runnable searchRunnable;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
@ -63,7 +64,7 @@ public class CreateWorkOrderActivity extends BaseActivity {
|
|
|
|
|
@Override
|
|
|
|
|
public void afterTextChanged(Editable s) {
|
|
|
|
|
Log.e("TAG", "afterTextChanged:" + s);
|
|
|
|
|
if (isSearch){
|
|
|
|
|
if (isSearch) {
|
|
|
|
|
if (searchRunnable != null) {
|
|
|
|
|
handler.removeCallbacks(searchRunnable);
|
|
|
|
|
}
|
|
|
|
|
@ -89,7 +90,7 @@ public class CreateWorkOrderActivity extends BaseActivity {
|
|
|
|
|
lpw.dismiss();
|
|
|
|
|
});
|
|
|
|
|
List<String> list = Arrays.asList(getResources().getStringArray(R.array.zxzd));
|
|
|
|
|
binding.orderCreateSite.setSelection(list.indexOf( SharedPreferencesUtils.getstring("workOrderSite", "光明修理厂")));
|
|
|
|
|
binding.orderCreateSite.setSelection(list.indexOf(SharedPreferencesUtils.getstring("workOrderSite", "光明修理厂")));
|
|
|
|
|
binding.orderCreateSite.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
|
|
|
|
|
@ -106,7 +107,7 @@ public class CreateWorkOrderActivity extends BaseActivity {
|
|
|
|
|
|
|
|
|
|
private void selectCarNo(String carNo) {
|
|
|
|
|
|
|
|
|
|
Map<String ,String> map=new HashMap<>();
|
|
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
|
|
map.put("carNo", carNo);
|
|
|
|
|
|
|
|
|
|
OkGo.<MyResult>post(MyUrl.url + "/tyre/car/PdaQueryCarList").tag(this)
|
|
|
|
|
@ -120,14 +121,17 @@ public class CreateWorkOrderActivity extends BaseActivity {
|
|
|
|
|
|
|
|
|
|
baseCarList = gson.fromJson(body.getJson(), new TypeToken<List<BaseCar>>() {
|
|
|
|
|
}.getType());
|
|
|
|
|
if (baseCarList == null || baseCarList.isEmpty()) return;
|
|
|
|
|
if (baseCarList == null || baseCarList.isEmpty()) {
|
|
|
|
|
lpw.dismiss();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
List<String> carNoList = new ArrayList<>(baseCarList.size());
|
|
|
|
|
baseCarList.forEach(car -> carNoList.add(car.getCarNo()));
|
|
|
|
|
lpw.setAdapter(new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, carNoList));
|
|
|
|
|
lpw.show();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
tipDialog.show(false,null, body.getMsg(), false);
|
|
|
|
|
tipDialog.show(false, null, body.getMsg(), false);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@ -143,7 +147,7 @@ public class CreateWorkOrderActivity extends BaseActivity {
|
|
|
|
|
submitMap.put("factoryId", getDeptId(binding.orderCreateSite.getSelectedItem().toString()));
|
|
|
|
|
submitMap.put("createBy", SharedPreferencesUtils.getstring("user", "admin"));
|
|
|
|
|
submitMap.put("status", "PROCESSING");
|
|
|
|
|
submitMap.put("maintainDate",dateFormat.format(new Date()));
|
|
|
|
|
submitMap.put("maintainDate", dateFormat.format(new Date()));
|
|
|
|
|
OkGo.<MyResult>post(MyUrl.url + "/tyre/order/PDAAddMaintenanceOrder")
|
|
|
|
|
.upRequestBody(RequestBody.create(JSON, gson.toJson(submitMap)))
|
|
|
|
|
.execute(new MyRecultCall(dialog, this) {
|
|
|
|
|
@ -152,9 +156,9 @@ public class CreateWorkOrderActivity extends BaseActivity {
|
|
|
|
|
super.onSuccess(response);
|
|
|
|
|
var body = response.body();
|
|
|
|
|
if (body.getCode() == 0) {
|
|
|
|
|
tipDialog.show(true,"发起成功!", "已加入【未完成】列表", true);
|
|
|
|
|
tipDialog.show(true, "发起成功!", "已加入【未完成】列表", true);
|
|
|
|
|
} else {
|
|
|
|
|
tipDialog.show(false,null, body.getMsg(), false);
|
|
|
|
|
tipDialog.show(false, null, body.getMsg(), false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|