|
|
@@ -7,6 +7,7 @@ import android.support.v7.widget.DividerItemDecoration;
|
|
|
import android.support.v7.widget.LinearLayoutManager;
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
import android.text.Editable;
|
|
|
+import android.text.TextUtils;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
@@ -20,6 +21,7 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baidu.cyberplayer.utils.G;
|
|
|
+import com.baidu.platform.comapi.map.E;
|
|
|
import com.chad.library.adapter.base.BaseViewHolder;
|
|
|
import com.common.LogUtil;
|
|
|
import com.common.data.CalendarUtil;
|
|
|
@@ -29,10 +31,13 @@ import com.common.data.ListUtils;
|
|
|
import com.common.data.StringUtil;
|
|
|
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.core.utils.time.wheel.DateTimePicker;
|
|
|
import com.core.widget.listener.EditChangeListener;
|
|
|
+import com.me.network.app.http.HttpClient;
|
|
|
import com.me.network.app.http.Method;
|
|
|
import com.modular.apputils.activity.BaseNetActivity;
|
|
|
import com.modular.apputils.listener.OnSmartHttpListener;
|
|
|
@@ -45,7 +50,9 @@ import com.uas.appworks.R;
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -67,7 +74,8 @@ public class PurchaseDetailsActivity extends BaseNetActivity implements OnSmartH
|
|
|
|
|
|
@Override
|
|
|
protected String getBaseUrl() {
|
|
|
- return "http://uas.ubtob.com/";
|
|
|
+// return "http://uas.ubtob.com/";
|
|
|
+ return "http://192.168.253.102:8090/platform-b2b/";
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -80,6 +88,7 @@ public class PurchaseDetailsActivity extends BaseNetActivity implements OnSmartH
|
|
|
if (varStatus == null) {
|
|
|
varStatus = "";
|
|
|
}
|
|
|
+ getSupportActionBar().setTitle(varStatus);
|
|
|
initView();
|
|
|
initData();
|
|
|
}
|
|
|
@@ -92,44 +101,97 @@ public class PurchaseDetailsActivity extends BaseNetActivity implements OnSmartH
|
|
|
}
|
|
|
|
|
|
private void initData() {
|
|
|
- handleMessage(TestStr.PURCHASE_STR);
|
|
|
+ loadData();
|
|
|
}
|
|
|
|
|
|
|
|
|
private void loadData() {
|
|
|
+ varId = 937370;
|
|
|
+ int enuu = 10041559;
|
|
|
+ String phone = "15671616315";
|
|
|
Parameter.Builder builder = new Parameter.Builder();
|
|
|
+ String url = "mobile/sale/orders/" + varId + "/info";//卖方
|
|
|
builder.mode(Method.GET)
|
|
|
- .url("sale/orders/" + varId + "/info");
|
|
|
+ .url(url)
|
|
|
+ .record(0x11)
|
|
|
+ .showLog(true)
|
|
|
+ .autoProgress(true)
|
|
|
+ .addParams("en_uu", enuu)
|
|
|
+ .addParams("user_tel", phone);
|
|
|
requestHttp(builder, this);
|
|
|
}
|
|
|
|
|
|
|
|
|
private void verifiReply(List<Purchase> purchases) {
|
|
|
- LogUtil.prinlnLongMsg("gongpengming", "json=" + JSON.toJSONString(purchases));
|
|
|
- reply();
|
|
|
+ for (Purchase purchase : purchases) {
|
|
|
+ if (!TextUtils.isEmpty(purchase.getDate()) &&
|
|
|
+ !TextUtils.isEmpty(purchase.getNumber()) &&
|
|
|
+ !TextUtils.isEmpty(purchase.getRemarksInput())) {
|
|
|
+ reply(purchase);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- private void reply() {
|
|
|
+ private void reply(Purchase purchases) {
|
|
|
+ int enuu = 10041559;
|
|
|
+ String phone = "15671616315";
|
|
|
Parameter.Builder builder = new Parameter.Builder();
|
|
|
- String json = null;
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("qty", purchases.getNumber());
|
|
|
+ map.put("delivery", 10);//DateFormatUtil.str2Long(purchases.getDate(),DateFormatUtil.YMD)
|
|
|
+ map.put("remark", purchases.getRemarksInput());
|
|
|
+ String json = JSONUtil.map2JSON(map);
|
|
|
+ LogUtil.i("json=" + json);
|
|
|
builder.mode(Method.POST)
|
|
|
- .url("sale/orders/items/{orderItemId}/reply")
|
|
|
- .addParams("json", json);
|
|
|
+ .url("mobile/sale/orders/items/" + purchases.getId() + "/reply")
|
|
|
+ .addParams("en_uu", enuu)
|
|
|
+ .addParams("body", json)
|
|
|
+ .showLog(true)
|
|
|
+ .autoProgress(true)
|
|
|
+ .addParams("user_tel", phone);
|
|
|
requestHttp(builder, this);
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void handleMessage(final String message) {
|
|
|
+ private void setData2Adapter(List<Purchase> dataList) {
|
|
|
+ mAdapter = new PurchaseDetailsAdapter(ct, varStatus, dataList);
|
|
|
+ mAdapter.setOnReplyLisenter(new PurchaseDetailsAdapter.OnReplyLisenter() {
|
|
|
+ @Override
|
|
|
+ public void reply(List<Purchase> purchases) {
|
|
|
+ PurchaseDetailsActivity.this.verifiReply(purchases);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ mRecyclerView.setAdapter(mAdapter);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int what, String message, Tags tag) throws Exception {
|
|
|
+ LogUtil.i("message=" + message);
|
|
|
+ switch (what) {
|
|
|
+ case 0x11:
|
|
|
+ handleMessage(message);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFailure(int what, String message, Tags tag) throws Exception {
|
|
|
+ ToastUtil.showToast(ct, message);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void handleMessage(final String message) throws Exception {
|
|
|
ThreadPool.getThreadPool().addTask(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
JSONObject object = JSON.parseObject(message);
|
|
|
final List<Purchase> dataList = new ArrayList<>();
|
|
|
dataList.add(getPurchase(object));
|
|
|
- JSONArray dataJSONs = JSONUtil.getJSONArray(object, "DATA");
|
|
|
- if (!ListUtils.isEmpty(dataJSONs)) {
|
|
|
- for (int i = 0; i < dataJSONs.size(); i++) {
|
|
|
- dataList.add(getPurchase(dataJSONs.getJSONObject(i)));
|
|
|
+ JSONArray orderItems = JSONUtil.getJSONArray(object, "orderItems");
|
|
|
+ if (!ListUtils.isEmpty(orderItems)) {
|
|
|
+ for (int i = 0; i < orderItems.size(); i++) {
|
|
|
+ dataList.add(getPurchase(orderItems.getJSONObject(i)));
|
|
|
}
|
|
|
}
|
|
|
OAHttpHelper.getInstance().post(new Runnable() {
|
|
|
@@ -142,46 +204,29 @@ public class PurchaseDetailsActivity extends BaseNetActivity implements OnSmartH
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+
|
|
|
private Purchase getPurchase(JSONObject object) {
|
|
|
Purchase purchase = new Purchase();
|
|
|
- int id = JSONUtil.getInt(object, "ID");
|
|
|
- String client = JSONUtil.getText(object, "CLIENT");
|
|
|
- String address = JSONUtil.getText(object, "ADDRESS");
|
|
|
- String time = JSONUtil.getText(object, "TIME");
|
|
|
- String remarks = JSONUtil.getText(object, "REMARKS");
|
|
|
- String alls = JSONUtil.getText(object, "ALLS");
|
|
|
- String number = JSONUtil.getText(object, "NUMBER");
|
|
|
- String date = JSONUtil.getText(object, "DELIVERYDATE");
|
|
|
- purchase.setNumber(number);
|
|
|
- purchase.setDate(date);
|
|
|
+ int id = JSONUtil.getInt(object, "id");
|
|
|
+ String client = JSONUtil.getText(object, "receiveName");//客户
|
|
|
+ String address = JSONUtil.getText(object, "shipAddress");//收货地址
|
|
|
+ String code = JSONUtil.getText(object, "code");//采购单号
|
|
|
+ String time = DateFormatUtil.long2Str(JSONUtil.getLong(object, "erpDate", "date"), DateFormatUtil.YMD_HMS);//单据时间
|
|
|
+ String remarks = JSONUtil.getText(object, "remark");//备注
|
|
|
+ String alls = JSONUtil.getText(object, "amount");//总额
|
|
|
+ String number = JSONUtil.getText(object, "qty");//数量
|
|
|
+ String date = DateFormatUtil.long2Str(JSONUtil.getLong(object, "delivery"), DateFormatUtil.YMD);//交货日期
|
|
|
+ String replyRemark = JSONUtil.getText(object, "replyRemark");//采购单号
|
|
|
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;
|
|
|
}
|
|
|
-
|
|
|
- private void setData2Adapter(List<Purchase> dataList) {
|
|
|
- mAdapter = new PurchaseDetailsAdapter(ct, varStatus, dataList);
|
|
|
- mAdapter.setOnReplyLisenter(new PurchaseDetailsAdapter.OnReplyLisenter() {
|
|
|
- @Override
|
|
|
- public void reply(List<Purchase> purchases) {
|
|
|
- PurchaseDetailsActivity.this.verifiReply(purchases);
|
|
|
- }
|
|
|
- });
|
|
|
- mRecyclerView.setAdapter(mAdapter);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onSuccess(int what, String message, Tags tag) throws Exception {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onFailure(int what, String message, Tags tag) throws Exception {
|
|
|
-
|
|
|
- }
|
|
|
}
|