Browse Source

Merge branch 'feature' of https://gitlab.com/Arisono/SkWeiChat-Baidu into feature_raomeng

raomeng 8 years ago
parent
commit
9884fe36f3

+ 43 - 7
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/message/ChatActivity.java

@@ -33,11 +33,14 @@ import com.common.LogUtil;
 import com.common.data.CalendarUtil;
 import com.common.data.ListUtils;
 import com.common.preferences.PreferenceUtils;
+import com.common.thread.ThreadPool;
 import com.common.ui.CameraUtil;
 import com.core.app.ActionBackActivity;
 import com.core.app.Constants;
 import com.core.app.MyApplication;
 import com.core.broadcast.MsgBroadcast;
+import com.core.dao.DBManager;
+import com.core.model.EmployeesEntity;
 import com.core.model.Friend;
 import com.core.model.User;
 import com.core.model.XmppMessage;
@@ -46,6 +49,7 @@ import com.core.net.volley.FastVolley;
 import com.core.net.volley.ObjectResult;
 import com.core.net.volley.Result;
 import com.core.net.volley.StringJsonObjectRequest;
+import com.core.utils.CommonUtil;
 import com.core.utils.ToastUtil;
 import com.core.xmpp.CoreService;
 import com.core.xmpp.FriendHelper;
@@ -150,7 +154,36 @@ public class ChatActivity extends ActionBackActivity
         instantFilePath = getIntent().getStringExtra(Constants.INSTANT_MESSAGE_FILE);//只有转发文件才会有
         IntentFilter filter = new IntentFilter(Constants.CHAT_MESSAGE_DELETE_ACTION);
         registerReceiver(broadcastReceiver, filter);
+        addPhone2Friend();
+    }
 
+    private void addPhone2Friend() {
+        if (mFriend != null && TextUtils.isEmpty(mFriend.getPhone())) {
+            LogUtil.i("mFriend != null && TextUtils.isEmpty(mFriend.getPhone())");
+            ThreadPool.getThreadPool().addTask(new Runnable() {
+                @Override
+                public void run() {
+                    Intent intent = getIntent();
+                    String phone = null;
+                    if (intent != null) {
+                        phone = intent.getStringExtra("phone");
+                    }
+                    if (!TextUtils.isEmpty(mFriend.getEmCode())) {
+                        String whichsys = CommonUtil.getMaster();
+                        String[] selectionArgs = {mFriend.getEmCode(), whichsys};
+                        String selection = "em_code=? and whichsys=? ";
+                        EmployeesEntity emModel = DBManager.getInstance().selectForEmployee(selectionArgs, selection);
+                        if (emModel != null && !TextUtils.isEmpty(emModel.getEM_MOBILE())) {
+                            phone = emModel.getEM_MOBILE();
+                        }
+                    }
+                    LogUtil.i("phone=" + phone);
+                    if (!TextUtils.isEmpty(phone)) {
+                        mFriend.setPhone(phone);
+                    }
+                }
+            });
+        }
     }
 
     BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
@@ -453,10 +486,10 @@ public class ChatActivity extends ActionBackActivity
             if (!message.isUpload()) {
                 UploadEngine.uploadImFile(mFriend.getUserId(), message, mUploadResponse);
             } else {
-                mService.sendChatMessage(mFriend.getUserId(), message);
+              sendMessageByService( message);
             }
         } else {
-            mService.sendChatMessage(mFriend.getUserId(), message);
+            sendMessageByService(message);
         }
         // mService.sendChatMessage(mFriend.getUserId(), chatMessage);
     }
@@ -507,24 +540,23 @@ public class ChatActivity extends ActionBackActivity
 
             } else {
                 Log.d("roamer", "sendChatMessage....");
-                mService.sendChatMessage(mFriend.getUserId(), message);
+                sendMessageByService( message);
             }
         } else {
             Log.d("roamer", "sendChatMessage");
 
-            mService.sendChatMessage(mFriend.getUserId(), message);
+            sendMessageByService( message);
             //进行百度推送
             sendPushTask(mLoginUserId, mFriend.getUserId(), message.getContent());
 
         }
-        LogUtil.i("发送聊天\n"+JSON.toJSONString(mFriend));
         TopContactsDao.api().addGoodFriend(mFriend);
     }
 
     private UploadEngine.ImFileUploadResponse mUploadResponse = new UploadEngine.ImFileUploadResponse() {
         @Override
         public void onSuccess(String toUserId, ChatMessage message) {
-            mService.sendChatMessage(mFriend.getUserId(), message);
+            sendMessageByService(message);
 
         }
 
@@ -541,9 +573,13 @@ public class ChatActivity extends ActionBackActivity
                 }
             }
         }
-
     };
 
+    private void sendMessageByService(ChatMessage message){
+        if (mService!=null&&mFriend!=null){
+            mService.sendChatMessage(mFriend.getUserId(), message);
+        }
+    }
     /**
      * 停止播放聊天的录音
      */

+ 0 - 4
app_modular/appcontact/src/main/java/com/uas/appcontact/db/TopContactsDao.java

@@ -114,14 +114,10 @@ public class TopContactsDao extends Dao<TopContacts> {
                 + DatabaseTables.TopContactsTable.Cols.USER_ID + "=? ";
         String[] whereAge = new String[]{topContacts.getOwnerId(), topContacts.getUserId()};
         List<TopContacts> dbContacts = query(where, whereAge);
-        LogUtil.i("owner_id=" + topContacts.getOwnerId());
-        LogUtil.i("user_id=" + topContacts.getUserId());
         if (ListUtils.isEmpty(dbContacts)) {
-            LogUtil.i("ListUtils.isEmpty(dbContacts)=");
             boolean b = insert(topContacts, where, whereAge);
             LogUtil.i("insert=" + b);
         } else {
-            LogUtil.i("ListUtils.isEmpty(dbContacts)=elseelseelseelseelse"+dbContacts.size());
             TopContacts dbContact = dbContacts.get(0);
             if (dbContact != null && (System.currentTimeMillis() - dbContact.getLastTime())< (86400000)) {
                 topContacts.setStatus(1);

+ 45 - 35
app_modular/appcontact/src/main/java/com/uas/appcontact/ui/activity/MyFriendActivity.java

@@ -23,6 +23,7 @@ import com.common.LogUtil;
 import com.common.data.JSONUtil;
 import com.common.data.ListUtils;
 import com.common.data.StringUtil;
+import com.common.thread.ThreadPool;
 import com.common.ui.ProgressDialogUtil;
 import com.core.app.MyApplication;
 import com.core.base.BaseActivity;
@@ -96,15 +97,15 @@ public class MyFriendActivity extends BaseActivity {
         initView();
 
     }
-    
+
     private void initView() {
         progressDialog.show();
         mPullToRefreshListView = (PullToRefreshListView) findViewById(R.id.pull_refresh_list);
         mTextDialog = (TextView) findViewById(R.id.text_dialog);
         mSideBar = (SideBar) findViewById(R.id.sidebar);
-        voiceSearchView = (VoiceSearchView)findViewById(R.id.voiceSearchView);
+        voiceSearchView = (VoiceSearchView) findViewById(R.id.voiceSearchView);
         mSideBar.setTextView(mTextDialog);
-      
+
         mSideBar.setOnTouchingLetterChangedListener(new SideBar.OnTouchingLetterChangedListener() {
             @Override
             public void onTouchingLetterChanged(String s) {
@@ -124,7 +125,7 @@ public class MyFriendActivity extends BaseActivity {
                 //linear_top_menu.setVisibility(View.VISIBLE);
             }
         });
-      // setHeaderView();
+        // setHeaderView();
         loadData();
        /* mPullToRefreshListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<ListView>() {
             @Override
@@ -134,23 +135,24 @@ public class MyFriendActivity extends BaseActivity {
                 loadData();
             }
         });*/
-       mPullToRefreshListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() {
-           @Override
-           public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) {
-               progressDialog.show();
-               mAdapter.setisRefeshed(true);
-               upDataFriend();
-               loadData();
-           }
+        mPullToRefreshListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() {
+            @Override
+            public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) {
+                progressDialog.show();
+                mAdapter.setisRefeshed(true);
+                upDataFriend();
+                loadData();
+            }
 
-           @Override
-           public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) {
+            @Override
+            public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) {
 
-           }
-       });
+            }
+        });
 
         mPullToRefreshListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
             private Friend friend;   //l临时对象
+
             @Override
             public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                 try {
@@ -199,10 +201,7 @@ public class MyFriendActivity extends BaseActivity {
         View headview = LayoutInflater.from(ct).inflate(R.layout.header_fragment_contact, null);
         mPullToRefreshListView.getRefreshableView().addHeaderView(headview);
         headview.findViewById(R.id.click_ll).setVisibility(View.GONE);
-       voiceSearchView = (VoiceSearchView) headview.findViewById(R.id.voiceSearchView);
-
-    
-
+        voiceSearchView = (VoiceSearchView) headview.findViewById(R.id.voiceSearchView);
     }
 
     /**
@@ -219,7 +218,7 @@ public class MyFriendActivity extends BaseActivity {
                 mAdapter.getmSortFriends().add(e);
             }
         }
-        LogUtil.prinlnLongMsg("mSortFriends",JSON.toJSONString(mAdapter.getmSortFriends()));
+        LogUtil.prinlnLongMsg("mSortFriends", JSON.toJSONString(mAdapter.getmSortFriends()));
         mAdapter.notifyDataSetChanged();
     }
 
@@ -230,7 +229,7 @@ public class MyFriendActivity extends BaseActivity {
 //            loadData();
             mNeedUpdate = false;
         }
-        if (mAdapter!=null) {
+        if (mAdapter != null) {
             mAdapter.notifyDataSetChanged();
         }
     }
@@ -240,18 +239,29 @@ public class MyFriendActivity extends BaseActivity {
     private void loadData() {
 //        if (isPeculiar) loadContactByERpNet();
 //        else
-        new Thread(new Runnable() {
+        ThreadPool.getThreadPool().addTask(new Runnable() {
             @Override
             public void run() {
                 long startTime = System.currentTimeMillis();
-                if (mLoginUserId == null)
+                if (mLoginUserId == null) {
                     mLoginUserId = MyApplication.getInstance().mLoginUser.getUserId();
+                }
+                friends = new ArrayList<>();
                 if (isPeculiar) {
                     List<TopContacts> topContacts = TopContactsDao.api().getTopContacts();
-                    if (topContacts!=null){
-                        LogUtil.i("topContacts="+JSON.toJSONString(topContacts));
+                    if (topContacts != null) {
+                        for (TopContacts e : topContacts) {
+                            Friend f = new Friend();
+                            f.setNickName(e.getName());
+                            f.setPhone(e.getPhone());
+                            f.setUserId(e.getUserId());
+                            f.setOwnerId(e.getOwnerId());
+                            f.setEmCode(e.getEmCode());
+                            f.setTimeSend((int) (e.getLastTime() / 1000));
+                            friends.add(f);
+                        }
                     }
-                    friends = FriendDao.getInstance().getFriends(mLoginUserId, "clickNum", 10);
+//                    friends = FriendDao.getInstance().getFriends(mLoginUserId, "clickNum", 10);
                 } else {
                     friends = FriendDao.getInstance().getFriends(mLoginUserId);// 取所有好友
                 }
@@ -266,11 +276,11 @@ public class MyFriendActivity extends BaseActivity {
                     @Override
                     public void run() {
                         handlerFriends(friends);
-                        LogUtil.prinlnLongMsg("hifriends",JSON.toJSONString(friends));
+                        LogUtil.prinlnLongMsg("hifriends", JSON.toJSONString(friends));
                     }
                 }, delayTime);
             }
-        }).start();
+        });
     }
 
     private void getFriendByRep(EmployeesEntity e, Friend friend) {
@@ -323,7 +333,7 @@ public class MyFriendActivity extends BaseActivity {
                     friends.add(friend);
                 }
                 handlerFriends(friends);
-                LogUtil.prinlnLongMsg("hifriends",JSON.toJSONString(friend));
+                LogUtil.prinlnLongMsg("hifriends", JSON.toJSONString(friend));
             }
 
             @Override
@@ -356,19 +366,19 @@ public class MyFriendActivity extends BaseActivity {
                 public int compare(BaseSortModel<Friend> o1, BaseSortModel<Friend> o2) {
                     Friend f1 = o1.getBean();
                     Friend f2 = o2.getBean();
-                    return f2.getClickNum()-f1.getClickNum();
+                    return f2.getClickNum() - f1.getClickNum();
                 }
             });
-            LogUtil.prinlnLongMsg("mSortFriends",JSON.toJSONString(mSortFriends));
+            LogUtil.prinlnLongMsg("mSortFriends", JSON.toJSONString(mSortFriends));
             Collections.sort(allFriends, new Comparator<BaseSortModel<Friend>>() {
                 @Override
                 public int compare(BaseSortModel<Friend> o1, BaseSortModel<Friend> o2) {
                     Friend f1 = o1.getBean();
                     Friend f2 = o2.getBean();
-                    return f2.getClickNum()-f1.getClickNum();
+                    return f2.getClickNum() - f1.getClickNum();
                 }
             });
-            LogUtil.prinlnLongMsg("allFriends",JSON.toJSONString(allFriends));
+            LogUtil.prinlnLongMsg("allFriends", JSON.toJSONString(allFriends));
 //            Collections.sort(mSortFriends, mBaseComparator);
 //            Collections.sort(allFriends, mBaseComparator);
         }
@@ -453,7 +463,7 @@ public class MyFriendActivity extends BaseActivity {
         }, new StringJsonArrayRequest.Listener<AttentionUser>() {
             @Override
             public void onResponse(ArrayResult<AttentionUser> result) {
-                LogUtil.d("Test","result:"+result);
+                LogUtil.d("Test", "result:" + result);
                 boolean success = Result.defaultParser(MyFriendActivity.this, result, false);
                 if (success) {
                     FriendDao.getInstance().addAttentionUsers(mHandler, MyApplication.getInstance().mLoginUser.getUserId(), result.getData(),

+ 46 - 0
app_modular/apputils/src/main/java/com/modular/apputils/utils/RecyclerItemDecoration.java

@@ -0,0 +1,46 @@
+package com.modular.apputils.utils;
+
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Rect;
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+
+import com.modular.apputils.R;
+
+/**
+ * Created by Bitlike on 2018/1/24.
+ */
+
+public class RecyclerItemDecoration extends RecyclerView.ItemDecoration {
+
+    private int dividerHeight;
+    private Paint mPaint;
+
+    public RecyclerItemDecoration(int dividerHeight) {
+        this.dividerHeight = dividerHeight;
+        mPaint = new Paint();
+        mPaint.setColor(0xBFD3D3D3);
+    }
+
+    @Override
+    public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
+        super.onDraw(c, parent, state);
+        int childCount = parent.getChildCount();
+        int left = parent.getPaddingLeft();
+        int right = parent.getWidth() - parent.getPaddingRight();
+
+        for (int i = 0; i < childCount - 1; i++) {
+            View view = parent.getChildAt(i);
+            float top = view.getBottom();
+            float bottom = view.getBottom() + dividerHeight;
+            c.drawRect(left, top, right, bottom, mPaint);
+        }
+    }
+
+    @Override
+    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
+        super.getItemOffsets(outRect, view, parent, state);
+        outRect.bottom = this.dividerHeight;
+    }
+}

+ 49 - 26
app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/activity/PurchaseDetailsActivity.java

@@ -21,12 +21,14 @@ import com.common.thread.ThreadPool;
 import com.core.app.Constants;
 import com.core.app.MyApplication;
 import com.core.net.http.http.OAHttpHelper;
+import com.core.utils.CommonUtil;
 import com.core.utils.ToastUtil;
 import com.me.network.app.http.Method;
 import com.modular.apputils.activity.BaseNetActivity;
 import com.modular.apputils.listener.OnSmartHttpListener;
 import com.modular.apputils.network.Parameter;
 import com.modular.apputils.network.Tags;
+import com.modular.apputils.utils.RecyclerItemDecoration;
 import com.uas.appworks.OA.platform.adapter.PurchaseDetailsAdapter;
 import com.uas.appworks.OA.platform.model.Purchase;
 import com.uas.appworks.R;
@@ -45,6 +47,7 @@ public class PurchaseDetailsActivity extends BaseNetActivity implements OnSmartH
 
     private String varId;
     private String varStatus;
+    private String enUU;
 
     private RecyclerView mRecyclerView;
     private PurchaseDetailsAdapter mAdapter;
@@ -68,6 +71,10 @@ public class PurchaseDetailsActivity extends BaseNetActivity implements OnSmartH
         if (intent != null) {
             varId = intent.getStringExtra(Constants.FLAG.KEY_PURCHASE_ID);
             varStatus = intent.getStringExtra(Constants.FLAG.KEY_PURCHASE_STATUS);
+            enUU = intent.getStringExtra(Constants.FLAG.EXTRA_B2B_LIST_ID);
+            if (TextUtils.isEmpty(enUU)) {
+                enUU = CommonUtil.getSharedPreferences(mContext, Constants.CACHE.B2B_BUSINESS_ENUU);
+            }
         }
         if (varStatus == null) {
             varStatus = "";
@@ -97,7 +104,7 @@ public class PurchaseDetailsActivity extends BaseNetActivity implements OnSmartH
     private void initView() {
         mRecyclerView = findViewById(R.id.mRecyclerView);
         mRecyclerView.setLayoutManager(new LinearLayoutManager(ct));
-        mRecyclerView.addItemDecoration(new DividerItemDecoration(ct, LinearLayout.VERTICAL));
+        mRecyclerView.addItemDecoration(new RecyclerItemDecoration(1));
 
     }
 
@@ -107,7 +114,7 @@ public class PurchaseDetailsActivity extends BaseNetActivity implements OnSmartH
 
 
     private void loadData() {
-        int enuu = 10041559;
+        showProgress();
         String phone = "15671616315";
         Parameter.Builder builder = new Parameter.Builder();
         String url = "mobile/sale/orders/" + varId + "/info";//卖方
@@ -116,15 +123,14 @@ public class PurchaseDetailsActivity extends BaseNetActivity implements OnSmartH
                 .record(0x11)
                 .showLog(true)
                 .autoProgress(true)
-                .addParams("en_uu", enuu)
+                .addParams("en_uu", enUU)
                 .addParams("user_tel", phone);
         requestHttp(builder, this);
     }
 
-    private int replyNumber;
+    private boolean replyed;
 
     private void verifiReply(List<Purchase> purchases) {
-        replyNumber = 0;
         List<Map<String, Object>> mapList = new ArrayList<>();
         for (int i = 1; i < purchases.size(); i++) {
             Purchase purchase = purchases.get(i);
@@ -141,18 +147,16 @@ public class PurchaseDetailsActivity extends BaseNetActivity implements OnSmartH
             String json = JSONUtil.map2JSON(mapList);
             reply(json);
         } else {
-            ToastUtil.showToast(ct,"没有可以提交的明细表单");
+            ToastUtil.showToast(ct, "没有可以提交的明细表单");
         }
     }
 
     private void reply(String json) {
-        replyNumber++;
-        int enuu = 10041559;
         String phone = "15671616315";
         Parameter.Builder builder = new Parameter.Builder();
         builder.mode(Method.POST)
                 .url("mobile/sale/orders/reply")
-                .addParams("en_uu", enuu)
+                .addParams("en_uu", enUU)
                 .addParams("json", json)
                 .addParams("user_tel", phone)
                 .record(0x12)
@@ -181,15 +185,13 @@ public class PurchaseDetailsActivity extends BaseNetActivity implements OnSmartH
                 handleMessage(message);
                 break;
             case 0x12:
-                replyNumber--;
-                if (replyNumber == 0) {
-                    Toast.makeText(MyApplication.getInstance(), "回复成功", Toast.LENGTH_SHORT).show();
-                    if (!this.isFinishing()) {
-                        loadData();
-                    }
+                if (!this.isFinishing()) {
+                    replyed = true;
+                    loadData();
                 }
                 break;
         }
+        dismissProgress();
     }
 
     @Override
@@ -208,18 +210,34 @@ public class PurchaseDetailsActivity extends BaseNetActivity implements OnSmartH
                 JSONObject object = JSON.parseObject(message);
                 setVarStatus(object);
                 final List<Purchase> dataList = new ArrayList<>();
-                dataList.add(getPurchase(true, object));
                 JSONArray orderItems = JSONUtil.getJSONArray(object, "orderItems");
+
+                Purchase mainPurchase = getPurchase(true, object);
+                float top = 0;
                 if (!ListUtils.isEmpty(orderItems)) {
+                    Purchase purchase = null;
                     for (int i = 0; i < orderItems.size(); i++) {
-                        dataList.add(getPurchase(false, orderItems.getJSONObject(i)));
+                        purchase = getPurchase(false, orderItems.getJSONObject(i));
+                        dataList.add(purchase);
+                        try {
+                            top += Float.valueOf(purchase.getAmount());
+                        } catch (Exception e) {
+                            LogUtil.i("e=" + e.getMessage());
+                        }
                     }
                 }
+                mainPurchase.setTotal(String.valueOf(top));
+                dataList.add(0, mainPurchase);
                 OAHttpHelper.getInstance().post(new Runnable() {
                     @Override
                     public void run() {
                         setStatus();
-                        setData2Adapter(dataList);
+                        if (replyed) {
+                            Toast.makeText(MyApplication.getInstance(), "回复成功", Toast.LENGTH_SHORT).show();
+                            finish();
+                        } else {
+                            setData2Adapter(dataList);
+                        }
                     }
                 });
             }
@@ -254,38 +272,43 @@ public class PurchaseDetailsActivity extends BaseNetActivity implements OnSmartH
     private Purchase getPurchase(boolean first, JSONObject object) {
         Purchase purchase = new Purchase();
         int id = JSONUtil.getInt(object, "id");
-        String client = JSONUtil.getText(object, "receiveName");//客户
         String address = JSONUtil.getText(object, "shipAddress");//收货地址
-        String time = DateFormatUtil.long2Str(JSONUtil.getLong(object, "erpDate", "date"), DateFormatUtil.YMD_HMS);//单据时间
-        String number = JSONUtil.getText(object, "qty");//数量
+        String time = DateFormatUtil.long2Str(JSONUtil.getLong(object, "erpDate", "date"), DateFormatUtil.YMD);//单据时间
         String date = DateFormatUtil.long2Str(JSONUtil.getLong(object, "replyDelivery", "delivery"), DateFormatUtil.YMD);//交货日期
         String replyRemark = JSONUtil.getText(object, "replyRemark");//采购单号
         int status = JSONUtil.getInt(object, "status");//状态
-
-
         String code;//采购单号
         String remarks;//备注|产品
         String alls;//总额|产品规格
         if (first) {
+            String currency = JSONUtil.getText(object, "currency");//采购单号
             code = JSONUtil.getText(object, "code");//采购单号
             remarks = JSONUtil.getText(object, "remark");//备注
             alls = JSONUtil.getText(object, "amount");//总额
+            JSONObject enterprise = JSONUtil.getJSONObject(object, "enterprise");//客户
+            String client = JSONUtil.getText(enterprise, "enName");
+            purchase.setCurrency(currency);
+            purchase.setCustomer(client);
         } else {
             JSONObject product = JSONUtil.getJSONObject(object, "product");
-            code = JSONUtil.getText(product, "cmpCode");
+            code = JSONUtil.getText(product, "code");
             remarks = JSONUtil.getText(product, "title");
             alls = JSONUtil.getText(product, "spec");
+            String amount = JSONUtil.getText(object, "amount");
+            String number = JSONUtil.getText(object, "number");//数量
+            LogUtil.i("number=" + number);
+            LogUtil.i("amount=" + amount);
+            purchase.setNumber(number);
+            purchase.setAmount(amount);
         }
         purchase.setCanInput(status == 200);
         purchase.setId(id);
         purchase.setCode(code);
-        purchase.setCustomer(client);
         purchase.setAddress(address);
         purchase.setTime(time);
         purchase.setRemarks(remarks);
         purchase.setTotal(alls);
         purchase.setDate(date);
-        purchase.setNumber(number);
         purchase.setRemarksInput(replyRemark);
         return purchase;
     }

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

@@ -84,7 +84,7 @@ public class PurchaseDetailsAdapter extends RecyclerView.Adapter<RecyclerView.Vi
     }
 
     class ViewHolder extends RecyclerView.ViewHolder {
-        TextView timeTv, remarksTv, totalTv, dateEd;
+        TextView timeTv, remarksTv, totalTv, dateEd,amountTv;
         EditText numberEd, remarksInputEd;
 
         public ViewHolder(ViewGroup viewGroup) {
@@ -94,6 +94,7 @@ public class PurchaseDetailsAdapter extends RecyclerView.Adapter<RecyclerView.Vi
         public ViewHolder(View itemView) {
             super(itemView);
             timeTv = itemView.findViewById(R.id.timeTv);
+            amountTv = itemView.findViewById(R.id.amountTv);
             remarksTv = itemView.findViewById(R.id.remarksTv);
             totalTv = itemView.findViewById(R.id.totalTv);
             dateEd = itemView.findViewById(R.id.dateEd);
@@ -104,7 +105,7 @@ public class PurchaseDetailsAdapter extends RecyclerView.Adapter<RecyclerView.Vi
     }
 
     class TotalViewHolder extends RecyclerView.ViewHolder {
-        TextView customerTv, addressTv, codeTv, timeTv, remarksTv, totalTv;
+        TextView customerTv, addressTv, codeTv, timeTv, remarksTv, totalTv,currencyTv;
 
         public TotalViewHolder(ViewGroup viewGroup) {
             this(mInflater.inflate(R.layout.item_ls_purchase, viewGroup, false));
@@ -112,6 +113,7 @@ public class PurchaseDetailsAdapter extends RecyclerView.Adapter<RecyclerView.Vi
 
         public TotalViewHolder(View itemView) {
             super(itemView);
+            currencyTv = itemView.findViewById(R.id.currencyTv);
             addressTv = itemView.findViewById(R.id.addressTv);
             codeTv = itemView.findViewById(R.id.codeTv);
             timeTv = itemView.findViewById(R.id.timeTv);
@@ -142,6 +144,7 @@ public class PurchaseDetailsAdapter extends RecyclerView.Adapter<RecyclerView.Vi
         holder.codeTv.setText(purchase.getCode());
         holder.remarksTv.setText(TextUtils.isEmpty(purchase.getRemarks()) ? "无" : purchase.getRemarks());
         holder.timeTv.setText(purchase.getTime());
+        holder.currencyTv.setText(purchase.getCurrency());
     }
 
     private void onBindViewHolder(BtnViewHolder holder) {
@@ -164,6 +167,7 @@ public class PurchaseDetailsAdapter extends RecyclerView.Adapter<RecyclerView.Vi
         holder.totalTv.setText(purchase.getTotal());
         holder.remarksTv.setText(purchase.getRemarks());
         holder.timeTv.setText(purchase.getCode());
+        holder.amountTv.setText(purchase.getAmount());
         holder.dateEd.setText(purchase.getDate());
         holder.numberEd.setText(purchase.getNumber());
         holder.remarksInputEd.setText(purchase.getRemarksInput());

+ 24 - 7
app_modular/appworks/src/main/java/com/uas/appworks/OA/platform/model/Purchase.java

@@ -9,14 +9,31 @@ public class Purchase {
     private boolean canInput;
     private String customer;
     private String address;
-    private  String code;
-    private  String time;
-    private  String remarks;
-    private  String total;
-    private  String date;
-    private  String number;
-    private  String remarksInput;
+    private String code;
+    private String time;
+    private String remarks;
+    private String total;
+    private String date;
+    private String number;
+    private String remarksInput;
+    private String amount;//单价
+    private String currency;//币种
 
+    public String getCurrency() {
+        return currency==null?"":currency;
+    }
+
+    public void setCurrency(String currency) {
+        this.currency = currency;
+    }
+
+    public String getAmount() {
+        return amount==null?"0":amount;
+    }
+
+    public void setAmount(String amount) {
+        this.amount = amount;
+    }
 
     public boolean isCanInput() {
         return canInput;

+ 25 - 6
app_modular/appworks/src/main/res/layout/item_ls_purchase.xml

@@ -26,9 +26,9 @@
     <android.support.v7.widget.AppCompatTextView
         android:id="@+id/addressTag"
         android:layout_width="80dp"
-        android:layout_marginTop="@dimen/padding"
         android:layout_height="wrap_content"
         android:layout_below="@id/customerTv"
+        android:layout_marginTop="@dimen/padding"
         android:text="收货地址:"
         android:textColor="@color/hintColor"
         android:textSize="@dimen/text_hine" />
@@ -46,9 +46,9 @@
     <android.support.v7.widget.AppCompatTextView
         android:id="@+id/codeTag"
         android:layout_width="80dp"
-        android:layout_marginTop="@dimen/padding"
         android:layout_height="wrap_content"
         android:layout_below="@id/addressTv"
+        android:layout_marginTop="@dimen/padding"
         android:text="订单号:"
         android:textColor="@color/hintColor"
         android:textSize="@dimen/text_hine" />
@@ -66,9 +66,9 @@
     <android.support.v7.widget.AppCompatTextView
         android:id="@+id/timeTag"
         android:layout_width="80dp"
-        android:layout_marginTop="@dimen/padding"
         android:layout_height="wrap_content"
         android:layout_below="@id/codeTv"
+        android:layout_marginTop="@dimen/padding"
         android:text="单据时间:"
         android:textColor="@color/hintColor"
         android:textSize="@dimen/text_hine" />
@@ -86,9 +86,9 @@
     <android.support.v7.widget.AppCompatTextView
         android:id="@+id/remarksTag"
         android:layout_width="80dp"
-        android:layout_marginTop="@dimen/padding"
         android:layout_height="wrap_content"
         android:layout_below="@id/timeTv"
+        android:layout_marginTop="@dimen/padding"
         android:text="备注:"
         android:textColor="@color/hintColor"
         android:textSize="@dimen/text_hine" />
@@ -105,11 +105,11 @@
 
     <android.support.v7.widget.AppCompatTextView
         android:id="@+id/totalTag"
-        android:layout_marginTop="@dimen/padding"
         android:layout_width="80dp"
         android:layout_height="wrap_content"
         android:layout_below="@id/remarksTv"
-        android:text="总额:"
+        android:layout_marginTop="@dimen/padding"
+        android:text="金额:"
         android:textColor="@color/hintColor"
         android:textSize="@dimen/text_hine" />
 
@@ -122,4 +122,23 @@
         android:text="客户:"
         android:textColor="@color/text_main"
         android:textSize="@dimen/text_hine" />
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/currencyTag"
+        android:layout_width="80dp"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/totalTv"
+        android:layout_marginTop="@dimen/padding"
+        android:text="币种:"
+        android:textColor="@color/hintColor"
+        android:textSize="@dimen/text_hine" />
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/currencyTv"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignTop="@id/currencyTag"
+        android:layout_toRightOf="@id/customerTag"
+        android:textColor="@color/text_main"
+        android:textSize="@dimen/text_hine" />
 </RelativeLayout>

+ 23 - 9
app_modular/appworks/src/main/res/layout/item_purchase.xml

@@ -39,7 +39,6 @@
         android:layout_height="wrap_content"
         android:layout_alignTop="@id/remarksTag"
         android:layout_toRightOf="@id/timeTag"
-        android:text="客户:"
         android:textColor="@color/text_main"
         android:textSize="@dimen/text_hine" />
 
@@ -59,16 +58,34 @@
         android:layout_height="wrap_content"
         android:layout_alignTop="@id/totalTag"
         android:layout_toRightOf="@id/timeTag"
-        android:text="客户:"
         android:textColor="@color/text_main"
         android:textSize="@dimen/text_hine" />
 
     <android.support.v7.widget.AppCompatTextView
-        android:id="@+id/dateTag"
+        android:id="@+id/amountTag"
         android:layout_width="80dp"
         android:layout_height="wrap_content"
         android:layout_below="@id/totalTv"
         android:layout_marginTop="@dimen/padding"
+        android:text="单价:"
+        android:textColor="@color/hintColor"
+        android:textSize="@dimen/text_hine" />
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/amountTv"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignTop="@id/amountTag"
+        android:layout_toRightOf="@id/timeTag"
+        android:textColor="@color/text_main"
+        android:textSize="@dimen/text_hine" />
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/dateTag"
+        android:layout_width="80dp"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/amountTv"
+        android:layout_marginTop="@dimen/padding"
         android:text="交货日期:"
         android:textColor="@color/hintColor"
         android:textSize="@dimen/text_hine" />
@@ -81,7 +98,6 @@
         android:layout_toRightOf="@id/timeTag"
         android:background="@drawable/edit_white_right_angle"
         android:gravity="center_vertical"
-        android:text="客户:"
         android:textColor="@color/text_main"
         android:textSize="@dimen/text_hine" />
 
@@ -104,7 +120,6 @@
         android:background="@drawable/edit_white_right_angle"
         android:gravity="center_vertical"
         android:inputType="number"
-        android:text="客户:"
         android:textColor="@color/text_main"
         android:textSize="@dimen/text_main" />
 
@@ -113,11 +128,11 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_alignTop="@id/numberTag"
+        android:layout_marginLeft="@dimen/padding"
         android:layout_toRightOf="@id/numberEd"
         android:gravity="center_vertical"
-        android:padding="0.5dp"
-        android:layout_marginLeft="@dimen/padding"
         android:inputType="number"
+        android:padding="0.5dp"
         android:text="PCS"
         android:textColor="@color/text_main"
         android:textSize="@dimen/text_hine" />
@@ -136,12 +151,11 @@
         android:id="@+id/remarksInputEd"
         android:layout_width="140dp"
         android:layout_height="wrap_content"
-        android:minHeight="25dp"
         android:layout_alignTop="@id/remarksInputTag"
         android:layout_toRightOf="@id/timeTag"
         android:background="@drawable/edit_white_right_angle"
         android:gravity="center_vertical"
-        android:text="客户:"
+        android:minHeight="25dp"
         android:textColor="@color/text_main"
         android:textSize="@dimen/text_hine" />