Пример #1
0
 @Override
 public void handleMessage(Message msg) {
   OrderDetail orderDetail;
   Bundle bundle;
   switch (msg.what) {
     case 0x12:
       bundle = msg.getData();
       orderDetail = (OrderDetail) bundle.getSerializable("orderDetail");
       reOrderStatus = orderDetail.getOrderStatusLists().get(0); // 获取订单最新状态
       setOrderDetailInfo(orderDetail);
       break;
     case 0x13:
       primaryId = getIntent().getStringExtra("primaryId");
       requestOrderDetailData(primaryId);
   }
 }
Пример #2
0
  /**
   * 更新订单
   *
   * @param orderDetail
   */
  private void operationOrder(final OrderDetail orderDetail) {

    receiveOrder.setBackgroundResource(R.drawable.border_corner_order);
    receiveOrder.setEnabled(false);

    int controlId = orderDetail.getControlId();
    final int controlStatus = orderDetail.getOrderStatusLists().get(0);
    String sessionUUID = getSessionUUID();
    String url =
        Constant.ENTRANCE_PREFIX
            + "appAutoUpdateOrderStatus.json?sessionUuid="
            + sessionUUID
            + "&controlId="
            + controlId;
    OkHttpClientManager.getAsyn(
        url,
        new OkHttpClientManager.ResultCallback<String>() {
          @Override
          public void onError(Request request, Exception e) {
            receiveOrder.setBackgroundResource(R.drawable.border_corner_order);
            receiveOrder.setEnabled(true);
          }

          @Override
          public void onResponse(String response) {
            JSONObject jsonObject;
            JSONArray jsonArray;
            List<OrderPerTime> orderPerTimeList = orderDetail.getOrderPerTimeList();
            try {
              jsonObject = new JSONObject(response);
              if (!jsonObject.getString("status").equals(Constant.LOGIN_SUCCESS_STATUS)) {
                Toast.makeText(getApplicationContext(), "接单异常异常", Toast.LENGTH_SHORT).show();
                return;
              }

              //                    TimerService timerService= EdydApplication.timerService;
              //                    LocationSource.OnLocationChangedListener listener =
              // TimerService.mListener;
              //                    timerService.stopTimer();
              //                    timerService.startTimer();
              //                    timerService.reActivate(listener);

              // ServiceUtil.cancelAlarmManager(getApplicationContext());
              // ServiceUtil.invokeTimerPOIService(getApplicationContext(),
              // String.valueOf(orderDetail.getControlId()), String.valueOf(controlStatus));
              MLocation mLocation;
              switch (controlStatus) {
                case 17:
                  tControlStatus = 20;
                  break;
                case 20:
                  tControlStatus = 30;
                  break;
                case 30:
                  tControlStatus = 40;
                  break;
                case 40:
                  tControlStatus = 50;
                  break;
                case 50:
                  tControlStatus = 60;
                  break;
                case 60:
                  tControlStatus = 99;
                  break;
              }
              mLocation =
                  new MLocation(
                      getApplicationContext(),
                      common,
                      String.valueOf(orderDetail.getControlId()),
                      String.valueOf(tControlStatus));

              Message message = new Message();
              message.what = 0x13;
              handler.sendMessage(message);
            } catch (JSONException e) {
              e.printStackTrace();
            }
          }
        });
  }
Пример #3
0
  /**
   * 设置订单数据
   *
   * @param orderDetail
   */
  public void setOrderDetailInfo(OrderDetail orderDetail) {
    List<OrderPerTime> orderPerTimeList = orderDetail.getOrderPerTimeList();
    List<Integer> orderStatusLists = orderDetail.getOrderStatusLists();
    Set<Integer> ts = new HashSet<Integer>();
    ts.addAll(orderStatusLists);
    int type = ts.size(); // 类别

    if (!(orderPerTimeList.size() == orderStatusLists.size())) {
      Toast.makeText(getApplicationContext(), "订单详情数据显示异常", Toast.LENGTH_SHORT).show();
      return;
    }
    switch (type) {
      case 1: // 未接单
        break;
      case 2: // 接单
        executeFirstPoint.setImageResource(R.mipmap.line_car); // 第一个点设置为车辆图标
        for (int i = 0; i < 1; i++) {
          if (i == 0) {
            executeFirstTime.setText(orderPerTimeList.get(i).getHour());
            executeFirstDate.setText(orderPerTimeList.get(i).getDate());
            // 设置颜色...
            tvFirstTime.setTextColor(getResources().getColor(R.color.user_icon_8));
            executeFirstTime.setTextColor(getResources().getColor(R.color.user_icon_8));
            executeFirstDate.setTextColor(getResources().getColor(R.color.user_icon_8));
          }
        }
        break;
      case 3: // 到达装货
        executeFirstPoint.setImageResource(R.mipmap.execute_green);
        executeFirstLine.setBackgroundResource(R.color.green_55e6ac);
        executeSecondLine.setBackgroundResource(R.color.green_55e6ac);
        executeSecondPoint.setImageResource(R.mipmap.line_car);
        for (int i = 0; i < 2; i++) {
          if (i == 0) {
            executeSecondTime.setText(orderPerTimeList.get(i).getHour());
            executeSecondDate.setText(orderPerTimeList.get(i).getDate());
            // 设置颜色...
            tvSecondTime.setTextColor(getResources().getColor(R.color.user_icon_8));
            executeSecondTime.setTextColor(getResources().getColor(R.color.user_icon_8));
            executeSecondDate.setTextColor(getResources().getColor(R.color.user_icon_8));

            tvFirstTime.setTextColor(getResources().getColor(R.color.dim_foreground_dark));
            executeFirstTime.setTextColor(getResources().getColor(R.color.dim_foreground_dark));
            executeFirstDate.setTextColor(getResources().getColor(R.color.dim_foreground_dark));
          } else if (i == 1) {
            executeFirstTime.setText(orderPerTimeList.get(i).getHour());
            executeFirstDate.setText(orderPerTimeList.get(i).getDate());
          }
        }
        break;
      case 4: // 装货完成
        executeFirstPoint.setImageResource(R.mipmap.execute_green);
        executeFirstLine.setBackgroundResource(R.color.green_55e6ac);
        executeSecondLine.setBackgroundResource(R.color.green_55e6ac);
        executeSecondPoint.setImageResource(R.mipmap.execute_green);
        executeThirdLine.setBackgroundResource(R.color.green_55e6ac);
        executeFourLine.setBackgroundResource(R.color.green_55e6ac);
        executeThirdPoint.setImageResource(R.mipmap.line_car);
        for (int i = 0; i < 3; i++) {
          if (i == 0) {
            executeThirdTime.setText(orderPerTimeList.get(i).getHour());
            executeThirdDate.setText(orderPerTimeList.get(i).getDate());
            // 设置颜色...
            tvThirdTime.setTextColor(getResources().getColor(R.color.user_icon_8));
            executeThirdTime.setTextColor(getResources().getColor(R.color.user_icon_8));
            executeThirdDate.setTextColor(getResources().getColor(R.color.user_icon_8));

            tvSecondTime.setTextColor(getResources().getColor(R.color.dim_foreground_dark));
            executeSecondTime.setTextColor(getResources().getColor(R.color.dim_foreground_dark));
            executeSecondDate.setTextColor(getResources().getColor(R.color.dim_foreground_dark));
          } else if (i == 1) {
            executeSecondTime.setText(orderPerTimeList.get(i).getHour());
            executeSecondDate.setText(orderPerTimeList.get(i).getDate());
          } else if (i == 2) {
            executeFirstTime.setText(orderPerTimeList.get(i).getHour());
            executeFirstDate.setText(orderPerTimeList.get(i).getDate());
          }
        }
        break;
      case 5: // 送货在途
        executeFirstPoint.setImageResource(R.mipmap.execute_green);
        executeFirstLine.setBackgroundResource(R.color.green_55e6ac);
        executeSecondLine.setBackgroundResource(R.color.green_55e6ac);

        executeSecondPoint.setImageResource(R.mipmap.execute_green);
        executeThirdLine.setBackgroundResource(R.color.green_55e6ac);
        executeFourLine.setBackgroundResource(R.color.green_55e6ac);

        executeThirdPoint.setImageResource(R.mipmap.execute_green);
        executeFiveLine.setBackgroundResource(R.color.green_55e6ac);
        executeSixLine.setBackgroundResource(R.color.green_55e6ac);

        executeFourPoint.setImageResource(R.mipmap.line_car);
        for (int i = 0; i < 4; i++) {
          if (i == 0) {
            executeFourTime.setText(orderPerTimeList.get(i).getHour());
            executeFourDate.setText(orderPerTimeList.get(i).getDate());
            // 设置颜色...
            tvFourTime.setTextColor(getResources().getColor(R.color.user_icon_8));
            executeFourTime.setTextColor(getResources().getColor(R.color.user_icon_8));
            executeFourDate.setTextColor(getResources().getColor(R.color.user_icon_8));

            tvThirdTime.setTextColor(getResources().getColor(R.color.dim_foreground_dark));
            executeThirdTime.setTextColor(getResources().getColor(R.color.dim_foreground_dark));
            executeThirdDate.setTextColor(getResources().getColor(R.color.dim_foreground_dark));
          } else if (i == 1) {
            executeThirdTime.setText(orderPerTimeList.get(i).getHour());
            executeThirdDate.setText(orderPerTimeList.get(i).getDate());
          } else if (i == 2) {
            executeSecondTime.setText(orderPerTimeList.get(i).getHour());
            executeSecondDate.setText(orderPerTimeList.get(i).getDate());
          } else if (i == 3) {
            executeFirstTime.setText(orderPerTimeList.get(i).getHour());
            executeFirstDate.setText(orderPerTimeList.get(i).getDate());
          }
        }
        break;
      case 6: // 到达收货
        executeFirstPoint.setImageResource(R.mipmap.execute_green);
        executeFirstLine.setBackgroundResource(R.color.green_55e6ac);
        executeSecondLine.setBackgroundResource(R.color.green_55e6ac);

        executeSecondPoint.setImageResource(R.mipmap.execute_green);
        executeThirdLine.setBackgroundResource(R.color.green_55e6ac);
        executeFourLine.setBackgroundResource(R.color.green_55e6ac);

        executeThirdPoint.setImageResource(R.mipmap.execute_green);
        executeFiveLine.setBackgroundResource(R.color.green_55e6ac);
        executeSixLine.setBackgroundResource(R.color.green_55e6ac);

        executeFourPoint.setImageResource(R.mipmap.execute_green);
        executeSevenLine.setBackgroundResource(R.color.green_55e6ac);
        executeEightLine.setBackgroundResource(R.color.green_55e6ac);

        executeFivePoint.setImageResource(R.mipmap.line_car);
        for (int i = 0; i < 5; i++) {
          if (i == 0) {
            executeFiveTime.setText(orderPerTimeList.get(i).getHour());
            executeFiveDate.setText(orderPerTimeList.get(i).getDate());
            // 设置颜色...
            tvFiveTime.setTextColor(getResources().getColor(R.color.user_icon_8));
            executeFiveTime.setTextColor(getResources().getColor(R.color.user_icon_8));
            executeFiveDate.setTextColor(getResources().getColor(R.color.user_icon_8));

            tvFourTime.setTextColor(getResources().getColor(R.color.dim_foreground_dark));
            executeFourTime.setTextColor(getResources().getColor(R.color.dim_foreground_dark));
            executeFourDate.setTextColor(getResources().getColor(R.color.dim_foreground_dark));
          } else if (i == 1) {
            executeFourTime.setText(orderPerTimeList.get(i).getHour());
            executeFourDate.setText(orderPerTimeList.get(i).getDate());
          } else if (i == 2) {
            executeThirdTime.setText(orderPerTimeList.get(i).getHour());
            executeThirdDate.setText(orderPerTimeList.get(i).getDate());
          } else if (i == 3) {
            executeSecondTime.setText(orderPerTimeList.get(i).getHour());
            executeSecondDate.setText(orderPerTimeList.get(i).getDate());
          } else if (i == 4) {
            executeFirstTime.setText(orderPerTimeList.get(i).getHour());
            executeFirstDate.setText(orderPerTimeList.get(i).getDate());
          }
        }
        break;
      case 7: // 收货完成
        executeFirstPoint.setImageResource(R.mipmap.execute_green);
        executeFirstLine.setBackgroundResource(R.color.green_55e6ac);
        executeSecondLine.setBackgroundResource(R.color.green_55e6ac);

        executeSecondPoint.setImageResource(R.mipmap.execute_green);
        executeThirdLine.setBackgroundResource(R.color.green_55e6ac);
        executeFourLine.setBackgroundResource(R.color.green_55e6ac);

        executeThirdPoint.setImageResource(R.mipmap.execute_green);
        executeFiveLine.setBackgroundResource(R.color.green_55e6ac);
        executeSixLine.setBackgroundResource(R.color.green_55e6ac);

        executeFourPoint.setImageResource(R.mipmap.execute_green);
        executeSevenLine.setBackgroundResource(R.color.green_55e6ac);
        executeEightLine.setBackgroundResource(R.color.green_55e6ac);

        executeFivePoint.setImageResource(R.mipmap.execute_green);
        executeNineLine.setBackgroundResource(R.color.green_55e6ac);
        executeTenLine.setBackgroundResource(R.color.green_55e6ac);

        executeSixPoint.setImageResource(R.mipmap.line_car);
        for (int i = 0; i < 6; i++) {
          if (i == 0) {
            executeSixTime.setText(orderPerTimeList.get(i).getHour());
            executeSixDate.setText(orderPerTimeList.get(i).getDate());
            // 设置颜色...
            tvSixTime.setTextColor(getResources().getColor(R.color.user_icon_8));
            executeSixTime.setTextColor(getResources().getColor(R.color.user_icon_8));
            executeSixDate.setTextColor(getResources().getColor(R.color.user_icon_8));

            tvFiveTime.setTextColor(getResources().getColor(R.color.dim_foreground_dark));
            executeFiveTime.setTextColor(getResources().getColor(R.color.dim_foreground_dark));
            executeFiveDate.setTextColor(getResources().getColor(R.color.dim_foreground_dark));
          } else if (i == 1) {
            executeFiveTime.setText(orderPerTimeList.get(i).getHour());
            executeFiveDate.setText(orderPerTimeList.get(i).getDate());
          } else if (i == 2) {
            executeFourTime.setText(orderPerTimeList.get(i).getHour());
            executeFourDate.setText(orderPerTimeList.get(i).getDate());
          } else if (i == 3) {
            executeThirdTime.setText(orderPerTimeList.get(i).getHour());
            executeThirdDate.setText(orderPerTimeList.get(i).getDate());
          } else if (i == 4) {
            executeSecondTime.setText(orderPerTimeList.get(i).getHour());
            executeSecondDate.setText(orderPerTimeList.get(i).getDate());
          } else if (i == 5) {
            executeFirstTime.setText(orderPerTimeList.get(i).getHour());
            executeFirstDate.setText(orderPerTimeList.get(i).getDate());
          }
        }
        break;
    }

    orderNumber.setText(orderDetail.getControlNum());
    orderDate.setText(orderDetail.getOrderDate());
    startPoint.setText(orderDetail.getStartPoint());
    endPoint.setText(orderDetail.getEndPoint());
    shipper.setText(orderDetail.getShipper());
    phoneNumber.setText(orderDetail.getPhoneNumber());
    consignee.setText(orderDetail.getConsignee());
    consigneePhoneNumber.setText(orderDetail.getConsigneePhoneNumber());

    switch (orderStatusLists.get(0)) {
      case 17: // 未接单
        receiveOrder.setText(getString(R.string.receive_order));
        break;
      case 20: // 已接单
        orderStatus.setImageResource(R.mipmap.tts_loading_way);
        receiveOrder.setText("到达装货");
        break;
      case 30: //	到达装货
        orderStatus.setImageResource(R.mipmap.tts_arrived_load);
        receiveOrder.setText("装货完成");
        break;
      case 40: // 装货完成
        orderStatus.setImageResource(R.mipmap.tts_completion_load);
        receiveOrder.setText("送货在途");
        break;
      case 50: // 送货在途
        orderStatus.setImageResource(R.mipmap.tts_delivery_way);
        receiveOrder.setText("到达收货");
        break;
      case 60: // 到达收货
        orderStatus.setImageResource(R.mipmap.tts_arrived_receive);
        receiveOrder.setText("收货完成");
        break;
      case 99: // 收货完成
        orderStatus.setImageResource(R.mipmap.finished_receive);
        receiveOrder.setBackgroundResource(R.drawable.border_corner_login);
        receiveOrder.setText("完成订单");
        receiveOrder.setEnabled(false);
        // orderStatus.setVisibility(View.GONE);
        break;
    }

    List<String> goodNameList = orderDetail.getGoodNameLists();
    String goods = "";
    for (int i = 0; i < goodNameList.size(); i++) {
      if (i == goodNameList.size() - 1) {
        goods = goods + goodNameList.get(i);
      } else {
        goods = goods + goodNameList.get(i) + "、";
      }
    }
    goodsName.setText(goods);
    goodsTotalVolume.setText(orderDetail.getGoodsTotalVolume());
    goodsTotalQuantity.setText(orderDetail.getGoodsTotalQuantity());
    goodsTotalWeight.setText(orderDetail.getGoodsTotalWeight());

    receiveOrder.setOnClickListener(new CusOnClickListener(orderDetail)); // 给接单按钮添加监听事件

    if (!(orderStatusLists.get(0) == 99)) {
      receiveOrder.setBackgroundResource(R.drawable.border_corner_order);
      receiveOrder.setEnabled(true);
    }
    // loadingDialog.getLoadingDialog().dismiss();
  }