|
|
@@ -488,103 +488,109 @@ public class MainActivity extends FragmentActivity implements View.OnClickListen |
|
|
|
*/ |
|
|
|
public void ShowDialog(String id) { |
|
|
|
try { |
|
|
|
OrderID = id; |
|
|
|
ArrayList<BPA_SUBORDER> sub = QueryDB.GetSubOrderList(id); |
|
|
|
DataBus.getInstance().GoodsSMMake.clear(); |
|
|
|
for (BPA_SUBORDER k : sub) { |
|
|
|
ResGoodsMake make = new ResGoodsMake(); |
|
|
|
make.recipes = QueryDB.GetGoodsSrecipeList(k.goodsID); |
|
|
|
BPA_GOODS good = QueryDB.GetGoodsId(k.goodsID); |
|
|
|
if (good.name != null) { |
|
|
|
make.good = QueryDB.GetGoodsId(k.goodsID); |
|
|
|
make.subOrder = k; |
|
|
|
if(!isFinishing()) |
|
|
|
{ |
|
|
|
OrderID = id; |
|
|
|
ArrayList<BPA_SUBORDER> sub = QueryDB.GetSubOrderList(id); |
|
|
|
DataBus.getInstance().GoodsSMMake.clear(); |
|
|
|
for (BPA_SUBORDER k : sub) { |
|
|
|
ResGoodsMake make = new ResGoodsMake(); |
|
|
|
make.recipes = QueryDB.GetGoodsSrecipeList(k.goodsID); |
|
|
|
BPA_GOODS good = QueryDB.GetGoodsId(k.goodsID); |
|
|
|
if (good.name != null) { |
|
|
|
make.good = QueryDB.GetGoodsId(k.goodsID); |
|
|
|
make.subOrder = k; |
|
|
|
|
|
|
|
make.makeMs = ""; |
|
|
|
make.makeProcess = 0; |
|
|
|
if (k.status == 0) { |
|
|
|
make.makeStatus = MakeStatus.等待制作; |
|
|
|
} else if (k.status == 1) { |
|
|
|
make.makeStatus = MakeStatus.制作中; |
|
|
|
} else { |
|
|
|
make.makeStatus = MakeStatus.制作完成; |
|
|
|
make.makeMs = ""; |
|
|
|
make.makeProcess = 100; |
|
|
|
for (ResGoodsRecipe recipe : make.recipes) { |
|
|
|
recipe.makeProcess = 100; |
|
|
|
make.makeProcess = 0; |
|
|
|
if (k.status == 0) { |
|
|
|
make.makeStatus = MakeStatus.等待制作; |
|
|
|
} else if (k.status == 1) { |
|
|
|
make.makeStatus = MakeStatus.制作中; |
|
|
|
} else { |
|
|
|
make.makeStatus = MakeStatus.制作完成; |
|
|
|
make.makeMs = ""; |
|
|
|
make.makeProcess = 100; |
|
|
|
for (ResGoodsRecipe recipe : make.recipes) { |
|
|
|
recipe.makeProcess = 100; |
|
|
|
} |
|
|
|
} |
|
|
|
// if(!make.makeStatus.equals(MakeStatus.制作完成)) |
|
|
|
{ |
|
|
|
DataBus.getInstance().GoodsSMMake.add(make); |
|
|
|
} |
|
|
|
} |
|
|
|
// if(!make.makeStatus.equals(MakeStatus.制作完成)) |
|
|
|
{ |
|
|
|
DataBus.getInstance().GoodsSMMake.add(make); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (DataBus.getInstance().GoodsSMMake.size() <= 0) { |
|
|
|
runOnUiThread(new Runnable() { |
|
|
|
if (DataBus.getInstance().GoodsSMMake.size() <= 0) { |
|
|
|
runOnUiThread(new Runnable() { |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
T.show(MainActivity.this, "无可制作的订单!"); |
|
|
|
} |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
ResGoodsMake statusMode = DataBus.getInstance().GoodsSMMake.get(0); |
|
|
|
|
|
|
|
|
|
|
|
if (!DataBus.getInstance().PlcIsConnect) { |
|
|
|
T.show(this, "PLC未连接,不允许制作!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (BusinessServer.Get().Commoditys.size() > 0) { |
|
|
|
T.show(this, "请等待前一饮品制作完成!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// 1.创建弹框对象,显示在当前页面 |
|
|
|
AlertDialog.Builder ab = new AlertDialog.Builder(this); |
|
|
|
// 2.编辑弹框样式 |
|
|
|
// 2.1 创建标题 |
|
|
|
ab.setTitle("配料安全提示"); |
|
|
|
// 2.3 设置图标 |
|
|
|
ab.setIcon(R.mipmap.ts); |
|
|
|
// 2.4 设置内容 |
|
|
|
ab.setMessage("请将碗放好后,务必保证碗在出料口下方,点击‘出料’开始出料?"); |
|
|
|
// 2.5 设置按钮 |
|
|
|
ab.setPositiveButton("取消出料", new DialogInterface.OnClickListener() { |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
T.show(MainActivity.this, "无可制作的订单!"); |
|
|
|
public void onClick(DialogInterface dialogInterface, int i) { |
|
|
|
ActiveMax.MaxFrom(activity);//最大化 |
|
|
|
} |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
ResGoodsMake statusMode = DataBus.getInstance().GoodsSMMake.get(0); |
|
|
|
ab.setNeutralButton("开始出料", new DialogInterface.OnClickListener() { |
|
|
|
@Override |
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
BusinessServer.Get().AddCommodity(statusMode.subOrder); |
|
|
|
T.show(context, "开始下方配方:" + statusMode.good.name.toString()); |
|
|
|
ActiveMax.MaxFrom(activity);//最大化 |
|
|
|
Speech.startAuto("开始执行" + statusMode.good.name + "配料"); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 3.创建弹框 |
|
|
|
ab.create(); |
|
|
|
// 4.显示弹框 |
|
|
|
AlertDialog dialog = ab.show(); |
|
|
|
|
|
|
|
|
|
|
|
if (!DataBus.getInstance().PlcIsConnect) { |
|
|
|
T.show(this, "PLC未连接,不允许制作!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
//外部配料按钮 |
|
|
|
DeviceData.Get().OnIngredientButtonPressedNotify = new IRun() { |
|
|
|
@Override |
|
|
|
public void Run() { |
|
|
|
dialog.dismiss(); |
|
|
|
BusinessServer.Get().AddCommodity(statusMode.subOrder); |
|
|
|
T.show(context, "开始下方配方:" + statusMode.good.name.toString()); |
|
|
|
ActiveMax.MaxFrom(activity);//最大化 |
|
|
|
Speech.startAuto("开始执行" + statusMode.good.name + "配料"); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
if (BusinessServer.Get().Commoditys.size() > 0) { |
|
|
|
T.show(this, "请等待前一饮品制作完成!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// 1.创建弹框对象,显示在当前页面 |
|
|
|
AlertDialog.Builder ab = new AlertDialog.Builder(this); |
|
|
|
// 2.编辑弹框样式 |
|
|
|
// 2.1 创建标题 |
|
|
|
ab.setTitle("配料安全提示"); |
|
|
|
// 2.3 设置图标 |
|
|
|
ab.setIcon(R.mipmap.ts); |
|
|
|
// 2.4 设置内容 |
|
|
|
ab.setMessage("请将碗放好后,务必保证碗在出料口下方,点击‘出料’开始出料?"); |
|
|
|
// 2.5 设置按钮 |
|
|
|
ab.setPositiveButton("取消出料", new DialogInterface.OnClickListener() { |
|
|
|
@Override |
|
|
|
public void onClick(DialogInterface dialogInterface, int i) { |
|
|
|
ActiveMax.MaxFrom(activity);//最大化 |
|
|
|
} |
|
|
|
}); |
|
|
|
ab.setNeutralButton("开始出料", new DialogInterface.OnClickListener() { |
|
|
|
@Override |
|
|
|
public void onClick(DialogInterface dialog, int which) { |
|
|
|
BusinessServer.Get().AddCommodity(statusMode.subOrder); |
|
|
|
T.show(context, "开始下方配方:" + statusMode.good.name.toString()); |
|
|
|
ActiveMax.MaxFrom(activity);//最大化 |
|
|
|
Speech.startAuto("开始执行" + statusMode.good.name + "配料"); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 3.创建弹框 |
|
|
|
ab.create(); |
|
|
|
// 4.显示弹框 |
|
|
|
AlertDialog dialog = ab.show(); |
|
|
|
|
|
|
|
|
|
|
|
//外部配料按钮 |
|
|
|
DeviceData.Get().OnIngredientButtonPressedNotify = new IRun() { |
|
|
|
@Override |
|
|
|
public void Run() { |
|
|
|
dialog.dismiss(); |
|
|
|
BusinessServer.Get().AddCommodity(statusMode.subOrder); |
|
|
|
T.show(context, "开始下方配方:" + statusMode.good.name.toString()); |
|
|
|
ActiveMax.MaxFrom(activity);//最大化 |
|
|
|
Speech.startAuto("开始执行" + statusMode.good.name + "配料"); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// runOnUiThread(new Runnable() { |
|
|
|
// @Override |
|
|
@@ -655,9 +661,9 @@ public class MainActivity extends FragmentActivity implements View.OnClickListen |
|
|
|
String[] res = ((String) msg).split("[|]"); |
|
|
|
if (res.length >= 4) { |
|
|
|
String Mgoodid = ""; |
|
|
|
String orderid = res[0]; |
|
|
|
String goodid = res[1]; |
|
|
|
String ggid = res[2]; |
|
|
|
String orderid = res[0];//P0003 |
|
|
|
String goodid = res[1];//P0003 |
|
|
|
String ggid = res[2];//A001,M002,T001 |
|
|
|
int num = 1; |
|
|
|
try { |
|
|
|
num = Integer.parseInt(res[3]); |
|
|
|