|
|
@@ -44,6 +44,7 @@ import com.me.network.app.http.HttpClient;
|
|
|
import com.me.network.app.http.Method;
|
|
|
import com.me.network.app.http.rx.Result2Listener;
|
|
|
import com.me.network.app.http.rx.ResultSubscriber;
|
|
|
+import com.uas.appworks.OA.erp.model.WorkReportBean;
|
|
|
import com.uas.appworks.R;
|
|
|
|
|
|
import org.json.JSONException;
|
|
|
@@ -75,6 +76,7 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
private RadioGroup mReportTimeRg;
|
|
|
private RadioButton mReportTimeBeforeRb;
|
|
|
private RadioButton mReportTimePresentRb;
|
|
|
+ private LinearLayout mOldScheduleLl;
|
|
|
private TextView mOldScheduleTitleTv;
|
|
|
private DrawableCenterTextView mOldScheduleEmptyTv;
|
|
|
private TextView mOldScheduleContentTv;
|
|
|
@@ -110,7 +112,7 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
private int mReportType = Constants.WORK_REPORT_DAY;
|
|
|
private int mkeyValue;
|
|
|
private HttpClient mHttpClient;
|
|
|
- private boolean isModify = false;
|
|
|
+ private boolean isModify = false, isOptionEvent = false;
|
|
|
|
|
|
private String mTodayDate, mYesterdayDate, mTodayWeek, mYesterdayWeek;
|
|
|
private String mThisWeekStartDate, mThisWeekEndDate, mLastWeekStartDate, mLastWeekEndDate, mThisWeekSerial, mLastWeekSerial;
|
|
|
@@ -119,7 +121,9 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
private String mDailyReportDate = "", mDailyReportWeek = "", mWeekReportStartDate = "", mWeekReportEndDate = "", mMonthReportStartDate = "", mMonthReportEndDate = "", mWeekReportSerial = "", mMonthReportSerial = "";
|
|
|
|
|
|
private String mUpdateDate = "", mUpdateWeekdays = "", mUpdateSerial = "", mUpdateStartTime = "", mUpdateEndTime = "";
|
|
|
- private boolean isOnlyUpdate = false;
|
|
|
+ private boolean isOnlyUpdate = false, isPresentExist = false, isBeforeExist = false;
|
|
|
+ private WorkReportBean mInitPresentWorkReportBean, mInitBeforeWorkReportBean;
|
|
|
+ private String mPresentPlan = "", mBeforePlan = "";
|
|
|
|
|
|
private Handler handler = new Handler() {
|
|
|
@Override
|
|
|
@@ -157,9 +161,6 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
mUnfinishedTask = new JSONObject(result).getJSONArray("data").getJSONObject(0).getString("WM_UNFINISHEDTASK");
|
|
|
}
|
|
|
|
|
|
- Log.i("First_mkeyValue", mkeyValue + " ");
|
|
|
- Log.i("wd_context", mFinishedTask + " ");
|
|
|
- Log.i("wd_context", mUnfinishedTask + " ");
|
|
|
} catch (JSONException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
@@ -190,7 +191,8 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
if (JSON.parseObject(result).containsKey("success") && JSON.parseObject(result).getBoolean("success")) {
|
|
|
boolean isResubmit = (!TextUtils.isEmpty(resubmit) && resubmit.equals("resubmit")) ||
|
|
|
(!TextUtils.isEmpty(resubmit) && resubmit.equals("unsub_tosub"));
|
|
|
- if (isResubmit) {
|
|
|
+ if (isResubmit || (mReportTimePresentRb.isChecked() && isPresentExist)
|
|
|
+ || (mReportTimeBeforeRb.isChecked() && isBeforeExist)) {
|
|
|
String updateResult = getResources().getString(R.string.report_update_result);
|
|
|
String updateSuccess = "";
|
|
|
if (mReportType == Constants.WORK_REPORT_DAY) {
|
|
|
@@ -203,11 +205,18 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
ToastMessage(updateSuccess);
|
|
|
if (isOnlyUpdate) {
|
|
|
progressDialog.dismiss();
|
|
|
- Intent intent1 = new Intent(WorkReportAddActivity.this, WorkDailyShowActivity.class);
|
|
|
- intent1.putExtra("caller", mCaller);
|
|
|
- intent1.putExtra("report_type", mReportType);
|
|
|
- startActivity(intent1);
|
|
|
- finish();
|
|
|
+ if (isResubmit || isOptionEvent) {
|
|
|
+ Intent intent1 = new Intent(WorkReportAddActivity.this, WorkDailyShowActivity.class);
|
|
|
+ intent1.putExtra("caller", mCaller);
|
|
|
+ intent1.putExtra("report_type", mReportType);
|
|
|
+ if (isOptionEvent) {
|
|
|
+ intent1.putExtra("fromwhere", "nosubmitdaily");
|
|
|
+ }
|
|
|
+ startActivity(intent1);
|
|
|
+ }
|
|
|
+ if (!isOptionEvent) {
|
|
|
+ finish();
|
|
|
+ }
|
|
|
} else {
|
|
|
submitWorkReport();
|
|
|
}
|
|
|
@@ -221,8 +230,8 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
if (msg.getData() != null) {
|
|
|
if (!StringUtil.isEmpty(msg.getData().getString("result"))) {
|
|
|
String result = msg.getData().getString("result");
|
|
|
+ LogUtil.prinlnLongMsg("LAST_SUBMIT_message", result);
|
|
|
if (JSON.parseObject(result).containsKey("success") && JSON.parseObject(result).getBoolean("success")) {
|
|
|
- LogUtil.prinlnLongMsg("LAST_SUBMIT_message", result);
|
|
|
String resubmitResult = getResources().getString(R.string.report_resubmit_result);
|
|
|
String resubmitSuccess = "";
|
|
|
if (mReportType == Constants.WORK_REPORT_DAY) {
|
|
|
@@ -349,6 +358,7 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
if (!TextUtils.isEmpty(resubmit)) {
|
|
|
mDateLinearLayout.setVisibility(View.VISIBLE);
|
|
|
mReportTimeRg.setVisibility(View.GONE);
|
|
|
+ mOldScheduleLl.setVisibility(View.GONE);
|
|
|
if ("unsub_tosub".equals(resubmit)) {
|
|
|
mSubmitButton.setText(getString(R.string.common_submit_button));
|
|
|
} else if ("resubmit".equals(resubmit)) {
|
|
|
@@ -408,6 +418,7 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
} else {
|
|
|
mDateLinearLayout.setVisibility(View.GONE);
|
|
|
mReportTimeRg.setVisibility(View.VISIBLE);
|
|
|
+ mOldScheduleLl.setVisibility(View.VISIBLE);
|
|
|
if (CommonUtil.isNetWorkConnected(this)) {
|
|
|
getWorkReportInit();
|
|
|
} else {
|
|
|
@@ -428,7 +439,6 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
@Override
|
|
|
public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) {
|
|
|
if (checkedId == R.id.work_report_add_time_before_rb) {
|
|
|
- mNewScheduleLl.setVisibility(View.GONE);
|
|
|
if (mReportType == Constants.WORK_REPORT_DAY) {
|
|
|
mDailyReportDate = mYesterdayDate;
|
|
|
mDailyReportWeek = mYesterdayWeek;
|
|
|
@@ -444,8 +454,45 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
mMonthReportEndDate = mLastMonthEndDate;
|
|
|
mReportTimeTv.setText(mLastMonthTime);
|
|
|
}
|
|
|
+
|
|
|
+ if (!TextUtils.isEmpty(mBeforePlan)) {
|
|
|
+ mOldScheduleEmptyTv.setVisibility(View.GONE);
|
|
|
+ mOldScheduleContentTv.setVisibility(View.VISIBLE);
|
|
|
+ mOldScheduleContentTv.setText(mBeforePlan);
|
|
|
+ } else {
|
|
|
+ mOldScheduleEmptyTv.setVisibility(View.VISIBLE);
|
|
|
+ mOldScheduleContentTv.setText("");
|
|
|
+ mOldScheduleContentTv.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isBeforeExist) {
|
|
|
+ mSummaryContentEt.setText(mInitBeforeWorkReportBean.getComment());
|
|
|
+ mNewScheduleContentEt.setText(mInitBeforeWorkReportBean.getPlan());
|
|
|
+ mExperienceContentEt.setText(mInitBeforeWorkReportBean.getExperience());
|
|
|
+
|
|
|
+ mkeyValue = mInitBeforeWorkReportBean.getReportId();
|
|
|
+ mUnfinishedTask = mInitBeforeWorkReportBean.getUnfinishedTask();
|
|
|
+ mFinishedTask = mInitBeforeWorkReportBean.getContext();
|
|
|
+
|
|
|
+ mUpdateDate = mInitBeforeWorkReportBean.getDate();
|
|
|
+ mUpdateWeekdays = mYesterdayWeek;
|
|
|
+ mUpdateStartTime = mInitBeforeWorkReportBean.getStartTime();
|
|
|
+ mUpdateEndTime = mInitBeforeWorkReportBean.getEndTime();
|
|
|
+ } else {
|
|
|
+ mSummaryContentEt.setText("");
|
|
|
+ mNewScheduleContentEt.setText("");
|
|
|
+ mExperienceContentEt.setText("");
|
|
|
+
|
|
|
+ mkeyValue = 0;
|
|
|
+ mUnfinishedTask = "";
|
|
|
+ mFinishedTask = "";
|
|
|
+
|
|
|
+ mUpdateDate = "";
|
|
|
+ mUpdateWeekdays = "";
|
|
|
+ mUpdateStartTime = "";
|
|
|
+ mUpdateEndTime = "";
|
|
|
+ }
|
|
|
} else if (checkedId == R.id.work_report_add_time_present_rb) {
|
|
|
- mNewScheduleLl.setVisibility(View.VISIBLE);
|
|
|
if (mReportType == Constants.WORK_REPORT_DAY) {
|
|
|
mDailyReportDate = mTodayDate;
|
|
|
mDailyReportWeek = mTodayWeek;
|
|
|
@@ -461,6 +508,44 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
mMonthReportEndDate = mThisMonthEndDate;
|
|
|
mReportTimeTv.setText(mThisMonthTime);
|
|
|
}
|
|
|
+
|
|
|
+ if (!TextUtils.isEmpty(mPresentPlan)) {
|
|
|
+ mOldScheduleEmptyTv.setVisibility(View.GONE);
|
|
|
+ mOldScheduleContentTv.setVisibility(View.VISIBLE);
|
|
|
+ mOldScheduleContentTv.setText(mPresentPlan);
|
|
|
+ } else {
|
|
|
+ mOldScheduleEmptyTv.setVisibility(View.VISIBLE);
|
|
|
+ mOldScheduleContentTv.setText("");
|
|
|
+ mOldScheduleContentTv.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isPresentExist) {
|
|
|
+ mSummaryContentEt.setText(mInitPresentWorkReportBean.getComment());
|
|
|
+ mNewScheduleContentEt.setText(mInitPresentWorkReportBean.getPlan());
|
|
|
+ mExperienceContentEt.setText(mInitPresentWorkReportBean.getExperience());
|
|
|
+
|
|
|
+ mkeyValue = mInitPresentWorkReportBean.getReportId();
|
|
|
+ mUnfinishedTask = mInitPresentWorkReportBean.getUnfinishedTask();
|
|
|
+ mFinishedTask = mInitPresentWorkReportBean.getContext();
|
|
|
+
|
|
|
+ mUpdateDate = mInitPresentWorkReportBean.getDate();
|
|
|
+ mUpdateWeekdays = mTodayWeek;
|
|
|
+ mUpdateStartTime = mInitPresentWorkReportBean.getStartTime();
|
|
|
+ mUpdateEndTime = mInitPresentWorkReportBean.getEndTime();
|
|
|
+ } else {
|
|
|
+ mSummaryContentEt.setText("");
|
|
|
+ mNewScheduleContentEt.setText("");
|
|
|
+ mExperienceContentEt.setText("");
|
|
|
+
|
|
|
+ mkeyValue = 0;
|
|
|
+ mUnfinishedTask = "";
|
|
|
+ mFinishedTask = "";
|
|
|
+
|
|
|
+ mUpdateDate = "";
|
|
|
+ mUpdateWeekdays = "";
|
|
|
+ mUpdateStartTime = "";
|
|
|
+ mUpdateEndTime = "";
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -569,6 +654,7 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
mReportTimeRg = (RadioGroup) findViewById(R.id.work_report_add_time_rg);
|
|
|
mReportTimeBeforeRb = (RadioButton) findViewById(R.id.work_report_add_time_before_rb);
|
|
|
mReportTimePresentRb = (RadioButton) findViewById(R.id.work_report_add_time_present_rb);
|
|
|
+ mOldScheduleLl = (LinearLayout) findViewById(R.id.work_report_add_old_schedule_ll);
|
|
|
mOldScheduleTitleTv = (TextView) findViewById(R.id.work_report_add_old_schedule_title_tv);
|
|
|
mOldScheduleEmptyTv = (DrawableCenterTextView) findViewById(R.id.work_report_add_old_schedule_empty_tv);
|
|
|
mOldScheduleContentTv = (TextView) findViewById(R.id.work_report_add_old_schedule_content_tv);
|
|
|
@@ -590,6 +676,8 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
mSubmitButton = (Button) findViewById(R.id.work_report_add_submit_btn);
|
|
|
|
|
|
mHttpClient = new HttpClient.Builder(CommonUtil.getAppBaseUrl(this)).build();
|
|
|
+ mInitPresentWorkReportBean = new WorkReportBean();
|
|
|
+ mInitBeforeWorkReportBean = new WorkReportBean();
|
|
|
|
|
|
if (mReportType == Constants.WORK_REPORT_DAY) {
|
|
|
getSupportActionBar().setTitle(R.string.oaworkdaily_title);
|
|
|
@@ -649,11 +737,32 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
if (dataObject != null) {
|
|
|
mDateLinearLayout.setVisibility(View.VISIBLE);
|
|
|
if (mReportType == Constants.WORK_REPORT_DAY) {
|
|
|
- showDailyReportTime(dataObject);
|
|
|
+ initDailyReport(dataObject);
|
|
|
} else if (mReportType == Constants.WORK_REPORT_WEEK) {
|
|
|
- showWeeklyReportTime(dataObject);
|
|
|
+ initWeeklyReport(dataObject);
|
|
|
} else if (mReportType == Constants.WORK_REPORT_MONTH) {
|
|
|
- showMonthlyReportTime(dataObject);
|
|
|
+ initMonthlyReport(dataObject);
|
|
|
+ }
|
|
|
+ if (mReportTimePresentRb.isChecked()) {
|
|
|
+ if (!TextUtils.isEmpty(mPresentPlan)) {
|
|
|
+ mOldScheduleEmptyTv.setVisibility(View.GONE);
|
|
|
+ mOldScheduleContentTv.setVisibility(View.VISIBLE);
|
|
|
+ mOldScheduleContentTv.setText(mPresentPlan);
|
|
|
+ } else {
|
|
|
+ mOldScheduleEmptyTv.setVisibility(View.VISIBLE);
|
|
|
+ mOldScheduleContentTv.setText("");
|
|
|
+ mOldScheduleContentTv.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+ } else if (mReportTimeBeforeRb.isChecked()) {
|
|
|
+ if (!TextUtils.isEmpty(mBeforePlan)) {
|
|
|
+ mOldScheduleEmptyTv.setVisibility(View.GONE);
|
|
|
+ mOldScheduleContentTv.setVisibility(View.VISIBLE);
|
|
|
+ mOldScheduleContentTv.setText(mBeforePlan);
|
|
|
+ } else {
|
|
|
+ mOldScheduleEmptyTv.setVisibility(View.VISIBLE);
|
|
|
+ mOldScheduleContentTv.setText("");
|
|
|
+ mOldScheduleContentTv.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
progressDialog.dismiss();
|
|
|
@@ -661,6 +770,80 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
ToastUtil.showToast(WorkReportAddActivity.this, "工作汇报初始数据获取异常");
|
|
|
// TODO: 2017/10/19 初始数据获取异常时的处理
|
|
|
}
|
|
|
+ JSONArray todayDataArray = resultObject.getJSONArray("todayData");
|
|
|
+ JSONArray yesterdayDataArray = resultObject.getJSONArray("YesterdayData");
|
|
|
+ com.alibaba.fastjson.JSONObject todayDataObject = null;
|
|
|
+ com.alibaba.fastjson.JSONObject yesterdayDataObject = null;
|
|
|
+ if (todayDataArray != null && todayDataArray.size() != 0) {
|
|
|
+ todayDataObject = todayDataArray.getJSONObject(0);
|
|
|
+ }
|
|
|
+ if (yesterdayDataArray != null && yesterdayDataArray.size() != 0) {
|
|
|
+ yesterdayDataObject = yesterdayDataArray.getJSONObject(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (mReportType == Constants.WORK_REPORT_DAY) {
|
|
|
+ if (todayDataObject != null) {
|
|
|
+ initDailyReport(mInitPresentWorkReportBean, todayDataObject);
|
|
|
+ }
|
|
|
+ if (yesterdayDataObject != null) {
|
|
|
+ initDailyReport(mInitBeforeWorkReportBean, yesterdayDataObject);
|
|
|
+ }
|
|
|
+ } else if (mReportType == Constants.WORK_REPORT_WEEK) {
|
|
|
+ if (todayDataObject != null) {
|
|
|
+ initWeeklyReport(mInitPresentWorkReportBean, todayDataObject);
|
|
|
+ }
|
|
|
+ if (yesterdayDataObject != null) {
|
|
|
+ initWeeklyReport(mInitBeforeWorkReportBean, yesterdayDataObject);
|
|
|
+ }
|
|
|
+ } else if (mReportType == Constants.WORK_REPORT_MONTH) {
|
|
|
+ if (todayDataObject != null) {
|
|
|
+ initMonthlyReport(mInitPresentWorkReportBean, todayDataObject);
|
|
|
+ }
|
|
|
+ if (yesterdayDataObject != null) {
|
|
|
+ initMonthlyReport(mInitBeforeWorkReportBean, yesterdayDataObject);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ("在录入".equals(mInitPresentWorkReportBean.getReportStatus())) {
|
|
|
+ isPresentExist = true;
|
|
|
+ } else {
|
|
|
+ isPresentExist = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("在录入".equals(mInitBeforeWorkReportBean.getReportStatus())) {
|
|
|
+ isBeforeExist = true;
|
|
|
+ } else {
|
|
|
+ isBeforeExist = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (mReportTimePresentRb.isChecked() && isPresentExist) {
|
|
|
+ mSummaryContentEt.setText(mInitPresentWorkReportBean.getComment());
|
|
|
+ mNewScheduleContentEt.setText(mInitPresentWorkReportBean.getPlan());
|
|
|
+ mExperienceContentEt.setText(mInitPresentWorkReportBean.getExperience());
|
|
|
+
|
|
|
+ mkeyValue = mInitPresentWorkReportBean.getReportId();
|
|
|
+ mUnfinishedTask = mInitPresentWorkReportBean.getUnfinishedTask();
|
|
|
+ mFinishedTask = mInitPresentWorkReportBean.getContext();
|
|
|
+
|
|
|
+ mUpdateDate = mInitPresentWorkReportBean.getDate();
|
|
|
+ mUpdateWeekdays = mTodayWeek;
|
|
|
+ mUpdateStartTime = mInitPresentWorkReportBean.getStartTime();
|
|
|
+ mUpdateEndTime = mInitPresentWorkReportBean.getEndTime();
|
|
|
+ }
|
|
|
+ if (mReportTimeBeforeRb.isChecked() && isBeforeExist) {
|
|
|
+ mSummaryContentEt.setText(mInitBeforeWorkReportBean.getComment());
|
|
|
+ mNewScheduleContentEt.setText(mInitBeforeWorkReportBean.getPlan());
|
|
|
+ mExperienceContentEt.setText(mInitBeforeWorkReportBean.getExperience());
|
|
|
+
|
|
|
+ mkeyValue = mInitBeforeWorkReportBean.getReportId();
|
|
|
+ mUnfinishedTask = mInitBeforeWorkReportBean.getUnfinishedTask();
|
|
|
+ mFinishedTask = mInitBeforeWorkReportBean.getContext();
|
|
|
+
|
|
|
+ mUpdateDate = mInitBeforeWorkReportBean.getDate();
|
|
|
+ mUpdateWeekdays = mYesterdayWeek;
|
|
|
+ mUpdateStartTime = mInitBeforeWorkReportBean.getStartTime();
|
|
|
+ mUpdateEndTime = mInitBeforeWorkReportBean.getEndTime();
|
|
|
+ }
|
|
|
+
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
progressDialog.dismiss();
|
|
|
@@ -679,7 +862,79 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
}));
|
|
|
}
|
|
|
|
|
|
- private void showMonthlyReportTime(com.alibaba.fastjson.JSONObject dataObject) {
|
|
|
+ private void initMonthlyReport(WorkReportBean workReportBean, com.alibaba.fastjson.JSONObject initDataObject) {
|
|
|
+ workReportBean.setReportId(JSONUtil.getInt(initDataObject, "WM_ID"));
|
|
|
+ workReportBean.setEmp(JSONUtil.getText(initDataObject, "WM_EMP"));
|
|
|
+ workReportBean.setDate(JSONUtil.getText(initDataObject, "WM_DATE"));
|
|
|
+ workReportBean.setComment(JSONUtil.getText(initDataObject, "WM_COMMENT"));
|
|
|
+ workReportBean.setDepart(JSONUtil.getText(initDataObject, "WM_DEPART"));
|
|
|
+ workReportBean.setJoname(JSONUtil.getText(initDataObject, "WM_JONAME"));
|
|
|
+ workReportBean.setPlan(JSONUtil.getText(initDataObject, "WM_PLAN"));
|
|
|
+ workReportBean.setExperience(JSONUtil.getText(initDataObject, "WM_EXPERIENCE"));
|
|
|
+ workReportBean.setContext(JSONUtil.getText(initDataObject, "WM_CONTEXT"));
|
|
|
+ workReportBean.setApprovalStatus(JSONUtil.getText(initDataObject, "STATUS"));
|
|
|
+ workReportBean.setReportStatus(JSONUtil.getText(initDataObject, "WM_STATUS"));
|
|
|
+ workReportBean.setUnfinishedTask(JSONUtil.getText(initDataObject, "WM_UNFINISHEDTASK"));
|
|
|
+ workReportBean.setSerial(JSONUtil.getText(initDataObject, "WM_MONTH"));
|
|
|
+ workReportBean.setStartTime(JSONUtil.getText(initDataObject, "WM_STARTTIME"));
|
|
|
+ workReportBean.setEndTime(JSONUtil.getText(initDataObject, "WM_ENDTIME"));
|
|
|
+ workReportBean.setRN(JSONUtil.getInt(initDataObject, "RN"));
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initWeeklyReport(WorkReportBean workReportBean, com.alibaba.fastjson.JSONObject initDataObject) {
|
|
|
+ workReportBean.setReportId(JSONUtil.getInt(initDataObject, "WW_ID"));
|
|
|
+ workReportBean.setEmp(JSONUtil.getText(initDataObject, "WW_EMP"));
|
|
|
+ workReportBean.setDate(JSONUtil.getText(initDataObject, "WW_DATE"));
|
|
|
+ workReportBean.setComment(JSONUtil.getText(initDataObject, "WW_COMMENT"));
|
|
|
+ workReportBean.setDepart(JSONUtil.getText(initDataObject, "WW_DEPART"));
|
|
|
+ workReportBean.setJoname(JSONUtil.getText(initDataObject, "WW_JONAME"));
|
|
|
+ workReportBean.setPlan(JSONUtil.getText(initDataObject, "WW_PLAN"));
|
|
|
+ workReportBean.setExperience(JSONUtil.getText(initDataObject, "WW_EXPERIENCE"));
|
|
|
+ workReportBean.setContext(JSONUtil.getText(initDataObject, "WW_CONTEXT"));
|
|
|
+ workReportBean.setApprovalStatus(JSONUtil.getText(initDataObject, "STATUS"));
|
|
|
+ workReportBean.setReportStatus(JSONUtil.getText(initDataObject, "WW_STATUS"));
|
|
|
+ workReportBean.setUnfinishedTask(JSONUtil.getText(initDataObject, "WW_UNFINISHEDTASK"));
|
|
|
+ workReportBean.setSerial(JSONUtil.getText(initDataObject, "WW_WEEK"));
|
|
|
+ workReportBean.setStartTime(JSONUtil.getText(initDataObject, "WW_STARTTIME"));
|
|
|
+ workReportBean.setEndTime(JSONUtil.getText(initDataObject, "WW_ENDTIME"));
|
|
|
+ workReportBean.setRN(JSONUtil.getInt(initDataObject, "RN"));
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initDailyReport(WorkReportBean workReportBean, com.alibaba.fastjson.JSONObject initDataObject) {
|
|
|
+ workReportBean.setReportId(JSONUtil.getInt(initDataObject, "WD_ID"));
|
|
|
+ workReportBean.setEmp(JSONUtil.getText(initDataObject, "WD_EMP"));
|
|
|
+ workReportBean.setDate(JSONUtil.getText(initDataObject, "WD_DATE"));
|
|
|
+ workReportBean.setComment(JSONUtil.getText(initDataObject, "WD_COMMENT"));
|
|
|
+ workReportBean.setDepart(JSONUtil.getText(initDataObject, "WD_DEPART"));
|
|
|
+ workReportBean.setJoname(JSONUtil.getText(initDataObject, "WD_JONAME"));
|
|
|
+ workReportBean.setPlan(JSONUtil.getText(initDataObject, "WD_PLAN"));
|
|
|
+ workReportBean.setExperience(JSONUtil.getText(initDataObject, "WD_EXPERIENCE"));
|
|
|
+ workReportBean.setContext(JSONUtil.getText(initDataObject, "WD_CONTEXT"));
|
|
|
+ workReportBean.setApprovalStatus(JSONUtil.getText(initDataObject, "STATUS"));
|
|
|
+ workReportBean.setReportStatus(JSONUtil.getText(initDataObject, "WD_STATUS"));
|
|
|
+ workReportBean.setUnfinishedTask(JSONUtil.getText(initDataObject, "WD_UNFINISHEDTASK"));
|
|
|
+ String wd_weekdays = JSONUtil.getText(initDataObject, "WD_WEEKDAYS");
|
|
|
+ if (wd_weekdays != null && "monday".equals(wd_weekdays.trim())) {
|
|
|
+ wd_weekdays = "星期一";
|
|
|
+ } else if (wd_weekdays != null && "tuesday".equals(wd_weekdays.trim())) {
|
|
|
+ wd_weekdays = "星期二";
|
|
|
+ } else if (wd_weekdays != null && "wednesday".equals(wd_weekdays.trim())) {
|
|
|
+ wd_weekdays = "星期三";
|
|
|
+ } else if (wd_weekdays != null && "thursday".equals(wd_weekdays.trim())) {
|
|
|
+ wd_weekdays = "星期四";
|
|
|
+ } else if (wd_weekdays != null && "friday".equals(wd_weekdays.trim())) {
|
|
|
+ wd_weekdays = "星期五";
|
|
|
+ } else if (wd_weekdays != null && "saturday".equals(wd_weekdays.trim())) {
|
|
|
+ wd_weekdays = "星期六";
|
|
|
+ } else if (wd_weekdays != null && "sunday".equals(wd_weekdays.trim())) {
|
|
|
+ wd_weekdays = "星期日";
|
|
|
+ }
|
|
|
+ workReportBean.setWeekDays(wd_weekdays);
|
|
|
+ workReportBean.setEntryDate(JSONUtil.getText(initDataObject, "WD_ENTRYDATE"));
|
|
|
+ workReportBean.setRN(JSONUtil.getInt(initDataObject, "RN"));
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initMonthlyReport(com.alibaba.fastjson.JSONObject dataObject) {
|
|
|
mThisMonthStartDate = JSONUtil.getText(dataObject, "wm_starttime");
|
|
|
mThisMonthEndDate = JSONUtil.getText(dataObject, "wm_endtime");
|
|
|
mLastMonthStartDate = JSONUtil.getText(dataObject, "wm_starttimeOld");
|
|
|
@@ -687,6 +942,9 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
mThisMonthSerial = JSONUtil.getText(dataObject, "wm_month");
|
|
|
mLastMonthSerial = JSONUtil.getText(dataObject, "wm_monthOld");
|
|
|
|
|
|
+ mPresentPlan = JSONUtil.getText(dataObject, "wm_plan");
|
|
|
+ mBeforePlan = JSONUtil.getText(dataObject, "wm_planOld");
|
|
|
+
|
|
|
mThisMonthTime = getMonthlyTimeStr(mThisMonthStartDate);
|
|
|
mLastMonthTime = getMonthlyTimeStr(mLastMonthStartDate);
|
|
|
|
|
|
@@ -717,7 +975,7 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void showWeeklyReportTime(com.alibaba.fastjson.JSONObject dataObject) {
|
|
|
+ private void initWeeklyReport(com.alibaba.fastjson.JSONObject dataObject) {
|
|
|
mThisWeekStartDate = JSONUtil.getText(dataObject, "ww_starttime");
|
|
|
mThisWeekEndDate = JSONUtil.getText(dataObject, "ww_endtime");
|
|
|
mLastWeekStartDate = JSONUtil.getText(dataObject, "ww_starttimeOld");
|
|
|
@@ -725,6 +983,9 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
mThisWeekSerial = JSONUtil.getText(dataObject, "ww_week");
|
|
|
mLastWeekSerial = JSONUtil.getText(dataObject, "ww_weekOld");
|
|
|
|
|
|
+ mPresentPlan = JSONUtil.getText(dataObject, "ww_plan");
|
|
|
+ mBeforePlan = JSONUtil.getText(dataObject, "ww_planOld");
|
|
|
+
|
|
|
mThisWeekTime = getWeeklyTimeStr(mThisWeekStartDate, mThisWeekEndDate);
|
|
|
mLastWeekTime = getWeeklyTimeStr(mLastWeekStartDate, mLastWeekEndDate);
|
|
|
|
|
|
@@ -759,12 +1020,15 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void showDailyReportTime(com.alibaba.fastjson.JSONObject dataObject) {
|
|
|
+ private void initDailyReport(com.alibaba.fastjson.JSONObject dataObject) {
|
|
|
mTodayDate = JSONUtil.getText(dataObject, "wd_date");
|
|
|
mYesterdayDate = JSONUtil.getText(dataObject, "wd_dateOld");
|
|
|
mTodayWeek = JSONUtil.getText(dataObject, "wd_weekDays");
|
|
|
mYesterdayWeek = JSONUtil.getText(dataObject, "wd_weekDaysOld");
|
|
|
|
|
|
+ mPresentPlan = JSONUtil.getText(dataObject, "wd_plan");
|
|
|
+ mBeforePlan = JSONUtil.getText(dataObject, "wd_planOld");
|
|
|
+
|
|
|
mTodayTime = getDailyTimeStr(mTodayDate, mTodayWeek);
|
|
|
mYesterdayTime = getDailyTimeStr(mYesterdayDate, mYesterdayWeek);
|
|
|
|
|
|
@@ -866,7 +1130,8 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
//执行重新提交之更改单据状态操作
|
|
|
boolean isResubmit = (!TextUtils.isEmpty(resubmit) && resubmit.equals("resubmit") && mkeyValue != 0) ||
|
|
|
(!TextUtils.isEmpty(resubmit) && resubmit.equals("unsub_tosub") && mkeyValue != 0);
|
|
|
- if (isResubmit) {
|
|
|
+ if (isResubmit || (mReportTimePresentRb.isChecked() && isPresentExist)
|
|
|
+ || (mReportTimeBeforeRb.isChecked() && isBeforeExist)) {
|
|
|
isOnlyUpdate = false;
|
|
|
updateWorkReport();
|
|
|
} else {
|
|
|
@@ -980,13 +1245,17 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
if (mReportType == Constants.WORK_REPORT_DAY) {
|
|
|
formStoreMap.put("wd_empcode", CommonUtil.getSharedPreferences(ct, "erp_username"));
|
|
|
formStoreMap.put("wd_comment", mSummaryText);
|
|
|
- formStoreMap.put("wd_plan", mNewScheduleText);
|
|
|
+ if (mNewScheduleLl.getVisibility() == View.VISIBLE) {
|
|
|
+ formStoreMap.put("wd_plan", mNewScheduleText);
|
|
|
+ }
|
|
|
formStoreMap.put("wd_experience", mExperienceText);
|
|
|
formStoreMap.put("wd_date", isResubmit ? mUpdateDate : mDailyReportDate);
|
|
|
} else if (mReportType == Constants.WORK_REPORT_WEEK) {
|
|
|
formStoreMap.put("ww_empcode", CommonUtil.getSharedPreferences(ct, "erp_username"));
|
|
|
formStoreMap.put("ww_comment", mSummaryText);
|
|
|
- formStoreMap.put("ww_plan", mNewScheduleText);
|
|
|
+ if (mNewScheduleLl.getVisibility() == View.VISIBLE) {
|
|
|
+ formStoreMap.put("ww_plan", mNewScheduleText);
|
|
|
+ }
|
|
|
formStoreMap.put("ww_experience", mExperienceText);
|
|
|
formStoreMap.put("ww_week", isResubmit ? mUpdateSerial : mWeekReportSerial);
|
|
|
formStoreMap.put("ww_starttime", isResubmit ? mUpdateStartTime : mWeekReportStartDate);
|
|
|
@@ -994,7 +1263,9 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
} else if (mReportType == Constants.WORK_REPORT_MONTH) {
|
|
|
formStoreMap.put("wm_empcode", CommonUtil.getSharedPreferences(ct, "erp_username"));
|
|
|
formStoreMap.put("wm_comment", mSummaryText);
|
|
|
- formStoreMap.put("wm_plan", mNewScheduleText);
|
|
|
+ if (mNewScheduleLl.getVisibility() == View.VISIBLE) {
|
|
|
+ formStoreMap.put("wm_plan", mNewScheduleText);
|
|
|
+ }
|
|
|
formStoreMap.put("wm_experience", mExperienceText);
|
|
|
formStoreMap.put("wm_month", isResubmit ? mUpdateSerial : mMonthReportSerial);
|
|
|
formStoreMap.put("wm_starttime", isResubmit ? mUpdateStartTime : mMonthReportStartDate);
|
|
|
@@ -1024,24 +1295,25 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
@Override
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
if (item.getItemId() == R.id.push) {
|
|
|
- startActivity(new Intent(activity, WorkDailyShowActivity.class)
|
|
|
- .putExtra("fromwhere", "nosubmitdaily").putExtra("caller", mCaller).putExtra("report_type", mReportType));
|
|
|
+ isOptionEvent = true;
|
|
|
+ leavePressEvent();
|
|
|
}
|
|
|
|
|
|
if (item.getItemId() == android.R.id.home) {
|
|
|
- backPressEvent();
|
|
|
+ leavePressEvent();
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 页面退出事件(是否保存单据为在录入状态)
|
|
|
+ * 页面离开事件(是否保存单据为在录入状态或者更新汇报内容)
|
|
|
*/
|
|
|
- private void backPressEvent() {
|
|
|
- Intent intent = getIntent();
|
|
|
+ private void leavePressEvent() {
|
|
|
+ final Intent intent = getIntent();
|
|
|
fromqzone = intent.getStringExtra("fromqzone");
|
|
|
- boolean isResubmit = !TextUtils.isEmpty(resubmit) && ("unsub_tosub".equals(resubmit) || "resubmit".equals(resubmit));
|
|
|
- if (isResubmit) {
|
|
|
+ final boolean isResubmit = !TextUtils.isEmpty(resubmit) && ("unsub_tosub".equals(resubmit) || "resubmit".equals(resubmit));
|
|
|
+ if (isResubmit || (mReportTimePresentRb.isChecked() && isPresentExist)
|
|
|
+ || (mReportTimeBeforeRb.isChecked() && isBeforeExist)) {
|
|
|
if (isModify) {
|
|
|
new AlertDialog
|
|
|
.Builder(mContext)
|
|
|
@@ -1050,11 +1322,18 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
.setNegativeButton(R.string.give_up, new DialogInterface.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
- Intent intent1 = new Intent(WorkReportAddActivity.this, WorkDailyShowActivity.class);
|
|
|
- intent1.putExtra("caller", mCaller);
|
|
|
- intent1.putExtra("report_type", mReportType);
|
|
|
- startActivity(intent1);
|
|
|
- finish();
|
|
|
+ if (isResubmit || isOptionEvent) {
|
|
|
+ Intent intent1 = new Intent(WorkReportAddActivity.this, WorkDailyShowActivity.class);
|
|
|
+ intent1.putExtra("caller", mCaller);
|
|
|
+ intent1.putExtra("report_type", mReportType);
|
|
|
+ if (isOptionEvent) {
|
|
|
+ intent1.putExtra("fromwhere", "nosubmitdaily");
|
|
|
+ }
|
|
|
+ startActivity(intent1);
|
|
|
+ }
|
|
|
+ if (!isOptionEvent) {
|
|
|
+ finish();
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
.setPositiveButton(R.string.updata, new DialogInterface.OnClickListener() {
|
|
|
@@ -1080,9 +1359,14 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
@Override
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
boolean isResubmit = !TextUtils.isEmpty(resubmit) && ("unsub_tosub".equals(resubmit) || "resubmit".equals(resubmit));
|
|
|
- if (isResubmit) {
|
|
|
- startActivity(new Intent(WorkReportAddActivity.this, WorkDailyShowActivity.class)
|
|
|
- .putExtra("caller", mCaller).putExtra("report_type", mReportType));
|
|
|
+ if (isResubmit || isOptionEvent) {
|
|
|
+ Intent optionIntent = new Intent(WorkReportAddActivity.this, WorkDailyShowActivity.class);
|
|
|
+ optionIntent.putExtra("caller", mCaller);
|
|
|
+ optionIntent.putExtra("report_type", mReportType);
|
|
|
+ if (isOptionEvent) {
|
|
|
+ optionIntent.putExtra("fromwhere", "nosubmitdaily");
|
|
|
+ }
|
|
|
+ startActivity(optionIntent);
|
|
|
|
|
|
} else if (!TextUtils.isEmpty(fromqzone) && "fromqzone".equals(fromqzone)) {
|
|
|
|
|
|
@@ -1090,7 +1374,9 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
Intent intent1 = new Intent(WorkReportAddActivity.this, WorkReportMenuActivity.class);
|
|
|
startActivity(intent1);
|
|
|
}
|
|
|
- finish();
|
|
|
+ if (!isOptionEvent) {
|
|
|
+ finish();
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
.setPositiveButton(R.string.save, new DialogInterface.OnClickListener() {
|
|
|
@@ -1121,9 +1407,14 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
Log.d("savetoentry", o.toString());
|
|
|
Toast.makeText(WorkReportAddActivity.this, "保存为在录入状态成功", Toast.LENGTH_SHORT).show();
|
|
|
boolean isResubmit = !TextUtils.isEmpty(resubmit) && ("unsub_tosub".equals(resubmit) || "resubmit".equals(resubmit));
|
|
|
- if (isResubmit) {
|
|
|
- startActivity(new Intent(WorkReportAddActivity.this, WorkDailyShowActivity.class)
|
|
|
- .putExtra("caller", mCaller).putExtra("report_type", mReportType));
|
|
|
+ if (isResubmit || isOptionEvent) {
|
|
|
+ Intent optionIntent = new Intent(WorkReportAddActivity.this, WorkDailyShowActivity.class);
|
|
|
+ optionIntent.putExtra("caller", mCaller);
|
|
|
+ optionIntent.putExtra("report_type", mReportType);
|
|
|
+ if (isOptionEvent) {
|
|
|
+ optionIntent.putExtra("fromwhere", "nosubmitdaily");
|
|
|
+ }
|
|
|
+ startActivity(optionIntent);
|
|
|
|
|
|
} else if (!TextUtils.isEmpty(fromqzone) && "fromqzone".equals(fromqzone)) {
|
|
|
|
|
|
@@ -1131,7 +1422,9 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
Intent intent1 = new Intent(WorkReportAddActivity.this, WorkReportMenuActivity.class);
|
|
|
startActivity(intent1);
|
|
|
}
|
|
|
- finish();
|
|
|
+ if (!isOptionEvent) {
|
|
|
+ finish();
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
progressDialog.dismiss();
|
|
|
ToastUtil.showToast(WorkReportAddActivity.this, getString(R.string.save_to_entry_status_failed));
|
|
|
@@ -1160,16 +1453,21 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
finish();
|
|
|
} else {
|
|
|
Intent intent1 = null;
|
|
|
- if (isResubmit) {
|
|
|
+ if (isResubmit || isOptionEvent) {
|
|
|
intent1 = new Intent(WorkReportAddActivity.this, WorkDailyShowActivity.class);
|
|
|
intent1.putExtra("caller", mCaller);
|
|
|
intent1.putExtra("report_type", mReportType);
|
|
|
+ if (isOptionEvent) {
|
|
|
+ intent1.putExtra("fromwhere", "nosubmitdaily");
|
|
|
+ }
|
|
|
startActivity(intent1);
|
|
|
} else {
|
|
|
intent1 = new Intent(WorkReportAddActivity.this, WorkReportMenuActivity.class);
|
|
|
startActivity(intent1);
|
|
|
}
|
|
|
- finish();
|
|
|
+ if (!isOptionEvent) {
|
|
|
+ finish();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1193,6 +1491,12 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ protected void onResume() {
|
|
|
+ super.onResume();
|
|
|
+ isOptionEvent = false;
|
|
|
+ }
|
|
|
+
|
|
|
private void getEmnameByReturn(String text) {
|
|
|
if (StringUtil.isEmpty(text)) return;
|
|
|
Pattern pattern = Pattern.compile("(?<=\\()(.+?)(?=\\))");
|
|
|
@@ -1260,7 +1564,7 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
intent.putExtra("fromwhere", "submitdaily");
|
|
|
intent.putExtra("Content", mSummaryText);
|
|
|
intent.putExtra("WD_Status", "已提交");
|
|
|
- intent.putExtra("Plan", mExperienceText);
|
|
|
+ intent.putExtra("Plan", mNewScheduleText);
|
|
|
intent.putExtra("Experience", mExperienceText);
|
|
|
intent.putExtra("Donetask", mFinishedTask);
|
|
|
intent.putExtra("Undotask", mUnfinishedTask);
|
|
|
@@ -1288,7 +1592,7 @@ public class WorkReportAddActivity extends BaseActivity implements View.OnClickL
|
|
|
|
|
|
@Override
|
|
|
public void onBackPressed() {
|
|
|
- backPressEvent();
|
|
|
+ leavePressEvent();
|
|
|
}
|
|
|
|
|
|
/**
|