|
|
@@ -1,8 +1,7 @@
|
|
|
package com.uas.gdstorage.activity;
|
|
|
|
|
|
import android.app.Activity;
|
|
|
-import android.app.AlertDialog;
|
|
|
-import android.content.DialogInterface;
|
|
|
+import android.app.Dialog;
|
|
|
import android.content.Intent;
|
|
|
import android.content.pm.PackageManager;
|
|
|
import android.graphics.drawable.BitmapDrawable;
|
|
|
@@ -18,6 +17,8 @@ import android.view.View;
|
|
|
import android.view.Window;
|
|
|
import android.widget.AdapterView;
|
|
|
import android.widget.Button;
|
|
|
+import android.widget.CheckBox;
|
|
|
+import android.widget.CompoundButton;
|
|
|
import android.widget.GridView;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
|
@@ -34,6 +35,8 @@ import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
|
|
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
|
|
|
import com.uas.gdstorage.R;
|
|
|
import com.uas.gdstorage.application.PdaApplication;
|
|
|
+import com.uas.gdstorage.bean.Master;
|
|
|
+import com.uas.gdstorage.bean.MoreEventBusBean;
|
|
|
import com.uas.gdstorage.fragment.BaseFragment;
|
|
|
import com.uas.gdstorage.fragment.WorkOrderSearchFragment;
|
|
|
import com.uas.gdstorage.global.GloableParams;
|
|
|
@@ -57,8 +60,12 @@ import com.uas.gdstorage.view.business.StaffUpPopup;
|
|
|
import com.uuzuche.lib_zxing.activity.CaptureActivity;
|
|
|
import com.uuzuche.lib_zxing.activity.CodeUtils;
|
|
|
|
|
|
+import org.greenrobot.eventbus.EventBus;
|
|
|
+import org.greenrobot.eventbus.Subscribe;
|
|
|
+
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
|
|
|
import razerdp.basepopup.BasePopupWindow;
|
|
|
|
|
|
@@ -87,6 +94,7 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
|
|
|
// SharedPreUtil.removeAll(getApplicationContext());
|
|
|
VolleyUtil.distoryVolley();
|
|
|
super.onDestroy();
|
|
|
+ EventBus.getDefault().unregister(this);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -149,6 +157,7 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
|
|
|
|
|
|
|
|
|
getPrintTemplate();
|
|
|
+ EventBus.getDefault().register(this);
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -477,7 +486,7 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ int pageType = -1;
|
|
|
@Override
|
|
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
|
String itemName = (String) gridItemList.get(position).get(DataSourceManager.KEY_GRID_ITEMNAME);
|
|
|
@@ -509,44 +518,67 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
|
|
|
CommonUtil.toastNoRepeat(this, "暂无在线工单,无法进行解除绑定操作");
|
|
|
return;
|
|
|
}
|
|
|
- new AlertDialog.Builder(this).setTitle("提示").setMessage("确认解除绑定?\n"+"工单:"+workOrder)
|
|
|
- .setPositiveButton(getString(R.string.confirm), new DialogInterface.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(DialogInterface dialog, int which) {
|
|
|
- progressDialog.show();
|
|
|
- VollyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
- new HttpParams.Builder()
|
|
|
- .url(GloableParams.ADDRESS_PDA_STOPMA)
|
|
|
- .method(Request.Method.POST)
|
|
|
- .tag("stopMa")
|
|
|
- .flag(0)
|
|
|
- .addParam("ma_code",workOrder)
|
|
|
- .addParam("sc_code",sc_code)
|
|
|
- .build(), new HttpCallback() {
|
|
|
- @Override
|
|
|
- public void onSuccess(int flag, Object o) throws Exception {
|
|
|
- Boolean isSuccess = FastjsonUtil.getBoolean(o.toString(),"success");
|
|
|
- if (isSuccess){
|
|
|
- CommonUtil.toastNoRepeat(IndexActivity.this,"解绑成功!");
|
|
|
- JSONObject dataObject = FastjsonUtil.getJSONObject(o.toString(),"data");
|
|
|
- Intent intent = new Intent(IndexActivity.this, IndexActivity.class);
|
|
|
- intent.putExtra(Constants.FLAG.SC_CODE,sc_code);
|
|
|
- startActivity(intent);
|
|
|
- }else{
|
|
|
- CommonUtil.toastNoRepeat(IndexActivity.this,"解绑失败!");
|
|
|
- }
|
|
|
- progressDialog.dismiss();
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onFail(int flag, String failStr) throws Exception {
|
|
|
- progressDialog.dismiss();
|
|
|
- CommonUtil.toastNoRepeat(IndexActivity.this, failStr);
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
+ List<Master> masterList = DataSourceManager.getDataSourceManager().getMasterList();
|
|
|
+ String maName = masterList.get(position).getMaName();
|
|
|
+ String userName = SharedPreUtil.getString(this, "user_name", null);
|
|
|
+ pageType = VolleyUtil.FRAGMENT_LOGIN;
|
|
|
+ Dialog dia = new Dialog(IndexActivity.this);
|
|
|
+ dia.setContentView(R.layout.dialog_custom);
|
|
|
+ CheckBox check_alldelete = dia.findViewById(R.id.check_alldelete);
|
|
|
+ LinearLayout lineone = dia.findViewById(R.id.lineone);
|
|
|
+ LinearLayout linetwo = dia.findViewById(R.id.linetwo);
|
|
|
+ TextView tv_info = dia.findViewById(R.id.tv_info);
|
|
|
+ ClearableEditText et_pwd_login = dia.findViewById(R.id.et_pwd_login);
|
|
|
+ Button btn_cancel = dia.findViewById(R.id.btn_cancel);//取消
|
|
|
+ Button btn_confirm = dia.findViewById(R.id.btn_confirm);//确定
|
|
|
+ tv_info.setText("工单:"+workOrder);
|
|
|
+ dia.show();
|
|
|
+ check_alldelete.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
+ @Override
|
|
|
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
|
+ if (isChecked==true){
|
|
|
+ lineone.setVisibility(View.GONE);
|
|
|
+ linetwo.setVisibility(View.VISIBLE);
|
|
|
+ }else {
|
|
|
+ lineone.setVisibility(View.VISIBLE);
|
|
|
+ linetwo.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ dia.setCanceledOnTouchOutside(true);
|
|
|
+ btn_confirm.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ String password = SharedPreUtil.getString(IndexActivity.this, Constants.FLAG.LOGINPASSOWRD, null);
|
|
|
+ String et_pwd_logintrim = et_pwd_login.getText().toString().trim();
|
|
|
+ if (check_alldelete.isChecked()){
|
|
|
+ if (et_pwd_logintrim.isEmpty()){
|
|
|
+ CommonUtil.toastNoRepeat(IndexActivity.this,"请输入密码");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!StringUtil.isEmpty(password)){
|
|
|
+ if (et_pwd_logintrim.equals(password)){
|
|
|
+ getalldeltes(workOrder);
|
|
|
+ dia.dismiss();
|
|
|
+ }else {
|
|
|
+ CommonUtil.toastNoRepeat(IndexActivity.this, "密码不正确");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ getDatagong(workOrder);
|
|
|
+ dia.dismiss();
|
|
|
}
|
|
|
- }).setNegativeButton(getString(R.string.cancel), null).create().show();
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ btn_cancel.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ dia.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
}else{
|
|
|
if (StringUtil.isEmpty(workOrder)){
|
|
|
@@ -569,6 +601,88 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Subscribe
|
|
|
+ public void onMessageEvent(MoreEventBusBean evensst) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //全部删除
|
|
|
+ public void getalldeltes(String workOrder){
|
|
|
+ progressDialog.show();
|
|
|
+ VollyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
+ new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_PDA_DELETEMSSALL)
|
|
|
+ .method(Request.Method.POST)
|
|
|
+ .tag(TAG + "deleteMSSAll")
|
|
|
+ .flag(0)
|
|
|
+ .addParam("ma_code",workOrder)
|
|
|
+ .addParam("sc_code", mPositionR.getText().toString().trim())
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ try {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ Boolean isSuccess = FastjsonUtil.getBoolean(o.toString(), "success");
|
|
|
+ if (isSuccess) {
|
|
|
+// JSONObject dataObject = FastjsonUtil.getJSONObject(o.toString(),"data");
|
|
|
+ getDatagong(workOrder);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(IndexActivity.this, failStr);
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //解除绑定
|
|
|
+ public void getDatagong(String workOrder){
|
|
|
+ Log.e("workOrder",workOrder);
|
|
|
+ Log.e("mPositionR",mPositionR.getText().toString().trim());
|
|
|
+ progressDialog.show();
|
|
|
+ VollyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
+ new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_PDA_STOPMA)
|
|
|
+ .method(Request.Method.POST)
|
|
|
+ .tag("stopMa")
|
|
|
+ .flag(0)
|
|
|
+ .addParam("ma_code",workOrder)
|
|
|
+ .addParam("sc_code",mPositionR.getText().toString().trim())
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ Boolean isSuccess = FastjsonUtil.getBoolean(o.toString(),"success");
|
|
|
+ if (isSuccess){
|
|
|
+ CommonUtil.toastNoRepeat(IndexActivity.this,"解绑成功!");
|
|
|
+ JSONObject dataObject = FastjsonUtil.getJSONObject(o.toString(),"data");
|
|
|
+ Intent intent = new Intent(IndexActivity.this, IndexActivity.class);
|
|
|
+ intent.putExtra(Constants.FLAG.SC_CODE,sc_code);
|
|
|
+ startActivity(intent);
|
|
|
+ Log.e("密码","解绑成功");
|
|
|
+ }else{
|
|
|
+ CommonUtil.toastNoRepeat(IndexActivity.this,"解绑失败!");
|
|
|
+ }
|
|
|
+ progressDialog.dismiss();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(IndexActivity.this, failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
private void staffDown() {
|
|
|
progressDialog.show();
|
|
|
VollyRequest.getInstance().stringRequest(new HttpParams.Builder()
|