|
|
@@ -6,6 +6,7 @@ import com.google.gson.Gson;
|
|
|
import com.google.gson.JsonElement;
|
|
|
import com.google.gson.reflect.TypeToken;
|
|
|
import com.qy.agv.activity.model.BinLocModel;
|
|
|
+import com.qy.agv.activity.model.OrderModel;
|
|
|
import com.qy.agv.activity.model.RelocModel;
|
|
|
import com.qy.agv.activity.model.RobotModel;
|
|
|
import com.qy.agv.activity.model.ShelfModel;
|
|
|
@@ -122,6 +123,54 @@ public class MainDao {
|
|
|
return shelfModels;
|
|
|
}
|
|
|
|
|
|
+ public List<OrderModel> searchOrder(Context context, String external_id) {
|
|
|
+ List<OrderModel> orders = new ArrayList<>();
|
|
|
+ RequestParams params = HttpsUtil.httParams(Constant.Order_LIST);
|
|
|
+ params.addBodyParameter("current", "1");
|
|
|
+ params.addBodyParameter("externalId", external_id);
|
|
|
+ params.addBodyParameter("orderType", "0");
|
|
|
+ try {
|
|
|
+ AtomicReference<JSONObject> rsAtm = new AtomicReference<>(new JSONObject());
|
|
|
+ Thread s1 = new Thread(()->{
|
|
|
+ try {
|
|
|
+ rsAtm.set(x.http().getSync(params, JSONObject.class));
|
|
|
+ }catch (Throwable e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ try{
|
|
|
+ s1.start();
|
|
|
+ s1.join();
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ JSONObject rs = rsAtm.get();
|
|
|
+ if (rs.has("code") && rs.getInt("code") != 200) {
|
|
|
+ ToastUtils.showToast(context, "请求失败");
|
|
|
+ }
|
|
|
+ if (rs.has("success")) {
|
|
|
+ System.out.println(rs.get("data"));
|
|
|
+ Type rds = new TypeToken<Map<String, JsonElement>>() {
|
|
|
+ }.getType();
|
|
|
+ Map<String, JsonElement> records = new Gson().fromJson(rs.get("data").toString(), rds);
|
|
|
+ System.out.println(records.get("records"));
|
|
|
+ Type lt = new TypeToken<ArrayList<OrderModel>>() {}.getType();
|
|
|
+ Object rs_record = records.get("records");
|
|
|
+ if(rs_record!=null) {
|
|
|
+ orders = new Gson().fromJson(rs_record.toString(), lt);
|
|
|
+ System.out.println("查询结果" + orders.size());
|
|
|
+ if (orders.size()>0) {
|
|
|
+ System.out.println(orders.get(0).getOrderDesc());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Throwable e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ mylog.error("加载站点列表异常:", e);
|
|
|
+ }
|
|
|
+ return orders;
|
|
|
+ }
|
|
|
+
|
|
|
public List<BinLocModel> searchBinLoc(Context context) {
|
|
|
List<BinLocModel> binLocModels = new ArrayList<>();
|
|
|
RequestParams params = HttpsUtil.httParams(Constant.BIN_LOC_LIST);
|