|
@@ -13,12 +13,14 @@ import android.widget.TextView;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.lidroid.xutils.ViewUtils;
|
|
import com.lidroid.xutils.ViewUtils;
|
|
|
-import com.lidroid.xutils.view.ViewInjectInfo;
|
|
|
|
|
import com.lidroid.xutils.view.annotation.ViewInject;
|
|
import com.lidroid.xutils.view.annotation.ViewInject;
|
|
|
import com.xzjmyk.pm.activity.R;
|
|
import com.xzjmyk.pm.activity.R;
|
|
|
|
|
+import com.xzjmyk.pm.activity.bean.oa.MeetUserEntity;
|
|
|
import com.xzjmyk.pm.activity.ui.base.BaseActivity;
|
|
import com.xzjmyk.pm.activity.ui.base.BaseActivity;
|
|
|
|
|
+import com.xzjmyk.pm.activity.ui.erp.activity.oa.UserSelectActivity;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.util.CommonUtil;
|
|
import com.xzjmyk.pm.activity.ui.erp.util.CommonUtil;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.util.Constants;
|
|
import com.xzjmyk.pm.activity.ui.erp.util.Constants;
|
|
|
|
|
+import com.xzjmyk.pm.activity.ui.erp.util.StringUtils;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.util.ViewUtil;
|
|
import com.xzjmyk.pm.activity.ui.erp.util.ViewUtil;
|
|
|
import com.xzjmyk.pm.activity.view.wheel.DatePicker;
|
|
import com.xzjmyk.pm.activity.view.wheel.DatePicker;
|
|
|
import com.xzjmyk.pm.activity.view.wheel.OptionPicker;
|
|
import com.xzjmyk.pm.activity.view.wheel.OptionPicker;
|
|
@@ -29,7 +31,7 @@ import java.util.LinkedHashMap;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
public class TaskAddActivity extends BaseActivity implements View.OnClickListener {
|
|
public class TaskAddActivity extends BaseActivity implements View.OnClickListener {
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
@ViewInject(R.id.tv_name)
|
|
@ViewInject(R.id.tv_name)
|
|
|
private EditText tv_name;
|
|
private EditText tv_name;
|
|
|
@ViewInject(R.id.tv_executive)
|
|
@ViewInject(R.id.tv_executive)
|
|
@@ -39,7 +41,7 @@ public class TaskAddActivity extends BaseActivity implements View.OnClickListene
|
|
|
@ViewInject(R.id.tv_priority)
|
|
@ViewInject(R.id.tv_priority)
|
|
|
private EditText tv_priority;
|
|
private EditText tv_priority;
|
|
|
@ViewInject(R.id.tv_type)
|
|
@ViewInject(R.id.tv_type)
|
|
|
- private EditText tv_type;
|
|
|
|
|
|
|
+ private TextView tv_type;
|
|
|
@ViewInject(R.id.tv_customer)
|
|
@ViewInject(R.id.tv_customer)
|
|
|
private EditText tv_customer;
|
|
private EditText tv_customer;
|
|
|
@ViewInject(R.id.tv_notice)
|
|
@ViewInject(R.id.tv_notice)
|
|
@@ -47,6 +49,7 @@ public class TaskAddActivity extends BaseActivity implements View.OnClickListene
|
|
|
@ViewInject(R.id.tv_content)
|
|
@ViewInject(R.id.tv_content)
|
|
|
private EditText tv_content;
|
|
private EditText tv_content;
|
|
|
|
|
|
|
|
|
|
+ private String code = null;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
@@ -54,41 +57,38 @@ public class TaskAddActivity extends BaseActivity implements View.OnClickListene
|
|
|
setContentView(R.layout.activity_task_add);
|
|
setContentView(R.layout.activity_task_add);
|
|
|
initView();
|
|
initView();
|
|
|
initData();
|
|
initData();
|
|
|
- initListener();
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void initView() {
|
|
private void initView() {
|
|
|
ViewUtils.inject(this);
|
|
ViewUtils.inject(this);
|
|
|
- int type=getIntent().getIntExtra("type",0);
|
|
|
|
|
- if (type==0){
|
|
|
|
|
|
|
+ int type = getIntent().getIntExtra("type", 0);
|
|
|
|
|
+ code = getIntent().getStringExtra("data");
|
|
|
|
|
+ if (type == 0) {
|
|
|
getSupportActionBar().setTitle("新增任务");
|
|
getSupportActionBar().setTitle("新增任务");
|
|
|
tv_type.setText("任务");
|
|
tv_type.setText("任务");
|
|
|
- }else if (type==1){
|
|
|
|
|
|
|
+ } else if (type == 1) {
|
|
|
getSupportActionBar().setTitle("新增日程");
|
|
getSupportActionBar().setTitle("新增日程");
|
|
|
tv_type.setText("日程");
|
|
tv_type.setText("日程");
|
|
|
}
|
|
}
|
|
|
tv_notice.setOnClickListener(this);
|
|
tv_notice.setOnClickListener(this);
|
|
|
tv_priority.setOnClickListener(this);
|
|
tv_priority.setOnClickListener(this);
|
|
|
tv_date.setOnClickListener(this);
|
|
tv_date.setOnClickListener(this);
|
|
|
-
|
|
|
|
|
|
|
+ findViewById(R.id.sex_erp_rl).setOnClickListener(this);
|
|
|
tv_date.setKeyListener(null);
|
|
tv_date.setKeyListener(null);
|
|
|
tv_date.setFocusable(false);
|
|
tv_date.setFocusable(false);
|
|
|
tv_notice.setKeyListener(null);
|
|
tv_notice.setKeyListener(null);
|
|
|
tv_notice.setFocusable(false);
|
|
tv_notice.setFocusable(false);
|
|
|
tv_priority.setKeyListener(null);
|
|
tv_priority.setKeyListener(null);
|
|
|
tv_priority.setFocusable(false);
|
|
tv_priority.setFocusable(false);
|
|
|
-
|
|
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
- private void initData() {
|
|
|
|
|
- getCodeByNet();
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- private void initListener() {
|
|
|
|
|
|
|
+ private void initData() {
|
|
|
|
|
+ getCodeByNet();
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public boolean onCreateOptionsMenu(Menu menu) {
|
|
public boolean onCreateOptionsMenu(Menu menu) {
|
|
|
getMenuInflater().inflate(R.menu.main_btn_submit, menu);
|
|
getMenuInflater().inflate(R.menu.main_btn_submit, menu);
|
|
@@ -108,33 +108,40 @@ public class TaskAddActivity extends BaseActivity implements View.OnClickListene
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private Handler mHandler=new Handler(){
|
|
|
|
|
|
|
+ private Handler mHandler = new Handler() {
|
|
|
@Override
|
|
@Override
|
|
|
public void handleMessage(Message msg) {
|
|
public void handleMessage(Message msg) {
|
|
|
- switch (msg.what){
|
|
|
|
|
|
|
+ switch (msg.what) {
|
|
|
case Constants.HTTP_SUCCESS_INIT:
|
|
case Constants.HTTP_SUCCESS_INIT:
|
|
|
progressDialog.dismiss();
|
|
progressDialog.dismiss();
|
|
|
Log.i(TAG, "handleMessage:" + msg.getData().getString("result"));
|
|
Log.i(TAG, "handleMessage:" + msg.getData().getString("result"));
|
|
|
ToastMessage("保存成功!");
|
|
ToastMessage("保存成功!");
|
|
|
|
|
+ if (!StringUtils.isEmpty(code))
|
|
|
|
|
+ setCodeByNet(code);
|
|
|
|
|
+// finish();
|
|
|
break;
|
|
break;
|
|
|
case Constants.APP_SOCKETIMEOUTEXCEPTION:
|
|
case Constants.APP_SOCKETIMEOUTEXCEPTION:
|
|
|
progressDialog.dismiss();
|
|
progressDialog.dismiss();
|
|
|
Log.i(TAG, "handleMessage:" + msg.getData().getString("result"));
|
|
Log.i(TAG, "handleMessage:" + msg.getData().getString("result"));
|
|
|
ToastMessage("保存异常!");
|
|
ToastMessage("保存异常!");
|
|
|
break;
|
|
break;
|
|
|
|
|
+ case endCodeWhat:
|
|
|
|
|
+ Log.i("gongpengming", msg.getData().getString("result"));
|
|
|
|
|
+ ToastMessage("保存上传成功!");
|
|
|
|
|
+ break;
|
|
|
case codeWhat://获取编号
|
|
case codeWhat://获取编号
|
|
|
progressDialog.dismiss();
|
|
progressDialog.dismiss();
|
|
|
- tv_code= JSON.parseObject(msg.getData().getString("result")).getString("code");
|
|
|
|
|
|
|
+ tv_code = JSON.parseObject(msg.getData().getString("result")).getString("code");
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- private void sendHttpResquest(int what){
|
|
|
|
|
|
|
+ private void sendHttpResquest(int what) {
|
|
|
progressDialog.show();
|
|
progressDialog.show();
|
|
|
- String formStore="{\n" +
|
|
|
|
|
- "\"taskcode\":\"" + tv_code+ "\",\n" +
|
|
|
|
|
- "\"name\":\"" + tv_name.getText().toString()+ "\",\n" +
|
|
|
|
|
|
|
+ String formStore = "{\n" +
|
|
|
|
|
+ "\"taskcode\":\"" + tv_code + "\",\n" +
|
|
|
|
|
+ "\"name\":\"" + tv_name.getText().toString() + "\",\n" +
|
|
|
"\"resourcename\":\"" +
|
|
"\"resourcename\":\"" +
|
|
|
tv_executive.getText().toString() +
|
|
tv_executive.getText().toString() +
|
|
|
"\",\n" +
|
|
"\",\n" +
|
|
@@ -144,7 +151,7 @@ public class TaskAddActivity extends BaseActivity implements View.OnClickListene
|
|
|
"\"tasklevel\":\"" +
|
|
"\"tasklevel\":\"" +
|
|
|
tv_priority.getText().toString() +
|
|
tv_priority.getText().toString() +
|
|
|
"\",\n" +
|
|
"\",\n" +
|
|
|
- "\"taskorschedule\":\""+tv_type.getText().toString()+"\",\n" +
|
|
|
|
|
|
|
+ "\"taskorschedule\":\"" + tv_type.getText().toString() + "\",\n" +
|
|
|
"\"custname\":\"" +
|
|
"\"custname\":\"" +
|
|
|
tv_customer.getText().toString() +
|
|
tv_customer.getText().toString() +
|
|
|
"\",\n" +
|
|
"\",\n" +
|
|
@@ -156,17 +163,17 @@ public class TaskAddActivity extends BaseActivity implements View.OnClickListene
|
|
|
"\",\n" +
|
|
"\",\n" +
|
|
|
/* "\"SOURCECOD\":\"U0316\"\n" +*/
|
|
/* "\"SOURCECOD\":\"U0316\"\n" +*/
|
|
|
"}";
|
|
"}";
|
|
|
- String url= Constants.getAppBaseUrl(ct)+"plm/task/addbilltask.action";
|
|
|
|
|
- Map<String,Object> params=new HashMap<>();
|
|
|
|
|
|
|
+ String url = Constants.getAppBaseUrl(ct) + "plm/task/addbilltask.action";
|
|
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
params.put("formStore", formStore);
|
|
params.put("formStore", formStore);
|
|
|
- LinkedHashMap<String , Object> headers=new LinkedHashMap<>();
|
|
|
|
|
|
|
+ LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
|
|
|
headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
|
ViewUtil.httpSendRequest(ct, url, params, mHandler, headers, what, null, null, "post");
|
|
ViewUtil.httpSendRequest(ct, url, params, mHandler, headers, what, null, null, "post");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void showNoticeDialog() {
|
|
private void showNoticeDialog() {
|
|
|
OptionPicker sex_option = new OptionPicker(this, new String[]{
|
|
OptionPicker sex_option = new OptionPicker(this, new String[]{
|
|
|
- "10分钟", "30分钟","60分钟"
|
|
|
|
|
|
|
+ "10分钟", "30分钟", "60分钟"
|
|
|
});
|
|
});
|
|
|
sex_option.setOffset(1);
|
|
sex_option.setOffset(1);
|
|
|
sex_option.setSelectedIndex(1);
|
|
sex_option.setSelectedIndex(1);
|
|
@@ -174,7 +181,6 @@ public class TaskAddActivity extends BaseActivity implements View.OnClickListene
|
|
|
sex_option.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() {
|
|
sex_option.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() {
|
|
|
@Override
|
|
@Override
|
|
|
public void onOptionPicked(int position, String option) {
|
|
public void onOptionPicked(int position, String option) {
|
|
|
-// ToastMessage(position+option);
|
|
|
|
|
tv_notice.setText(option);
|
|
tv_notice.setText(option);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -182,18 +188,25 @@ public class TaskAddActivity extends BaseActivity implements View.OnClickListene
|
|
|
sex_option.show();
|
|
sex_option.show();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void showPriorityDialog() {
|
|
|
|
|
- OptionPicker sex_option = new OptionPicker(this, new String[]{
|
|
|
|
|
- "紧急", "一般","不紧急"
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ private void showPriorityDialog(final EditText et, int type) {
|
|
|
|
|
+ String[] str = null;
|
|
|
|
|
+ if (type == 0x11) {//
|
|
|
|
|
+ str = new String[]{
|
|
|
|
|
+ "紧急", "一般", "不紧急"
|
|
|
|
|
+ };
|
|
|
|
|
+ } else if (type == 0x12) {
|
|
|
|
|
+ str = new String[]{
|
|
|
|
|
+ "任务", "日程"
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+ OptionPicker sex_option = new OptionPicker(this, str);
|
|
|
sex_option.setOffset(1);
|
|
sex_option.setOffset(1);
|
|
|
sex_option.setSelectedIndex(1);
|
|
sex_option.setSelectedIndex(1);
|
|
|
sex_option.setTextSize(18);
|
|
sex_option.setTextSize(18);
|
|
|
sex_option.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() {
|
|
sex_option.setOnOptionPickListener(new OptionPicker.OnOptionPickListener() {
|
|
|
@Override
|
|
@Override
|
|
|
public void onOptionPicked(int position, String option) {
|
|
public void onOptionPicked(int position, String option) {
|
|
|
-// ToastMessage(position+option);
|
|
|
|
|
- tv_priority.setText(option);
|
|
|
|
|
|
|
+ et.setText(option);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
});
|
|
});
|
|
@@ -210,7 +223,6 @@ public class TaskAddActivity extends BaseActivity implements View.OnClickListene
|
|
|
picker.setOnDatePickListener(new DatePicker.OnYearMonthDayPickListener() {
|
|
picker.setOnDatePickListener(new DatePicker.OnYearMonthDayPickListener() {
|
|
|
@Override
|
|
@Override
|
|
|
public void onDatePicked(String year, String month, String day) {
|
|
public void onDatePicked(String year, String month, String day) {
|
|
|
-// ToastUtil.showToast(ct, year + "-" + month + "-" + day);
|
|
|
|
|
tv_date.setText(year + "-" + month + "-" + day);
|
|
tv_date.setText(year + "-" + month + "-" + day);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
@@ -219,7 +231,7 @@ public class TaskAddActivity extends BaseActivity implements View.OnClickListene
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
public void onClick(View v) {
|
|
|
- switch (v.getId()){
|
|
|
|
|
|
|
+ switch (v.getId()) {
|
|
|
case R.id.tv_date:
|
|
case R.id.tv_date:
|
|
|
showDateDialog();
|
|
showDateDialog();
|
|
|
break;
|
|
break;
|
|
@@ -227,14 +239,20 @@ public class TaskAddActivity extends BaseActivity implements View.OnClickListene
|
|
|
showNoticeDialog();
|
|
showNoticeDialog();
|
|
|
break;
|
|
break;
|
|
|
case R.id.tv_priority:
|
|
case R.id.tv_priority:
|
|
|
- showPriorityDialog();
|
|
|
|
|
|
|
+ showPriorityDialog(tv_priority, 0x11);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case R.id.sex_erp_rl:
|
|
|
|
|
+ Intent intent = new Intent(ct, UserSelectActivity.class);
|
|
|
|
|
+ intent.putExtra("data", true);
|
|
|
|
|
+ startActivityForResult(intent, 0x11);
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
private static final int codeWhat = 0x11;
|
|
private static final int codeWhat = 0x11;
|
|
|
- private String tv_code;
|
|
|
|
|
|
|
+ private static final int endCodeWhat = 0x12;
|
|
|
|
|
+ private String tv_code;
|
|
|
|
|
+
|
|
|
private void getCodeByNet() {
|
|
private void getCodeByNet() {
|
|
|
String url = Constants.getAppBaseUrl(ct) + "common/getCodeString.action";
|
|
String url = Constants.getAppBaseUrl(ct) + "common/getCodeString.action";
|
|
|
final Map<String, Object> param = new HashMap<>();
|
|
final Map<String, Object> param = new HashMap<>();
|
|
@@ -244,6 +262,26 @@ public class TaskAddActivity extends BaseActivity implements View.OnClickListene
|
|
|
param.put("sessionId", CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
param.put("sessionId", CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
|
LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
|
|
LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
|
|
|
headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
|
- ViewUtil.httpSendRequest(ct, url, param, mHandler, headers, codeWhat, null, null, "post");
|
|
|
|
|
|
|
+ ViewUtil.httpSendRequest(ct, url, param, mHandler, headers, codeWhat, null, null, "post");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void setCodeByNet(String code) {
|
|
|
|
|
+ String url = Constants.getAppBaseUrl(ct) + "mobile/crm/updateLastdate.action";
|
|
|
|
|
+ final Map<String, Object> param = new HashMap<>();
|
|
|
|
|
+ param.put("bc_code", code);
|
|
|
|
|
+ param.put("sessionId", CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
|
|
|
+ LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
|
|
|
|
|
+ headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
|
|
|
+ ViewUtil.httpSendRequest(ct, url, param, mHandler, headers, endCodeWhat, null, null, "post");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
|
|
+ if (data == null) return;
|
|
|
|
|
+ if (requestCode == 0x11 && resultCode == 0x11) {
|
|
|
|
|
+ MeetUserEntity entity = data.getParcelableExtra("data");
|
|
|
|
|
+ if (entity == null || entity.getName() == null) return;
|
|
|
|
|
+ tv_executive.setText(entity.getName());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|