|
|
@@ -1,4 +1,4 @@
|
|
|
-package com.xzjmyk.pm.activity.ui.erp.activity.crm;
|
|
|
+package com.uas.appworks.CRM.erp.activity;
|
|
|
|
|
|
import android.content.Intent;
|
|
|
import android.os.Bundle;
|
|
|
@@ -16,18 +16,17 @@ import com.andreabaccega.widget.FormEditText;
|
|
|
import com.common.LogUtil;
|
|
|
import com.common.data.DateFormatUtil;
|
|
|
import com.common.data.StringUtil;
|
|
|
-import com.lidroid.xutils.ViewUtils;
|
|
|
-import com.lidroid.xutils.view.annotation.ViewInject;
|
|
|
+import com.core.app.Constants;
|
|
|
import com.core.app.MyApplication;
|
|
|
-import com.xzjmyk.pm.activity.R;
|
|
|
-import com.core.model.SelectBean;
|
|
|
import com.core.base.BaseActivity;
|
|
|
-import com.core.widget.view.Activity.SelectActivity;
|
|
|
+import com.core.model.SelectBean;
|
|
|
import com.core.net.http.ViewUtil;
|
|
|
-import com.xzjmyk.pm.activity.util.oa.CommonUtil;
|
|
|
-import com.core.app.Constants;
|
|
|
-import com.xzjmyk.pm.activity.ui.erp.view.SingleDialog;
|
|
|
+import com.core.utils.CommonUtil;
|
|
|
import com.core.utils.time.wheel.DatePicker;
|
|
|
+import com.core.widget.SingleDialog;
|
|
|
+import com.core.widget.view.Activity.SelectActivity;
|
|
|
+import com.lidroid.xutils.ViewUtils;
|
|
|
+import com.uas.appworks.R;
|
|
|
|
|
|
import org.json.JSONException;
|
|
|
import org.json.JSONObject;
|
|
|
@@ -48,169 +47,31 @@ import java.util.Map;
|
|
|
*/
|
|
|
public class BusinessAddActivity extends BaseActivity implements View.OnClickListener {
|
|
|
|
|
|
- @ViewInject(R.id.et_business_no)
|
|
|
private FormEditText et_business_no; // 天数
|
|
|
- @ViewInject(R.id.et_business_name)
|
|
|
private FormEditText et_business_name;
|
|
|
- @ViewInject(R.id.et_business_source)
|
|
|
private FormEditText et_business_source;
|
|
|
- // @ViewInject(R.id.et_business_phone)
|
|
|
-// private FormEditText et_business_phone;
|
|
|
- @ViewInject(R.id.et_business)
|
|
|
private FormEditText et_business;
|
|
|
-
|
|
|
-
|
|
|
- @ViewInject(R.id.et_business_jieDuan)
|
|
|
private FormEditText et_business_jieDuan;
|
|
|
- // @ViewInject(R.id.et_business_enterTime)
|
|
|
-// private FormEditText et_business_enterTime;
|
|
|
- @ViewInject(R.id.et_business_enterMan)
|
|
|
private FormEditText et_business_enterMan;
|
|
|
- @ViewInject(R.id.et_business_remark)
|
|
|
private FormEditText et_business_remark;
|
|
|
- @ViewInject(R.id.et_business_type)
|
|
|
private FormEditText et_business_type;
|
|
|
- @ViewInject(R.id.et_company_name)
|
|
|
private FormEditText et_company_name;
|
|
|
- @ViewInject(R.id.et_company_address)
|
|
|
private FormEditText et_company_address;
|
|
|
- @ViewInject(R.id.et_company_man)
|
|
|
private FormEditText et_company_man;
|
|
|
- @ViewInject(R.id.et_company_position)
|
|
|
private FormEditText et_company_position;
|
|
|
- @ViewInject(R.id.et_company_tel)
|
|
|
private FormEditText et_company_tele;
|
|
|
-
|
|
|
- @ViewInject(R.id.et_company_businesslicense)
|
|
|
private FormEditText et_company_businesslicense;
|
|
|
- @ViewInject(R.id.et_company_planmoney)
|
|
|
private FormEditText et_company_planmoney;
|
|
|
- @ViewInject(R.id.et_company_plantime)
|
|
|
private FormEditText et_company_plantime;
|
|
|
- @ViewInject(R.id.et_company_depart)
|
|
|
private FormEditText et_company_depart;
|
|
|
- @ViewInject(R.id.et_bc_factory)
|
|
|
private FormEditText et_bc_factory;
|
|
|
- @ViewInject(R.id.et_bt_tel)
|
|
|
private FormEditText et_bc_tel;
|
|
|
|
|
|
-
|
|
|
private List<String> lists = new ArrayList<String>();
|
|
|
private int et_business_enterCode;
|
|
|
private int mBcId;
|
|
|
private String enterManCode;
|
|
|
|
|
|
- @Override
|
|
|
- protected void onCreate(Bundle savedInstanceState) {
|
|
|
- super.onCreate(savedInstanceState);
|
|
|
- setContentView(R.layout.activity_business_add);
|
|
|
- initView();
|
|
|
- initData();
|
|
|
- initListener();
|
|
|
- }
|
|
|
-
|
|
|
- private void initListener() {
|
|
|
- et_business.setOnClickListener(this);
|
|
|
- et_business_jieDuan.setOnClickListener(this);
|
|
|
- et_business_source.setOnClickListener(this);
|
|
|
- et_business_enterMan.setOnClickListener(this);
|
|
|
-
|
|
|
- et_company_plantime.setOnClickListener(this);
|
|
|
-// et_business_no.setOnClickListener(this);
|
|
|
- // et_business.setKeyListener(null);
|
|
|
-// et_business_no.setKeyListener(null);
|
|
|
- //et_business_jieDuan.setKeyListener(null);
|
|
|
- et_business_source.setKeyListener(null);
|
|
|
- // et_business_enterMan.setKeyListener(null);
|
|
|
-
|
|
|
- et_business_type.setOnClickListener(this);
|
|
|
-// et_business_enterTime.setOnClickListener(this);
|
|
|
- et_business_type.setKeyListener(null);
|
|
|
-// et_business_enterTime.setKeyListener(null);
|
|
|
- et_business_type.setFocusable(false);
|
|
|
-// et_business_enterTime.setFocusable(false);
|
|
|
-
|
|
|
- et_business_no.setKeyListener(null);
|
|
|
- et_business_no.setFocusable(false);
|
|
|
-
|
|
|
- et_company_plantime.setKeyListener(null);
|
|
|
- et_company_plantime.setFocusable(false);
|
|
|
- }
|
|
|
-
|
|
|
- private void initData() {
|
|
|
- CommonUtil.getCommonId(this, "BUSINESSCHANCE_SEQ", mHandler, GET_BC_ID);
|
|
|
- getCodeByNet();
|
|
|
- }
|
|
|
-
|
|
|
- private void initView() {
|
|
|
- ViewUtils.inject(this);
|
|
|
- getSupportActionBar().setTitle("创建商机");
|
|
|
- if (!StringUtil.isEmpty(CommonUtil.getSharedPreferences(ct, "erp_emname"))) {
|
|
|
- et_business_enterMan.setText(CommonUtil.getSharedPreferences(ct, "erp_emname"));
|
|
|
- } else {
|
|
|
- et_business_enterMan.setText(MyApplication.getInstance().mLoginUser.getNickName());
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onClick(View v) {
|
|
|
- switch (v.getId()) {
|
|
|
- case R.id.et_business:
|
|
|
- loadBusiness();
|
|
|
- break;
|
|
|
- case R.id.et_business_source:
|
|
|
- loadSource();
|
|
|
- break;
|
|
|
- case R.id.et_business_enterMan:
|
|
|
- loadManGenJin();
|
|
|
- break;
|
|
|
- case R.id.et_business_no:
|
|
|
-
|
|
|
- break;
|
|
|
- case R.id.et_business_jieDuan:
|
|
|
- loadJieDuan();
|
|
|
- break;
|
|
|
- case R.id.et_business_type:
|
|
|
- onPopupButtonClick(v);
|
|
|
- break;
|
|
|
- case R.id.et_company_plantime:
|
|
|
- showDateDialog((FormEditText) v.findViewById(R.id.et_company_plantime));
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public boolean onCreateOptionsMenu(Menu menu) {
|
|
|
- getMenuInflater().inflate(R.menu.main_btn_submit, menu);
|
|
|
- menu.findItem(R.id.btn_save).setTitle(getString(R.string.common_save_button));
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
- switch (item.getItemId()) {
|
|
|
- case R.id.btn_save:
|
|
|
- if (et_business_name.testValidity() &&
|
|
|
- et_business_source.testValidity() &&
|
|
|
- et_business.testValidity() &&
|
|
|
- et_business_jieDuan.testValidity() &&
|
|
|
- et_company_tele.testValidity() &&
|
|
|
- et_company_businesslicense.testValidity() &&
|
|
|
- et_company_address.testValidity() &&
|
|
|
- et_company_name.testValidity()&&
|
|
|
- et_bc_tel.testValidity()&&
|
|
|
- et_bc_factory.testValidity()) {
|
|
|
- sendHttpResquest();
|
|
|
- }
|
|
|
- break;
|
|
|
- case android.R.id.home:
|
|
|
- onBackPressed();
|
|
|
- break;
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
private static final int codeWhat = 0x11;
|
|
|
private static final int LOAD_SOURCE = 2;
|
|
|
private static final int LOAD_BUSINESS = 3;
|
|
|
@@ -219,7 +80,15 @@ public class BusinessAddActivity extends BaseActivity implements View.OnClickLis
|
|
|
private static final int GET_BC_ID = 6;
|
|
|
private JSONArray jsons;
|
|
|
private JSONArray enterArray;
|
|
|
-
|
|
|
+ @Override
|
|
|
+ protected void onCreate(Bundle savedInstanceState) {
|
|
|
+ super.onCreate(savedInstanceState);
|
|
|
+ setContentView(R.layout.activity_business_add);
|
|
|
+ initIDS();
|
|
|
+ initView();
|
|
|
+ initData();
|
|
|
+ initListener();
|
|
|
+ }
|
|
|
private Handler mHandler = new Handler() {
|
|
|
@Override
|
|
|
public void handleMessage(Message msg) {
|
|
|
@@ -323,7 +192,115 @@ public class BusinessAddActivity extends BaseActivity implements View.OnClickLis
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
+ private void initIDS() {
|
|
|
+ et_business_no = (FormEditText) findViewById(R.id.et_business_no);
|
|
|
+ et_business_name = (FormEditText) findViewById(R.id.et_business_name);
|
|
|
+ et_business_source = (FormEditText) findViewById(R.id.et_business_source);
|
|
|
+ et_business = (FormEditText) findViewById(R.id.et_business);
|
|
|
+ et_business_jieDuan = (FormEditText) findViewById(R.id.et_business_jieDuan);
|
|
|
+ et_business_enterMan = (FormEditText) findViewById(R.id.et_business_enterMan);
|
|
|
+ et_business_remark = (FormEditText) findViewById(R.id.et_business_remark);
|
|
|
+ et_business_type = (FormEditText) findViewById(R.id.et_business_type);
|
|
|
+ et_company_name = (FormEditText) findViewById(R.id.et_company_name);
|
|
|
+ et_company_address = (FormEditText) findViewById(R.id.et_company_address);
|
|
|
+ et_company_man = (FormEditText) findViewById(R.id.et_company_man);
|
|
|
+ et_company_position = (FormEditText) findViewById(R.id.et_company_position);
|
|
|
+ et_company_tele= (FormEditText) findViewById(R.id.et_company_tel);
|
|
|
+ et_company_businesslicense= (FormEditText) findViewById(R.id.et_company_businesslicense);
|
|
|
+ et_company_planmoney= (FormEditText) findViewById(R.id.et_company_planmoney);
|
|
|
+ et_company_plantime = (FormEditText) findViewById(R.id.et_company_plantime);
|
|
|
+ et_company_depart = (FormEditText) findViewById(R.id.et_company_depart);
|
|
|
+ et_bc_factory= (FormEditText) findViewById(R.id.et_bc_factory);
|
|
|
+ et_bc_tel = (FormEditText) findViewById(R.id.et_bt_tel);
|
|
|
+ }
|
|
|
|
|
|
+ private void initListener() {
|
|
|
+ et_business.setOnClickListener(this);
|
|
|
+ et_business_jieDuan.setOnClickListener(this);
|
|
|
+ et_business_source.setOnClickListener(this);
|
|
|
+ et_business_enterMan.setOnClickListener(this);
|
|
|
+
|
|
|
+ et_company_plantime.setOnClickListener(this);
|
|
|
+// et_business_no.setOnClickListener(this);
|
|
|
+ // et_business.setKeyListener(null);
|
|
|
+// et_business_no.setKeyListener(null);
|
|
|
+ //et_business_jieDuan.setKeyListener(null);
|
|
|
+ et_business_source.setKeyListener(null);
|
|
|
+ // et_business_enterMan.setKeyListener(null);
|
|
|
+
|
|
|
+ et_business_type.setOnClickListener(this);
|
|
|
+// et_business_enterTime.setOnClickListener(this);
|
|
|
+ et_business_type.setKeyListener(null);
|
|
|
+// et_business_enterTime.setKeyListener(null);
|
|
|
+ et_business_type.setFocusable(false);
|
|
|
+// et_business_enterTime.setFocusable(false);
|
|
|
+
|
|
|
+ et_business_no.setKeyListener(null);
|
|
|
+ et_business_no.setFocusable(false);
|
|
|
+
|
|
|
+ et_company_plantime.setKeyListener(null);
|
|
|
+ et_company_plantime.setFocusable(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initData() {
|
|
|
+ CommonUtil.getCommonId(this, "BUSINESSCHANCE_SEQ", mHandler, GET_BC_ID);
|
|
|
+ getCodeByNet();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initView() {
|
|
|
+ getSupportActionBar().setTitle("创建商机");
|
|
|
+ if (!StringUtil.isEmpty(CommonUtil.getSharedPreferences(ct, "erp_emname"))) {
|
|
|
+ et_business_enterMan.setText(CommonUtil.getSharedPreferences(ct, "erp_emname"));
|
|
|
+ } else {
|
|
|
+ et_business_enterMan.setText(MyApplication.getInstance().mLoginUser.getNickName());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ if (v.getId() == R.id.et_business){
|
|
|
+ loadBusiness();
|
|
|
+ }else if (v.getId() == R.id.et_business_source){
|
|
|
+ loadSource();
|
|
|
+ }else if (v.getId() == R.id.et_business_enterMan){
|
|
|
+ loadManGenJin();
|
|
|
+ }else if (v.getId() == R.id.et_business_jieDuan){
|
|
|
+ loadJieDuan();
|
|
|
+ }else if (v.getId() == R.id.et_business_type){
|
|
|
+ onPopupButtonClick(v);
|
|
|
+ }else if (v.getId() == R.id.et_company_plantime){
|
|
|
+ showDateDialog((FormEditText) v.findViewById(R.id.et_company_plantime));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean onCreateOptionsMenu(Menu menu) {
|
|
|
+ getMenuInflater().inflate(R.menu.main_btn_submit, menu);
|
|
|
+ menu.findItem(R.id.btn_save).setTitle(getString(R.string.common_save_button));
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
+ if (item.getItemId() == R.id.btn_save) {
|
|
|
+ if (et_business_name.testValidity() &&
|
|
|
+ et_business_source.testValidity() &&
|
|
|
+ et_business.testValidity() &&
|
|
|
+ et_business_jieDuan.testValidity() &&
|
|
|
+ et_company_tele.testValidity() &&
|
|
|
+ et_company_businesslicense.testValidity() &&
|
|
|
+ et_company_address.testValidity() &&
|
|
|
+ et_company_name.testValidity() &&
|
|
|
+ et_bc_tel.testValidity() &&
|
|
|
+ et_bc_factory.testValidity()) {
|
|
|
+ sendHttpResquest();
|
|
|
+ }
|
|
|
+ }else if (item.getItemId() == android.R.id.home) {
|
|
|
+ onBackPressed();
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
private String getEditText(FormEditText et) {
|
|
|
String temp = "";
|
|
|
@@ -566,48 +543,41 @@ public class BusinessAddActivity extends BaseActivity implements View.OnClickLis
|
|
|
@Override
|
|
|
public void onListItemClick(int position, String value) {
|
|
|
if (StringUtil.isEmpty(value)) return;
|
|
|
- switch (et.getId()) {
|
|
|
- case R.id.et_business_enterMan:
|
|
|
- et.setText(value);
|
|
|
- for (int i = 0; i < enterArray.size(); i++) {
|
|
|
- if (value.equals(enterArray.getJSONObject(i).getString("BC_DOMAN"))) {
|
|
|
- //获取跟进人编号
|
|
|
- enterManCode = enterArray.getJSONObject(i).getString("EM_CODE");
|
|
|
- }
|
|
|
+ if (et.getId() == R.id.et_business_enterMan){
|
|
|
+ et.setText(value);
|
|
|
+ for (int i = 0; i < enterArray.size(); i++) {
|
|
|
+ if (value.equals(enterArray.getJSONObject(i).getString("BC_DOMAN"))) {
|
|
|
+ //获取跟进人编号
|
|
|
+ enterManCode = enterArray.getJSONObject(i).getString("EM_CODE");
|
|
|
}
|
|
|
- break;
|
|
|
- case R.id.et_business_source:
|
|
|
- et.setText(value);
|
|
|
- break;
|
|
|
- case R.id.et_business:
|
|
|
- et.setText(value);
|
|
|
- for (int i = 0; i < jsons.size(); i++) {
|
|
|
- if (jsons.getJSONObject(i).getString("BD_NAME").equals(value)) {
|
|
|
- String bd_prop = jsons.getJSONObject(i).getString("BD_PROP");
|
|
|
- if (bd_prop.equals(getString(R.string.business_common))
|
|
|
- || bd_prop.equals(getString(R.string.business_get_split))) {
|
|
|
- //跟进人不可编辑,不可点击
|
|
|
- et_business_enterMan.setClickable(false);
|
|
|
- et_business_enterMan.setEnabled(false);
|
|
|
- et_business_enterMan.setText("");
|
|
|
- et_business_enterCode = 0;
|
|
|
- } else {
|
|
|
- //跟进人可编辑
|
|
|
- et_business_enterCode = 1;
|
|
|
- et_business_enterMan.setEnabled(true);
|
|
|
- et_business_enterMan.setClickable(true);
|
|
|
- jsons.getJSONObject(i).getString("BD_PROP");
|
|
|
- // et_business_enterMan.setText(MyApplication.getInstance().mLoginUser.getNickName());
|
|
|
- }
|
|
|
+ }
|
|
|
+ }else if (et.getId() == R.id.et_business_source){
|
|
|
+ et.setText(value);
|
|
|
+ }else if (et.getId() == R.id.et_business){
|
|
|
+ et.setText(value);
|
|
|
+ for (int i = 0; i < jsons.size(); i++) {
|
|
|
+ if (jsons.getJSONObject(i).getString("BD_NAME").equals(value)) {
|
|
|
+ String bd_prop = jsons.getJSONObject(i).getString("BD_PROP");
|
|
|
+ if (bd_prop.equals(getString(R.string.business_common))
|
|
|
+ || bd_prop.equals(getString(R.string.business_get_split))) {
|
|
|
+ //跟进人不可编辑,不可点击
|
|
|
+ et_business_enterMan.setClickable(false);
|
|
|
+ et_business_enterMan.setEnabled(false);
|
|
|
+ et_business_enterMan.setText("");
|
|
|
+ et_business_enterCode = 0;
|
|
|
+ } else {
|
|
|
+ //跟进人可编辑
|
|
|
+ et_business_enterCode = 1;
|
|
|
+ et_business_enterMan.setEnabled(true);
|
|
|
+ et_business_enterMan.setClickable(true);
|
|
|
+ jsons.getJSONObject(i).getString("BD_PROP");
|
|
|
+ // et_business_enterMan.setText(MyApplication.getInstance().mLoginUser.getNickName());
|
|
|
}
|
|
|
}
|
|
|
- break;
|
|
|
- default:
|
|
|
- et.setText(value);
|
|
|
- break;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ et.setText(value);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
});
|
|
|
singleDialog.show();
|
|
|
@@ -639,23 +609,16 @@ public class BusinessAddActivity extends BaseActivity implements View.OnClickLis
|
|
|
|
|
|
public void onPopupButtonClick(View button) {
|
|
|
popup = new PopupMenu(this, button);
|
|
|
- switch (button.getId()) {
|
|
|
- case R.id.et_business_type:
|
|
|
- getMenuInflater().inflate(R.menu.menu_business_type, popup.getMenu());
|
|
|
- break;
|
|
|
+ if (button.getId() == R.id.et_business_type){
|
|
|
+ getMenuInflater().inflate(R.menu.menu_business_type, popup.getMenu());
|
|
|
}
|
|
|
-
|
|
|
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
|
|
@Override
|
|
|
public boolean onMenuItemClick(MenuItem item) {
|
|
|
- switch (item.getItemId()) {
|
|
|
- case R.id.items_public:
|
|
|
- et_business_type.setText(item.getTitle());
|
|
|
- break;
|
|
|
- case R.id.items_private:
|
|
|
- et_business_type.setText(item.getTitle());
|
|
|
- break;
|
|
|
- }
|
|
|
+ if (item.getItemId() == R.id.items_public)
|
|
|
+ et_business_type.setText(item.getTitle());
|
|
|
+ else if (item.getItemId() == R.id.items_private)
|
|
|
+ et_business_type.setText(item.getTitle());
|
|
|
return true;
|
|
|
}
|
|
|
});
|