|
@@ -1,16 +1,11 @@
|
|
|
package com.uas.gdstorage.activity;
|
|
package com.uas.gdstorage.activity;
|
|
|
|
|
|
|
|
-import android.Manifest;
|
|
|
|
|
import android.app.Activity;
|
|
import android.app.Activity;
|
|
|
-import android.content.DialogInterface;
|
|
|
|
|
import android.content.Intent;
|
|
import android.content.Intent;
|
|
|
import android.content.pm.PackageManager;
|
|
import android.content.pm.PackageManager;
|
|
|
import android.graphics.drawable.BitmapDrawable;
|
|
import android.graphics.drawable.BitmapDrawable;
|
|
|
-import android.os.Bundle;
|
|
|
|
|
import android.support.annotation.NonNull;
|
|
import android.support.annotation.NonNull;
|
|
|
-import android.support.v7.app.AlertDialog;
|
|
|
|
|
import android.text.TextUtils;
|
|
import android.text.TextUtils;
|
|
|
-import android.util.Log;
|
|
|
|
|
import android.view.Gravity;
|
|
import android.view.Gravity;
|
|
|
import android.view.KeyEvent;
|
|
import android.view.KeyEvent;
|
|
|
import android.view.LayoutInflater;
|
|
import android.view.LayoutInflater;
|
|
@@ -29,7 +24,6 @@ import android.widget.TextView;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.android.volley.Request;
|
|
import com.android.volley.Request;
|
|
|
-import com.android.volley.toolbox.StringRequest;
|
|
|
|
|
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
|
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
|
|
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
|
|
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
|
|
|
import com.uas.gdstorage.R;
|
|
import com.uas.gdstorage.R;
|
|
@@ -59,8 +53,6 @@ import com.uuzuche.lib_zxing.activity.CodeUtils;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
|
|
|
|
|
-import javax.crypto.Mac;
|
|
|
|
|
-
|
|
|
|
|
import razerdp.basepopup.BasePopupWindow;
|
|
import razerdp.basepopup.BasePopupWindow;
|
|
|
|
|
|
|
|
public class IndexActivity extends BaseActivity implements AdapterView.OnItemClickListener, View.OnClickListener, StaffUpPopup.OnStaffUpListener {
|
|
public class IndexActivity extends BaseActivity implements AdapterView.OnItemClickListener, View.OnClickListener, StaffUpPopup.OnStaffUpListener {
|
|
@@ -70,7 +62,8 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
|
|
|
private GridView menuGridView;
|
|
private GridView menuGridView;
|
|
|
private TextView actionbarTextVeiw;
|
|
private TextView actionbarTextVeiw;
|
|
|
private PopupWindow mExitPopupWindow;
|
|
private PopupWindow mExitPopupWindow;
|
|
|
- private TextView mPositionR, mFeeding, mCurDoc, mUnfinish, mEmCodeTv, mEmNameTv, mScName, mStaffTextView, mScrapTextView;
|
|
|
|
|
|
|
+ private TextView mPositionR, mFeeding, mCurDoc, mUnfinish, tv_pihao,
|
|
|
|
|
+ mEmCodeTv, mEmNameTv, mScName, mStaffTextView, mScrapTextView;
|
|
|
private String sc_code = null, mStaffName, mStaffCode;
|
|
private String sc_code = null, mStaffName, mStaffCode;
|
|
|
private RefreshLayout mRefreshLayout;
|
|
private RefreshLayout mRefreshLayout;
|
|
|
private PopupWindow editPW;
|
|
private PopupWindow editPW;
|
|
@@ -97,12 +90,13 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
|
|
|
menuGridView = (GridView) findViewById(R.id.grid_menu);
|
|
menuGridView = (GridView) findViewById(R.id.grid_menu);
|
|
|
mPositionR = (TextView) findViewById(R.id.index_position_resource);
|
|
mPositionR = (TextView) findViewById(R.id.index_position_resource);
|
|
|
mScName = (TextView) findViewById(R.id.scname_tv);
|
|
mScName = (TextView) findViewById(R.id.scname_tv);
|
|
|
- mFeeding = (TextView) findViewById(R.id.index_feeding);
|
|
|
|
|
|
|
+ // mFeeding = (TextView) findViewById(R.id.index_feeding);
|
|
|
mCurDoc = (TextView) findViewById(R.id.index_cur_doc);
|
|
mCurDoc = (TextView) findViewById(R.id.index_cur_doc);
|
|
|
mUnfinish = (TextView) findViewById(R.id.index_unfinish_number);
|
|
mUnfinish = (TextView) findViewById(R.id.index_unfinish_number);
|
|
|
mBackButton = findViewById(R.id.btn_actionbar_withback);
|
|
mBackButton = findViewById(R.id.btn_actionbar_withback);
|
|
|
- mStaffTextView = findViewById(R.id.index_staff_info_tv);
|
|
|
|
|
|
|
+ // mStaffTextView = findViewById(R.id.index_staff_info_tv);
|
|
|
mScrapTextView = findViewById(R.id.index_scrap_number);
|
|
mScrapTextView = findViewById(R.id.index_scrap_number);
|
|
|
|
|
+ tv_pihao=findViewById(R.id.tv_pihao);
|
|
|
|
|
|
|
|
findViewById(R.id.index_edit).setOnClickListener(this);
|
|
findViewById(R.id.index_edit).setOnClickListener(this);
|
|
|
mRefreshLayout = findViewById(R.id.SmartRefreshLayout_id);
|
|
mRefreshLayout = findViewById(R.id.SmartRefreshLayout_id);
|
|
@@ -391,11 +385,11 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
|
|
|
CommonUtil.toastNoRepeat(this, "岗位资源数据为空");
|
|
CommonUtil.toastNoRepeat(this, "岗位资源数据为空");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- if (!StringUtil.isEmpty(dataObject.getString("LI_NAME"))) {
|
|
|
|
|
- mFeeding.setText(dataObject.getString("LI_NAME"));
|
|
|
|
|
- } else {
|
|
|
|
|
- mFeeding.setText("-");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// if (!StringUtil.isEmpty(dataObject.getString("LI_NAME"))) {
|
|
|
|
|
+// mFeeding.setText(dataObject.getString("LI_NAME"));
|
|
|
|
|
+// } else {
|
|
|
|
|
+// mFeeding.setText("-");
|
|
|
|
|
+// }
|
|
|
if (!StringUtil.isEmpty(dataObject.getString("DL_MACODE"))) {
|
|
if (!StringUtil.isEmpty(dataObject.getString("DL_MACODE"))) {
|
|
|
MACODE = dataObject.getString("DL_MACODE");
|
|
MACODE = dataObject.getString("DL_MACODE");
|
|
|
SharedPreUtil.saveString(this, "MA_CODE", dataObject.getString("DL_MACODE"));
|
|
SharedPreUtil.saveString(this, "MA_CODE", dataObject.getString("DL_MACODE"));
|
|
@@ -410,11 +404,18 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
|
|
|
mUnfinish.setText("");
|
|
mUnfinish.setText("");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- mScrapTextView.setText(FastjsonUtil.getText(dataObject, "MA_ONLINESCRAPQTY"));
|
|
|
|
|
|
|
+ if (!StringUtil.isEmpty(dataObject.getString("SC_STEPCODE"))) {
|
|
|
|
|
+ tv_pihao.setText(dataObject.getString("SC_STEPCODE"));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ tv_pihao.setText("");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ mScrapTextView.setText(FastjsonUtil.getText(dataObject, "MA_ONLINESCRAPQTY"));
|
|
|
mStaffName = FastjsonUtil.getText(dataObject, "UO_EMNAME");
|
|
mStaffName = FastjsonUtil.getText(dataObject, "UO_EMNAME");
|
|
|
- mStaffCode = FastjsonUtil.getText(dataObject, "UO_EMCODE");
|
|
|
|
|
- mStaffTextView.setText(mStaffName + (TextUtils.isEmpty(mStaffCode) ? "" : ("(" + mStaffCode + ")")));
|
|
|
|
|
|
|
+ mStaffCode = TextUtils.isEmpty(FastjsonUtil.getText(dataObject, "UO_EMCODE"))?
|
|
|
|
|
+ SharedPreUtil.getString(this, Constants.FLAG.CACHE_USER_EMCODE, "")
|
|
|
|
|
+ :FastjsonUtil.getText(dataObject, "UO_EMCODE");
|
|
|
|
|
+ // mStaffTextView.setText(mStaffName + (TextUtils.isEmpty(mStaffCode) ? "" : ("(" + mStaffCode + ")")));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -423,22 +424,8 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
|
|
|
super.onResume();
|
|
super.onResume();
|
|
|
mEmCodeTv.setText("(" + SharedPreUtil.getString(this, Constants.FLAG.CACHE_USER_EMCODE, "-") + ")");
|
|
mEmCodeTv.setText("(" + SharedPreUtil.getString(this, Constants.FLAG.CACHE_USER_EMCODE, "-") + ")");
|
|
|
mEmNameTv.setText(SharedPreUtil.getString(this, Constants.FLAG.CACHE_USER_EMNAME, "-"));
|
|
mEmNameTv.setText(SharedPreUtil.getString(this, Constants.FLAG.CACHE_USER_EMNAME, "-"));
|
|
|
- /* Intent intent = getIntent();
|
|
|
|
|
- boolean needClear = intent.getBooleanExtra(Constants.FLAG.NEED_CLEAR_SCCODE,false);
|
|
|
|
|
- String fromSc_Code = intent.getStringExtra(Constants.FLAG.SC_CODE);
|
|
|
|
|
- LogUtil.i("getDevicelineneedClear",needClear+"");
|
|
|
|
|
- LogUtil.i("getDevicelinefromSc_Code",fromSc_Code+"");
|
|
|
|
|
- if (!StringUtil.isEmpty(fromSc_Code) && !needClear){
|
|
|
|
|
- getDeviceline(fromSc_Code);
|
|
|
|
|
- }else if (!StringUtil.isEmpty(fromSc_Code) && needClear){
|
|
|
|
|
- sc_code = null;
|
|
|
|
|
- mPositionR.setText("");
|
|
|
|
|
- mFeeding.setText("");
|
|
|
|
|
- mCurDoc.setText("");
|
|
|
|
|
- mUnfinish.setText("");
|
|
|
|
|
- }else {
|
|
|
|
|
- return;
|
|
|
|
|
- }*/
|
|
|
|
|
|
|
+ //新增---给上线人员设置默认值
|
|
|
|
|
+ mStaffCode =SharedPreUtil.getString(this, Constants.FLAG.CACHE_USER_EMCODE, "");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -466,60 +453,34 @@ public class IndexActivity extends BaseActivity implements AdapterView.OnItemCli
|
|
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
|
String itemName = (String) gridItemList.get(position).get(DataSourceManager.KEY_GRID_ITEMNAME);
|
|
String itemName = (String) gridItemList.get(position).get(DataSourceManager.KEY_GRID_ITEMNAME);
|
|
|
//岗位
|
|
//岗位
|
|
|
- String station = mPositionR.getText().toString().trim();
|
|
|
|
|
|
|
+ String station = mPositionR.getText().toString().trim();//岗位资源
|
|
|
if (StringUtil.isEmpty(station)) {
|
|
if (StringUtil.isEmpty(station)) {
|
|
|
- if (GloableParams.GRIDNAME_STAFF_CHANGE.equals(itemName)) {
|
|
|
|
|
- goFragment(position);
|
|
|
|
|
- } else {
|
|
|
|
|
- CommonUtil.toastNoRepeat(this, "请先采集岗位资源");
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ CommonUtil.toastNoRepeat(this, "请先采集岗位资源");
|
|
|
|
|
+ return;
|
|
|
} else {
|
|
} else {
|
|
|
- if (GloableParams.GRIDNAME_STAFF_UP.equals(itemName)) {
|
|
|
|
|
- if (!TextUtils.isEmpty(mStaffCode)) {
|
|
|
|
|
- CommonUtil.toastNoRepeat(this, "请先将当前上线人员下线");
|
|
|
|
|
- } else {
|
|
|
|
|
- mStaffUpPopup.showPopupWindow();
|
|
|
|
|
- }
|
|
|
|
|
- } else if (GloableParams.GRIDNAME_STAFF_DOWN.equals(itemName)) {
|
|
|
|
|
- if (TextUtils.isEmpty(mStaffCode)) {
|
|
|
|
|
- CommonUtil.toastNoRepeat(this, "当前无上线人员");
|
|
|
|
|
- } else {
|
|
|
|
|
- new AlertDialog.Builder(this)
|
|
|
|
|
- .setTitle("提示")
|
|
|
|
|
- .setMessage("确认将当前上线人员:" + mStaffName + " 下线?")
|
|
|
|
|
- .setNegativeButton(R.string.cancel, null)
|
|
|
|
|
- .setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
- staffDown();
|
|
|
|
|
- }
|
|
|
|
|
- }).show();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //工单暂停,工单切换,实时报工
|
|
|
|
|
+ if (TextUtils.isEmpty(mStaffCode) && (GloableParams.GRIDNAME_WORK_PAUSE.equals(itemName)
|
|
|
|
|
+ || GloableParams.GRIDNAME_WORK_SWITCH.equals(itemName)
|
|
|
|
|
+ || GloableParams.GRIDNAME_TIME_REPORT.equals(itemName)
|
|
|
|
|
+ || GloableParams.GRIDNAME_TIME_REPORT_DETAIL.equals(itemName))) {
|
|
|
|
|
+ CommonUtil.toastNoRepeat(this, "当前没有上线人员,请先进行人员上线");
|
|
|
} else {
|
|
} else {
|
|
|
- if (TextUtils.isEmpty(mStaffCode) && (GloableParams.GRIDNAME_WORK_PAUSE.equals(itemName)
|
|
|
|
|
- || GloableParams.GRIDNAME_WORK_SWITCH.equals(itemName)
|
|
|
|
|
- || GloableParams.GRIDNAME_TIME_REPORT.equals(itemName))) {
|
|
|
|
|
- CommonUtil.toastNoRepeat(this, "当前没有上线人员,请先进行人员上线");
|
|
|
|
|
|
|
+ //工单号为空,启动工单
|
|
|
|
|
+ String workOrder = mCurDoc.getText().toString().trim();
|
|
|
|
|
+ if (StringUtil.isEmpty(workOrder)) {
|
|
|
|
|
+ //工单启动,人员换岗
|
|
|
|
|
+ if (GloableParams.GRIDNAME_WORK_START.equals(itemName)) {
|
|
|
|
|
+ goFragment(position);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ CommonUtil.toastNoRepeat(this, "暂无在线工单,可点击工单启动进行操作");
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
- //工单
|
|
|
|
|
- String workOrder = mCurDoc.getText().toString().trim();
|
|
|
|
|
- if (StringUtil.isEmpty(workOrder)) {
|
|
|
|
|
- if (GloableParams.GRIDNAME_WORK_START.equals(itemName)
|
|
|
|
|
- || GloableParams.GRIDNAME_STAFF_CHANGE.equals(itemName)) {
|
|
|
|
|
- goFragment(position);
|
|
|
|
|
- } else {
|
|
|
|
|
- CommonUtil.toastNoRepeat(this, "暂无在线工单,可点击工单启动进行操作");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (GloableParams.GRIDNAME_WORK_START.equals(itemName)) {//工单启动
|
|
|
|
|
+ CommonUtil.toastNoRepeat(this, "已有在线工单不需要进行工单启动");
|
|
|
} else {
|
|
} else {
|
|
|
- if (GloableParams.GRIDNAME_WORK_START.equals(itemName)) {
|
|
|
|
|
- CommonUtil.toastNoRepeat(this, "已有在线工单不需要进行工单启动");
|
|
|
|
|
- } else {
|
|
|
|
|
- goFragment(position);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ goFragment(position);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|