|
|
@@ -6,6 +6,7 @@ import android.graphics.BitmapFactory;
|
|
|
import android.os.Bundle;
|
|
|
import android.os.Environment;
|
|
|
import android.os.Handler;
|
|
|
+import android.util.DisplayMetrics;
|
|
|
import android.util.Log;
|
|
|
import android.view.Gravity;
|
|
|
import android.view.LayoutInflater;
|
|
|
@@ -23,6 +24,7 @@ import android.widget.Toast;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baidu.cyberplayer.utils.G;
|
|
|
import com.common.LogUtil;
|
|
|
import com.common.data.DateFormatUtil;
|
|
|
import com.common.data.JSONUtil;
|
|
|
@@ -86,12 +88,13 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
private LinearLayout noWageLl;
|
|
|
private Boolean haveData = true;
|
|
|
private TextView announcement_tv;
|
|
|
- private int needSignature;
|
|
|
+ private int needSignature = -1;
|
|
|
private JSONObject dataObject;
|
|
|
private int sl_result = -1;
|
|
|
private String sl_remark;
|
|
|
private LinearLayout error_ll;
|
|
|
private TextView error_tv;
|
|
|
+ private boolean errorgone = false;
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
@@ -118,10 +121,11 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
if (!StringUtil.isEmpty(gonggao))
|
|
|
announcement_tv.setText("通知公告:"+gonggao);
|
|
|
else if (gonggao == null)
|
|
|
- announcement_tv.setText("暂无通知公告");
|
|
|
-
|
|
|
+ announcement_tv.setVisibility(View.GONE);
|
|
|
+ Log.i("needSignature",needSignature+"");
|
|
|
needSignature = dataObject.getInteger("sl_signature");
|
|
|
- if (needSignature == 0) mBtnSignature.setText("确认签收");
|
|
|
+ Log.i("needSignature",needSignature+"");
|
|
|
+ if (needSignature != 1) mBtnSignature.setText("确认签收");
|
|
|
sl_result = dataObject.getInteger("sl_result");
|
|
|
sl_remark = dataObject.getString("sl_remark");
|
|
|
if (!StringUtil.isEmpty(sl_remark) && sl_result == -1){
|
|
|
@@ -175,8 +179,11 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
|
|
|
private void showEnty() {
|
|
|
haveData = false;
|
|
|
+ mWagesLv.setVisibility(View.GONE);
|
|
|
+ received_im.setVisibility(View.GONE);
|
|
|
noWageLl.setVisibility(View.VISIBLE);
|
|
|
mBtnSignature.setVisibility(View.GONE);
|
|
|
+ announcement_tv.setVisibility(View.GONE);
|
|
|
Log.i("getEmSalary","showEnty");
|
|
|
}
|
|
|
|
|
|
@@ -238,9 +245,7 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
if (needSignature == 1)
|
|
|
showSiganWindow();
|
|
|
else
|
|
|
-// doSubmit();
|
|
|
- doNewSubmit(null,null);
|
|
|
-
|
|
|
+ doNoSignatureSubmit();
|
|
|
}else if (v.getId() == R.id.clear_im){
|
|
|
pathView.clear();
|
|
|
}else if (v.getId() == R.id.cancel_tv){
|
|
|
@@ -260,7 +265,6 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
BitmapFactory.Options options = new BitmapFactory.Options();
|
|
|
options.inSampleSize = 2;
|
|
|
Bitmap pathBm = BitmapFactory.decodeFile(plainpath);
|
|
|
-// doSubmit(pathBm,plainpath);
|
|
|
doNewSubmit(pathBm, plainpath);
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
@@ -270,7 +274,7 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
}
|
|
|
}else if (v.getId() == R.id.sure_tv){
|
|
|
if (StringUtil.isEmpty(msg_et.getText().toString())){
|
|
|
- ToastMessage("请输入你的问题");
|
|
|
+ ToastMessage("请输入你的报错问题");
|
|
|
return;
|
|
|
}
|
|
|
if (!CommonUtil.isNetWorkConnected(ct)){
|
|
|
@@ -295,6 +299,8 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
}
|
|
|
});
|
|
|
picker.show();
|
|
|
+ }else if (v.getId() == R.id.cancel_tv){
|
|
|
+ popupWindow.dismiss();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -307,6 +313,8 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
kvModeList.clear();
|
|
|
myAdapter.notifyDataSetChanged();
|
|
|
}
|
|
|
+
|
|
|
+ errorgone = false;
|
|
|
// HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
|
|
|
HttpClient httpClient = new HttpClient.Builder("http://192.168.253.58:8080/ERP/").isDebug(true).build(true);
|
|
|
httpClient.Api().send(new HttpClient.Builder()
|
|
|
@@ -352,7 +360,9 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
if (!JSONUtil.validate(o.toString()) || o == null) return;
|
|
|
LogUtil.prinlnLongMsg("salaryWrong", o.toString()+"");
|
|
|
if (o.toString().contains("success") && JSON.parseObject(o.toString()).getBoolean("success")){
|
|
|
- ToastMessage("你的问题已提交");
|
|
|
+ ToastMessage("报错成功");
|
|
|
+ error_ll.setVisibility(View.VISIBLE);
|
|
|
+ error_tv.setText(msg_et.getText().toString());
|
|
|
popupWindow.dismiss();
|
|
|
}
|
|
|
|
|
|
@@ -367,10 +377,15 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
params.addBodyParameter("sl_id",sl_id);
|
|
|
params.addBodyParameter("result","true");
|
|
|
params.addQueryStringParameter("master", master);
|
|
|
- params.addBodyParameter("msg","");
|
|
|
- Log.i("urlparams",plainpath);
|
|
|
- if (needSignature == 1)
|
|
|
+ Log.i("urlparams",plainpath+"");
|
|
|
+ if (needSignature == 1 && !StringUtil.isEmpty(plainpath)){
|
|
|
params.addBodyParameter("img",new File(plainpath));
|
|
|
+ }else {
|
|
|
+// params.addHeader("Content-Type","multipart/form-data");
|
|
|
+ params.addBodyParameter("img","");
|
|
|
+ }
|
|
|
+// else
|
|
|
+// params.addBodyParameter("img",new File());
|
|
|
final HttpUtils http = new HttpUtils();
|
|
|
Log.i("urlparams",url+params+"");
|
|
|
|
|
|
@@ -390,6 +405,8 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
received_im.setVisibility(View.VISIBLE);
|
|
|
mBtnSignature.setText("已收签");
|
|
|
mBtnSignature.setEnabled(false);
|
|
|
+ errorgone = true;
|
|
|
+ invalidateOptionsMenu();
|
|
|
closePopupWindow();
|
|
|
}
|
|
|
progressDialog.dismiss();
|
|
|
@@ -411,28 +428,31 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
}
|
|
|
|
|
|
//不需要签名情况下的签收
|
|
|
- private void doSubmit() {
|
|
|
+ private void doNoSignatureSubmit() {
|
|
|
// HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL()).isDebug(true).build(true);
|
|
|
HttpClient httpClient = new HttpClient.Builder("http://192.168.253.58:8080/ERP/").isDebug(true).build(true);
|
|
|
httpClient.Api().send(new HttpClient.Builder()
|
|
|
- .url("mobile/salary/salaryBack.action")
|
|
|
+ .url("mobile/salary/salaryBackNoSignature.action\n")
|
|
|
.add("emcode", emcode)
|
|
|
.add("sl_id",sl_id)
|
|
|
.add("result",true)
|
|
|
.add("master", master)
|
|
|
- .add("msg","")
|
|
|
.method(Method.POST)
|
|
|
.build(),new ResultSubscriber<>(new ResultListener<Object>() {
|
|
|
@Override
|
|
|
public void onResponse(Object o) {
|
|
|
- if (!JSONUtil.validate(o.toString()) || o == null) return;
|
|
|
LogUtil.prinlnLongMsg("salaryBack", o.toString()+"");
|
|
|
- if (JSONUtil.validate(o.toString()) && JSON.parseObject(o.toString()).getBoolean("success")) {
|
|
|
+ if (!JSONUtil.validate(o.toString()) || o == null) return;
|
|
|
+ if (JSONUtil.validate(o.toString()) && o.toString().contains("success") && JSON.parseObject(o.toString()).getBoolean("success")) {
|
|
|
Toast.makeText(ct,"工资条签名提交成功",Toast.LENGTH_LONG).show();
|
|
|
received_im.setVisibility(View.VISIBLE);
|
|
|
mBtnSignature.setText("已收签");
|
|
|
mBtnSignature.setEnabled(false);
|
|
|
+ errorgone = true;
|
|
|
+ invalidateOptionsMenu();
|
|
|
closePopupWindow();
|
|
|
+ }else {
|
|
|
+ ViewUtil.ToastMessage(ct, getString(R.string.common_save_failed));
|
|
|
}
|
|
|
progressDialog.dismiss();
|
|
|
}
|
|
|
@@ -454,7 +474,7 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
if (setWindow == null) initPopupWindow();
|
|
|
setWindow.showAtLocation(getWindow().getDecorView().
|
|
|
findViewById(android.R.id.content), Gravity.BOTTOM, 0, 0);
|
|
|
- DisplayUtil.backgroundAlpha(this, 0.4f);
|
|
|
+// DisplayUtil.backgroundAlpha(this, 0.4f);
|
|
|
}
|
|
|
|
|
|
private void initPopupWindow() {
|
|
|
@@ -471,8 +491,8 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
|
|
|
setWindow = new PopupWindow(viewContext,
|
|
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
|
|
- LinearLayout.LayoutParams.WRAP_CONTENT, true);
|
|
|
- setWindow.setOutsideTouchable(false);
|
|
|
+ LinearLayout.LayoutParams.WRAP_CONTENT, false);
|
|
|
+ setWindow.setOutsideTouchable(true);
|
|
|
setWindow.setAnimationStyle(com.uas.appworks.R.style.MenuAnimationFade);
|
|
|
setWindow.setBackgroundDrawable(mContext.getResources().getDrawable(com.uas.appworks.R.drawable.bg_popuwin));
|
|
|
setWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
|
|
|
@@ -491,10 +511,11 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
@Override
|
|
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
|
|
menu.clear();
|
|
|
- if(haveData && StringUtil.isEmpty(sl_remark) && sl_result == 0)
|
|
|
+ if(haveData && StringUtil.isEmpty(sl_remark) && sl_result == 0 && !errorgone)
|
|
|
getMenuInflater().inflate(R.menu.wage_error, menu);
|
|
|
else
|
|
|
menu.clear();
|
|
|
+
|
|
|
return super.onPrepareOptionsMenu(menu);
|
|
|
}
|
|
|
@Override
|
|
|
@@ -521,14 +542,15 @@ public class WagesDetailsActivity extends BaseActivity implements View.OnClickLi
|
|
|
// 设置按钮的点击事件
|
|
|
msg_et = (EditText) contentView.findViewById(R.id.msg_et);
|
|
|
contentView.findViewById(R.id.sure_tv).setOnClickListener(this);
|
|
|
+ contentView.findViewById(R.id.cancel_tv).setOnClickListener(this);
|
|
|
|
|
|
-// DisplayMetrics dm = getResources().getDisplayMetrics();
|
|
|
-// int w_screen = dm.widthPixels;
|
|
|
-// int h_screen = dm.heightPixels;
|
|
|
-// w_screen = DisplayUtil.dip2px(this, 300);
|
|
|
-// h_screen = DisplayUtil.dip2px(this, 250);
|
|
|
-//
|
|
|
-// popupWindow = new PopupWindow(contentView, w_screen, h_screen, true);
|
|
|
+ DisplayMetrics dm = getResources().getDisplayMetrics();
|
|
|
+ int w_screen = dm.widthPixels;
|
|
|
+ int h_screen = dm.heightPixels;
|
|
|
+ w_screen = DisplayUtil.dip2px(this, 300);
|
|
|
+ h_screen = DisplayUtil.dip2px(this, 250);
|
|
|
+
|
|
|
+ popupWindow = new PopupWindow(contentView, w_screen, h_screen, true);
|
|
|
popupWindow = new PopupWindow(contentView,
|
|
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
|
|
LinearLayout.LayoutParams.WRAP_CONTENT, true);
|