|
|
@@ -21,6 +21,7 @@ import com.bpa.scalage.message.MessageLooper; |
|
|
|
import com.bpa.scalage.message.MessageManager; |
|
|
|
import com.bpa.scalage.mode.Foods.FoodModel; |
|
|
|
import com.bpa.scalage.helper.T; |
|
|
|
import com.bpa.scalage.mode.Order.AddSubOrder; |
|
|
|
import com.bpa.scalage.mode.Order.BPA_Order; |
|
|
|
import com.bpa.scalage.mode.Order.BPA_SubOrder; |
|
|
|
import com.bpa.scalage.mode.UserAndCart.UserAndCartMerge; |
|
|
@@ -444,21 +445,22 @@ public class MainActivity extends AppCompatActivity { |
|
|
|
public void SendApiConsume() |
|
|
|
{ |
|
|
|
//满足条件 创建子订单 |
|
|
|
if(DataBus.getInstance().xf_price>0 && DataBus.getInstance().selectMerge!=null && !DataBus.getInstance().selectMerge.orderId.isEmpty()) |
|
|
|
if(DataBus.getInstance().xf_price>0 && DataBus.getInstance().selectMerge!=null |
|
|
|
&& !DataBus.getInstance().selectMerge.orderId.isEmpty() && DataBus.getInstance().selectMerge.orderList!=null |
|
|
|
&& DataBus.getInstance().selectMerge.orderList.size()>0) |
|
|
|
{ |
|
|
|
//判断是否查询到 |
|
|
|
String str=String.format("用户消费成功!\n当前用户:{0}\n当前消费重量:{1}g\n当前消费金额:{2}元\n", |
|
|
|
DataBus.getInstance().selectuser.nickName, |
|
|
|
DataBus.getInstance().xf_weight, |
|
|
|
String.format("%.2f",DataBus.getInstance().xf_price)); |
|
|
|
Log.i("DEBUG", ""); |
|
|
|
Log.i("DEBUG", "当前用户:"+DataBus.getInstance().selectuser.nickName ); |
|
|
|
Log.i("DEBUG", "当前卡号:"+DataBus.getInstance().CartNo ); |
|
|
|
Log.i("DEBUG", "当前初重:"+DataBus.getInstance().start_weight+"g"); |
|
|
|
Log.i("DEBUG", "当前末重:"+DataBus.getInstance().weight+"g"); |
|
|
|
Log.i("DEBUG", "当前消费重量:"+DataBus.getInstance().xf_weight+"g"); |
|
|
|
Log.i("DEBUG", "当前消费金额:"+String.format("%.2f",DataBus.getInstance().xf_price)+"元"); |
|
|
|
T.show(MainActivity.this, str); |
|
|
|
DataBus.getInstance().Ch=DataBus.getInstance().CartNo; |
|
|
|
DataBus.getInstance().addsuborder=new AddSubOrder(); |
|
|
|
DataBus.getInstance().addsuborder.orderId=DataBus.getInstance().selectMerge.orderList.get(0).id; |
|
|
|
DataBus.getInstance().addsuborder.goodId=DataBus.getInstance().SelectFood.id; |
|
|
|
DataBus.getInstance().addsuborder.goodName=DataBus.getInstance().SelectFood.name; |
|
|
|
DataBus.getInstance().addsuborder.storeId=ConfigName.getInstance().Shop_Id; |
|
|
|
DataBus.getInstance().addsuborder.gooodOriginPrice=DataBus.getInstance().xf_price; |
|
|
|
DataBus.getInstance().addsuborder.goodsRealPrice=DataBus.getInstance().xf_price; |
|
|
|
DataBus.getInstance().addsuborder.remark="称重台主动创建"; |
|
|
|
DataBus.getInstance().addsuborder.cookingStatus=1; |
|
|
|
DataBus.getInstance().addsuborder.consumeUnit=String.valueOf(DataBus.getInstance().xf_weight); |
|
|
|
Main.getInstance().AddSubOrder(new Json<AddSubOrder>().objectToJson(AddSubOrder.class,DataBus.getInstance().addsuborder)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -482,13 +484,16 @@ public class MainActivity extends AppCompatActivity { |
|
|
|
if (msg != null) { |
|
|
|
if((msg!=null) && (((String)msg).length()>2)){ |
|
|
|
ReceiveUserAndCartGXModel model=new Json<ReceiveUserAndCartGXModel>().jsonToobject(ReceiveUserAndCartGXModel.class,((String)msg)); |
|
|
|
DataBus.getInstance().selectMerge=model.data; |
|
|
|
if(model.data==null || model.data.icardId.isEmpty()|| model.data.userId.isEmpty()) |
|
|
|
if(model.data==null) |
|
|
|
DataBus.getInstance().selectMerge=null; |
|
|
|
else |
|
|
|
DataBus.getInstance().selectMerge=model.data; |
|
|
|
if(model.data==null) |
|
|
|
{ |
|
|
|
runOnUiThread(new Runnable() { |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
former_price.setText("¥"+ String.format("%.2f",0));//已消费 |
|
|
|
former_price.setText("¥"+ String.format("%.2f",0.00));//已消费 |
|
|
|
T.show(MainActivity.this,"请先用微信扫码下单!"); |
|
|
|
} |
|
|
|
}); |
|
|
@@ -582,6 +587,38 @@ public class MainActivity extends AppCompatActivity { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
//创建子订单返回 |
|
|
|
MessageManager.getInstance().registerMessageReceiver(this, MessageName.AddSuOrderUrl.name(), new MessageLooper.OnMessageListener() { |
|
|
|
@Override |
|
|
|
public void onMessage(Object msg) { |
|
|
|
if (msg != null) { |
|
|
|
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", |
|
|
|
DataBus.getInstance().selectuser.nickName, |
|
|
|
DataBus.getInstance().Ch, |
|
|
|
DataBus.getInstance().addsuborder.consumeUnit, |
|
|
|
String.format("%.2f",DataBus.getInstance().addsuborder.goodsRealPrice)); |
|
|
|
Log.i("DEBUG", str); |
|
|
|
|
|
|
|
T.show(MainActivity.this, str); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}else |
|
|
|
{ |
|
|
|
runOnUiThread(new Runnable() { |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
T.show(MainActivity.this,"服务器异常,请稍后重试!"); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
//endregion |
|
|
|
} |