@@ -1,5 +1,6 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<project version="4"> | |||
<component name="GradleMigrationSettings" migrationVersion="1" /> | |||
<component name="GradleSettings"> | |||
<option name="linkedExternalProjectsSettings"> | |||
<GradleProjectSettings> | |||
@@ -499,6 +499,7 @@ public class MainActivity extends AppCompatActivity { | |||
}else | |||
{ | |||
//查询用户信息-是否会员信息 | |||
Log.i("当前用户信息", DataBus.getInstance().selectMerge.userId); | |||
Main.getInstance().GetUser(DataBus.getInstance().selectMerge.userId); | |||
runOnUiThread(new Runnable() { | |||
@Override | |||
@@ -508,7 +509,7 @@ public class MainActivity extends AppCompatActivity { | |||
iscartk.setVisibility(View.VISIBLE); | |||
//region 获取已消费金额 | |||
double yxfprice=0; | |||
if(DataBus.getInstance().selectMerge.orderList!=null) | |||
if(DataBus.getInstance().selectMerge.orderList!=null && DataBus.getInstance().selectMerge.orderList.size()>0) | |||
{ | |||
BPA_Order order= DataBus.getInstance().selectMerge.orderList.get(0); | |||
if(order!=null && order.subOrderList!=null && order.subOrderList.size()>0) | |||
@@ -541,6 +542,7 @@ public class MainActivity extends AppCompatActivity { | |||
@Override | |||
public void onMessage(Object msg) { | |||
if (msg != null) { | |||
Log.i("查询用户会员信息", (String)msg); | |||
if((msg!=null) && (((String)msg).length()>2)){ | |||
ReceiveUserModel model=new Json<ReceiveUserModel>().jsonToobject(ReceiveUserModel.class,((String)msg)); | |||
@@ -591,12 +593,13 @@ public class MainActivity extends AppCompatActivity { | |||
@Override | |||
public void onMessage(Object msg) { | |||
if (msg != null) { | |||
Log.i("创建子订单结果", (String)msg); | |||
if((msg!=null) && (((String)msg).length()>2)){ | |||
runOnUiThread(new Runnable() { | |||
@Override | |||
public void run() { | |||
String str=String.format("用户消费成功!\n当前用户:{0}\n当前卡号:{1}\n当前消费重量:{2}g\n当前消费金额:{3}元\n", | |||
String str=String.format("用户消费成功!\n当前用户:%s\n当前卡号:%s\n当前消费重量:%sg\n当前消费金额:%s元\n", | |||
DataBus.getInstance().selectuser.nickName, | |||
DataBus.getInstance().Ch, | |||
DataBus.getInstance().addsuborder.consumeUnit, | |||
@@ -1,5 +1,7 @@ | |||
package com.bpa.scalage.app; | |||
import android.util.Log; | |||
import com.bpa.scalage.MainActivity; | |||
import com.bpa.scalage.config.ConfigName; | |||
import com.bpa.scalage.config.MessageName; | |||
@@ -105,7 +107,9 @@ public class Main { | |||
*/ | |||
public void GetUser(String OpenId) | |||
{ | |||
//oh0Xy4v9t2AwutYMpRTB51z6falI | |||
//String api="https://bpa.black-pa.com:21528/kitchen/api/member-helper/memberinfobywechat/987654321"; | |||
Log.i("查询用户接口", ConfigName.getInstance().GetUserUrl+OpenId); | |||
HttpUtils.httpPost(MessageName.GetUserInformation.name(),ConfigName.getInstance().GetUserUrl+OpenId,""); | |||
} | |||
@@ -114,7 +118,7 @@ public class Main { | |||
*/ | |||
public void GetUserAndOrderGX(String CartId) | |||
{ | |||
HttpUtils.httpGet(MessageName.GetUserAndCartGX.name(),ConfigName.getInstance().GetUserOrCartGX+CartId); | |||
HttpUtils.httpGet(MessageName.GetUserAndCartGX.name(),ConfigName.getInstance().GetUserOrCartGX+CartId+"/"+ConfigName.getInstance().Shop_Id); | |||
} | |||
/** | |||
@@ -26,7 +26,7 @@ public class ConfigName { | |||
/** | |||
* 店铺ID | |||
*/ | |||
public String Shop_Id="d55b4e04-d17f-45df-bc0a-12e39734ff00"; | |||
public String Shop_Id="8f969239-3fe3-4e60-bf60-60b16a9f7b37"; | |||
/** | |||
* 店铺设备号 | |||
*/ | |||
@@ -34,7 +34,7 @@ public class ConfigName { | |||
//region uRL | |||
//Sass地址 | |||
public String SaasAddress="https://bpa.black-pa.com:21528"; | |||
public String SaasAddress="https://bpa.black-pa.com:21527"; | |||
//获取店铺菜品接口 Get | |||
public String GetFruitUrl=SaasAddress+"/kitchen/api/StoreHelper/StoreGoodsMenuByStoreId?storeId="+Shop_Id; | |||
//获取店铺详细信息 Get | |||
@@ -43,10 +43,10 @@ public class ConfigName { | |||
public String GetUserUrl=SaasAddress+"/kitchen/api/member-helper/memberinfobywechat/"; | |||
//查询Vip用户信息 | |||
public String GetVipUserUrl=SaasAddress+"/kitchen/api/member-helper/memberinfobymemberid_wechat/"; | |||
//获取用户与卡的订单的关联关系 | |||
public String GetUserOrCartGX="http://124.222.238.75:9092/api/User/Getorder?id="; | |||
//获取用户与卡的订单的关联关系 https://bpa.black-pa.com:21528/order/order/orderantusericard/64F9D80311A204E0/d55b4e04-d17f-45df-bc0a-12e39734ff00 | |||
public String GetUserOrCartGX=SaasAddress+"/order/order/orderantusericard/"; | |||
//创建子订单接口 | |||
public String AddSuOrderUrl="http://124.222.238.75:9092/api/User/AddOrder"; | |||
public String AddSuOrderUrl=SaasAddress+"/order/order/orderdetail"; | |||
//endregion | |||
//region 菜品放置区 | |||
@@ -33,8 +33,10 @@ import com.bpa.scalage.helper.T; | |||
import com.bpa.scalage.message.MessageManager; | |||
import com.lztek.toolkit.SerialPort; | |||
import com.pc_rfid.api.PC_API; | |||
import com.pc_rfid.api.PC_COMM; | |||
import com.pc_rfid.api.RFdata; | |||
import java.io.OutputStream; | |||
import java.util.concurrent.ConcurrentLinkedQueue; | |||
/** | |||
@@ -63,7 +65,7 @@ public class SystemDebugFragment extends Fragment { | |||
//读卡区域 保存按钮 | |||
private TextView system_open_cp,de_cp_ms,de_cp_data; | |||
//称重区域 保存按钮 | |||
private TextView system_open_cpgy,de_cpgy_ms,de_cpgy_data; | |||
private TextView system_open_cpgy,de_cpgy_ms,de_cpgy_data,clear_zl; | |||
private EditText de_receive; | |||
//endregion | |||
@@ -109,7 +111,7 @@ public class SystemDebugFragment extends Fragment { | |||
system_open_cpgy=MainView.findViewById(R.id.system_open_cpgy); | |||
de_cpgy_ms=MainView.findViewById(R.id.de_cpgy_ms); | |||
de_cpgy_data=MainView.findViewById(R.id.de_cpgy_data); | |||
clear_zl=MainView.findViewById(R.id.clear_zl); | |||
//根据配置自动填充下拉项-选中文字 | |||
SetShowText(); | |||
@@ -154,6 +156,14 @@ public class SystemDebugFragment extends Fragment { | |||
} | |||
} | |||
}); | |||
//清除重量 | |||
clear_zl.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
WriteData(); | |||
} | |||
}); | |||
} | |||
/** | |||
* 设置界面显示 | |||
@@ -350,6 +360,28 @@ public class SystemDebugFragment extends Fragment { | |||
//endregion | |||
//region 称重数据处理 | |||
/** | |||
* 清零 | |||
*/ | |||
public void WriteData() | |||
{ | |||
if(mSerialPort!=null) | |||
{ | |||
OutputStream mOutputStream = mSerialPort.getOutputStream(); | |||
byte[] bytes=new byte[5];//字符转成byte数组 | |||
bytes[0] = 0x01; | |||
bytes[1] = 0x03; | |||
bytes[2] = 0x54; | |||
bytes[3] = 0x21; | |||
bytes[4] = 0x0f; | |||
try { | |||
mOutputStream.write(bytes);//通过输出流写入数据 | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
} | |||
} | |||
} | |||
/** | |||
* 串口处理函数 | |||
*/ | |||
@@ -384,7 +416,6 @@ public class SystemDebugFragment extends Fragment { | |||
java.io.InputStream input = null; | |||
try { | |||
input = mSerialPort.getInputStream(); | |||
byte[] buffer = new byte[1024]; | |||
int len = input.read(buffer); | |||
return len > 0 ? java.util.Arrays.copyOfRange(buffer, 0, len) : null; | |||
@@ -223,6 +223,7 @@ | |||
android:layout_marginBottom="20dp" | |||
android:layout_marginTop="20dp"> | |||
<TextView | |||
android:id="@+id/clear_zl" | |||
android:layout_width="130dp" | |||
android:layout_height="wrap_content" | |||
android:layout_marginLeft="20dp" | |||
@@ -231,33 +232,33 @@ | |||
android:text="重量清零" | |||
android:textColor="@color/white" | |||
android:textSize="@dimen/submit_text_size"/> | |||
<TextView | |||
android:layout_width="130dp" | |||
android:layout_height="wrap_content" | |||
android:layout_marginLeft="20dp" | |||
android:background="@drawable/selector_renren_blue_button" | |||
android:gravity="center" | |||
android:text="标定负载" | |||
android:textColor="@color/white" | |||
android:textSize="@dimen/submit_text_size"/> | |||
<TextView | |||
android:layout_width="130dp" | |||
android:layout_height="wrap_content" | |||
android:layout_marginLeft="20dp" | |||
android:background="@drawable/selector_renren_blue_button" | |||
android:gravity="center" | |||
android:text="设置精度" | |||
android:textColor="@color/white" | |||
android:textSize="@dimen/submit_text_size"/> | |||
<TextView | |||
android:layout_width="130dp" | |||
android:layout_height="wrap_content" | |||
android:layout_marginLeft="20dp" | |||
android:background="@drawable/selector_renren_blue_button" | |||
android:gravity="center" | |||
android:text="标定负载" | |||
android:textColor="@color/white" | |||
android:textSize="@dimen/submit_text_size"/> | |||
<!-- <TextView--> | |||
<!-- android:layout_width="130dp"--> | |||
<!-- android:layout_height="wrap_content"--> | |||
<!-- android:layout_marginLeft="20dp"--> | |||
<!-- android:background="@drawable/selector_renren_blue_button"--> | |||
<!-- android:gravity="center"--> | |||
<!-- android:text="标定负载"--> | |||
<!-- android:textColor="@color/white"--> | |||
<!-- android:textSize="@dimen/submit_text_size"/>--> | |||
<!-- <TextView--> | |||
<!-- android:layout_width="130dp"--> | |||
<!-- android:layout_height="wrap_content"--> | |||
<!-- android:layout_marginLeft="20dp"--> | |||
<!-- android:background="@drawable/selector_renren_blue_button"--> | |||
<!-- android:gravity="center"--> | |||
<!-- android:text="设置精度"--> | |||
<!-- android:textColor="@color/white"--> | |||
<!-- android:textSize="@dimen/submit_text_size"/>--> | |||
<!-- <TextView--> | |||
<!-- android:layout_width="130dp"--> | |||
<!-- android:layout_height="wrap_content"--> | |||
<!-- android:layout_marginLeft="20dp"--> | |||
<!-- android:background="@drawable/selector_renren_blue_button"--> | |||
<!-- android:gravity="center"--> | |||
<!-- android:text="标定负载"--> | |||
<!-- android:textColor="@color/white"--> | |||
<!-- android:textSize="@dimen/submit_text_size"/>--> | |||
</LinearLayout> | |||
<EditText | |||
android:layout_marginTop="20dp" | |||