|
|
@@ -302,7 +302,7 @@ public class AutoErpService extends Service {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
private void reckonWork() {
|
|
|
- if (BaseConfig.isDebug()) return;
|
|
|
+ if (!BaseConfig.isDebug()) return;
|
|
|
if (System.currentTimeMillis() - updateTime < 30000) {
|
|
|
return;
|
|
|
}
|
|
|
@@ -466,6 +466,7 @@ public class AutoErpService extends Service {
|
|
|
MyApplication.getInstance().getBdLocationHelper().requestLocation();
|
|
|
}
|
|
|
if (missionIter == 0 || missionIter == MISSION_ITER) {
|
|
|
+ log("missionIter == 0 || missionIter == MISSION_ITER");
|
|
|
CommonUtil.saveAutoLogtoLocal(getString(R.string.app_monitor_log), getString(R.string.app_outplan_running));
|
|
|
missionIter = 0;
|
|
|
List<MissionModel> plans = MissionDao.getInstance().queryByEnCode();
|
|
|
@@ -477,19 +478,27 @@ public class AutoErpService extends Service {
|
|
|
//判断是否自动外勤
|
|
|
boolean isB2b = ApiUtils.getApiModel() instanceof ApiPlatform;
|
|
|
boolean isAuto = isB2b || getBoolean(AppConfig.AUTO_MISSION, false);
|
|
|
+ log("isAuto=" + isAuto);
|
|
|
if (isAuto) {
|
|
|
MissionModel mission = getReckonAutoUtil().reckonMission(plans);//判断
|
|
|
if (mission != null) {
|
|
|
+ log("mission != null=" + isAuto);
|
|
|
log("符合外勤签到");
|
|
|
if (mission.getStatus() == 2) {
|
|
|
missionIter = -1;
|
|
|
}
|
|
|
- Message message = handler.obtainMessage();
|
|
|
- message.what = STATUS_MISSION;
|
|
|
- Bundle bundle = new Bundle();
|
|
|
- bundle.putParcelable("data", mission);
|
|
|
- message.setData(bundle);
|
|
|
- handler.sendMessage(message);
|
|
|
+ OAHttpHelper.getInstance().post(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ signinUitl.signinMission(mission);
|
|
|
+ }
|
|
|
+ });
|
|
|
+// Message message = handler.obtainMessage();
|
|
|
+// message.what = STATUS_MISSION;
|
|
|
+// Bundle bundle = new Bundle();
|
|
|
+// bundle.putParcelable("data", mission);
|
|
|
+// message.setData(bundle);
|
|
|
+// handler.sendMessage(message);
|
|
|
} else {
|
|
|
CommonUtil.saveAutoLogtoLocal(getString(R.string.auto_outplan_failed), "距离太远");
|
|
|
}
|
|
|
@@ -531,19 +540,26 @@ public class AutoErpService extends Service {
|
|
|
}
|
|
|
|
|
|
private void init() throws Exception {
|
|
|
- try {
|
|
|
- MyApplication.getInstance().getBdLocationHelper().requestLocation();
|
|
|
- } catch (Exception e) {
|
|
|
- }
|
|
|
+ MyApplication.getInstance().getBdLocationHelper().requestLocation();
|
|
|
if (dnoticeUtil == null)
|
|
|
dnoticeUtil = new DepositNoticeUtil();
|
|
|
if (signinUitl == null)
|
|
|
signinUitl = new AutoErpSigninUitl();
|
|
|
//TODO 这个接口没有用 先关闭
|
|
|
// signinUitl.loadIsCompany();
|
|
|
- initWork();
|
|
|
- initMission();
|
|
|
- initDNotice();
|
|
|
+// initWork();
|
|
|
+ OAHttpHelper.getInstance().postDelayed(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ try {
|
|
|
+ initMission();
|
|
|
+ initDNotice();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, 5000);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|