|
|
@@ -47,10 +47,13 @@ import com.nostra13.universalimageloader.core.ImageLoader;
|
|
|
import com.xzjmyk.pm.activity.AppConstant;
|
|
|
import com.xzjmyk.pm.activity.MyApplication;
|
|
|
import com.xzjmyk.pm.activity.R;
|
|
|
+import com.xzjmyk.pm.activity.bean.oa.CommonDocAMBean;
|
|
|
import com.xzjmyk.pm.activity.bean.oa.CostBean;
|
|
|
import com.xzjmyk.pm.activity.bean.oa.CostSingleBean;
|
|
|
+import com.xzjmyk.pm.activity.bean.oa.CostUpdatePModel;
|
|
|
import com.xzjmyk.pm.activity.bean.oa.SaveCostDetailsGridStoreBean;
|
|
|
import com.xzjmyk.pm.activity.bean.oa.SelectBean;
|
|
|
+import com.xzjmyk.pm.activity.bean.oa.UpdateCostDetailsGridStoreBean;
|
|
|
import com.xzjmyk.pm.activity.ui.base.BaseActivity;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.activity.CommonDocDetailsActivity;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.activity.form.FormListSelectActivity;
|
|
|
@@ -141,9 +144,10 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
private List<CostBean.DataBean.FormdetailBean> mFormconfigsBean;
|
|
|
private List<CostBean.DataBean.GridetailBean> mGridconfigsBean;
|
|
|
|
|
|
- private CostBean m2CostBean;
|
|
|
- private List<CostBean.DataBean.FormdetailBean> m2FormconfigsBean;
|
|
|
- private List<CostBean.DataBean.GridetailBean> m2GridconfigsBean;
|
|
|
+ private CommonDocAMBean mCommonDocAMBean;
|
|
|
+ private List<CommonDocAMBean.DatasBean.FormconfigsBean> mFormconfigsList;
|
|
|
+ private List<CommonDocAMBean.DatasBean.GridconfigsBean> mGridconfigsList;
|
|
|
+
|
|
|
private AddCostBean mAddCostBean;
|
|
|
private List<AddCostBean> mAddCost_list; // popwindow要展示的消费明细类型
|
|
|
|
|
|
@@ -155,6 +159,7 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
private int keyValue;
|
|
|
private int formid; //重新提交带过来的id
|
|
|
|
|
|
+
|
|
|
private Handler erhandler = new Handler(){
|
|
|
@Override
|
|
|
public void handleMessage(Message msg) {
|
|
|
@@ -191,8 +196,9 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
//{"fp_id": 38366,"success": true,"fpd_id": [[28859,1]]}
|
|
|
keyValue = JSON.parseObject(result).getIntValue("fp_id");
|
|
|
sendPicture();
|
|
|
+// commitSuccess(keyValue);
|
|
|
//TODO 测试接口返回数据
|
|
|
- getUpdateData(keyValue);
|
|
|
+// getUpdateData(keyValue);
|
|
|
}
|
|
|
LogUtil.prinlnLongMsg("0x05result",result);
|
|
|
break;
|
|
|
@@ -207,7 +213,7 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
if (!StringUtils.isEmpty(result)){
|
|
|
Log.i("0x07result", result);
|
|
|
progressDialog.dismiss();
|
|
|
- Toast.makeText(ct,getString(R.string.fangkui_success),Toast.LENGTH_LONG).show();
|
|
|
+ Toast.makeText(ct,"发票提交成功",Toast.LENGTH_LONG).show();
|
|
|
new Handler().postDelayed(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
@@ -217,14 +223,43 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
}
|
|
|
break;
|
|
|
case 0x08:
|
|
|
- if (!StringUtils.isEmpty(result)) {
|
|
|
- JSONObject resultJsonObject = JSON.parseObject(result);
|
|
|
- cb_id = resultJsonObject.getInteger("id");
|
|
|
- for (int i = 0; i < mPhotoList.size(); i++) {
|
|
|
- String path = mPhotoList.get(i);
|
|
|
- sendPictureRequest(path);
|
|
|
+ if (!StringUtils.isEmpty(result)){
|
|
|
+ Log.i("0x08result", result);
|
|
|
+ keyValue = formid;
|
|
|
+ sendPicture();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 0x09:
|
|
|
+ if (!StringUtils.isEmpty(result)){
|
|
|
+ Log.i("0x09result", result);
|
|
|
+ costFormModel_list.remove(cd_table_position);
|
|
|
+ if (costFormModel_list.size() == 0){
|
|
|
+ detail_table_ll.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+ dtAdapter.notifyDataSetChanged();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 0x10:
|
|
|
+ if (!StringUtils.isEmpty(result)){
|
|
|
+ Log.i("0x10result", result);
|
|
|
+ try {
|
|
|
+ JSONObject resultObject = JSON.parseObject(result);
|
|
|
+ if (resultObject != null){
|
|
|
+ CostUpdatePModel mCostUpdatePModel = new CostUpdatePModel();
|
|
|
+ mCostUpdatePModel = JSON.parseObject(JSON.toJSONString(resultObject),CostUpdatePModel.class);
|
|
|
+ doShowUpP(mCostUpdatePModel);
|
|
|
+ }
|
|
|
+ } catch (JSONException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
- Log.i("0x08result", result + "");
|
|
|
+
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 0x11:
|
|
|
+ if (!StringUtils.isEmpty(result)){
|
|
|
+ Log.i("0x11result", result);
|
|
|
}
|
|
|
break;
|
|
|
case Constants.APP_SOCKETIMEOUTEXCEPTION:
|
|
|
@@ -234,11 +269,41 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
} else {
|
|
|
ToastMessage(result);
|
|
|
}
|
|
|
+ progressDialog.dismiss();
|
|
|
+ btn_save.setEnabled(true);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ private void doShowUpP(CostUpdatePModel mCostUpdatePModel) {
|
|
|
+
|
|
|
+ if (ListUtils.isEmpty(mCostUpdatePModel.getFiles())) return;
|
|
|
+ if (!ListUtils.isEmpty(mPhotoList)) mPhotoList.clear();
|
|
|
+ for (int i = 0; i < mCostUpdatePModel.getFiles().size(); i++) {
|
|
|
+ mPhotoList.add(mCostUpdatePModel.getFiles().get(i).getFp_path());
|
|
|
+ }
|
|
|
+
|
|
|
+ mAdapter.setCUPmodel(mCostUpdatePModel);
|
|
|
+ mAdapter.notifyDataSetChanged();
|
|
|
+ Log.i("mPhotoList_update",JSON.toJSONString(mPhotoList));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void getPictUrl(List<String> pathlist) {
|
|
|
+ Log.i("pathlist",JSON.toJSONString(pathlist));
|
|
|
+ for (int i = 0; i < pathlist.size(); i++) {
|
|
|
+ String url = Constants.getAppBaseUrl(getApplicationContext()) + "common/download.action";
|
|
|
+ Map<String,Object> params = new HashMap<>();
|
|
|
+ params.put("path",pathlist.get(i));
|
|
|
+ LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
|
|
|
+ headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
|
+ ViewUtil.httpSendRequest(ct, url, params, erhandler, headers, 0x11, null, null, "get");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private int cd_table_position;
|
|
|
+ private String fb_attach;
|
|
|
|
|
|
|
|
|
@Override
|
|
|
@@ -247,7 +312,7 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
setContentView(R.layout.activity_expense_reimbursement);
|
|
|
ViewUtils.inject(this);
|
|
|
initView();
|
|
|
- initTypeAndMoneyData();
|
|
|
+// initTypeAndMoneyData(); //TODO 获取该表单相关字段,只做查阅作用,看完了关掉不请求
|
|
|
getTypeAndMoneyData(); //获取报销类型、币种数据
|
|
|
getCostDetailsData(); //获取新增要展示明细列表数据源
|
|
|
initPicturesEvent(); //添加发票事件
|
|
|
@@ -287,15 +352,39 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
|
|
|
mAddCostBean = new AddCostBean();
|
|
|
mAddCost_list = new ArrayList<>();
|
|
|
+ //消费明细表格适配器
|
|
|
|
|
|
+ dtAdapter = new DetailsTableAdapter();
|
|
|
+ table_details_list.setAdapter(dtAdapter);
|
|
|
+
|
|
|
+ mFormconfigsList = new ArrayList<>();
|
|
|
+ mGridconfigsList = new ArrayList<>();
|
|
|
Intent intent = getIntent();
|
|
|
formid = 0;
|
|
|
formid = intent.getIntExtra("id", 0);
|
|
|
if (formid != 0){
|
|
|
- getUpdateData(formid);
|
|
|
+ getUpdateData(formid); // 获取单据数据
|
|
|
+ btn_save.setText(getString(R.string.common_update_button));
|
|
|
+ Log.i("formid",formid+"if");
|
|
|
+ }else {
|
|
|
+ Log.i("formid",formid+"else");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * //获取发票图片路径接口
|
|
|
+ */
|
|
|
+ private void getUpdatePicture() {
|
|
|
+ String url = Constants.getAppBaseUrl(getApplicationContext()) + "common/getFilePaths.action";
|
|
|
+ Map<String,Object> params = new HashMap<>();
|
|
|
+ params.put("field","fb_attach");
|
|
|
+// params.put("caller",caller);
|
|
|
+ params.put("id",fb_attach);
|
|
|
+ LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
|
|
|
+ headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
|
+ ViewUtil.httpSendRequest(ct, url, params, erhandler, headers, 0x10, null, null, "get");
|
|
|
+
|
|
|
+ }
|
|
|
/**
|
|
|
* 重新提交操作根据id,获取单据内容
|
|
|
* @param id
|
|
|
@@ -303,14 +392,15 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
private void getUpdateData(int id) {
|
|
|
// progressDialog.show();
|
|
|
if (!CommonUtil.isNetWorkConnected(mContext)) {
|
|
|
- ToastMessage("网络未连接!");
|
|
|
+ ToastMessage(getString(R.string.networks_out));
|
|
|
}
|
|
|
- String url = Constants.getAppBaseUrl(ct) + "mobile/getformandgriddetail.action";
|
|
|
-
|
|
|
+// String url = Constants.getAppBaseUrl(ct) + "mobile/getformandgriddetail.action";
|
|
|
+ String url = Constants.getAppBaseUrl(getApplicationContext()) + "mobile/common/getformandgriddata.action";
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
params.put("caller", caller);
|
|
|
- params.put("condition", "1=1");
|
|
|
params.put("id", id);
|
|
|
+// params.put("condition", "1=1");
|
|
|
+// params.put("id", id);Log.i("formid",id+"if");
|
|
|
params.put("sessionId", CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
|
LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
|
|
|
headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
|
@@ -318,7 +408,9 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
}
|
|
|
|
|
|
private void commitSuccess(final int id) {
|
|
|
- ToastMessage("提交成功!");
|
|
|
+ ToastMessage(getString(R.string.submit_success));
|
|
|
+ progressDialog.dismiss();
|
|
|
+ btn_save.setEnabled(true);
|
|
|
erhandler.postDelayed(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
@@ -372,55 +464,50 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
* 更新时录入界面数据的处理初始化
|
|
|
* @param result
|
|
|
*/
|
|
|
+
|
|
|
private void handleUpdateData(String result) {
|
|
|
- m2CostBean = new CostBean();
|
|
|
- m2GridconfigsBean = new ArrayList<>();
|
|
|
- m2FormconfigsBean = new ArrayList<>();
|
|
|
+ mFormconfigsList.clear();
|
|
|
+ mGridconfigsList.clear();
|
|
|
try {
|
|
|
- JSONObject amresultJsonObject = JSON.parseObject(result);
|
|
|
- JSONObject dataObjecty = amresultJsonObject.getJSONObject("data");
|
|
|
- JSONArray formdataArray = dataObjecty.getJSONArray("formdetail");
|
|
|
- JSONArray griddataArray = dataObjecty.getJSONArray("gridetail");
|
|
|
-
|
|
|
- if (formdataArray == null || griddataArray == null) {
|
|
|
- // TODO
|
|
|
- } else {
|
|
|
- m2CostBean = JSON.parseObject(amresultJsonObject.toString(), CostBean.class);
|
|
|
- if (m2CostBean.getData().getFormdetail() != null && m2CostBean.getData().getGridetail() != null) {
|
|
|
- int allFormconfigs_num = m2CostBean.getData().getFormdetail().size();
|
|
|
- for (int i = 0; i < allFormconfigs_num; i++) {
|
|
|
- String fd_caption = m2CostBean.getData().getFormdetail().get(i).getFd_caption();
|
|
|
- String fd_field = m2CostBean.getData().getFormdetail().get(i).getFd_field();
|
|
|
- int mfd_isdefault = m2CostBean.getData().getFormdetail().get(i).getMfd_isdefault();
|
|
|
- if (mfd_isdefault == -1 && fd_caption != null && fd_field != null) {
|
|
|
- m2FormconfigsBean.add(m2CostBean.getData().getFormdetail().get(i));
|
|
|
- }
|
|
|
-
|
|
|
+ JSONObject resultJsonObject =JSON.parseObject(result);
|
|
|
+ JSONObject dataObjecty = resultJsonObject.getJSONObject("datas");
|
|
|
+ JSONArray formdataArray = dataObjecty.getJSONArray("formdata");
|
|
|
+ JSONArray griddataArray = dataObjecty.getJSONArray("griddata");
|
|
|
+ mCommonDocAMBean = JSON.parseObject(resultJsonObject.toString(), CommonDocAMBean.class);
|
|
|
+ if (mCommonDocAMBean.getDatas() == null) return;
|
|
|
+ if (!ListUtils.isEmpty(mCommonDocAMBean.getDatas().getFormdata())
|
|
|
+ && !ListUtils.isEmpty(mCommonDocAMBean.getDatas().getFormconfigs())){
|
|
|
+
|
|
|
+ int allFormconfigs_num = mCommonDocAMBean.getDatas().getFormconfigs().size();
|
|
|
+ for (int i = 0; i < allFormconfigs_num; i++) {
|
|
|
+ String fd_caption = mCommonDocAMBean.getDatas().getFormconfigs().get(i).getFD_CAPTION();
|
|
|
+ String fd_field = mCommonDocAMBean.getDatas().getFormconfigs().get(i).getFD_FIELD();
|
|
|
+ int mfd_isdefault = mCommonDocAMBean.getDatas().getFormconfigs().get(i).getMFD_ISDEFAULT();
|
|
|
+ if (mfd_isdefault == -1 && fd_caption != null && fd_field != null) {
|
|
|
+ mFormconfigsList.add(mCommonDocAMBean.getDatas().getFormconfigs().get(i));
|
|
|
}
|
|
|
- LogUtil.prinlnLongMsg("m2FormconfigsBean", JSON.toJSONString(m2FormconfigsBean));
|
|
|
}
|
|
|
+ doShowFormData(formdataArray,mFormconfigsList);
|
|
|
+ LogUtil.prinlnLongMsg("mFormconfigsList",JSON.toJSONString(mFormconfigsList));
|
|
|
+ LogUtil.prinlnLongMsg("formdataArray",JSON.toJSONString(formdataArray));
|
|
|
|
|
|
- // 获取需要显示的从表单配置数据属性保存到mGridconfigsBean中
|
|
|
- if (m2CostBean.getData().getGridetail() != null && m2CostBean.getData().getGridetail() != null) {
|
|
|
- int allGridconfigs_num = m2CostBean.getData().getGridetail().size();
|
|
|
- for (int i = 0; i < allGridconfigs_num; i++) {
|
|
|
- String dg_caption = m2CostBean.getData().getGridetail().get(i).getDg_caption();
|
|
|
- String dg_field = m2CostBean.getData().getGridetail().get(i).getDg_field();
|
|
|
- int mdg_isdefault = m2CostBean.getData().getGridetail().get(i).getMdg_isdefault();
|
|
|
- if (mdg_isdefault == -1 && dg_caption != null && dg_field != null) {
|
|
|
- m2GridconfigsBean.add(m2CostBean.getData().getGridetail().get(i));
|
|
|
- }
|
|
|
- }
|
|
|
- LogUtil.prinlnLongMsg("m2GridconfigsBean", JSON.toJSONString(m2GridconfigsBean));
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
- new Handler().postDelayed(new Runnable() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- showUpdateData(m2FormconfigsBean,m2GridconfigsBean);
|
|
|
+ if (!ListUtils.isEmpty(mCommonDocAMBean.getDatas().getGriddata())
|
|
|
+ && !ListUtils.isEmpty(mCommonDocAMBean.getDatas().getGridconfigs())){
|
|
|
+ int allGridconfigs_num = mCommonDocAMBean.getDatas().getGridconfigs().size();
|
|
|
+ for (int i = 0; i < allGridconfigs_num; i++) {
|
|
|
+ String dg_caption = mCommonDocAMBean.getDatas().getGridconfigs().get(i).getDG_CAPTION();
|
|
|
+ String dg_field = mCommonDocAMBean.getDatas().getGridconfigs().get(i).getDG_FIELD();
|
|
|
+ int mdg_isdefault = mCommonDocAMBean.getDatas().getGridconfigs().get(i).getMDG_ISDEFAULT();
|
|
|
+ if (mdg_isdefault == -1 && dg_caption != null && dg_field != null) {
|
|
|
+ mGridconfigsList.add(mCommonDocAMBean.getDatas().getGridconfigs().get(i));
|
|
|
+ }
|
|
|
}
|
|
|
- },1000);
|
|
|
+ doShowGridData(griddataArray);
|
|
|
+ LogUtil.prinlnLongMsg("mGridconfigsList", JSON.toJSONString(mGridconfigsList));
|
|
|
+ LogUtil.prinlnLongMsg("griddataArray", JSON.toJSONString(griddataArray));
|
|
|
+ }
|
|
|
}catch (JSONException e){
|
|
|
e.printStackTrace();
|
|
|
} catch (Exception e){
|
|
|
@@ -428,14 +515,102 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void doShowGridData(JSONArray griddataArray) {
|
|
|
+ if (ListUtils.isEmpty(griddataArray)) return;
|
|
|
+ for (int i = 0; i < griddataArray.size(); i++) {
|
|
|
+ costFormModel = new CostFormModel();
|
|
|
+ costFormModel.setCost_type(griddataArray.getJSONObject(i).getString("fpd_d1"));
|
|
|
+ costFormModel.setCost_money(griddataArray.getJSONObject(i).getInteger("fpd_total"));
|
|
|
+ costFormModel.setFpd_id(griddataArray.getJSONObject(i).getInteger("fpd_id"));
|
|
|
+ costFormModel_list.add(costFormModel);
|
|
|
+ if (i == griddataArray.size()-1){
|
|
|
+ dtAdapter.setModels(costFormModel_list);
|
|
|
+ dtAdapter.notifyDataSetChanged();
|
|
|
+ detail_table_ll.setVisibility(View.VISIBLE);
|
|
|
+ doAutoCalculateJudge();
|
|
|
+ LogUtil.prinlnLongMsg("costFormModel_list",JSON.toJSONString(costFormModel_list));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void doShowFormData(JSONArray formdataArray, List<CommonDocAMBean.DatasBean.FormconfigsBean> mFormconfigsList) {
|
|
|
+ if (!ListUtils.isEmpty(mFormconfigsList) && !ListUtils.isEmpty(formdataArray)){
|
|
|
+ fb_attach = formdataArray.getJSONObject(0).getString("fb_attach");
|
|
|
+ if (!StringUtils.isEmpty(fb_attach)) {
|
|
|
+ getUpdatePicture(); //获取发票图片
|
|
|
+ }
|
|
|
+
|
|
|
+ Log.i("fb_attach_ss",fb_attach+"?");
|
|
|
+ for (int i = 0; i < mFormconfigsList.size(); i++) {
|
|
|
+ String key = mFormconfigsList.get(i).getFD_FIELD();
|
|
|
+ if (StringUtils.isEmpty(key)) return;
|
|
|
+ String value = formdataArray.getJSONObject(0).getString(key);
|
|
|
+ if (StringUtils.isEmpty(value)) return;
|
|
|
+ switch (key){
|
|
|
+ case "fp_class":
|
|
|
+ reimbursement_type_fet.setText(value);
|
|
|
+ break;
|
|
|
+ case "fp_v13":
|
|
|
+ reimbursement_currency_fet.setText(value);
|
|
|
+ break;
|
|
|
+ case "fp_pleaseamount":
|
|
|
+ sum_money_tv.setText(value);
|
|
|
+ break;
|
|
|
+ case "fp_v3":
|
|
|
+ reimbursement_title_fet.setText(value);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void showUpdateData(List<CostBean.DataBean.FormdetailBean> m2Form_update, List<CostBean.DataBean.GridetailBean> m2Grid_update) {
|
|
|
LogUtil.prinlnLongMsg("m2Form_update", JSON.toJSONString(m2Form_update));
|
|
|
LogUtil.prinlnLongMsg("m2Grid_update", JSON.toJSONString(m2Grid_update));
|
|
|
+
|
|
|
+ if (!ListUtils.isEmpty(m2Form_update)){
|
|
|
+ for (int i = 0; i < m2Form_update.size(); i++) {
|
|
|
+ if (!StringUtils.isEmpty(m2Form_update.get(i).getFd_field())
|
|
|
+ && !StringUtils.isEmpty(m2Form_update.get(i).getFd_caption())
|
|
|
+ && !StringUtils.isEmpty(m2Form_update.get(i).getFd_value())){
|
|
|
+
|
|
|
+ String key = m2Form_update.get(i).getFd_field();
|
|
|
+ String value = m2Form_update.get(i).getFd_value();
|
|
|
+ switch (key){
|
|
|
+ case "fp_class":
|
|
|
+ reimbursement_type_fet.setText(value);
|
|
|
+ break;
|
|
|
+ case "fp_v13":
|
|
|
+ reimbursement_currency_fet.setText(value);
|
|
|
+ break;
|
|
|
+ case "fp_pleaseamount":
|
|
|
+ sum_money_tv.setText(value);
|
|
|
+ break;
|
|
|
+ case "fp_v3":
|
|
|
+ reimbursement_title_fet.setText(value);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!ListUtils.isEmpty(m2Grid_update)){
|
|
|
+ for (int i = 0; i < m2Grid_update.size(); i++) {
|
|
|
+ if (!StringUtils.isEmpty(m2Grid_update.get(i).getDg_field())
|
|
|
+ && !StringUtils.isEmpty(m2Grid_update.get(i).getDg_caption())
|
|
|
+ && !StringUtils.isEmpty(m2Grid_update.get(i).getDg_type())){
|
|
|
+// costFormModel
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private void handleTypeAndM(String result) {
|
|
|
try {
|
|
|
- JSONObject amresultJsonObject = JSON.parseObject(result);
|
|
|
+ JSONObject amresultJsonObject =JSON.parseObject(result);
|
|
|
JSONObject dataObjecty = amresultJsonObject.getJSONObject("data");
|
|
|
JSONArray formdataArray = dataObjecty.getJSONArray("formdetail");
|
|
|
JSONArray griddataArray = dataObjecty.getJSONArray("gridetail");
|
|
|
@@ -455,7 +630,7 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- LogUtil.prinlnLongMsg("mFormconfigsBean", JSON.toJSONString(mFormconfigsBean));
|
|
|
+ LogUtil.prinlnLongMsg("mFormconfigsBean_eg", JSON.toJSONString(mFormconfigsBean));
|
|
|
}
|
|
|
|
|
|
// 获取需要显示的从表单配置数据属性保存到mGridconfigsBean中
|
|
|
@@ -469,7 +644,7 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
mGridconfigsBean.add(mCostBean.getData().getGridetail().get(i));
|
|
|
}
|
|
|
}
|
|
|
- LogUtil.prinlnLongMsg("mGridconfigsBean", JSON.toJSONString(mGridconfigsBean));
|
|
|
+ LogUtil.prinlnLongMsg("mGridconfigsBean_eg", JSON.toJSONString(mGridconfigsBean));
|
|
|
}
|
|
|
}
|
|
|
}catch (JSONException e){
|
|
|
@@ -683,10 +858,56 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
ToastMessage("请增加消费明细");
|
|
|
return;
|
|
|
}
|
|
|
- doFirstCommit();
|
|
|
+ if (CommonUtil.isNetWorkConnected(ct)){
|
|
|
+ if (formid != 0){
|
|
|
+ doUpdateCommit();
|
|
|
+ }else {
|
|
|
+ doFirstCommit();
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ ToastMessage(getString(R.string.networks_out));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void doUpdateCommit() {
|
|
|
+ progressDialog.show();
|
|
|
+ btn_save.setEnabled(false);
|
|
|
+ String url= Constants.getAppBaseUrl(ct) + "mobile/oa/UpdateSubmitFYBX.action";
|
|
|
+ Map<String, Object> formStoreMap = new HashMap<>();
|
|
|
+ formStoreMap.put("fp_v3", reimbursement_title_fet.getText().toString());
|
|
|
+ formStoreMap.put("fp_class", reimbursement_type_fet.getText().toString());
|
|
|
+ formStoreMap.put("fp_v13", reimbursement_currency_fet.getText().toString());
|
|
|
+ formStoreMap.put("fp_id",formid);
|
|
|
+ String formStore = JSON.toJSONString(formStoreMap);
|
|
|
+
|
|
|
+ List<UpdateCostDetailsGridStoreBean> gridStore_list = new ArrayList<>();
|
|
|
+ UpdateCostDetailsGridStoreBean gridStore_bean;
|
|
|
+ for (int i = 0; i < costFormModel_list.size(); i++) {
|
|
|
+ gridStore_bean = new UpdateCostDetailsGridStoreBean();
|
|
|
+ gridStore_bean.setFpd_d1(costFormModel_list.get(i).getCost_type());
|
|
|
+ gridStore_bean.setFpd_total(costFormModel_list.get(i).getCost_money());
|
|
|
+ gridStore_bean.setFpd_id(costFormModel_list.get(i).getFpd_id());
|
|
|
+ gridStore_list.add(gridStore_bean);
|
|
|
+
|
|
|
+ if (i == (costFormModel_list.size()-1)){
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+// params.put("fp_id",formid);
|
|
|
+ params.put("caller", caller);
|
|
|
+ params.put("formStore", formStore);
|
|
|
+ params.put("param1",JSON.toJSONString(gridStore_list));
|
|
|
+ params.put("param2","");
|
|
|
+ LogUtil.prinlnLongMsg("gridStore_list",JSON.toJSONString(gridStore_list));
|
|
|
+ LinkedHashMap<String, Object> headers1 = new LinkedHashMap<>();
|
|
|
+ headers1.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
|
+ ViewUtil.httpSendRequest(ct, url, params, erhandler, headers1, 0x08, null, null, "post");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void doFirstCommit() {
|
|
|
+ progressDialog.show();
|
|
|
+ btn_save.setEnabled(false);
|
|
|
String url= Constants.getAppBaseUrl(ct) + "mobile/oa/saveAndSubmitFYBX.action";
|
|
|
Map<String, Object> formStoreMap = new HashMap<>();
|
|
|
formStoreMap.put("fp_v3", reimbursement_title_fet.getText().toString());
|
|
|
@@ -858,9 +1079,6 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
selected_detailsData = new ArrayList<>();
|
|
|
gAdapter = new GridDataAdapter(mContext, mAddCost_list);
|
|
|
gv_details_list.setAdapter(gAdapter);
|
|
|
-
|
|
|
- dtAdapter = new DetailsTableAdapter();
|
|
|
- table_details_list.setAdapter(dtAdapter);
|
|
|
}
|
|
|
|
|
|
private void doAutoCalculateJudge() {
|
|
|
@@ -978,11 +1196,17 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
.setPositiveButton(mContext.getString(R.string.common_sure), new DialogInterface.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
- models.remove(position);
|
|
|
- if (ListUtils.isEmpty(models)) {
|
|
|
- detail_table_ll.setVisibility(View.GONE);
|
|
|
+ if (models.get(position).getFpd_id() != 0){
|
|
|
+ cd_table_position = position;
|
|
|
+ doDeleteCostDetailshttp(position);
|
|
|
+ }else {
|
|
|
+ models.remove(position);
|
|
|
+ if (ListUtils.isEmpty(models)) {
|
|
|
+ detail_table_ll.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+ notifyDataSetChanged();
|
|
|
}
|
|
|
- notifyDataSetChanged();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}).show();
|
|
|
@@ -1013,6 +1237,23 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private void doDeleteCostDetailshttp(int position) {
|
|
|
+ //TODO 删除details 请求
|
|
|
+ String url = Constants.getAppBaseUrl(ct)+"common/deleteDetail.action";
|
|
|
+ Map<String,Object> params = new HashMap<>();
|
|
|
+ params.put("caller",caller);
|
|
|
+ params.put("gridcaller",caller);
|
|
|
+ params.put("condition","fpd_id = '"+ costFormModel_list.get(position).getFpd_id() +"'");
|
|
|
+ LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
|
|
|
+ if (platform){
|
|
|
+ headers.put("Cookie", "JSESSIONID=" + ApiConfig.getInstance(ApiUtils.getApiModel()).getmApiBase().getCookie());
|
|
|
+ }else {
|
|
|
+ headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
|
+ }
|
|
|
+ ViewUtil.httpSendRequest(ct, url, params, erhandler, headers, 0x09, null, null, "post");
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
*新增弹出PopupWindow表格适配器
|
|
|
*/
|
|
|
@@ -1094,6 +1335,16 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
* 图片适配器
|
|
|
*/
|
|
|
private class GridViewAdapter extends BaseAdapter {
|
|
|
+ private CostUpdatePModel CUPmodel;
|
|
|
+
|
|
|
+ public CostUpdatePModel getCUPmodel() {
|
|
|
+ return CUPmodel;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setCUPmodel(CostUpdatePModel CUPmodel) {
|
|
|
+ this.CUPmodel = CUPmodel;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public int getCount() {
|
|
|
if (mPhotoList.size() >= 9) {return 9;}
|
|
|
@@ -1125,7 +1376,19 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
+// private String getImageUrl2(String path ) {
|
|
|
+// return Constants.getAppBaseUrl(ct) + "common/download.action?path=" + path + "&sessionId=" +
|
|
|
+// CommonUtil.getSharedPreferences(ct, "sessionId") +
|
|
|
+// "&sessionUser=" + CommonUtil.getSharedPreferences(ct, "erp_username") +
|
|
|
+// "&master=" + CommonUtil.getSharedPreferences(ct, "erp_master");
|
|
|
+// }
|
|
|
|
|
|
+ private String getImageUrl(int id) {
|
|
|
+ return Constants.getAppBaseUrl(ct) + "common/downloadbyId.action?id=" + id + "&sessionId=" +
|
|
|
+ CommonUtil.getSharedPreferences(ct, "sessionId") +
|
|
|
+ "&sessionUser=" + CommonUtil.getSharedPreferences(ct, "erp_username") +
|
|
|
+ "&master=" + CommonUtil.getSharedPreferences(ct, "erp_master");
|
|
|
+ }
|
|
|
@Override
|
|
|
public View getView(final int position, View convertView, ViewGroup parent) {
|
|
|
if (getItemViewType(position) == 0) {// 普通的视图
|
|
|
@@ -1135,7 +1398,14 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
if (url == null) {
|
|
|
url = "";
|
|
|
}
|
|
|
- ImageLoader.getInstance().displayImage(Uri.fromFile(new File(url)).toString(), imageView);
|
|
|
+ if (getCUPmodel() != null && !ListUtils.isEmpty(getCUPmodel().getFiles())
|
|
|
+ && position < getCUPmodel().getFiles().size()){
|
|
|
+ int id = getCUPmodel().getFiles().get(position).getFp_id();
|
|
|
+ String path =getCUPmodel().getFiles().get(position).getFp_path();
|
|
|
+ ImageLoader.getInstance().displayImage(getImageUrl(id), imageView);
|
|
|
+ }else {
|
|
|
+ ImageLoader.getInstance().displayImage(Uri.fromFile(new File(url)).toString(), imageView);
|
|
|
+ }
|
|
|
return imageView;
|
|
|
} else {
|
|
|
View view = LayoutInflater.from(ct).inflate(R.layout.layout_circle_add_more_item,
|
|
|
@@ -1257,20 +1527,20 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
}
|
|
|
return super.onOptionsItemSelected(item);
|
|
|
}
|
|
|
-// private String cb_emcode;
|
|
|
private void sendPicture() {
|
|
|
if (ListUtils.isEmpty(mPhotoList)) {
|
|
|
commitSuccess(keyValue);
|
|
|
return;
|
|
|
}
|
|
|
- CommonUtil.getCommonId("http://218.18.115.198:8888/ERP/",ct, "Commentsback_mobile_SEQ", erhandler, 0x08);
|
|
|
-// cb_emcode = CommonUtil.getSharedPreferences(MyApplication.getInstance(), "erp_username");
|
|
|
+ for (int i = 0; i < mPhotoList.size(); i++) {
|
|
|
+ String path = mPhotoList.get(i);
|
|
|
+ sendPictureRequest(path);
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
private Boolean platform = ApiUtils.getApiModel() instanceof ApiPlatform;
|
|
|
private int sended_p = 0;
|
|
|
private String update = "";
|
|
|
- private int cb_id;
|
|
|
|
|
|
private void sendPictureRequest(String path) {
|
|
|
if (com.xzjmyk.pm.activity.ui.erp.util.StringUtils.isEmpty(path)) return;
|
|
|
@@ -1329,12 +1599,12 @@ public class ExpenseReimbursementActivity extends BaseActivity implements View.O
|
|
|
});
|
|
|
}
|
|
|
private void doUpdateId(String update) {
|
|
|
- String url = "http://218.18.115.198:8888/ERP/common/attach/change.action";
|
|
|
+ String url = Constants.getAppBaseUrl(ct) + "common/attach/change.action";
|
|
|
Map<String,Object> params = new HashMap<>();
|
|
|
- params.put("caller","Commentsback_mobile");
|
|
|
- params.put("table","Commentsback_mobile");
|
|
|
+ params.put("caller",caller);
|
|
|
+ params.put("table","FeePlease");
|
|
|
params.put("update","fb_attach = '"+update+"'"); // TODO 附件字段fb_attach
|
|
|
- params.put("condition","cb_id = '"+cb_id+"'");
|
|
|
+ params.put("condition","fp_id = '"+keyValue+"'");
|
|
|
params.put("type","添加附件");
|
|
|
LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
|
|
|
if (platform){
|