|
|
@@ -9,6 +9,7 @@ import android.support.v4.app.Fragment;
|
|
|
import android.support.v4.app.FragmentManager;
|
|
|
import android.support.v4.app.FragmentPagerAdapter;
|
|
|
import android.support.v4.view.ViewPager;
|
|
|
+import android.text.TextUtils;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.Menu;
|
|
|
import android.view.MenuItem;
|
|
|
@@ -37,6 +38,7 @@ import com.xzjmyk.pm.activity.ui.erp.util.LogUtil;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.util.StringUtils;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.view.NScrollerGridView;
|
|
|
import com.xzjmyk.pm.activity.util.DateFormatUtil;
|
|
|
+import com.xzjmyk.pm.activity.util.TimeUtils;
|
|
|
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
@@ -106,21 +108,22 @@ public class SelectCalendarActivity extends BaseActivity implements View.OnClick
|
|
|
private int status;//0:在录入(无值)1:在录入(有值)
|
|
|
private boolean swich = false;//true 按时间段 false按时间
|
|
|
private boolean isMenuShuffle = false;//默认隐藏
|
|
|
-
|
|
|
+
|
|
|
private Handler mHandler=new Handler(){
|
|
|
|
|
|
@Override
|
|
|
public void handleMessage(Message msg) {
|
|
|
- switch (msg.what){
|
|
|
- case Constants.HTTP_SUCCESS_INIT:
|
|
|
- parsedResult(msg.getData().getString("result"));
|
|
|
- break;
|
|
|
- case Constants.APP_SOCKETIMEOUTEXCEPTION:
|
|
|
- initGridData();
|
|
|
- break;
|
|
|
- }
|
|
|
+ switch (msg.what){
|
|
|
+ case Constants.HTTP_SUCCESS_INIT:
|
|
|
+ parsedResult(msg.getData().getString("result"));
|
|
|
+ break;
|
|
|
+ case Constants.APP_SOCKETIMEOUTEXCEPTION:
|
|
|
+ initGridData();
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
+ private Boolean mWorkovertime = false;
|
|
|
|
|
|
@Override
|
|
|
public boolean onCreateOptionsMenu(Menu menu) {
|
|
|
@@ -215,8 +218,14 @@ public class SelectCalendarActivity extends BaseActivity implements View.OnClick
|
|
|
startDate = intent.getStringExtra("startDate");
|
|
|
endDate = intent.getStringExtra("endDate");
|
|
|
field = intent.getStringExtra("field");
|
|
|
-
|
|
|
- isMenuShuffle= intent.getBooleanExtra("hasMenu",false);
|
|
|
+
|
|
|
+ String mcaller = intent.getStringExtra("caller");
|
|
|
+ if (!TextUtils.isEmpty(mcaller) && "Workovertime".equals(mcaller)){
|
|
|
+ mWorkovertime = true;
|
|
|
+ v_date_start.setText(startDate);
|
|
|
+ v_date_end.setText(startDate);
|
|
|
+ }
|
|
|
+ isMenuShuffle= intent.getBooleanExtra("hasMenu", false);
|
|
|
LogUtil.d("start:" + startDate + " end:" + endDate+" field:"+field);
|
|
|
if (!StringUtils.isEmpty(field)){
|
|
|
if (field.contains("end")||field.contains("date2")){
|
|
|
@@ -231,6 +240,11 @@ public class SelectCalendarActivity extends BaseActivity implements View.OnClick
|
|
|
v_date_start.setText(startDate.substring(0, startDate.length() - 3));
|
|
|
v_date_end.setText(endDate.substring(0, endDate.length() - 3));
|
|
|
currentSelectDate = startDate.substring(0, 10);
|
|
|
+ }else{
|
|
|
+ String currentDate = TimeUtils.long_to_yMdHm_str(System.currentTimeMillis());
|
|
|
+ v_date_start.setText(currentDate.substring(0,currentDate.length() - 3));
|
|
|
+ v_date_end.setText(currentDate.substring(0,currentDate.length() - 3));
|
|
|
+ currentSelectDate = currentDate.substring(0,10);
|
|
|
}
|
|
|
}
|
|
|
initListener();
|
|
|
@@ -343,7 +357,7 @@ public class SelectCalendarActivity extends BaseActivity implements View.OnClick
|
|
|
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
private void setDateTag(Date date) {
|
|
|
Calendar c = Calendar.getInstance();
|
|
|
@@ -376,35 +390,62 @@ public class SelectCalendarActivity extends BaseActivity implements View.OnClick
|
|
|
if (!ListUtils.isEmpty(mTimeData)){
|
|
|
mTimeData.clear();
|
|
|
}
|
|
|
- mTimeData.add("08:30");
|
|
|
- mTimeData.add("09:00");
|
|
|
- mTimeData.add("09:30");
|
|
|
- mTimeData.add("10:00");
|
|
|
- mTimeData.add("10:30");
|
|
|
- mTimeData.add("11:00");
|
|
|
- mTimeData.add("11:30");
|
|
|
- mTimeData.add("12:00");
|
|
|
- mTimeData.add("13:00");
|
|
|
- mTimeData.add("13:30");
|
|
|
- mTimeData.add("14:00");
|
|
|
- mTimeData.add("14:30");
|
|
|
- mTimeData.add("15:00");
|
|
|
- mTimeData.add("15:30");
|
|
|
- mTimeData.add("16:00");
|
|
|
- mTimeData.add("16:30");
|
|
|
- mTimeData.add("17:00");
|
|
|
- mTimeData.add("17:30");
|
|
|
- mTimeData.add("18:00");
|
|
|
- mTimeData.add("18:30");
|
|
|
+ if (mWorkovertime){
|
|
|
+ mTimeData.add("00:00");
|
|
|
+ mTimeData.add("01:00");
|
|
|
+ mTimeData.add("02:00");
|
|
|
+ mTimeData.add("03:00");
|
|
|
+ mTimeData.add("04:00");
|
|
|
+ mTimeData.add("05:00");
|
|
|
+ mTimeData.add("06:00");
|
|
|
+ mTimeData.add("07:00");
|
|
|
+ mTimeData.add("08:00");
|
|
|
+ mTimeData.add("09:00");
|
|
|
+ mTimeData.add("10:00");
|
|
|
+ mTimeData.add("11:00");
|
|
|
+ mTimeData.add("12:00");
|
|
|
+ mTimeData.add("13:00");
|
|
|
+ mTimeData.add("14:00");
|
|
|
+ mTimeData.add("15:00");
|
|
|
+ mTimeData.add("16:00");
|
|
|
+ mTimeData.add("17:00");
|
|
|
+ mTimeData.add("18:00");
|
|
|
+ mTimeData.add("19:00");
|
|
|
+ mTimeData.add("20:00");
|
|
|
+ mTimeData.add("21:00");
|
|
|
+ mTimeData.add("22:00");
|
|
|
+ mTimeData.add("23:00");
|
|
|
+ }else {
|
|
|
+ mTimeData.add("08:30");
|
|
|
+ mTimeData.add("09:00");
|
|
|
+ mTimeData.add("09:30");
|
|
|
+ mTimeData.add("10:00");
|
|
|
+ mTimeData.add("10:30");
|
|
|
+ mTimeData.add("11:00");
|
|
|
+ mTimeData.add("11:30");
|
|
|
+ mTimeData.add("12:00");
|
|
|
+ mTimeData.add("13:00");
|
|
|
+ mTimeData.add("13:30");
|
|
|
+ mTimeData.add("14:00");
|
|
|
+ mTimeData.add("14:30");
|
|
|
+ mTimeData.add("15:00");
|
|
|
+ mTimeData.add("15:30");
|
|
|
+ mTimeData.add("16:00");
|
|
|
+ mTimeData.add("16:30");
|
|
|
+ mTimeData.add("17:00");
|
|
|
+ mTimeData.add("17:30");
|
|
|
+ mTimeData.add("18:00");
|
|
|
+ mTimeData.add("18:30");
|
|
|
+ }
|
|
|
gAdapter = new GridDataAdapter(mContext, mTimeData);
|
|
|
gv_date_list.setAdapter(gAdapter);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public void parsedResult(String result){
|
|
|
if (result==null) {
|
|
|
result = "{\"ifDefaultClass\":false,\"wd_degree\":2,\"wd_earlytime\":null,\"comAddressdata\":[{\"CS_WORKADDR\":\"深圳市南山区\",\"CS_VALIDRANGE\":\"300\",\"CS_ID\":10141,\"CS_LATITUDE\":\"22.540676518856678\",\"CS_LONGITUDE\":\"113.9528745854545\",\"CS_SHORTNAME\":\"宇声数码技术公司\",\"CS_CODE\":\"2017020234\",\"CS_INNERDISTANCE\":500,\"success\":true},{\"CS_WORKADDR\":\"广东省深圳市南山区高新区科技南六路29号万德莱大厦南座6楼\",\"CS_VALIDRANGE\":\"300\",\"CS_ID\":10143,\"CS_LATITUDE\":\"22.5416028163184\",\"CS_LONGITUDE\":\"113.95309916183191\",\"CS_SHORTNAME\":\"深圳市中兴供应链有限公司\",\"CS_CODE\":\"2017020236\",\"CS_INNERDISTANCE\":500,\"success\":true}],\"count\":null,\"wd_code\":\"TEST1\",\"Class3\":{\"wd_offend\":null,\"wd_onduty\":null,\"wd_offduty\":null,\"wd_onbeg\":null},\"Class2\":{\"wd_offend\":\"20:00\",\"wd_onduty\":\"13:30\",\"wd_offduty\":\"18:00\",\"wd_onbeg\":\"13:00\"},\"wd_id\":111281,\"Class1\":{\"wd_offend\":\"12:30\",\"wd_onduty\":\"08:30\",\"wd_offduty\":\"12:00\",\"wd_onbeg\":\"07:00\"},\"wd_pcount\":null,\"wd_name\":\"测试1\",\"ifNeedSignCard\":true,\"innerdistance\":null,\"distance\":null,\"sessionId\":\"729F70FB568EF25CC7F1CEE14A0900EE\",\"comaddressset\":false,\"longitude\":null,\"latitude\":null,\"success\":true,\"wd_day\":null}";
|
|
|
}
|
|
|
- // List<String> mTimeData=new ArrayList<String>();
|
|
|
+ // List<String> mTimeData=new ArrayList<String>();
|
|
|
try {
|
|
|
JSONObject root = JSON.parseObject(result);
|
|
|
JSONObject Class1 = root.getJSONObject("Class1");
|
|
|
@@ -443,7 +484,6 @@ public class SelectCalendarActivity extends BaseActivity implements View.OnClick
|
|
|
mTimeData.add("11:00");
|
|
|
mTimeData.add("11:30");
|
|
|
mTimeData.add("12:00");
|
|
|
- mTimeData.add("12:30");
|
|
|
mTimeData.add("13:00");
|
|
|
mTimeData.add("13:30");
|
|
|
mTimeData.add("14:00");
|
|
|
@@ -455,6 +495,35 @@ public class SelectCalendarActivity extends BaseActivity implements View.OnClick
|
|
|
mTimeData.add("17:00");
|
|
|
mTimeData.add("17:30");
|
|
|
mTimeData.add("18:00");
|
|
|
+ mTimeData.add("18:30");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (mWorkovertime){
|
|
|
+ mTimeData.clear();
|
|
|
+ mTimeData.add("00:00");
|
|
|
+ mTimeData.add("01:00");
|
|
|
+ mTimeData.add("02:00");
|
|
|
+ mTimeData.add("03:00");
|
|
|
+ mTimeData.add("04:00");
|
|
|
+ mTimeData.add("05:00");
|
|
|
+ mTimeData.add("06:00");
|
|
|
+ mTimeData.add("07:00");
|
|
|
+ mTimeData.add("08:00");
|
|
|
+ mTimeData.add("09:00");
|
|
|
+ mTimeData.add("10:00");
|
|
|
+ mTimeData.add("11:00");
|
|
|
+ mTimeData.add("12:00");
|
|
|
+ mTimeData.add("13:00");
|
|
|
+ mTimeData.add("14:00");
|
|
|
+ mTimeData.add("15:00");
|
|
|
+ mTimeData.add("16:00");
|
|
|
+ mTimeData.add("17:00");
|
|
|
+ mTimeData.add("18:00");
|
|
|
+ mTimeData.add("19:00");
|
|
|
+ mTimeData.add("20:00");
|
|
|
+ mTimeData.add("21:00");
|
|
|
+ mTimeData.add("22:00");
|
|
|
+ mTimeData.add("23:00");
|
|
|
}
|
|
|
gAdapter = new GridDataAdapter(MyApplication.getInstance(), mTimeData);
|
|
|
gv_date_list.setAdapter(gAdapter);
|
|
|
@@ -487,7 +556,6 @@ public class SelectCalendarActivity extends BaseActivity implements View.OnClick
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
private void setDate() {
|
|
|
//当前天在 MAX_PAGER/2 位置
|
|
|
Calendar c = Calendar.getInstance();
|
|
|
@@ -577,11 +645,11 @@ public class SelectCalendarActivity extends BaseActivity implements View.OnClick
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
- * @desc:发送网络请求
|
|
|
- * @author:Arison on 2017/2/15
|
|
|
- */
|
|
|
+ * @desc:发送网络请求
|
|
|
+ * @author:Arison on 2017/2/15
|
|
|
+ */
|
|
|
private void sendRequest(){
|
|
|
String url = CommonUtil.getSharedPreferences(this, "erp_baseurl") +
|
|
|
"mobile/getWorkDate.action";
|