Commit 29df5b49 by llxqb

擎朗机器人正式环境提交,修改统一更换tag值,strings下和DinnerUtil类下面

parent 39fccf6e
...@@ -21,7 +21,8 @@ import peanut.keenon.com.network.WebApiRequest; ...@@ -21,7 +21,8 @@ import peanut.keenon.com.network.WebApiRequest;
public class RobotServiceAction extends BaseAction<WebResponse> { public class RobotServiceAction extends BaseAction<WebResponse> {
private static final String O2O_URL_ADDRESS = "http://waimaiapitest.freemudorder.com/api"; private static final String O2O_URL_ADDRESS_DEBUG = "http://waimaiapitest.freemudorder.com/api";
private static final String O2O_URL_ADDRESS_RELEASE = "http://wmpos.sandload.cn/api";
// private static final String O2O_URL_ADDRESS = "http://111.231.64.247/api"; // private static final String O2O_URL_ADDRESS = "http://111.231.64.247/api";
@Override @Override
...@@ -41,7 +42,7 @@ public class RobotServiceAction extends BaseAction<WebResponse> { ...@@ -41,7 +42,7 @@ public class RobotServiceAction extends BaseAction<WebResponse> {
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
} }
GsonRequest<WebResponse> jr = new GsonRequest<WebResponse>(Request.Method.POST, O2O_URL_ADDRESS, jsonRequest, WebResponse.class , this, this); GsonRequest<WebResponse> jr = new GsonRequest<WebResponse>(Request.Method.POST, O2O_URL_ADDRESS_RELEASE, jsonRequest, WebResponse.class , this, this);
jr.setIndex(WebApiRequest.USER_LOGIN_INDEX); jr.setIndex(WebApiRequest.USER_LOGIN_INDEX);
jr.setTag(WebApiRequest.USER_LOGIN_REQUEST); jr.setTag(WebApiRequest.USER_LOGIN_REQUEST);
addRequestQueue(jr); addRequestQueue(jr);
...@@ -60,7 +61,7 @@ public class RobotServiceAction extends BaseAction<WebResponse> { ...@@ -60,7 +61,7 @@ public class RobotServiceAction extends BaseAction<WebResponse> {
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
} }
GsonRequest<WebResponse> jr = new GsonRequest<WebResponse>(Request.Method.POST, O2O_URL_ADDRESS, jsonRequest, WebResponse.class , this, this); GsonRequest<WebResponse> jr = new GsonRequest<WebResponse>(Request.Method.POST, O2O_URL_ADDRESS_RELEASE, jsonRequest, WebResponse.class , this, this);
jr.setIndex(WebApiRequest.ORDER_QUERY_INDEX); jr.setIndex(WebApiRequest.ORDER_QUERY_INDEX);
jr.setTag(WebApiRequest.ORDER_QUERY_REQUEST); jr.setTag(WebApiRequest.ORDER_QUERY_REQUEST);
addRequestQueue(jr); addRequestQueue(jr);
...@@ -78,7 +79,7 @@ public class RobotServiceAction extends BaseAction<WebResponse> { ...@@ -78,7 +79,7 @@ public class RobotServiceAction extends BaseAction<WebResponse> {
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
} }
GsonRequest<WebResponse> jr = new GsonRequest<WebResponse>(Request.Method.POST, O2O_URL_ADDRESS, jsonRequest, WebResponse.class , this, this); GsonRequest<WebResponse> jr = new GsonRequest<WebResponse>(Request.Method.POST, O2O_URL_ADDRESS_RELEASE, jsonRequest, WebResponse.class , this, this);
jr.setIndex(WebApiRequest.ORDER_DELIVERY_INDEX); jr.setIndex(WebApiRequest.ORDER_DELIVERY_INDEX);
jr.setTag(WebApiRequest.ORDER_DELIVERY_REQUEST); jr.setTag(WebApiRequest.ORDER_DELIVERY_REQUEST);
addRequestQueue(jr); addRequestQueue(jr);
...@@ -96,7 +97,7 @@ public class RobotServiceAction extends BaseAction<WebResponse> { ...@@ -96,7 +97,7 @@ public class RobotServiceAction extends BaseAction<WebResponse> {
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
} }
GsonRequest<WebResponse> jr = new GsonRequest<WebResponse>(Request.Method.POST, O2O_URL_ADDRESS, jsonRequest, WebResponse.class , this, this); GsonRequest<WebResponse> jr = new GsonRequest<WebResponse>(Request.Method.POST, O2O_URL_ADDRESS_RELEASE, jsonRequest, WebResponse.class , this, this);
jr.setIndex(WebApiRequest.ORDER_COMPLETED_INDEX); jr.setIndex(WebApiRequest.ORDER_COMPLETED_INDEX);
jr.setTag(WebApiRequest.ORDER_COMPLETED_REQUEST); jr.setTag(WebApiRequest.ORDER_COMPLETED_REQUEST);
addRequestQueue(jr); addRequestQueue(jr);
......
...@@ -165,8 +165,6 @@ public class DinnerActivity extends Activity implements View.OnClickListener { ...@@ -165,8 +165,6 @@ public class DinnerActivity extends Activity implements View.OnClickListener {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dinner); setContentView(R.layout.activity_dinner);
// SystemUtils.getMinDp(this);
// SystemUtils.getPixelSize(this);
mContext = this; mContext = this;
//initialize robot relative interface //initialize robot relative interface
initXunfei(); initXunfei();
...@@ -228,10 +226,10 @@ public class DinnerActivity extends Activity implements View.OnClickListener { ...@@ -228,10 +226,10 @@ public class DinnerActivity extends Activity implements View.OnClickListener {
public void onClick(View v) { public void onClick(View v) {
switch (v.getId()) { switch (v.getId()) {
case R.id.btn_reset: case R.id.btn_reset:
if (mCurrentIndex == 0) { // if (mCurrentIndex == 0) {
Toast.makeText(this, "请先选择餐桌号", Toast.LENGTH_SHORT).show(); // Toast.makeText(this, "请先选择餐桌号", Toast.LENGTH_SHORT).show();
return; // return;
} // }
mCurrentPlate = null; mCurrentPlate = null;
mCurrentIndex = 0; mCurrentIndex = 0;
mTableGroup.clearCheck(); mTableGroup.clearCheck();
...@@ -410,7 +408,7 @@ public class DinnerActivity extends Activity implements View.OnClickListener { ...@@ -410,7 +408,7 @@ public class DinnerActivity extends Activity implements View.OnClickListener {
*/ */
private void dispatching(int current) { private void dispatching(int current) {
if (current < targetData.size()) {//仍然有未送达的餐,这里继续进行送餐 if (current < targetData.size()) {//仍然有未送达的餐,这里继续进行送餐
mDinnerStatusValue.setText(DinnerUtil.tranPointName(targetData.get(current))); mDinnerStatusValue.setText(DinnerUtil.tranPointName(targetData.get(current),DinnerActivity.this));
btnCancel.setVisibility(View.VISIBLE); btnCancel.setVisibility(View.VISIBLE);
mPickup.setVisibility(View.GONE); mPickup.setVisibility(View.GONE);
int target = Integer.valueOf(targetData.get(current).toString()); int target = Integer.valueOf(targetData.get(current).toString());
...@@ -484,7 +482,7 @@ public class DinnerActivity extends Activity implements View.OnClickListener { ...@@ -484,7 +482,7 @@ public class DinnerActivity extends Activity implements View.OnClickListener {
case WebApiRequest.ORDER_QUERY_INDEX: case WebApiRequest.ORDER_QUERY_INDEX:
OrderInfo info = data.order; OrderInfo info = data.order;
if (info != null && info.tab_num != null && !info.tab_num.isEmpty()) { if (info != null && info.tab_num != null && !info.tab_num.isEmpty()) {
RadioButton radioButton = findRadioButtonByTag(Integer.valueOf(info.tab_num)); RadioButton radioButton = findRadioButtonByTag(DinnerUtil.tranPointByTableName(info.tab_num));
if (radioButton != null) { if (radioButton != null) {
radioButton.performClick(); radioButton.performClick();
mTts.startSpeaking(radioButton.getText().toString(), mTtsListener); mTts.startSpeaking(radioButton.getText().toString(), mTtsListener);
...@@ -582,7 +580,7 @@ public class DinnerActivity extends Activity implements View.OnClickListener { ...@@ -582,7 +580,7 @@ public class DinnerActivity extends Activity implements View.OnClickListener {
case LOGIN: case LOGIN:
try { try {
mAction.setIndex(WebApiRequest.USER_LOGIN_INDEX); mAction.setIndex(WebApiRequest.USER_LOGIN_INDEX);
mAction.login(AppConstant.LOGIN_USERNAME, AppConstant.LOGIN_PASSWORD); mAction.login(AppConstant.LOGIN_USERNAME_RELEASE, AppConstant.LOGIN_PASSWORD_RELEASE);
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -883,7 +881,7 @@ public class DinnerActivity extends Activity implements View.OnClickListener { ...@@ -883,7 +881,7 @@ public class DinnerActivity extends Activity implements View.OnClickListener {
top.setText(""); top.setText("");
left.setText(""); left.setText("");
right.setText(""); right.setText("");
} else if(status==RobotStatus.WALKING){//送餐状态 } else if (status == RobotStatus.WALKING) {//送餐状态
currentRobotStatus = 1; currentRobotStatus = 1;
mTts.startSpeaking("出发啦!", mTtsListener); mTts.startSpeaking("出发啦!", mTtsListener);
robotParams.weight = 0; robotParams.weight = 0;
...@@ -896,7 +894,7 @@ public class DinnerActivity extends Activity implements View.OnClickListener { ...@@ -896,7 +894,7 @@ public class DinnerActivity extends Activity implements View.OnClickListener {
btnCancel.setVisibility(View.VISIBLE); btnCancel.setVisibility(View.VISIBLE);
mDinnerStatus.setVisibility(View.VISIBLE); mDinnerStatus.setVisibility(View.VISIBLE);
mDinnerStatusValue.setVisibility(View.VISIBLE); mDinnerStatusValue.setVisibility(View.VISIBLE);
mDinnerStatusValue.setText(DinnerUtil.tranPointName(targetData.get(0))); mDinnerStatusValue.setText(DinnerUtil.tranPointName(targetData.get(0),DinnerActivity.this));
mLoading.setVisibility(View.VISIBLE); mLoading.setVisibility(View.VISIBLE);
if (mLoading.isAnimating()) { if (mLoading.isAnimating()) {
mLoading.stop(); mLoading.stop();
...@@ -915,7 +913,7 @@ public class DinnerActivity extends Activity implements View.OnClickListener { ...@@ -915,7 +913,7 @@ public class DinnerActivity extends Activity implements View.OnClickListener {
mediaPlayer.seekTo(0); mediaPlayer.seekTo(0);
mediaPlayer.start();//开始播放 mediaPlayer.start();//开始播放
} }
}else { } else {
currentRobotStatus = 0; currentRobotStatus = 0;
if (mediaPlayer != null) { if (mediaPlayer != null) {
mediaPlayer.pause(); mediaPlayer.pause();
......
...@@ -2,20 +2,31 @@ package peanut.keenon.com.util; ...@@ -2,20 +2,31 @@ package peanut.keenon.com.util;
/** /**
* Created by ping.ge on 2018/5/16. * Created by ping.ge on 2018/5/16.
* 常量值
*/ */
public class AppConstant { public class AppConstant {
public static final int ERROR_SUCCESS = 100; public static final int ERROR_SUCCESS = 100;
/** /**
* 机器人初始点位 * 机器人初始点位
*/ */
public static final int INIT_POINT = 60006; public static final int INIT_POINT = 60006;
public static final int TABLE_ONE_TAG = 81;
public static final int TABLE_TWO_TAG = 82;
public static final int TABLE_THREE_TAG = 83;
public static final int TABLE_FOUR_TAG = 84;
public static final int TABLE_FIVE_TAG = 85;
/** /**
* 登陆信息 * 登陆信息
*/ */
public static final String LOGIN_USERNAME = "ql_pos_Keenon001"; public static final String LOGIN_USERNAME_DEBUG = "ql_pos_Keenon001";
public static final String LOGIN_USERNAME_RELEASE = "Keenon001";
public static final String LOGIN_PASSWORD_DEBUG = "posoperator@freemud.cn";
public static final String LOGIN_PASSWORD_RELEASE = "Keenon001";
public static final String LOGIN_PASSWORD = "posoperator@freemud.cn";
} }
package peanut.keenon.com.util; package peanut.keenon.com.util;
import android.content.Context;
import android.text.TextUtils;
import peanut.keenon.com.peanutsample.R;
/** /**
* Created by li.liu on 2018/11/27. * Created by li.liu on 2018/11/27.
* 送餐util
* 修改点位时记得同时更改strings下 餐桌点位值
*/ */
public class DinnerUtil { public class DinnerUtil {
public static String tranPointName(int point){ public static String tranPointName(int point, Context context) {
String pointName =null; String pointName = null;
if(point== 60006){ if (point == AppConstant.INIT_POINT) {
pointName = "返回中"; pointName = "返回中";
}else if(point== 81){ } else if (point == AppConstant.TABLE_ONE_TAG) {
pointName = "送餐中:一号餐桌"; pointName = "送餐中:"+context.getResources().getString(R.string.table_one_name);
}else if(point== 82){ } else if (point == AppConstant.TABLE_TWO_TAG) {
pointName = "送餐中:二号餐桌"; pointName = "送餐中:"+context.getResources().getString(R.string.table_two_name);
}else if(point== 83){ } else if (point == AppConstant.TABLE_THREE_TAG) {
pointName = "送餐中:三号餐桌"; pointName = "送餐中:"+context.getResources().getString(R.string.table_three_name);
}else if(point== 84){ } else if (point == AppConstant.TABLE_FOUR_TAG) {
pointName = "送餐中:四号餐桌"; pointName = "送餐中:"+context.getResources().getString(R.string.table_four_name);
}else if(point== 85){ } else if (point == AppConstant.TABLE_FIVE_TAG) {
pointName = "送餐中:五号餐桌"; pointName = "送餐中:"+context.getResources().getString(R.string.table_five_name);
} }
return pointName; return pointName;
} }
/**
* 根据餐桌号获取餐桌点位(tag值)
*
* @param pointTableName 餐桌号
* @return 餐桌tag
*/
public static Integer tranPointByTableName(String pointTableName) {
Integer pointValue = 0;
if (TextUtils.equals(pointTableName, "1")) {
pointValue = AppConstant.TABLE_ONE_TAG;
} else if (TextUtils.equals(pointTableName, "2")) {
pointValue = AppConstant.TABLE_TWO_TAG;
} else if (TextUtils.equals(pointTableName, "3")) {
pointValue = AppConstant.TABLE_THREE_TAG;
} else if (TextUtils.equals(pointTableName, "4")) {
pointValue = AppConstant.TABLE_FOUR_TAG;
} else if (TextUtils.equals(pointTableName, "5")) {
pointValue = AppConstant.TABLE_FIVE_TAG;
}
return pointValue;
}
} }
...@@ -90,8 +90,8 @@ ...@@ -90,8 +90,8 @@
android:background="@drawable/radiobutton_background" android:background="@drawable/radiobutton_background"
android:button="@null" android:button="@null"
android:gravity="center" android:gravity="center"
android:tag="60006" android:tag="@string/table_point_tag"
android:text="服务台" android:text="@string/table_point_name"
android:textColor="@color/radiobutton_textcolor" android:textColor="@color/radiobutton_textcolor"
android:textSize="@dimen/sp_14" /> android:textSize="@dimen/sp_14" />
...@@ -104,8 +104,8 @@ ...@@ -104,8 +104,8 @@
android:background="@drawable/radiobutton_background" android:background="@drawable/radiobutton_background"
android:button="@null" android:button="@null"
android:gravity="center" android:gravity="center"
android:tag="81" android:tag="@string/table_one_tag"
android:text="一号餐桌" android:text="@string/table_one_name"
android:textColor="@color/radiobutton_textcolor" android:textColor="@color/radiobutton_textcolor"
android:textSize="@dimen/sp_14" /> android:textSize="@dimen/sp_14" />
...@@ -118,8 +118,8 @@ ...@@ -118,8 +118,8 @@
android:background="@drawable/radiobutton_background" android:background="@drawable/radiobutton_background"
android:button="@null" android:button="@null"
android:gravity="center" android:gravity="center"
android:tag="82" android:tag="@string/table_two_tag"
android:text="二号餐桌" android:text="@string/table_two_name"
android:textColor="@color/radiobutton_textcolor" android:textColor="@color/radiobutton_textcolor"
android:textSize="@dimen/sp_14" /> android:textSize="@dimen/sp_14" />
...@@ -132,8 +132,8 @@ ...@@ -132,8 +132,8 @@
android:background="@drawable/radiobutton_background" android:background="@drawable/radiobutton_background"
android:button="@null" android:button="@null"
android:gravity="center" android:gravity="center"
android:tag="83" android:tag="@string/table_three_tag"
android:text="三号餐桌" android:text="@string/table_three_name"
android:textColor="@color/radiobutton_textcolor" android:textColor="@color/radiobutton_textcolor"
android:textSize="@dimen/sp_14" /> android:textSize="@dimen/sp_14" />
...@@ -146,8 +146,8 @@ ...@@ -146,8 +146,8 @@
android:background="@drawable/radiobutton_background" android:background="@drawable/radiobutton_background"
android:button="@null" android:button="@null"
android:gravity="center" android:gravity="center"
android:tag="84" android:tag="@string/table_four_tag"
android:text="四号餐桌" android:text="@string/table_four_name"
android:textColor="@color/radiobutton_textcolor" android:textColor="@color/radiobutton_textcolor"
android:textSize="@dimen/sp_14" /> android:textSize="@dimen/sp_14" />
...@@ -160,8 +160,8 @@ ...@@ -160,8 +160,8 @@
android:background="@drawable/radiobutton_background" android:background="@drawable/radiobutton_background"
android:button="@null" android:button="@null"
android:gravity="center" android:gravity="center"
android:tag="85" android:tag="@string/table_five_tag"
android:text="五号餐桌" android:text="@string/table_five_name"
android:textColor="@color/radiobutton_textcolor" android:textColor="@color/radiobutton_textcolor"
android:textSize="@dimen/sp_14" /> android:textSize="@dimen/sp_14" />
......
...@@ -19,4 +19,19 @@ ...@@ -19,4 +19,19 @@
<string name="dinner_right_table">3</string> <string name="dinner_right_table">3</string>
<string name="dinner_table_have_check">已经被选择,请选择其它餐桌</string> <string name="dinner_table_have_check">已经被选择,请选择其它餐桌</string>
<string name="dinner_table_hint">请选择餐桌号,机器人会按右侧餐桌顺序送餐</string> <string name="dinner_table_hint">请选择餐桌号,机器人会按右侧餐桌顺序送餐</string>
<string name="table_point_name">服务台</string>
<string name="table_one_name">一号餐桌</string>
<string name="table_two_name">二号餐桌</string>
<string name="table_three_name">三号餐桌</string>
<string name="table_four_name">四号餐桌</string>
<string name="table_five_name">五号餐桌</string>
<!--餐桌点位值 -->
<string name="table_point_tag">60006</string>
<string name="table_one_tag">81</string>
<string name="table_two_tag">82</string>
<string name="table_three_tag">83</string>
<string name="table_four_tag">84</string>
<string name="table_five_tag">85</string>
</resources> </resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment