|
@@ -3,6 +3,7 @@ package com.xzjmyk.pm.activity.ui.erp.presenter;
|
|
|
import android.content.Context;
|
|
import android.content.Context;
|
|
|
import android.content.Intent;
|
|
import android.content.Intent;
|
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
|
|
|
+import android.util.Log;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
@@ -157,6 +158,7 @@ public class MissionPresenter implements IMissionPresenter, HttpHandler.OnResult
|
|
|
param.put("param", "[" + StringUtils.mapToJson(params) + "]");
|
|
param.put("param", "[" + StringUtils.mapToJson(params) + "]");
|
|
|
Bundle bundle = new Bundle();
|
|
Bundle bundle = new Bundle();
|
|
|
bundle.putInt("position", position);
|
|
bundle.putInt("position", position);
|
|
|
|
|
+ bundle.putParcelable("data", entity);
|
|
|
HttpHandler.getInstance().loadERPByNet(SAVE_PLAN, "mobile/addOutPlan.action", param, bundle, this);
|
|
HttpHandler.getInstance().loadERPByNet(SAVE_PLAN, "mobile/addOutPlan.action", param, bundle, this);
|
|
|
saveOutAddress(entity);
|
|
saveOutAddress(entity);
|
|
|
}
|
|
}
|
|
@@ -234,10 +236,26 @@ public class MissionPresenter implements IMissionPresenter, HttpHandler.OnResult
|
|
|
handlerData(array);
|
|
handlerData(array);
|
|
|
break;
|
|
break;
|
|
|
case SAVE_PLAN:
|
|
case SAVE_PLAN:
|
|
|
- //TODO 保存成功后将对象添加到数据库中 并更新任务
|
|
|
|
|
- Intent intent = new Intent();
|
|
|
|
|
- intent.setAction(AutoErpService.INIT_MISSION_TASK);
|
|
|
|
|
- MyApplication.getInstance().sendBroadcast(intent);
|
|
|
|
|
|
|
+ if (isJSON && JSON.parseObject(message).getBoolean("success")) {
|
|
|
|
|
+ int mpd_id = JSON.parseObject(message).getIntValue("mpd_id");
|
|
|
|
|
+ MissionModel entity = bundle.getParcelable("data");
|
|
|
|
|
+ Log.i("gongpengming", "SAVE_PLAN");
|
|
|
|
|
+ if (mpd_id != 0 && entity != null) {//保存数据库
|
|
|
|
|
+ entity.setId(mpd_id);
|
|
|
|
|
+ Log.i("gongpengming", "entity != null");
|
|
|
|
|
+ boolean saveOk = MissionDao.getInstance().updataOrCreate(entity);
|
|
|
|
|
+ Log.i("gongpengming", "saveOk=" + saveOk);
|
|
|
|
|
+ if (saveOk) {
|
|
|
|
|
+ Intent intent = new Intent();
|
|
|
|
|
+ intent.setAction(AutoErpService.SAVE_MISSION_ACTION);
|
|
|
|
|
+ MyApplication.getInstance().sendBroadcast(intent);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+// //TODO 保存成功后将对象添加到数据库中 并更新任务
|
|
|
|
|
+// Intent intent = new Intent();
|
|
|
|
|
+// intent.setAction(AutoErpService.INIT_MISSION_TASK);
|
|
|
|
|
+// MyApplication.getInstance().sendBroadcast(intent);
|
|
|
if (iMission != null) iMission.dimssLoading();
|
|
if (iMission != null) iMission.dimssLoading();
|
|
|
int position = bundle.getInt("position", -1);//成功保存第几个目标
|
|
int position = bundle.getInt("position", -1);//成功保存第几个目标
|
|
|
if (iMission != null) iMission.showToast("保存成功", R.color.load_submit);
|
|
if (iMission != null) iMission.showToast("保存成功", R.color.load_submit);
|