|
|
@@ -8,7 +8,6 @@ import android.os.Handler;
|
|
|
import android.os.Message;
|
|
|
import android.os.Parcelable;
|
|
|
import android.text.Editable;
|
|
|
-import android.text.Html;
|
|
|
import android.text.Selection;
|
|
|
import android.text.TextUtils;
|
|
|
import android.util.DisplayMetrics;
|
|
|
@@ -49,11 +48,11 @@ import com.xzjmyk.pm.activity.ui.erp.util.Constants;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.util.JsonValidator;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.util.LogUtil;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.util.OACheckUtil;
|
|
|
+import com.xzjmyk.pm.activity.ui.erp.util.StringUtils;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.util.oa.CommonInterface;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.view.SingleDialog;
|
|
|
import com.xzjmyk.pm.activity.util.DateFormatUtil;
|
|
|
import com.xzjmyk.pm.activity.util.DisplayUtil;
|
|
|
-import com.xzjmyk.pm.activity.util.StringUtils;
|
|
|
import com.xzjmyk.pm.activity.util.TimeUtils;
|
|
|
import com.xzjmyk.pm.activity.util.ToastUtil;
|
|
|
import com.xzjmyk.pm.activity.view.crouton.Crouton;
|
|
|
@@ -107,17 +106,18 @@ public class VisitReportAddActivity extends BaseActivity implements View.OnClick
|
|
|
@ViewInject(R.id.delete_btn)
|
|
|
private Button delete_btn;
|
|
|
|
|
|
- private int vp_id = -1;
|
|
|
+ private int vp_id = 0;
|
|
|
private int mVrId;
|
|
|
- private int vr_code;
|
|
|
+ private String vr_code;
|
|
|
private boolean isB2b;
|
|
|
private boolean isOutplan;
|
|
|
+ private boolean isMe = true;
|
|
|
/*
|
|
|
*单据状态和显示按钮的对应:
|
|
|
- * 1.已提交==》反提交==》resSubmitVisitRecord.action
|
|
|
- * 2.在录入==》删除==》deleteVisitRecord.action
|
|
|
- * 3.无状态==》提交==》saveVisitRecord.action
|
|
|
- * 4.反提交(点击反提交后的状态)==》更新==》updateVisitRecord.action
|
|
|
+ * 0.无状态==》提交==》saveVisitRecord.action
|
|
|
+ * 1.在录入||反提交后(在录入)==》删除&&更新==》deleteVisitRecord.action||updateVisitRecord.action
|
|
|
+ * 2.已提交==》反提交==》resSubmitVisitRecord.action
|
|
|
+ * 3.已审核==》所有的按钮没有了
|
|
|
*/
|
|
|
private int status;
|
|
|
|
|
|
@@ -131,6 +131,47 @@ public class VisitReportAddActivity extends BaseActivity implements View.OnClick
|
|
|
initListener();
|
|
|
}
|
|
|
|
|
|
+ private void initData() {
|
|
|
+ isB2b = ApiUtils.getApiModel() instanceof ApiPlatform;
|
|
|
+ Intent intent = getIntent();
|
|
|
+ if (intent == null || intent.getIntExtra("type", -1) == -1) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ isOutplan = intent.getBooleanExtra("isOutplan", false);
|
|
|
+ isMe = intent.getBooleanExtra("isMe", true);
|
|
|
+ String chche = getIntent().getStringExtra("data");
|
|
|
+ if (!new JsonValidator().validate(chche)) return;
|
|
|
+ JSONObject object = JSON.parseObject(chche);
|
|
|
+ //共有
|
|
|
+ tv_date_start.setText(TimeUtils.f_long_2_str(OACheckUtil.getJsonTime(object, "vr_visittime", "vr_startdate", "mpd_actdate", "mp_firsttime")));
|
|
|
+ tv_date_end.setText(TimeUtils.f_long_2_str(OACheckUtil.getJsonTime(object, "vr_visitend", "vr_enddate", "mpd_outdate", "mp_lasttime")));
|
|
|
+ tv_customer_login.setText(OACheckUtil.getJson2Text(object, "custname", "vr_cuname", "mpd_company"));
|
|
|
+ tv_address_login.setText(OACheckUtil.getJson2Text(object, "address", "vr_cuaddress", "mpd_address"));
|
|
|
+ tv_visit_theme.setText(OACheckUtil.getJson2Text(object, "vr_title", "mpd_remark"));
|
|
|
+ //独享
|
|
|
+ tv_linksman_login.setText(OACheckUtil.getJson2Text(object, "vr_cucontact"));
|
|
|
+ tv_visit_steps.setText(OACheckUtil.getJson2Text(object, "vr_nichestep"));
|
|
|
+ tv_visit_type.setText(OACheckUtil.getJson2Text(object, "vr_class"));
|
|
|
+ tv_visit_content.setText(OACheckUtil.getJson2Text(object, "vr_detail"));
|
|
|
+ nichecode = object.getString(OACheckUtil.getJson2Text(object, "vr_nichecode"));
|
|
|
+ tv_relate_business.setText(OACheckUtil.getJson2Text(object, "vr_nichename"));
|
|
|
+ phone_tv.setText(OACheckUtil.getJson2Text(object, "vr_tel"));
|
|
|
+ //变量
|
|
|
+ String vr_status = OACheckUtil.getJson2Text(object, "vr_status");
|
|
|
+ vp_id = OACheckUtil.getJsonIntager(object, "mpd_id");
|
|
|
+ mVrId = OACheckUtil.getJsonIntager(object, "id");
|
|
|
+ vr_code = OACheckUtil.getJson2Text(object, "vr_code");
|
|
|
+ if (StringUtils.isEmpty(vr_status)) {
|
|
|
+ status = 0;
|
|
|
+ } else if ("在录入".equals(vr_status)) {
|
|
|
+ status = 1;
|
|
|
+ } else if ("已提交".equals(vr_status)) {
|
|
|
+ status = 2;
|
|
|
+ } else if ("已审核".equals(vr_status)) {
|
|
|
+ status = 3;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void initView() {
|
|
|
getSupportActionBar().setTitle(getString(R.string.visitrecord));
|
|
|
findViewById(R.id.voice_search_iv).setOnClickListener(this);
|
|
|
@@ -139,32 +180,72 @@ public class VisitReportAddActivity extends BaseActivity implements View.OnClick
|
|
|
findViewById(R.id.business_rl).setVisibility(View.GONE);
|
|
|
findViewById(R.id.phone_rl).setVisibility(View.GONE);
|
|
|
}
|
|
|
+ initStatus(status);
|
|
|
+ if (mVrId == 0 && !isB2b) {
|
|
|
+ CommonUtil.getCommonId(this, "VISITRECORD_SEQ", mHandler, GET_VR_ID);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initStatus(int status) {
|
|
|
+ this.status = status;
|
|
|
switch (status) {
|
|
|
case 0:
|
|
|
save_btn.setText(R.string.common_submit_button);
|
|
|
delete_btn.setVisibility(View.GONE);
|
|
|
+ delete_btn.setOnClickListener(null);
|
|
|
break;
|
|
|
case 1:
|
|
|
- save_btn.setText(R.string.unsubmit);
|
|
|
- delete_btn.setVisibility(View.GONE);
|
|
|
+ save_btn.setText(R.string.common_update_button);
|
|
|
+ delete_btn.setVisibility(View.VISIBLE);
|
|
|
+ delete_btn.setOnClickListener(this);
|
|
|
break;
|
|
|
case 2:
|
|
|
- save_btn.setText(R.string.common_update_button);
|
|
|
+ save_btn.setText(R.string.unsubmit);
|
|
|
delete_btn.setVisibility(View.GONE);
|
|
|
+ delete_btn.setOnClickListener(null);
|
|
|
break;
|
|
|
case 3:
|
|
|
- save_btn.setText(R.string.unsubmit);
|
|
|
- delete_btn.setVisibility(View.VISIBLE);
|
|
|
+ save_btn.setVisibility(View.GONE);
|
|
|
+ delete_btn.setVisibility(View.GONE);
|
|
|
+ delete_btn.setOnClickListener(null);
|
|
|
break;
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 存在的情况:
|
|
|
+ * 1.新增单据进来的==》所有按钮可以点击没有限制,提交按钮为提交,隐藏删除按钮
|
|
|
+ * 2.点击oa首页拜访报告单进来的==》已提交(所有内容不能修改,显示反提交) 在录入(所有内容都可以修改,显示更新和删除按钮)
|
|
|
+ * 3.点击oa首页外勤计划单进来添加拜访报告的==》个别存在的字段不可以点击更改,其他可以修改
|
|
|
+ */
|
|
|
private void initListener() {
|
|
|
- boolean isMe = getIntent().getBooleanExtra("isMe", true);
|
|
|
- if (isMe) {
|
|
|
-// tv_visit_steps.setKeyListener(null);
|
|
|
-// tv_visit_steps.setEnabled(false);
|
|
|
+ if (!isMe || status == 2 || status == 3) {
|
|
|
+ //当不可编辑tv_date_end
|
|
|
+ tv_date_start.setFocusable(false);
|
|
|
+ phone_tv.setFocusable(false);
|
|
|
+ tv_date_end.setFocusable(false);
|
|
|
+ tv_customer_login.setFocusable(false);
|
|
|
+ tv_visit_steps.setFocusable(false);
|
|
|
+ tv_relate_business.setFocusable(false);
|
|
|
+ tv_visit_content.setFocusable(false);
|
|
|
+ tv_visit_theme.setFocusable(false);
|
|
|
+ tv_address_login.setFocusable(false);
|
|
|
+ tv_linksman_login.setFocusable(false);
|
|
|
+ tv_visit_type.setFocusable(false);
|
|
|
+ if (status != 2) {
|
|
|
+ save_btn.setFocusable(false);
|
|
|
+ delete_btn.setFocusable(false);
|
|
|
+ } else {
|
|
|
+ save_btn.setOnClickListener(this);
|
|
|
+ delete_btn.setOnClickListener(this);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ phone_tv.setFocusableInTouchMode(true);
|
|
|
+ tv_visit_steps.setFocusableInTouchMode(true);
|
|
|
+ tv_visit_content.setFocusableInTouchMode(true);
|
|
|
+ tv_address_login.setFocusableInTouchMode(true);
|
|
|
+ tv_linksman_login.setFocusableInTouchMode(true);
|
|
|
+ LogUtil.i("status=" + status);
|
|
|
tv_relate_business.setKeyListener(null);
|
|
|
tv_relate_business.setOnClickListener(this);
|
|
|
tv_visit_type.setOnClickListener(this);
|
|
|
@@ -173,7 +254,9 @@ public class VisitReportAddActivity extends BaseActivity implements View.OnClick
|
|
|
tv_visit_theme.setOnClickListener(this);
|
|
|
tv_visit_theme.setKeyListener(null);
|
|
|
tv_visit_theme.setFocusable(false);
|
|
|
- if (3 == getIntent().getIntExtra("type", -1)) {
|
|
|
+ save_btn.setOnClickListener(this);
|
|
|
+ delete_btn.setOnClickListener(this);
|
|
|
+ if (isOutplan) {
|
|
|
setFocusable(tv_date_start, isMe && TextUtils.isEmpty(tv_date_start.getText()));
|
|
|
setFocusable(tv_date_end, isMe && TextUtils.isEmpty(tv_date_end.getText()));
|
|
|
setFocusable(tv_customer_login, isMe && TextUtils.isEmpty(tv_customer_login.getText()));
|
|
|
@@ -187,71 +270,10 @@ public class VisitReportAddActivity extends BaseActivity implements View.OnClick
|
|
|
tv_date_end.setKeyListener(null);
|
|
|
tv_customer_login.setOnClickListener(this);
|
|
|
}
|
|
|
- } else {
|
|
|
- //当不可编辑tv_date_end
|
|
|
- tv_date_start.setFocusable(false);
|
|
|
- tv_date_end.setFocusable(false);
|
|
|
- tv_customer_login.setFocusable(false);
|
|
|
- tv_visit_steps.setFocusable(false);
|
|
|
- tv_relate_business.setFocusable(false);
|
|
|
- tv_visit_content.setFocusable(false);
|
|
|
|
|
|
- tv_visit_theme.setFocusable(false);
|
|
|
- tv_address_login.setFocusable(false);
|
|
|
- tv_linksman_login.setFocusable(false);
|
|
|
- tv_visit_type.setFocusable(false);
|
|
|
}
|
|
|
- save_btn.setOnClickListener(this);
|
|
|
- delete_btn.setOnClickListener(this);
|
|
|
}
|
|
|
|
|
|
- private void initData() {
|
|
|
- isB2b = ApiUtils.getApiModel() instanceof ApiPlatform;
|
|
|
- if (!isB2b)
|
|
|
- CommonUtil.getCommonId(this, "VISITRECORD_SEQ", mHandler, GET_VR_ID);
|
|
|
- if (getIntent() == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
- isOutplan = getIntent().getBooleanExtra("isOutplan", false);
|
|
|
- int type = getIntent().getIntExtra("type", -1);
|
|
|
- if (type == -1) return;
|
|
|
- if (type == 2) {
|
|
|
- status = 1;
|
|
|
- String chche = getIntent().getStringExtra("data");
|
|
|
- JSONObject object = JSON.parseObject(chche);
|
|
|
- tv_date_start.setText(getTime(object, "vr_visittime", "vr_startdate"));
|
|
|
- tv_date_end.setText(getTime(object, "vr_visitend", "vr_enddate"));
|
|
|
- tv_customer_login.setText(OACheckUtil.getJson2Text(object, "custname", "vr_cuname"));
|
|
|
- tv_linksman_login.setText(OACheckUtil.getJson2Text(object, "vr_cucontact"));
|
|
|
- tv_address_login.setText(OACheckUtil.getJson2Text(object, "address", "vr_cuaddress"));
|
|
|
- tv_visit_theme.setText(OACheckUtil.getJson2Text(object, "vr_title"));
|
|
|
- tv_visit_steps.setText(OACheckUtil.getJson2Text(object, "vr_nichestep"));
|
|
|
- tv_visit_type.setText(OACheckUtil.getJson2Text(object, "vr_class"));
|
|
|
-// if (getJSONString(object,"vr_detail").contains("<div")){
|
|
|
-// tv_visit_content.setText(Html.fromHtml(getJSONString(object, "vr_detail")));
|
|
|
-// }else {
|
|
|
-// tv_visit_content.setText(getJSONString(object, "vr_detail"));
|
|
|
-// }
|
|
|
- tv_visit_content.setText(Html.fromHtml(getJSONString(object, "vr_detail")));
|
|
|
- nichecode = object.getString(getJSONString(object, "vr_nichecode"));
|
|
|
- tv_relate_business.setText(getJSONString(object, "vr_nichename"));
|
|
|
-// tv_visit_content.setText(getJSONString(object, "vr_detail"));
|
|
|
- mVrId = OACheckUtil.getJsonIntager(object, "id");
|
|
|
- vr_code = OACheckUtil.getJsonIntager(object, "vr_code");
|
|
|
- } else if (type == 3) {
|
|
|
- status = 0;
|
|
|
- //1.开始日期==预计拜访时间 2.客户名称==公司名称 客户地址
|
|
|
- String chche = getIntent().getStringExtra("data");
|
|
|
- JSONObject object = JSON.parseObject(chche);
|
|
|
- vp_id = object.containsKey("mpd_id") ? object.getInteger("mpd_id") : -1;
|
|
|
- tv_date_start.setText(getTime(object, "mpd_actdate", "mp_firsttime"));
|
|
|
- tv_date_end.setText(getTime(object, "mpd_outdate", "mp_lasttime"));
|
|
|
- tv_customer_login.setText(getJSONString(object, "mpd_company"));
|
|
|
- tv_address_login.setText(getJSONString(object, "mpd_address"));
|
|
|
- tv_visit_theme.setText(getJSONString(object, "mpd_remark"));
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
private void setFocusable(FormEditText v, boolean focusable) {
|
|
|
if (focusable) {
|
|
|
@@ -262,22 +284,6 @@ public class VisitReportAddActivity extends BaseActivity implements View.OnClick
|
|
|
|
|
|
}
|
|
|
|
|
|
- private String getTime(JSONObject o, String... keys) {
|
|
|
- if (isB2b) {
|
|
|
- long time = OACheckUtil.getJsonLong(o, keys);
|
|
|
- if (time == 0) return "";
|
|
|
- return TimeUtils.f_long_2_str(time);
|
|
|
- } else
|
|
|
- return OACheckUtil.getJson2Text(o, keys);
|
|
|
- }
|
|
|
-
|
|
|
- private String getJSONString(JSONObject object, String key) {
|
|
|
- if (object.containsKey(key) && !StringUtils.isEmpty(object.getString(key))) {
|
|
|
- return object.getString(key);
|
|
|
- } else {
|
|
|
- return "";
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
@Override
|
|
|
public boolean onCreateOptionsMenu(Menu menu) {
|
|
|
@@ -327,7 +333,7 @@ public class VisitReportAddActivity extends BaseActivity implements View.OnClick
|
|
|
case Constants.HTTP_SUCCESS_INIT:
|
|
|
Log.i(TAG, "handleMessage:" + msg.getData().getString("result"));
|
|
|
ToastMessage(getString(R.string.common_save_success));
|
|
|
- if (!isB2b && vp_id != -1)//更新接口
|
|
|
+ if (!isB2b && vp_id != 0)//更新接口
|
|
|
updataCode();
|
|
|
else if (!isB2b && !getIntent().getBooleanExtra("isAgen", false) && !isB2b) {//第一次
|
|
|
submit();
|
|
|
@@ -383,9 +389,20 @@ public class VisitReportAddActivity extends BaseActivity implements View.OnClick
|
|
|
}
|
|
|
showSimpleDialog(tv_visit_steps, "商机阶段");
|
|
|
break;
|
|
|
- case RES_SUBMIT_VISITRECORD:
|
|
|
- save_btn.setText(R.string.common_update_button);
|
|
|
- status = 2;
|
|
|
+ case RES_SUBMIT_VISITRECORD://反提交(重新提交)
|
|
|
+ initStatus(1);//反提交后,状态变成在录入
|
|
|
+ initListener();
|
|
|
+ break;
|
|
|
+ case UPDATE_VISITRECORD://更新,保存数据成功
|
|
|
+ ToastUtil.showToast(ct, R.string.update_success);
|
|
|
+ submit();
|
|
|
+ initStatus(2);
|
|
|
+ initListener();
|
|
|
+ break;
|
|
|
+ case DELETE_VISITRECORD://删除单据
|
|
|
+ ToastUtil.showToast(ct, R.string.delete_succeed_notice1);
|
|
|
+ endActivity();
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
@@ -400,27 +417,6 @@ public class VisitReportAddActivity extends BaseActivity implements View.OnClick
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void saveB2bByHttp() {
|
|
|
- String url = ApiConfig.getInstance(ApiUtils.getApiModel()).getmApiBase().saveVisitRecord;
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
- Map<String, Object> formStore = new HashMap<>();
|
|
|
- formStore.put("vr_class", tv_visit_type.getText().toString());//拜访类别
|
|
|
- formStore.put("vr_startdate", tv_date_start.getText().toString());//开始时间
|
|
|
- formStore.put("vr_enddate", tv_date_end.getText().toString());//结束时间
|
|
|
- formStore.put("emuu", CommonUtil.getSharedPreferences(MyApplication.getInstance(), "b2b_uu"));//录入人uu
|
|
|
- formStore.put("enuu", CommonUtil.getSharedPreferences(MyApplication.getInstance().getApplicationContext(), "companyEnUu"));//企业uu
|
|
|
- formStore.put("vr_title", tv_visit_theme.getText().toString());//主题
|
|
|
- formStore.put("vr_detail", com.xzjmyk.pm.activity.ui.erp.util.StringUtils.string2Json(tv_visit_content.getText().toString()));//内容
|
|
|
- formStore.put("vr_cucode", cu_code);//客户编号
|
|
|
- formStore.put("vr_cuname", com.xzjmyk.pm.activity.ui.erp.util.StringUtils.string2Json(tv_customer_login.getText().toString()));//客户名字
|
|
|
- formStore.put("vr_cuaddress", tv_address_login.getText().toString());//客户地址
|
|
|
- formStore.put("vr_cucontact", com.xzjmyk.pm.activity.ui.erp.util.StringUtils.string2Json(tv_linksman_login.getText().toString()));//客户联系人
|
|
|
- params.put("formStore", com.xzjmyk.pm.activity.ui.erp.util.StringUtils.mapToJson(formStore));
|
|
|
- LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
|
|
|
- headers.put("Cookie", "JSESSIONID=" + ApiConfig.getInstance(ApiUtils.getApiModel()).getmApiBase().getCookie());
|
|
|
- ViewUtil.httpSendRequest(ct, url, params, mHandler, headers, Constants.HTTP_SUCCESS_INIT, null, null, "post");
|
|
|
- }
|
|
|
-
|
|
|
private boolean canSubmit() {
|
|
|
if (!CommonUtil.isNetWorkConnected(ct)) {
|
|
|
Crouton.makeText(ct, R.string.networks_out);
|
|
|
@@ -472,95 +468,6 @@ public class VisitReportAddActivity extends BaseActivity implements View.OnClick
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- //保存
|
|
|
- private void sendHttpResquest(int what, String code) {
|
|
|
- String emname = CommonUtil.getSharedPreferences(ct, "erp_emname");
|
|
|
- if (StringUtils.isEmpty(emname)) {
|
|
|
- emname = MyApplication.getInstance().mLoginUser.getNickName().trim();
|
|
|
- }
|
|
|
- String formStore = "";
|
|
|
- if (tv_customer_login.testValidity() && tv_linksman_login.testValidity()
|
|
|
- && tv_address_login.testValidity() && tv_visit_theme.testValidity()
|
|
|
- && tv_visit_content.testValidity()) {
|
|
|
- formStore =
|
|
|
- "{\n" +
|
|
|
- "\"vr_id\":" + mVrId + ",\n" +
|
|
|
- "\"vr_class\":\"" + tv_visit_type.getHint().toString() + "\",\n" +
|
|
|
- "\"vr_code\":\"" + code
|
|
|
- + "\",\n" +
|
|
|
- "\"vr_tel\":\"" + phone_tv.getText().toString()
|
|
|
- + "\",\n" +
|
|
|
- "\"vr_visittime\":\""
|
|
|
- + tv_date_start.getText().toString() + //开始时间
|
|
|
- "\",\n" +
|
|
|
- "\"vr_visitplace\":\"" +
|
|
|
- CommonUtil.getNoMarkEditText(tv_address_login) +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_cuname\":\"" +
|
|
|
- CommonUtil.getNoMarkEditText(tv_customer_login) +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_cucontact\":\"" +
|
|
|
- CommonUtil.getNoMarkEditText(tv_linksman_login) +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_contact\":\"" +
|
|
|
- CommonUtil.getNoMarkEditText(tv_linksman_login) +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_title\":\"" +
|
|
|
- CommonUtil.getNoMarkEditText(tv_visit_theme) +//主题
|
|
|
- "\",\n" +
|
|
|
- "\"vr_nichestep\":\"" +
|
|
|
- CommonUtil.getNoMarkEditText(tv_visit_steps) +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_detail\":\"" +
|
|
|
- CommonUtil.getNoMarkEditText(tv_visit_content) +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_nichecode\":\"" +
|
|
|
- nichecode +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_nichename\":\"" +
|
|
|
- (TextUtils.isEmpty(tv_relate_business.getText()) ? "" : tv_relate_business.getText().toString()) +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_recorddate\":\"" +
|
|
|
- DateFormatUtil.getStrDate4Date(new Date(), "yyyy-MM-dd") +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_statuscode\":\"" +
|
|
|
- "ENTERING" +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_recorder\":\"" +
|
|
|
- emname +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_status\":\"" +
|
|
|
- "在录入" +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_cuuu\":\"" +
|
|
|
- cu_code +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_visitend\":\"" +
|
|
|
- tv_date_end.getText().toString() +//结束时间
|
|
|
- "\"\n" +
|
|
|
- "}";
|
|
|
- } else {
|
|
|
- return;
|
|
|
- }
|
|
|
- if (progressDialog != null)
|
|
|
- progressDialog.show();
|
|
|
- String url = Constants.getAppBaseUrl(ct) + "crm/customermgr/saveVisitRecord.action";
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
- params.put("formStore", formStore);
|
|
|
- params.put("caller", "VisitRecord");
|
|
|
- String param1 = "{\"pl_detno\":1,\"pl_name\":" + emname + ",\"pl_vrid\":" + mVrId + "}";
|
|
|
- params.put("param1", "[]");
|
|
|
- params.put("param2", "[]");
|
|
|
- params.put("param3", param1);
|
|
|
- params.put("param4", "[]");
|
|
|
- params.put("param5", "[]");
|
|
|
- params.put("param6", "[]");
|
|
|
- params.put("param7", "[]");
|
|
|
- LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
|
|
|
- headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
|
- ViewUtil.httpSendRequest(ct, url, params, mHandler, headers, what, null, null, "post");
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
@@ -575,38 +482,13 @@ public class VisitReportAddActivity extends BaseActivity implements View.OnClick
|
|
|
showDateDialog((FormEditText) v.findViewById(R.id.tv_date_end));
|
|
|
break;
|
|
|
case R.id.tv_customer_login:
|
|
|
-// param = new HashMap<>();
|
|
|
-// param.put("sellercode", CommonUtil.getSharedPreferences(ct, "erp_username"));
|
|
|
-// bundle = new Bundle();
|
|
|
-// bundle.putSerializable("param", param);
|
|
|
-// intent = new Intent(ct, SelectActivity.class);
|
|
|
-// intent.putExtra("type", 1);
|
|
|
-// intent.putExtra("reid", R.style.OAThemeMeet);
|
|
|
-// intent.putExtras(bundle);
|
|
|
-// intent.putExtra("key", "customers");
|
|
|
-// intent.putExtra("showKey", "CU_NAME");
|
|
|
-// intent.putExtra("action", "mobile/crm/getCustomerbySeller.action");
|
|
|
-// intent.putExtra("title", "客户列表");
|
|
|
-// startActivityForResult(intent, 0x22);
|
|
|
+
|
|
|
intent = new Intent(ct, SelectAimActivity.class);
|
|
|
intent.putExtra("type", 1);
|
|
|
startActivityForResult(intent, 0x22);
|
|
|
- //SelectAimActivity
|
|
|
break;
|
|
|
case R.id.tv_visit_steps:
|
|
|
-// param = new HashMap<>();
|
|
|
-// param.put("condition", "1=1");
|
|
|
-// bundle = new Bundle();
|
|
|
-// bundle.putSerializable("param", param);
|
|
|
-// intent = new Intent(ct, SelectActivity.class);
|
|
|
-// intent.putExtra("type", 1);
|
|
|
-// intent.putExtra("reid", R.style.OAThemeMeet);
|
|
|
-// intent.putExtras(bundle);
|
|
|
-// intent.putExtra("key", "stages");
|
|
|
-// intent.putExtra("showKey", "BS_NAME");
|
|
|
-// intent.putExtra("action", "mobile/crm/getBusinessChanceStage.action");
|
|
|
-// intent.putExtra("title", "当前阶段");
|
|
|
-// startActivityForResult(intent, 0x23);
|
|
|
+
|
|
|
break;
|
|
|
case R.id.tv_relate_business:
|
|
|
param = new HashMap<>();
|
|
|
@@ -651,31 +533,9 @@ public class VisitReportAddActivity extends BaseActivity implements View.OnClick
|
|
|
case R.id.tv_visit_theme:
|
|
|
if (getIntent().getIntExtra("type", -1) == 3 && !TextUtils.isEmpty(tv_visit_theme.getText()))
|
|
|
return;
|
|
|
- intent = new Intent(ct, SelectRemarkActivity.class).putExtra("title", getString(R.string.select_contact));
|
|
|
+ intent = new Intent(ct, SelectRemarkActivity.class).putExtra("title", getString(R.string.visit_aim));
|
|
|
startActivityForResult(intent, 0x29);
|
|
|
|
|
|
- //与外勤一样的目的
|
|
|
-// param = new HashMap<>();
|
|
|
-// param.put("field", "vr_nichestep");
|
|
|
-// param.put("caller", "VisitRecord");
|
|
|
-//
|
|
|
-// HashMap<String, Object> param1 = new HashMap<>();
|
|
|
-//
|
|
|
-// param1.put("field", "vr_type");
|
|
|
-// param1.put("caller", "VisitRecord");
|
|
|
-// bundle = new Bundle();
|
|
|
-// bundle.putSerializable("param", param);
|
|
|
-// bundle.putSerializable("param1", param1);
|
|
|
-// intent = new Intent(ct, SelectActivity.class);
|
|
|
-// intent.putExtra("type", 3);
|
|
|
-// intent.putExtra("reid", R.style.OAThemeMeet);
|
|
|
-// intent.putExtras(bundle);
|
|
|
-// intent.putExtra("key", "combdatas");
|
|
|
-// intent.putExtra("showKey", "name");
|
|
|
-// intent.putExtra("action", "mobile/common/getCombo.action");
|
|
|
-// intent.putExtra("title", "拜访目的");
|
|
|
-// startActivityForResult(intent, 0x28);
|
|
|
-
|
|
|
break;
|
|
|
case R.id.voice_search_iv:
|
|
|
final VoiceToWord voice = new VoiceToWord(VisitReportAddActivity.this, "534e3fe2");
|
|
|
@@ -690,6 +550,7 @@ public class VisitReportAddActivity extends BaseActivity implements View.OnClick
|
|
|
else if (save_btn.getText().toString().trim().equals(getString(R.string.common_save_button)))
|
|
|
saveVisit();
|
|
|
else saveVisit();
|
|
|
+ break;
|
|
|
case R.id.delete_btn:
|
|
|
deleteVisitRecord();
|
|
|
break;
|
|
|
@@ -880,8 +741,28 @@ public class VisitReportAddActivity extends BaseActivity implements View.OnClick
|
|
|
|
|
|
}
|
|
|
|
|
|
+ private void saveB2bByHttp() {
|
|
|
+ String url = ApiConfig.getInstance(ApiUtils.getApiModel()).getmApiBase().saveVisitRecord;
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ Map<String, Object> formStore = new HashMap<>();
|
|
|
+ formStore.put("vr_class", tv_visit_type.getText().toString());//拜访类别
|
|
|
+ formStore.put("vr_startdate", tv_date_start.getText().toString());//开始时间
|
|
|
+ formStore.put("vr_enddate", tv_date_end.getText().toString());//结束时间
|
|
|
+ formStore.put("emuu", CommonUtil.getSharedPreferences(MyApplication.getInstance(), "b2b_uu"));//录入人uu
|
|
|
+ formStore.put("enuu", CommonUtil.getSharedPreferences(MyApplication.getInstance().getApplicationContext(), "companyEnUu"));//企业uu
|
|
|
+ formStore.put("vr_title", tv_visit_theme.getText().toString());//主题
|
|
|
+ formStore.put("vr_detail", com.xzjmyk.pm.activity.ui.erp.util.StringUtils.string2Json(tv_visit_content.getText().toString()));//内容
|
|
|
+ formStore.put("vr_cucode", cu_code);//客户编号
|
|
|
+ formStore.put("vr_cuname", com.xzjmyk.pm.activity.ui.erp.util.StringUtils.string2Json(tv_customer_login.getText().toString()));//客户名字
|
|
|
+ formStore.put("vr_cuaddress", tv_address_login.getText().toString());//客户地址
|
|
|
+ formStore.put("vr_cucontact", com.xzjmyk.pm.activity.ui.erp.util.StringUtils.string2Json(tv_linksman_login.getText().toString()));//客户联系人
|
|
|
+ params.put("formStore", com.xzjmyk.pm.activity.ui.erp.util.StringUtils.mapToJson(formStore));
|
|
|
+ LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
|
|
|
+ headers.put("Cookie", "JSESSIONID=" + ApiConfig.getInstance(ApiUtils.getApiModel()).getmApiBase().getCookie());
|
|
|
+ ViewUtil.httpSendRequest(ct, url, params, mHandler, headers, Constants.HTTP_SUCCESS_INIT, null, null, "post");
|
|
|
+ }
|
|
|
|
|
|
- //更新
|
|
|
+ //更新外勤计划
|
|
|
private void updataCode() {
|
|
|
if (progressDialog != null)
|
|
|
progressDialog.show();
|
|
|
@@ -903,8 +784,8 @@ public class VisitReportAddActivity extends BaseActivity implements View.OnClick
|
|
|
}
|
|
|
|
|
|
private void resSubmitVisitRecord() {
|
|
|
- String url = CommonUtil.getSharedPreferences(this, "erp_baseurl") +
|
|
|
- "crm/customermgr/resSubmitVisitRecord.action";
|
|
|
+ progressDialog.show();
|
|
|
+ String url = CommonUtil.getSharedPreferences(this, "erp_baseurl") + "crm/customermgr/resSubmitVisitRecord.action";
|
|
|
Map<String, Object> param = new HashMap<>();
|
|
|
param.put("caller", "VisitRecord");
|
|
|
param.put("id", mVrId);
|
|
|
@@ -914,7 +795,7 @@ public class VisitReportAddActivity extends BaseActivity implements View.OnClick
|
|
|
}
|
|
|
|
|
|
private void deleteVisitRecord() {
|
|
|
- if (!canSubmit()) return;
|
|
|
+ progressDialog.show();
|
|
|
String url = CommonUtil.getSharedPreferences(this, "erp_baseurl") +
|
|
|
"crm/customermgr/deleteVisitRecord.action";
|
|
|
Map<String, Object> param = new HashMap<>();
|
|
|
@@ -925,76 +806,47 @@ public class VisitReportAddActivity extends BaseActivity implements View.OnClick
|
|
|
ViewUtil.httpSendRequest(this, url, param, mHandler, headers, DELETE_VISITRECORD, null, null, "post");
|
|
|
}
|
|
|
|
|
|
- private void updateVisitRecord() {
|
|
|
- String emname = CommonUtil.getName();
|
|
|
+ //保存
|
|
|
+ private void sendHttpResquest(int what, String code) {
|
|
|
+ String emname = CommonUtil.getSharedPreferences(ct, "erp_emname");
|
|
|
+ if (StringUtils.isEmpty(emname)) {
|
|
|
+ emname = MyApplication.getInstance().mLoginUser.getNickName().trim();
|
|
|
+ }
|
|
|
String formStore = "";
|
|
|
if (tv_customer_login.testValidity() && tv_linksman_login.testValidity()
|
|
|
&& tv_address_login.testValidity() && tv_visit_theme.testValidity()
|
|
|
&& tv_visit_content.testValidity()) {
|
|
|
- formStore =
|
|
|
- "{\n" +
|
|
|
- "\"vr_id\":" + mVrId + ",\n" +
|
|
|
- "\"vr_class\":\"" + tv_visit_type.getHint().toString() + "\",\n" +
|
|
|
- "\"vr_code\":\"" + vr_code
|
|
|
- + "\",\n" +
|
|
|
- "\"vr_tel\":\"" +
|
|
|
- CommonUtil.getNoMarkEditText(phone_tv)
|
|
|
- + "\",\n" +
|
|
|
- "\"vr_visittime\":\""
|
|
|
- + tv_date_start.getText().toString() + //开始时间
|
|
|
- "\",\n" +
|
|
|
- "\"vr_visitplace\":\"" +
|
|
|
- CommonUtil.getNoMarkEditText(tv_address_login) +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_cuname\":\"" +
|
|
|
- CommonUtil.getNoMarkEditText(tv_customer_login) +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_cucontact\":\"" +
|
|
|
- CommonUtil.getNoMarkEditText(tv_linksman_login) +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_contact\":\"" +
|
|
|
- CommonUtil.getNoMarkEditText(tv_linksman_login) +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_title\":\"" +
|
|
|
- CommonUtil.getNoMarkEditText(tv_visit_theme) +//主题
|
|
|
- "\",\n" +
|
|
|
- "\"vr_nichestep\":\"" +
|
|
|
- CommonUtil.getNoMarkEditText(tv_visit_steps) +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_detail\":\"" +
|
|
|
- CommonUtil.getNoMarkEditText(tv_visit_content) +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_nichecode\":\"" +
|
|
|
- nichecode +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_nichename\":\"" +
|
|
|
- (TextUtils.isEmpty(tv_relate_business.getText()) ? "" : tv_relate_business.getText().toString()) +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_recorddate\":\"" +
|
|
|
- DateFormatUtil.getStrDate4Date(new Date(), "yyyy-MM-dd") +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_statuscode\":\"" +
|
|
|
- "ENTERING" +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_recorder\":\"" +
|
|
|
- emname +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_status\":\"" +
|
|
|
- "在录入" +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_cuuu\":\"" +
|
|
|
- cu_code +
|
|
|
- "\",\n" +
|
|
|
- "\"vr_visitend\":\"" +
|
|
|
- tv_date_end.getText().toString() +//结束时间
|
|
|
- "\"\n" +
|
|
|
- "}";
|
|
|
+ formStore = getFormStore(emname, code);
|
|
|
} else {
|
|
|
return;
|
|
|
}
|
|
|
if (progressDialog != null)
|
|
|
progressDialog.show();
|
|
|
- String url = Constants.getAppBaseUrl(ct) + "uas/crm/customermgr/updateVisitRecord.action";
|
|
|
+ String url = Constants.getAppBaseUrl(ct) + "crm/customermgr/saveVisitRecord.action";
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ params.put("formStore", formStore);
|
|
|
+ params.put("caller", "VisitRecord");
|
|
|
+ String param1 = "{\"pl_detno\":1,\"pl_name\":" + emname + ",\"pl_vrid\":" + mVrId + "}";
|
|
|
+ params.put("param1", "[]");
|
|
|
+ params.put("param2", "[]");
|
|
|
+ params.put("param3", param1);
|
|
|
+ params.put("param4", "[]");
|
|
|
+ params.put("param5", "[]");
|
|
|
+ params.put("param6", "[]");
|
|
|
+ params.put("param7", "[]");
|
|
|
+ LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
|
|
|
+ headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
|
+ ViewUtil.httpSendRequest(ct, url, params, mHandler, headers, what, null, null, "post");
|
|
|
+ }
|
|
|
+
|
|
|
+ private void updateVisitRecord() {
|
|
|
+ progressDialog.show();
|
|
|
+ if (!canSubmit()) return;
|
|
|
+ String emname = CommonUtil.getName();
|
|
|
+ String formStore = getFormStore(emname, vr_code);
|
|
|
+ if (progressDialog != null)
|
|
|
+ progressDialog.show();
|
|
|
+ String url = Constants.getAppBaseUrl(ct) + "crm/customermgr/updateVisitRecord.action";
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
params.put("formStore", formStore);
|
|
|
params.put("caller", "VisitRecord");
|
|
|
@@ -1023,6 +875,69 @@ public class VisitReportAddActivity extends BaseActivity implements View.OnClick
|
|
|
ViewUtil.httpSendRequest(this, url, param, mHandler, headers, 0x17, null, null, "post");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ private String getFormStore(String emname, String vr_code) {
|
|
|
+ return
|
|
|
+ "{\n" +
|
|
|
+ "\"vr_id\":" + mVrId + ",\n" +
|
|
|
+ "\"vr_class\":\"" + tv_visit_type.getHint().toString() + "\",\n" +
|
|
|
+ "\"vr_code\":\"" + vr_code
|
|
|
+ + "\",\n" +
|
|
|
+ "\"vr_tel\":\"" +
|
|
|
+ CommonUtil.getNoMarkEditText(phone_tv)
|
|
|
+ + "\",\n" +
|
|
|
+ "\"vr_visittime\":\""
|
|
|
+ + tv_date_start.getText().toString() + //开始时间
|
|
|
+ "\",\n" +
|
|
|
+ "\"vr_visitplace\":\"" +
|
|
|
+ CommonUtil.getNoMarkEditText(tv_address_login) +
|
|
|
+ "\",\n" +
|
|
|
+ "\"vr_cuname\":\"" +
|
|
|
+ CommonUtil.getNoMarkEditText(tv_customer_login) +
|
|
|
+ "\",\n" +
|
|
|
+ "\"vr_cucontact\":\"" +
|
|
|
+ CommonUtil.getNoMarkEditText(tv_linksman_login) +
|
|
|
+ "\",\n" +
|
|
|
+ "\"vr_contact\":\"" +
|
|
|
+ CommonUtil.getNoMarkEditText(tv_linksman_login) +
|
|
|
+ "\",\n" +
|
|
|
+ "\"vr_title\":\"" +
|
|
|
+ CommonUtil.getNoMarkEditText(tv_visit_theme) +//主题
|
|
|
+ "\",\n" +
|
|
|
+ "\"vr_nichestep\":\"" +
|
|
|
+ CommonUtil.getNoMarkEditText(tv_visit_steps) +
|
|
|
+ "\",\n" +
|
|
|
+ "\"vr_detail\":\"" +
|
|
|
+ CommonUtil.getNoMarkEditText(tv_visit_content) +
|
|
|
+ "\",\n" +
|
|
|
+ "\"vr_nichecode\":\"" +
|
|
|
+ nichecode +
|
|
|
+ "\",\n" +
|
|
|
+ "\"vr_nichename\":\"" +
|
|
|
+ (TextUtils.isEmpty(tv_relate_business.getText()) ? "" : tv_relate_business.getText().toString()) +
|
|
|
+ "\",\n" +
|
|
|
+ "\"vr_recorddate\":\"" +
|
|
|
+ DateFormatUtil.getStrDate4Date(new Date(), "yyyy-MM-dd") +
|
|
|
+ "\",\n" +
|
|
|
+ "\"vr_statuscode\":\"" +
|
|
|
+ "ENTERING" +
|
|
|
+ "\",\n" +
|
|
|
+ "\"vr_recorder\":\"" +
|
|
|
+ emname +
|
|
|
+ "\",\n" +
|
|
|
+ "\"vr_status\":\"" +
|
|
|
+ "在录入" +
|
|
|
+ "\",\n" +
|
|
|
+ "\"vr_cuuu\":\"" +
|
|
|
+ cu_code +
|
|
|
+ "\",\n" +
|
|
|
+ "\"vr_visitend\":\"" +
|
|
|
+ tv_date_end.getText().toString() +//结束时间
|
|
|
+ "\"\n" +
|
|
|
+ "}";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
private JSONArray array;
|
|
|
private SingleDialog singleDialog;
|
|
|
private String vp_code;
|