Browse Source

提交类型 添加功能,处理bug
提交内容 添加设备管理方面需求代码

Bitliker 8 years ago
parent
commit
c4ccd1a8e2

+ 4 - 1
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/WebViewCommActivity.java

@@ -6,6 +6,7 @@ import android.app.Activity;
 import android.content.ClipData;
 import android.content.Context;
 import android.content.Intent;
+import android.content.pm.ActivityInfo;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.net.Uri;
@@ -143,7 +144,9 @@ public class WebViewCommActivity extends BaseActivity implements View.OnClickLis
             getSupportActionBar().setTitle(msg_title);
         }
         String StartApp = intent.getStringExtra("isStartApp");//参数账套
-
+        if (intent.getBooleanExtra("orientation",false)){
+            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
+        }
         mSubsAct = intent.getStringExtra("subsact");
         mPosition = intent.getIntExtra("position", -1);
         mSubscriptionMessages = (ArrayList<SubMessage>) intent.getSerializableExtra("subsdata");

+ 5 - 5
WeiChat/version.properties

@@ -1,5 +1,5 @@
-#Mon Mar 19 17:14:22 CST 2018
-debugName=295
-versionName=622
-debugCode=295
-versionCode=161
+#Wed Mar 21 09:18:01 CST 2018
+debugName=306
+versionName=625
+debugCode=306
+versionCode=164

+ 2 - 1
app_modular/appmessages/src/main/AndroidManifest.xml

@@ -8,7 +8,8 @@
         android:supportsRtl="true">
         <activity android:name=".activity.MsgsSecondCommonActivity" />
         <activity android:name=".activity.PlatMsgThirdActivity" />
-        <activity android:name=".activity.MsgThirdWebActivity" />
+        <activity android:name=".activity.MsgThirdWebActivity"
+            />
         <activity android:name=".activity.ProcessB2BActivity">
             <intent-filter>
                 <action android:name="com.modular.work.ProcessB2BActivity" />

+ 8 - 0
app_modular/appmessages/src/main/java/com/modular/appmessages/activity/MsgThirdWebActivity.java

@@ -2,6 +2,8 @@ package com.modular.appmessages.activity;
 
 import android.Manifest;
 import android.content.Intent;
+import android.content.pm.ActivityInfo;
+import android.os.Bundle;
 import android.text.TextUtils;
 import android.view.View;
 import android.webkit.JsResult;
@@ -24,6 +26,12 @@ import java.io.File;
  * Created by Bitlike on 2018/1/16.
  */
 public class MsgThirdWebActivity extends MessageWebActivity {
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+    }
+
     @Override
     protected WebChromeClient getWebChromeClient() {
         return new WebChromeClient() {

+ 1 - 0
app_modular/appmessages/src/main/java/com/modular/appmessages/activity/RealTimeFormActivity.java

@@ -60,6 +60,7 @@ public class RealTimeFormActivity extends BaseActivity {
                 Intent intent = new Intent("com.modular.main.WebViewCommActivity");
                 intent.putExtra("url", url);
                 intent.putExtra("title", title);
+                intent.putExtra("orientation", true);
                 intent.putExtra("cookie", true);
                 startActivity(intent);
 

+ 177 - 14
app_modular/appworks/src/main/java/com/uas/appworks/CRM/erp/activity/DeviceCycleCountInfoActivity.java

@@ -4,13 +4,19 @@ import android.Manifest;
 import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
+import android.support.v7.widget.DefaultItemAnimator;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
 import android.text.Html;
+import android.text.TextUtils;
 import android.util.Log;
 import android.view.Gravity;
 import android.view.LayoutInflater;
 import android.view.View;
+import android.view.ViewGroup;
 import android.widget.ListView;
 import android.widget.PopupWindow;
+import android.widget.RelativeLayout;
 import android.widget.TextView;
 
 import com.afollestad.materialdialogs.MaterialDialog;
@@ -19,18 +25,24 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.common.LogUtil;
 import com.common.data.JSONUtil;
+import com.common.data.ListUtils;
 import com.common.data.StringUtil;
 import com.common.system.DisplayUtil;
 import com.core.app.MyApplication;
 import com.core.base.BaseActivity;
 import com.core.utils.CommonUtil;
 import com.core.utils.ToastUtil;
+import com.handmark.pulltorefresh.library.PullToRefreshBase;
+import com.handmark.pulltorefresh.library.PullToRefreshListView;
 import com.me.network.app.http.HttpClient;
 import com.me.network.app.http.Method;
 import com.me.network.app.http.rx.ResultListener;
 import com.me.network.app.http.rx.ResultSubscriber;
+import com.module.recyclerlibrary.ui.refresh.BaseRefreshLayout;
+import com.module.recyclerlibrary.ui.refresh.simlpe.SimpleRefreshLayout;
 import com.uas.appworks.CRM.erp.adapter.CycleCountAdapter;
 import com.uas.appworks.CRM.erp.model.CycleCount;
+import com.uas.appworks.CRM.erp.model.DeviceInfo;
 import com.uas.appworks.R;
 import com.uuzuche.lib_zxing.activity.CaptureActivity;
 import com.uuzuche.lib_zxing.activity.CodeUtils;
@@ -52,7 +64,9 @@ public class DeviceCycleCountInfoActivity extends BaseActivity implements View.O
     private TextView centerTv;
     private TextView lineTv;
     private TextView kindTv;
-    private ListView gridList;
+    private RecyclerView gridList;
+    private SimpleRefreshLayout mSimpleRefreshLayout;
+    private int page;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -84,10 +98,9 @@ public class DeviceCycleCountInfoActivity extends BaseActivity implements View.O
             }
         }
         loadData(true);
-        loadGridData(page);
+        loadGridData(page = 1);
     }
 
-    private int page=1;
 
     private void initJSONData(String message) throws Exception {
         JSONArray array = JSON.parseArray(message);
@@ -114,6 +127,7 @@ public class DeviceCycleCountInfoActivity extends BaseActivity implements View.O
         codeTv = findViewById(R.id.codeTv);
         workshopTv = findViewById(R.id.workshopTv);
         gridList = findViewById(R.id.gridList);
+        mSimpleRefreshLayout = findViewById(R.id.mSimpleRefreshLayout);
         centerTv = findViewById(R.id.centerTv);
         lineTv = findViewById(R.id.lineTv);
         kindTv = findViewById(R.id.kindTv);
@@ -125,6 +139,22 @@ public class DeviceCycleCountInfoActivity extends BaseActivity implements View.O
         findViewById(R.id.cycleBtn).setOnClickListener(this);
         findViewById(R.id.deviceAttributeBtn).setOnClickListener(this);
         findViewById(R.id.lossDeviceBtn).setOnClickListener(this);
+        mSimpleRefreshLayout.setEnabledPullUp(true);
+        mSimpleRefreshLayout.setEnablePullDown(false);
+        gridList.setItemAnimator(new DefaultItemAnimator());
+        gridList.setLayoutManager(new LinearLayoutManager(ct));
+        mSimpleRefreshLayout.setOnRefreshListener(new BaseRefreshLayout.onRefreshListener() {
+            @Override
+            public void onRefresh() {
+
+            }
+
+            @Override
+            public void onLoadMore() {
+                page++;
+                loadGridData(page);
+            }
+        });
     }
 
 
@@ -181,28 +211,25 @@ public class DeviceCycleCountInfoActivity extends BaseActivity implements View.O
     }
 
     private void loadGridData(int page) {
-        progressDialog.show();
-        String condition = "dc_dbid="+id;
+        String condition = "dc_dbid=" + id;
         httpClient.Api().send(new HttpClient.Builder()
                 .url("mobile/common/getGridPanelandDataPage.action")
                 .add("caller", "DeviceBatch!Stock")
                 .add("condition", condition)
                 .add("page", page)
                 .add("pageSize", 50)
-                .method(Method.POST)
+                .method(Method.GET)
                 .build(), new ResultSubscriber<>(new ResultListener<Object>() {
             @Override
             public void onResponse(Object o) {
-                if (progressDialog != null) {
-                    progressDialog.dismiss();
-                }
                 try {
-                    LogUtil.i("o.toString()="+o.toString());
+                    handlerGridData(o.toString());
                 } catch (Exception e) {
                     if (e != null) {
                         LogUtil.i("e=" + e.getMessage());
                     }
                 }
+                mSimpleRefreshLayout.stopRefresh();
 
             }
         }));
@@ -214,7 +241,7 @@ public class DeviceCycleCountInfoActivity extends BaseActivity implements View.O
                 .url("mobile/device/getDeviceAttribute.action")
                 .add("caller", "DeviceBatch!Stock")
                 .add("id", id)
-                .method(Method.POST)
+                .method(Method.GET)
                 .build(), new ResultSubscriber<>(new ResultListener<Object>() {
             @Override
             public void onResponse(Object o) {
@@ -222,7 +249,7 @@ public class DeviceCycleCountInfoActivity extends BaseActivity implements View.O
                     progressDialog.dismiss();
                 }
                 try {
-                    handleSubmitCycle(o.toString());
+                    handlerAttribute(o.toString());
                 } catch (Exception e) {
                     if (e != null) {
                         LogUtil.i("e=" + e.getMessage());
@@ -239,7 +266,7 @@ public class DeviceCycleCountInfoActivity extends BaseActivity implements View.O
                 .url("mobile/device/lossDevice.action")
                 .add("caller", "DeviceBatch!Stock")
                 .add("id", id)
-                .method(Method.POST)
+                .method(Method.GET)
                 .build(), new ResultSubscriber<>(new ResultListener<Object>() {
             @Override
             public void onResponse(Object o) {
@@ -247,7 +274,7 @@ public class DeviceCycleCountInfoActivity extends BaseActivity implements View.O
                     progressDialog.dismiss();
                 }
                 try {
-                    handleSubmitCycle(o.toString());
+                    handlerLoss(o.toString());
                 } catch (Exception e) {
                     if (e != null) {
                         LogUtil.i("e=" + e.getMessage());
@@ -258,6 +285,78 @@ public class DeviceCycleCountInfoActivity extends BaseActivity implements View.O
         }));
     }
 
+    private void handlerLoss(String message) {
+        JSONObject object = JSON.parseObject(message);
+        if (object.containsKey("exceptionInfo")) {
+            ToastUtil.showToast(ct, JSONUtil.getText(object, "exceptionInfo"));
+        } else {
+            if (JSONUtil.getBoolean(object, "success")) {
+                ToastUtil.showToast(ct, "盘亏成功");
+                loadGridData(page=1);
+                loadData(false);
+            }
+
+        }
+        LogUtil.i(message);
+    }
+
+    private void handlerAttribute(String message) {
+        JSONObject object = JSON.parseObject(message);
+        if (object.containsKey("exceptionInfo")) {
+            ToastUtil.showToast(ct, JSONUtil.getText(object, "exceptionInfo"));
+        } else {
+            if (JSONUtil.getBoolean(object, "success")) {
+                loadGridData(page = 1);
+                loadData(false);
+            }
+        }
+        LogUtil.i(message);
+    }
+
+    private GridAdapter mAdapter = null;
+
+    private void handlerGridData(String message) {
+        JSONObject object = JSON.parseObject(message);
+        if (object.containsKey("exceptionInfo")) {
+            ToastUtil.showToast(ct, JSONUtil.getText(object, "exceptionInfo"));
+        } else {
+            JSONArray array = JSONUtil.getJSONArray(object, "gridItem");
+            JSONArray datas = JSONUtil.getJSONArray(object, "gridData");
+            List<Grid> grids = new ArrayList<>();
+
+            for (int j = 0; j < datas.size(); j++) {
+                JSONObject data = datas.getJSONObject(j);
+                boolean isTop = true;
+                for (int i = 0; i < array.size(); i++) {
+                    JSONObject config = array.getJSONObject(i);
+                    String dataIndex = JSONUtil.getText(config, "dataIndex");
+                    Grid grid = new Grid();
+                    grid.caption = JSONUtil.getText(config, "caption");
+                    grid.values = JSONUtil.getText(data, dataIndex.toUpperCase());
+                    if (!TextUtils.isEmpty(grid.caption) && !TextUtils.isEmpty(grid.values)) {
+                        if (isTop) {
+                            grid.isTop = isTop;
+                            isTop = false;
+                        }
+                        grids.add(grid);
+                    }
+                }
+            }
+
+            if (mAdapter == null) {
+                mAdapter = new GridAdapter(grids);
+                gridList.setAdapter(mAdapter);
+            } else {
+                if (page <= 1) {
+                    mAdapter.setModels(grids);
+                } else {
+                    mAdapter.addModels(grids);
+                }
+            }
+        }
+        LogUtil.i(message);
+    }
+
     private void handleData(String message) throws Exception {
         JSONObject object = JSONUtil.getJSONObject(message, "data");
         String code = JSONUtil.getText(object, "DB_CODE");
@@ -413,4 +512,68 @@ public class DeviceCycleCountInfoActivity extends BaseActivity implements View.O
             }
         }
     }
+
+
+    private class GridAdapter extends RecyclerView.Adapter<GridAdapter.ViewHolder> {
+
+        List<Grid> models;
+
+        public GridAdapter(List<Grid> models) {
+            this.models = models;
+        }
+
+        public void setModels(List<Grid> models) {
+            this.models = models;
+            notifyDataSetChanged();
+        }
+
+        public void addModels(List<Grid> models) {
+            if (this.models == null) {
+                this.models = new ArrayList<>();
+            }
+            int sizeOld = this.models.size();
+            this.models.addAll(models);
+            notifyItemRangeChanged(sizeOld, this.models.size());
+        }
+
+        @Override
+        public GridAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+            return new GridAdapter.ViewHolder(parent);
+        }
+
+        @Override
+        public void onBindViewHolder(GridAdapter.ViewHolder holder, int position) {
+            Grid model = models.get(position);
+            holder.line.setVisibility(model.isTop ? View.VISIBLE : View.GONE);
+            holder.captionTv.setText(model.caption == null ? "" : model.caption);
+            holder.valuesTv.setText(model.values == null ? "" : model.values);
+        }
+
+        @Override
+        public int getItemCount() {
+            return ListUtils.getSize(models);
+        }
+
+        class ViewHolder extends RecyclerView.ViewHolder {
+            View line;
+            TextView captionTv, valuesTv;
+
+            public ViewHolder(ViewGroup parent) {
+                this(LayoutInflater.from(ct).inflate(R.layout.item_cycle_grid, parent, false));
+            }
+
+            public ViewHolder(View itemView) {
+                super(itemView);
+                line = itemView.findViewById(R.id.line);
+                captionTv = itemView.findViewById(R.id.captionTv);
+                valuesTv = itemView.findViewById(R.id.valuesTv);
+            }
+        }
+    }
+
+    private class Grid {
+        boolean isTop;
+        String caption;
+        String values;
+    }
 }

+ 0 - 1
app_modular/appworks/src/main/java/com/uas/appworks/CRM/erp/activity/DeviceDataFormAddActivity.java

@@ -179,7 +179,6 @@ public class DeviceDataFormAddActivity extends BaseActivity implements View.OnCl
                                     data.setValue(items.getString("fd_value"));
                                 } else {
                                     String values = JSONUtil.getText(formData, data.getField().toUpperCase());
-//                                    LogUtil.i("keys="+keys);
                                     LogUtil.i("values=" + values);
                                     data.setValue(values);
                                 }

+ 5 - 8
app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/activity/CommonDocDetailsActivity.java

@@ -674,16 +674,13 @@ public class CommonDocDetailsActivity extends BaseActivity {
         }
         if (device) {
             LogUtil.i("real_status=" + real_status);
-//            resanddel_ll.setVisibility(View.GONE);
-            if (real_status.equals("已审核") && !StringUtil.isEmpty(mCaller) && (mCaller.equals("DeviceChange!Use") || mCaller.equals("DeviceChange!Inspect"))) {
+            //只有故障单有按钮
+            if (real_status.equals("已审核") && !StringUtil.isEmpty(mCaller) && mCaller.equals("DeviceChange!Inspect")) {
                 resanddel_ll.setVisibility(View.GONE);
                 deviceLL.setVisibility(View.VISIBLE);
                 sureTv.setOnClickListener(mOnClickListener);
-                if (mCaller != null && mCaller.equals("DeviceChange!Inspect")) {
-                    turnScrapTv.setVisibility(View.VISIBLE);
-                    turnScrapTv.setOnClickListener(mOnClickListener);
-                }
-
+                turnScrapTv.setVisibility(View.VISIBLE);
+                turnScrapTv.setOnClickListener(mOnClickListener);
             }
 
         }
@@ -1102,7 +1099,7 @@ public class CommonDocDetailsActivity extends BaseActivity {
         params.put("id", mkeyValue);
         LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
         headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
-        String url = CommonUtil.getAppBaseUrl(ct) + "mobile/device/turnScrap/action";
+        String url = CommonUtil.getAppBaseUrl(ct) + "mobile/device/turnScrap.action";
         ViewUtil.httpSendRequest(ct, url, params, mHandler, headers, COM_DOC_DEVICE_TURN_SACN, null, null, "post");
     }
 

+ 6 - 6
app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/adapter/BusinessTravelAdapter.java

@@ -167,7 +167,7 @@ public class BusinessTravelAdapter extends RecyclerView.Adapter<RecyclerView.Vie
     }
 
     private void bindHotelView(HotelViewHolder holder, BusinessTravel model) {
-        String whenLongTv = "入住: " + DateFormatUtil.long2Str(model.getStartTime(), "MM-dd") + "      离店: " + DateFormatUtil.long2Str(model.getStartTime(), "MM-dd") + "     共" + model.getAllTime()+"晚";
+        String whenLongTv = "入住: " + DateFormatUtil.long2Str(model.getStartTime(), "MM-dd") + "      离店: " + DateFormatUtil.long2Str(model.getStartTime(), "MM-dd") + "     共" + model.getAllTime()+(model.getAllTime().contains("分钟")?"":"晚");
         holder.whenLongTv.setText(whenLongTv);
         holder.businessNameTv.setText(model.getBusinessName());
         holder.numberTv.setText(model.getNumber() + "人");
@@ -390,11 +390,11 @@ public class BusinessTravelAdapter extends RecyclerView.Adapter<RecyclerView.Vie
             String appkey = "y8gd87dsdkencgzk394k7s5c78io35c";
             String appSceret = "e212e142a5c9e0590eefb7d9f1bc91d7";
             String baseUrl="http://124.254.45.234:8082/oa/caslogin/";
-//            if (!BaseConfig.isDebug()){
-//                appkey = "fjdsfnvg6523fsgjkff879fidsf";
-//                appSceret = "9891ca5330271eba81ec1332e740c210";
-//                baseUrl="http://h5.auvgo.com/";
-//            }
+            if (!BaseConfig.isDebug()){
+                appkey = "fjdsfnvg6523fsgjkff879fidsf";
+                appSceret = "9891ca5330271eba81ec1332e740c210";
+                baseUrl="http://h5.auvgo.com/";
+            }
             String username = CommonUtil.getEmcode();
             String data = appkey + username.toUpperCase() + appSceret;
             String key = Md5Util.toMD5(appSceret).toUpperCase();

+ 11 - 5
app_modular/appworks/src/main/res/layout/activity_device_cycle_info.xml

@@ -224,7 +224,7 @@
 
     <LinearLayout
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
+        android:layout_height="wrap_content"
         android:layout_marginTop="@dimen/padding"
         android:orientation="horizontal">
 
@@ -266,9 +266,15 @@
 
     </LinearLayout>
 
-
-    <com.core.widget.MyListView
-        android:id="@+id/gridList"
+    <com.module.recyclerlibrary.ui.refresh.simlpe.SimpleRefreshLayout
         android:layout_width="match_parent"
-        android:layout_height="match_parent" />
+        android:id="@+id/mSimpleRefreshLayout"
+        android:layout_height="match_parent">
+
+        <android.support.v7.widget.RecyclerView
+            android:id="@+id/gridList"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent" />
+    </com.module.recyclerlibrary.ui.refresh.simlpe.SimpleRefreshLayout>
+
 </LinearLayout>

+ 33 - 0
app_modular/appworks/src/main/res/layout/item_cycle_grid.xml

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="@color/white">
+
+    <View
+        android:id="@+id/line"
+        android:visibility="gone"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/line"
+        android:background="@color/item_line"/>
+
+    <TextView
+        android:id="@+id/captionTv"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/line"
+        android:gravity="left|center_vertical"
+        android:padding="@dimen/paddingMin"
+        android:text="设备编号" />
+
+    <TextView
+        android:id="@+id/valuesTv"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentRight="true"
+        android:layout_alignTop="@id/captionTv"
+        android:layout_toRightOf="@id/captionTv"
+        android:gravity="right|center_vertical"
+        android:padding="@dimen/paddingMin"
+        android:textColor="@color/text_main" />
+</RelativeLayout>