From 13a80b264b27ec163ebfdd1f6cfa8d99588142f4 Mon Sep 17 00:00:00 2001
From: liup <1454939542@qq.com>
Date: Tue, 17 Dec 2024 18:03:52 +0800
Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=BC=80=E5=8F=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/other.xml | 329 ++++++++++++++++++
app/src/main/AndroidManifest.xml | 7 +-
.../business/ExecuteTheRecipe.java | 294 +++++++++-------
.../common/constant/ConfigName.java | 4 +
.../common/db/util/OrderDetailUtil.java | 21 ++
.../newui/activity/MainHActivity.java | 9 +-
.../newui/activity/PlcDebugActivity.java | 134 +++++++
.../newui/activity/SystemSetActivity.java | 28 +-
.../newui/adapter/order/FoodInfoAdapter.java | 20 +-
.../newui/adapter/order/OrderInfoAdapter.java | 2 +-
.../dialog/check/ChuCanPenCheckDialog.java | 172 +++++++++
.../dialog/control/FoodPosSetDialog.java | 13 +-
.../dialog/control/RobotControlDialog.java | 2 +-
.../dialog/control/WokControlDialog.java | 22 +-
.../fragment/main/HomeDevicesFragment.java | 24 +-
.../fragment/main/HomeMainsFragment.java | 30 +-
.../fragment/main/HomeOrderFragment.java | 92 ++++-
.../fragment/setting/SceneSetFragment.java | 3 +
.../setting/WokDirectionSetFragment.java | 45 ++-
.../newui/widget/DeviceStatusView.java | 59 ++--
app/src/main/res/drawable/bg_order.xml | 2 +-
.../main/res/layout/activity_plc_debug.xml | 121 +++++++
.../main/res/layout/activity_system_set.xml | 109 ++----
app/src/main/res/layout/dialog_psw.xml | 82 +++++
.../main/res/layout/fragment_scene_set.xml | 22 ++
.../new/layout/dialog_chu_can_pen_check.xml | 125 +++++++
.../layout/new/layout/dialog_food_control.xml | 12 +-
.../layout/new/layout/dialog_wok_make_tip.xml | 2 +-
.../new/layout/fragment_home_device_debug.xml | 106 ++++--
.../layout/new/layout/fragment_home_order.xml | 48 +--
.../new/layout/fragment_wok_direction_set.xml | 26 +-
.../layout/new/layout/view_device_status.xml | 46 ++-
32 files changed, 1632 insertions(+), 379 deletions(-)
create mode 100644 .idea/other.xml
create mode 100644 app/src/main/java/com/bonait/bnframework/newui/activity/PlcDebugActivity.java
create mode 100644 app/src/main/java/com/bonait/bnframework/newui/dialog/check/ChuCanPenCheckDialog.java
create mode 100644 app/src/main/res/layout/activity_plc_debug.xml
create mode 100644 app/src/main/res/layout/dialog_psw.xml
create mode 100644 app/src/main/res/layout/new/layout/dialog_chu_can_pen_check.xml
diff --git a/.idea/other.xml b/.idea/other.xml
new file mode 100644
index 00000000..104e542e
--- /dev/null
+++ b/.idea/other.xml
@@ -0,0 +1,329 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 309655db..793ec80c 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -83,8 +83,11 @@
android:windowSoftInputMode="adjustPan"
android:screenOrientation="landscape"
android:exported="false" />
-
-
+
goodsrecipes = GoodsProcessDetailDBUtil.getByGroupId(orderDetail.groupId);
@@ -93,27 +90,51 @@ public class ExecuteTheRecipe {
if(!goodsrecipes.isEmpty()){
ConfigName.hasClear[orderDetail.type-1] = goodsrecipes.get(goodsrecipes.size()-1).processname.contains("清洗");
}
+ EventBus.getDefault().post(new MakingStepEvent(orderDetail.type,1));
+ orderDetail.process=1;
+ orderDetail.status=1;
+ OrderDetailUtil.update(orderDetail);
+ //是否允许取料
+ String name = "翻转轴1允许机器人放盒取盒";
+ String name2 = "翻转轴2允许机器人放盒取盒";
+ boolean permissionTakePen = false;
+ long a = System.currentTimeMillis();
+ while (!permissionTakePen && !ConfigName.IsForcedEnd[orderDetail.type-1]) {
+ if ((System.currentTimeMillis() - a) > 1000 * (whileTime)) {
+ return;
+ } else {
+ Object object1 = ReadPLC(orderDetail.type,name);//ListeningValue.get(name);
+ Object object2 = ReadPLC(orderDetail.type,name2);//ListeningValue.get(name);
+ if (object1 != null) {
+ permissionTakePen = (boolean) (object1) && (boolean) (object2);
+ }
+
+ LogUtils.d(" Write_PLC_RebackPen:"+orderDetail.type +" 允许机器人放盒取盒"+object1+object2);
+ if (permissionTakePen) {
+ RecordManager.getInstance().addLogRecord("订单处理日志",orderDetail.type+"号炒锅-" + ",允许机器人放盒取盒:"+object1+object2);
+ }else {
+ RecordManager.getInstance().addLogRecord("订单处理日志",orderDetail.type+"号炒锅-" + ",不允许机器人放盒取盒:"+object1+object2);
+ showToastErrorTip(orderDetail.type+"号炒锅-"+"不允许机器人放盒取盒");
+ }
+ }
+ Thread.sleep(100);
+ }
Wait_Robot_No_Working(orderDetail.type);
ConfigName.RobotIsWorking[orderDetail.type-1] = true;
ModbusCenter.robotWritePlc(true,orderDetail.mainPosition+"#库取原料",true,null);
RobotModbusTcpServer.get().WriteShort("GI1", (short) orderDetail.type, null);
- Thread.sleep(5000);
+ Thread.sleep(1000);
ThreadWhile(orderDetail.type,orderDetail.type+"#炒锅放原料盆完成");
ConfigName.RobotIsWorking[orderDetail.type-1] = false;
- EventBus.getDefault().post(new MakingStepEvent(orderDetail.type,1));
- orderDetail.process=1;
- orderDetail.status=1;
- OrderDetailUtil.update(orderDetail);
-
for (BPA_GOODS_PROCESS_DETAIL item : goodsrecipes) {
if(!ConfigName.MakeStatus[orderDetail.type-1]){
RecordManager.getInstance().addLogRecord("订单处理日志",orderDetail.type+"号炒锅-"+",MakeStatus=false");
return;
}
while (ConfigName.IsPause[orderDetail.type-1]) {
- NewToastUtil.getInstance().showToast("当前菜品已暂停制作!");
+ showToastTip(orderDetail.type+"号炒锅,"+"当前菜品已暂停制作!");
RecordManager.getInstance().addLogRecord("订单处理日志",orderDetail.type+"号炒锅-"+",当前菜品已暂停制作");
Thread.sleep(500);
@@ -141,7 +162,7 @@ public class ExecuteTheRecipe {
isError = true;
orderDetail.status = 3;
OrderDetailUtil.update(orderDetail);
- NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage());
+ showToastErrorTip(orderDetail.type+"号炒锅,"+"异常信息:" + ex.getMessage());
EventBus.getDefault().post(new MakingStepEvent(orderDetail.type,-1));
RecordManager.getInstance().addLogRecord("订单处理日志",orderDetail.type+"号炒锅("+orderDetail.goodsName+"-"+orderDetail.groupName+")-制作异常:"+ex.getMessage());
RecordManager.getInstance().addOrderRecords(orderDetail,orderDetail.type+"号炒锅-"+"异常");
@@ -169,7 +190,7 @@ public class ExecuteTheRecipe {
long endTime = System.currentTimeMillis(); //结束时间
int time = (int) ((endTime - startTime) / 1000);
Log.e("运行时长", String.format("方法使用时间 %d s", time));
- showlog("结束烹饪菜谱【" + orderDetail.goodsName + "】,关闭搅拌、关闭加热," + String.format("方法使用时间 %d s", time));
+ showlog(orderDetail.type,"结束烹饪菜谱【" + orderDetail.goodsName + "】," + String.format("方法使用时间 %d s", time));
if (ConfigName.IsForcedEnd[orderDetail.type-1])//强制结束
@@ -178,10 +199,8 @@ public class ExecuteTheRecipe {
orderDetail.process = 0;
OrderDetailUtil.update(orderDetail);
EventBus.getDefault().post(new MakingStepEvent(orderDetail.type,-2));
- NewToastUtil.getInstance().showToast("客官,当前菜品已强制结束!!!");
- //初始化
// BottomClick("初始化");
- showlog("菜谱【" + orderDetail.goodsName + "】已强制结束...");
+ showlog(orderDetail.type,"菜谱【" + orderDetail.goodsName + "】已强制结束...");
ConfigName.IsForcedEnd[orderDetail.type-1] = false;
RecordManager.getInstance().addLogRecord("订单处理日志",orderDetail.type+"号炒锅("+orderDetail.goodsName+"-"+orderDetail.groupName+")-制作取消");
RecordManager.getInstance().addOrderRecords(orderDetail,orderDetail.type+"号炒锅-"+"取消");
@@ -200,7 +219,9 @@ public class ExecuteTheRecipe {
}
Thread.sleep(1000);
} catch (InterruptedException e) {
- NewToastUtil.getInstance().showToast("异常信息:" + e.getMessage());
+ showToastTip(orderDetail.type+"号炒锅,"+"异常信息:" + e.getMessage());
+ RecordManager.getInstance().addLogRecord("订单处理日志",orderDetail.type+"号炒锅,"+"异常信息:" + e.getMessage());
+
}
}
}));
@@ -218,14 +239,14 @@ public class ExecuteTheRecipe {
try {
//1.解析
if (ConfigName.IsForcedEnd[deviceNum-1]) {
- showlog("客官,小菠萝正在强制结束当前炒制菜品,请耐心等候!!!");
+ showlog(deviceNum,"客官,小菠萝正在强制结束当前炒制菜品,请耐心等候!!!");
return false;
}
if(deviceNum==1){
while (!Wok1ModbusTcpServer.get().plcIsConnect||!RobotModbusTcpServer.get().plcIsConnect
&&!ConfigName.IsForcedEnd[deviceNum-1]){
try{
- showlog("客官,检测到硬件已经断开连接,等待重连!!!");
+ showlog(deviceNum,"客官,检测到硬件已经断开连接,等待重连!!!");
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+" 检测到硬件已经断开连接,等待连接中 Wok:"
+deviceNum + Wok1ModbusTcpServer.get().plcIsConnect+" Robot:"+RobotModbusTcpServer.get().plcIsConnect);
Thread.sleep(100);
@@ -237,7 +258,7 @@ public class ExecuteTheRecipe {
while (!Wok2ModbusTcpServer.get().plcIsConnect||!RobotModbusTcpServer.get().plcIsConnect
&&!ConfigName.IsForcedEnd[deviceNum-1]){
try{
- showlog("客官,检测到硬件已经断开连接,等待重连!!!");
+ showlog(deviceNum,"客官,检测到硬件已经断开连接,等待重连!!!");
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+" 检测到硬件已经断开连接,等待连接中 Wok:"
+deviceNum +Wok2ModbusTcpServer.get().plcIsConnect+" Robot:"+RobotModbusTcpServer.get().plcIsConnect);
Thread.sleep(100);
@@ -249,7 +270,7 @@ public class ExecuteTheRecipe {
while (!Wok3ModbusTcpServer.get().plcIsConnect||!RobotModbusTcpServer.get().plcIsConnect
&&!ConfigName.IsForcedEnd[deviceNum-1]){
try{
- showlog("客官,检测到硬件已经断开连接,等待重连!!!");
+ showlog(deviceNum,"客官,检测到硬件已经断开连接,等待重连!!!");
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+" 检测到硬件已经断开连接,等待连接中 Wok:"
+deviceNum +Wok3ModbusTcpServer.get().plcIsConnect+" Robot:"+RobotModbusTcpServer.get().plcIsConnect);
Thread.sleep(100);
@@ -261,7 +282,7 @@ public class ExecuteTheRecipe {
while (!Wok4ModbusTcpServer.get().plcIsConnect||!RobotModbusTcpServer.get().plcIsConnect
&&!ConfigName.IsForcedEnd[deviceNum-1]){
try{
- showlog("客官,检测到硬件已经断开连接,等待重连!!!");
+ showlog(deviceNum,"客官,检测到硬件已经断开连接,等待重连!!!");
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+" 检测到硬件已经断开连接,等待连接中 Wok:"
+deviceNum +Wok4ModbusTcpServer.get().plcIsConnect+" Robot:"+RobotModbusTcpServer.get().plcIsConnect);
Thread.sleep(100);
@@ -283,12 +304,12 @@ public class ExecuteTheRecipe {
{
Object gz = ReadPLC(deviceNum,"异常加热故障信息");
if (gz != null && (boolean) gz && !ConfigName.TEST) {
- showlog("客官,检测到硬件加热异常,已主动停止炒制,请联系海科人员!!!");
+ showlog(deviceNum,"客官,检测到硬件加热异常,已主动停止炒制,请联系海科人员!!!");
ConfigName.IsForcedEnd[deviceNum-1] = true;
String title = "加热异常-温馨提示!";
String message = "客官硬件加热异常,请联系海科人员,已强制停止炒制!";
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅("+deviceNum+")-加热异常");
- NewToastUtil.getInstance().showToastError(title+message);
+ showToastErrorTip(deviceNum+"号炒锅,"+title+message);
return false;
}
}
@@ -306,8 +327,10 @@ public class ExecuteTheRecipe {
ExecuteOperationSteps(deviceNum,recipe.processname, recipe.processvalue,mainPosition);
}
} catch (Exception ex) {
- NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage());
+ showToastErrorTip(deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
+ RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
status = false;
+ LogUtils.d("异常信息:" + ex.getMessage());
} finally {
return status;
}
@@ -354,7 +377,7 @@ public class ExecuteTheRecipe {
BPA_SILOS silos = bpa_silos.get(0);
if (val >= 32767) {
val = 32767;
- showlog("料仓" + silos.num + "出量克数溢出,已按照最大出量出料!!!");
+ showlog(deviceNum,"料仓" + silos.num + "出量克数溢出,已按照最大出量出料!!!");
}
formulation.put(silos, val);
@@ -365,8 +388,9 @@ public class ExecuteTheRecipe {
int ztime = (int) (val / (jzzz_1 / 5.0));
MaxValue = ztime > MaxValue ? ztime : MaxValue;
}else {
- NewToastUtil.getInstance().showToastError("料仓" + silos.num + "校准值为空");
- RecordManager.getInstance().addLogRecord("订单处理日志","料仓" + silos.num + "校准值为空");
+ showToastErrorTip(deviceNum+"号炒锅,"+"料仓" + silos.num + "校准值为空");
+ LogUtils.d("料仓" + silos.num + "校准值为空");
+ RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅,"+"料仓" + silos.num + "校准值为空");
}
}
}
@@ -389,7 +413,9 @@ public class ExecuteTheRecipe {
}
}
} catch (Exception ex) {
- NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage());
+ showToastErrorTip(deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
+ LogUtils.d("异常信息:" + ex.getMessage());
+ RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
}
}
@@ -430,10 +456,8 @@ public class ExecuteTheRecipe {
//写入PLC
if (formulation.size() > 0) {
switch (processname){
- case "主料":
case "辅料":
case "出菜":
-
//等待机器人工作 关闭加热或搅拌
boolean isJre;
Object K = ReadPLC(deviceNum,"加热");
@@ -525,9 +549,7 @@ public class ExecuteTheRecipe {
Write_PLC_Heating(deviceNum,formulation);
break;
case "主料":
- ConfigName.RobotIsWorking[deviceNum-1] = true;
Write_PLC_MainIngredients(deviceNum,formulation);
- ConfigName.RobotIsWorking[deviceNum-1] = false;
break;
case "辅料":
ConfigName.RobotIsWorking[deviceNum-1] = true;
@@ -552,7 +574,9 @@ public class ExecuteTheRecipe {
}
}
} catch (Exception ex) {
- NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage());
+ showToastErrorTip(deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
+ LogUtils.d("异常信息:" + ex.getMessage());
+ RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
}
}
@@ -576,14 +600,14 @@ public class ExecuteTheRecipe {
@Override
public void onSuccess() {
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-"+"物料"+"料仓" + silos.num + "需求值"+val+"写入成功");
-// showlog("需求值写入成功!");
+// showlog(deviceNum,"需求值写入成功!");
IsComplete[0] = true;
}
@Override
public void onFailure(String ErrorMsg) {
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-"+"物料"+"料仓" + silos.num + "需求值"+val+"写入失败:"+ErrorMsg);
- showlog("需求值写入失败!尝试再次写入...错误原因:" + ErrorMsg);
+ showlog(deviceNum,"需求值写入失败!尝试再次写入...错误原因:" + ErrorMsg);
WritePLC(deviceNum,"料仓" + silos.num + "需求值", val, null);
IsComplete[0] = true;
}
@@ -597,7 +621,9 @@ public class ExecuteTheRecipe {
int otherG = silos.silosmargin - (val / 10);
QueryDB.UpdateYL(silos.id, otherG >= 0 ? otherG : 0);
} catch (Exception ex) {
- NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage());
+ showToastErrorTip(deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
+ LogUtils.d("异常信息:" + ex.getMessage());
+ RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
}
}
@@ -617,7 +643,7 @@ public class ExecuteTheRecipe {
if (key.contains("(秒)")) {
val = Integer.parseInt(value);
} else {
- NewToastUtil.getInstance().showToast("工序:" + key + "," + value);
+ showToastTip(deviceNum+"号炒锅,"+"工序:" + key + "," + value);
writeValue = GetMXValue(key, value);
int finalWriteValue = writeValue;
WritePLC(deviceNum,key, writeValue, new IWriteCallBack() {
@@ -664,7 +690,9 @@ public class ExecuteTheRecipe {
ThreadDelay(deviceNum,val,"Write_PLC_Stir");
}
} catch (Exception ex) {
- NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage());
+ showToastErrorTip(deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
+ LogUtils.d("异常信息:" + ex.getMessage());
+ RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
}
}
@@ -707,7 +735,9 @@ public class ExecuteTheRecipe {
ThreadDelay(deviceNum,val,"Write_PLC_Location");
}
} catch (Exception ex) {
- NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage());
+ showToastErrorTip(deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
+ LogUtils.d("异常信息:" + ex.getMessage());
+ RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
}
}
@@ -839,7 +869,9 @@ public class ExecuteTheRecipe {
}
} catch (Exception ex) {
- NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage());
+ showToastErrorTip(deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
+ LogUtils.d("异常信息:" + ex.getMessage());
+ RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
}
}
@@ -895,7 +927,9 @@ public class ExecuteTheRecipe {
ThreadDelay(deviceNum,val,"Write_PLC_ParallelDischarge");
}
} catch (Exception ex) {
- NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage());
+ showToastErrorTip(deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
+ LogUtils.d("异常信息:" + ex.getMessage());
+ RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
}
}
@@ -915,7 +949,9 @@ public class ExecuteTheRecipe {
}
}
} catch (Exception ex) {
- NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage());
+ showToastErrorTip(deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
+ LogUtils.d("异常信息:" + ex.getMessage());
+ RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
}
}
@@ -926,7 +962,7 @@ public class ExecuteTheRecipe {
*/
private static void Write_PLC_CleanPan(int deviceNum,HashMap data) {
try {
- showlog("准备清洗!");
+ showlog(deviceNum,"准备清洗!");
String qx_type = "一般清洗";
int val_csl=0;
int clearTime = 150;
@@ -935,7 +971,7 @@ public class ExecuteTheRecipe {
for (HashMap.Entry entry : data.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
- NewToastUtil.getInstance().showToast("工序:" + key + "," + value);
+ showToastTip(deviceNum+"号炒锅,"+"工序:" + key + "," + value);
if (key.contains("(秒)") && !ConfigName.IsForcedEnd[deviceNum-1]) {
int val = Integer.parseInt(value);
ThreadDelay(deviceNum,val,"Write_PLC_CleanPan");
@@ -968,10 +1004,12 @@ public class ExecuteTheRecipe {
//等待清洗完成
ThreadWhileClear(deviceNum,"炒锅清洗反馈", 5);
Make位置(deviceNum,"原点位");
- showlog("炒锅清洗完成!");
- NewToastUtil.getInstance().showToast("炒锅清洗完成");
+ showlog(deviceNum,"炒锅清洗完成!");
+ showToastTip(deviceNum+"号炒锅,"+"炒锅清洗完成");
} catch (Exception ex) {
- NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage());
+ showToastErrorTip(deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
+ LogUtils.d("异常信息:" + ex.getMessage());
+ RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
}
}
@@ -998,7 +1036,9 @@ public class ExecuteTheRecipe {
}
}catch (Exception ex){
- NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage());
+ showToastErrorTip(deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
+ LogUtils.d("异常信息:" + ex.getMessage());
+ RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
}
}
@@ -1009,10 +1049,11 @@ public class ExecuteTheRecipe {
*/
public static void Write_PLC_MainIngredients(int deviceNum,HashMap data) {
try {
- showlog("准备倒入主料!");
+ Thread.sleep(50);
+ showlog(deviceNum,"准备倒入主料!");
//判断炒制位置
String czwz = "炒菜位高";
- String foodPosition = "Z1";
+ String foodPosition = "1号位";
String foodName = "";
for (HashMap.Entry entry : data.entrySet()) {
@@ -1021,36 +1062,18 @@ public class ExecuteTheRecipe {
if (key.contains("炒制位置")) {
czwz = value;
}else if(key.contains("主料位置")){
- foodPosition = value.replace("Z","");
+ if (value.contains("1号位") || value.contains("2号位")) {
+ foodPosition = value;
+ }
}else if(key.contains("主料名称")){
foodName = value;
}
}
- boolean isJre = false;
- Object K = ReadPLC(deviceNum,"加热");
- isJre = K == null ? false : (boolean) K;
- if (isJre && ConfigName.getInstance().WhetherManualFeedingSuspended.contains("是")) {
- WritePLC(deviceNum,"加热", false, null);
- }//提前关闭加热
-
- Make位置(deviceNum,"原点位");
- //检测盆是否存在
-// ThreadWhile(foodPosition+"#料仓检测有无");
-
- Wait_Robot_No_Working(deviceNum);//等待机器人空闲
- if(!ConfigName.MakeStatus[deviceNum-1]){
- return;
- }
- ModbusCenter.robotWritePlc(true,foodPosition+"#位取原料",true,null);
- RobotModbusTcpServer.get().WriteShort("GI1", (short) deviceNum, null);
-
- Thread.sleep(2000);
- ThreadWhile(deviceNum,deviceNum+"#炒锅放原料盆完成");
-
- if (isJre && ConfigName.getInstance().WhetherManualFeedingSuspended.contains("是")) {
- WritePLC(deviceNum,"加热", true, null);
- }//再次释放加热
+ Make位置(deviceNum,"炒菜位高");
+ //2.给倒菜启动
+ BottomClick1(deviceNum,"主料" + foodPosition);
+ ThreadWhile(deviceNum,foodPosition + "倒菜完成");
Make位置(deviceNum,czwz);
//判断是否有烹饪时间
@@ -1069,7 +1092,9 @@ public class ExecuteTheRecipe {
Thread.sleep(5000);
}
} catch (Exception ex) {
- NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage());
+ showToastErrorTip(deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
+ LogUtils.d("异常信息:" + ex.getMessage());
+ RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
}finally {
}
}
@@ -1080,7 +1105,7 @@ public class ExecuteTheRecipe {
*/
public static void Write_PLC_MainIngredients_shoudong(int deviceNum,HashMap data) {
try {
- showlog("准备倒入主料!");
+ showlog(deviceNum,"准备倒入主料!");
//判断炒制位置
String czwz = "炒菜位高";
String foodPosition = "Z1";
@@ -1124,7 +1149,9 @@ public class ExecuteTheRecipe {
Make位置(deviceNum,czwz);
} catch (Exception ex) {
- NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage());
+ showToastErrorTip(deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
+ LogUtils.d("异常信息:" + ex.getMessage());
+ RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
}finally {
}
}
@@ -1136,7 +1163,8 @@ public class ExecuteTheRecipe {
*/
public static void Write_PLC_MainAccessory(int deviceNum,HashMap data) {
try {
- showlog("准备倒入辅料!");
+ Thread.sleep(50);
+ showlog(deviceNum,"准备倒入辅料!");
//判断炒制位置
String czwz = "炒菜位高";
String foodPosition = "F1";
@@ -1195,7 +1223,9 @@ public class ExecuteTheRecipe {
Thread.sleep(5000);
}
} catch (Exception ex) {
- NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage());
+ showToastErrorTip(deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
+ LogUtils.d("异常信息:" + ex.getMessage());
+ RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
}finally {
}
}
@@ -1206,7 +1236,7 @@ public class ExecuteTheRecipe {
*/
public static void Write_PLC_MainAccessory_shoudong(int deviceNum,HashMap data) {
try {
- showlog("准备倒入辅料!");
+ showlog(deviceNum,"准备倒入辅料!");
//判断炒制位置
String czwz = "炒菜位高";
String foodPosition = "F1";
@@ -1250,7 +1280,9 @@ public class ExecuteTheRecipe {
Make位置(deviceNum,czwz);
} catch (Exception ex) {
- NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage());
+ showToastErrorTip(deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
+ LogUtils.d("异常信息:" + ex.getMessage());
+ RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
}finally {
}
}
@@ -1262,13 +1294,14 @@ public class ExecuteTheRecipe {
*/
public static void Write_PLC_MainOutdishes(int deviceNum,HashMap data,int mainPosition) {
try {
- showlog("准备出菜!");
+ Thread.sleep(50);
+ showlog(deviceNum,"准备出菜!");
//先延迟
for (HashMap.Entry entry : data.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
- NewToastUtil.getInstance().showToast("工序:" + key + "," + value);
+ showToastTip(deviceNum+"号炒锅,"+"工序:" + key + "," + value);
if (key.contains("(秒)")) {
int val = Integer.parseInt(value);
ThreadDelay(deviceNum,val,"Write_PLC_MainOutdishes");
@@ -1277,7 +1310,7 @@ public class ExecuteTheRecipe {
WritePLC(deviceNum,"加热", false, null);
- showlog("关闭搅拌、关闭加热!");
+ showlog(deviceNum,"关闭搅拌、关闭加热!");
Wait_Robot_No_Working(deviceNum);//等待机器人空闲
@@ -1298,7 +1331,7 @@ public class ExecuteTheRecipe {
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-" + ",空盆库位检测有无:异常");
}
if(!isCheck){
- NewToastUtil.getInstance().showToast("请检测出餐盆是否放置正确!");
+ showToastTip(deviceNum+"号炒锅,"+"请检测出餐盆是否放置正确!");
}else {
if(deviceNum==1){
index = 31;
@@ -1421,9 +1454,11 @@ public class ExecuteTheRecipe {
}
ConfigName.getInstance().isPutFinish = true;
}
- showlog("出菜完成,锅体准备回到原位!");
+ showlog(deviceNum,"出菜完成,锅体准备回到原位!");
} catch (Exception ex) {
- NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage());
+ showToastErrorTip(deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
+ LogUtils.d("异常信息:" + ex.getMessage());
+ RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
}
}
@@ -1454,7 +1489,7 @@ public class ExecuteTheRecipe {
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-" + ",允许机器人放盒取盒:"+object1+object2);
}else {
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-" + ",不允许机器人放盒取盒:"+object1+object2);
- NewToastUtil.getInstance().showToastError(deviceNum+"号炒锅-"+"允许机器人放盒取盒");
+ showToastErrorTip(deviceNum+"号炒锅-"+"不允许机器人放盒取盒");
}
}
Thread.sleep(100);
@@ -1464,7 +1499,7 @@ public class ExecuteTheRecipe {
return;
}
ConfigName.RobotIsWorking[deviceNum-1] = true;
- NewToastUtil.getInstance().showToastError(deviceNum + "#炒锅投料位取原料空盆 放回Z"+mainPosition);
+ showToastTip(deviceNum + "#炒锅投料位取原料空盆 放回Z"+mainPosition);
ModbusCenter.robotWritePlc(true, deviceNum + "#炒锅投料位取原料空盆", true, new IWriteCallBack() {
@Override
public void onSuccess() {
@@ -1491,7 +1526,9 @@ public class ExecuteTheRecipe {
ThreadWhile(deviceNum,mainPosition+"#库原料空盆放回完成");
ConfigName.RobotIsWorking[deviceNum-1] = false;
}catch (Exception ex){
- NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage());
+ showToastErrorTip(deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
+ LogUtils.d("异常信息:" + ex.getMessage());
+ RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
}finally {
ConfigName.RobotIsWorking[deviceNum-1] = false;
}
@@ -1518,10 +1555,12 @@ public class ExecuteTheRecipe {
public void onFailure(String ErrorMsg) {
}
});
- NewToastUtil.getInstance().showToast("火力按钮点击,当前级别:" + data);
+ showToastTip(deviceNum+"号炒锅,"+"火力按钮点击,当前级别:" + data);
} catch (Exception ex) {
- NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage());
+ showToastErrorTip(deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
+ LogUtils.d("异常信息:" + ex.getMessage());
+ RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅,"+"异常信息:" + ex.getMessage());
}
}
@@ -1592,7 +1631,8 @@ public class ExecuteTheRecipe {
}
}
} catch (Exception ex) {
- NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage());
+ showToastErrorTip("异常信息:" + ex.getMessage());
+ LogUtils.d("异常信息:" + ex.getMessage());
} finally {
return ReturnsVariable[0];
}
@@ -1617,7 +1657,7 @@ public class ExecuteTheRecipe {
int mmmm = delay - (int) ((System.currentTimeMillis() - startTime) / 1000);
if (AtPresentTime != mmmm) {
AtPresentTime = mmmm;
- NewToastUtil.getInstance().showToast(deviceNum+"号炒锅,延迟等待中,剩余"+AtPresentTime+"秒");
+// showToastTip(deviceNum+"号炒锅,延迟等待中,剩余"+AtPresentTime+"秒");
}
} catch (InterruptedException ex) {
}
@@ -1639,7 +1679,7 @@ public class ExecuteTheRecipe {
while (!IsComplete[0] && !ConfigName.IsForcedEnd[deviceNum-1]) {
if ((System.currentTimeMillis() - a) > 1000 * whileTime) {
- showlog(name + ",异常超时退出!");
+ showlog(deviceNum,name + ",异常超时退出!");
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhile_WL-"+"异常超时退出");
break;
} else {
@@ -1650,7 +1690,7 @@ public class ExecuteTheRecipe {
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhile_WL-"+"true");
}else {
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhile_WL-"+"false");
- NewToastUtil.getInstance().showToast(deviceNum+"号炒锅,等待"+name);
+// showToastTip(deviceNum+"号炒锅,等待"+name);
}
}else {
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhile_WL-"+"null");
@@ -1665,7 +1705,7 @@ public class ExecuteTheRecipe {
Thread.sleep(500);//10 *6
} catch (InterruptedException e) {
IsComplete[0] = true;
- showlog(name + ",异常退出!" + e.getMessage());
+ showlog(deviceNum,name + ",异常退出!" + e.getMessage());
}
}
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhile_WL-"+"等待物料("+name+")出料完成");
@@ -1684,7 +1724,7 @@ public class ExecuteTheRecipe {
while (!IsComplete[0] && !ConfigName.IsForcedEnd[deviceNum-1] && !ConfigName.TEST) {
if ((System.currentTimeMillis() - a) > 1000 * whileTime) {
- showlog(name + ",异常超时退出!");
+ showlog(deviceNum,name + ",异常超时退出!");
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhile-"+name + ",异常超时退出");
break;
} else {
@@ -1695,11 +1735,8 @@ public class ExecuteTheRecipe {
LogUtils.d(TAG+" ThreadWhile name="+name+" true ////");
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhile-"+name + ",true");
}else {
- if(name.equals("出料空盆检测有无")){
- NewToastUtil.getInstance().showToastError("出料空盆没有盆,请检查传感器或放置空盆!");
- }
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhile-"+name + ",false");
- NewToastUtil.getInstance().showToast(deviceNum+"号炒锅,等待"+name);
+// showToastTip(deviceNum+"号炒锅,等待"+name);
LogUtils.d(TAG+" ThreadWhile name="+name+" false");
}
}else {
@@ -1710,7 +1747,7 @@ public class ExecuteTheRecipe {
Thread.sleep(500);//10 *6
} catch (InterruptedException e) {
IsComplete[0] = true;
- showlog(name + ",异常退出!" + e.getMessage());
+ showlog(deviceNum,name + ",异常退出!" + e.getMessage());
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhile-"+name + ",异常退出");
}
}
@@ -1726,7 +1763,7 @@ public class ExecuteTheRecipe {
while (!IsComplete[0] && !ConfigName.IsForcedEnd[deviceNum-1] && !ConfigName.TEST) {
if ((System.currentTimeMillis() - a) > 1000 * whileTime) {
- showlog(name + ",异常超时退出!");
+ showlog(deviceNum,name + ",异常超时退出!");
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhile-"+name + ",异常超时退出");
break;
} else {
@@ -1742,7 +1779,7 @@ public class ExecuteTheRecipe {
BottomClick1(deviceNum,value);
}
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhile-"+name + ",false");
- NewToastUtil.getInstance().showToast(deviceNum+"号炒锅,等待"+name);
+// showToastTip(deviceNum+"号炒锅,等待"+name);
LogUtils.d(TAG+" ThreadWhile name="+name+" false");
}
}else {
@@ -1753,7 +1790,7 @@ public class ExecuteTheRecipe {
Thread.sleep(500);//10 *6
} catch (InterruptedException e) {
IsComplete[0] = true;
- showlog(name + ",异常退出!" + e.getMessage());
+ showlog(deviceNum,name + ",异常退出!" + e.getMessage());
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhile-"+name + ",异常退出");
}
}
@@ -1773,7 +1810,7 @@ public class ExecuteTheRecipe {
while (!IsComplete[0] && !ConfigName.IsForcedEnd[deviceNum-1]&& !ConfigName.TEST) {
if ((System.currentTimeMillis() - a) > 1000 * whileTime * k) {
- showlog(name + ",异常超时退出!");
+ showlog(deviceNum,name + ",异常超时退出!");
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhileClear-"+name + ",异常超时退出");
break;
} else {
@@ -1783,11 +1820,11 @@ public class ExecuteTheRecipe {
if (IsComplete[0]) {
LogUtils.d(TAG+" ThreadWhileClear name="+name+" true");
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhileClear-"+name + ",true");
- NewToastUtil.getInstance().showToast(deviceNum+"号炒锅,清洗完成");
+// showToastTip(deviceNum+"号炒锅,清洗完成");
}else {
LogUtils.d(TAG+" ThreadWhileClear name="+name+" false");
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhileClear-"+name + ",false");
- NewToastUtil.getInstance().showToast(deviceNum+"号炒锅,清洗中...");
+// showToastTip(deviceNum+"号炒锅,清洗中...");
}
}else {
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhileClear-"+name + ",null");
@@ -1797,7 +1834,7 @@ public class ExecuteTheRecipe {
Thread.sleep(500);//10 *6
} catch (InterruptedException e) {
IsComplete[0] = true;
- showlog(name + ",异常退出!" + e.getMessage());
+ showlog(deviceNum,name + ",异常退出!" + e.getMessage());
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhileClear-"+name + ",转换异常");
}
}
@@ -1813,10 +1850,21 @@ public class ExecuteTheRecipe {
/**
* 显示日志
*/
- public static void showlog(String msg) {
+ public static void showlog(int deviceNum,String msg) {
LogUtils.d(TAG+" showlog msg="+msg);
- NewToastUtil.getInstance().showToast(msg);
- RecordManager.getInstance().addLogRecord("订单处理日志","炒锅-showlog-"+msg + "");
+ showToastTip(deviceNum+"号炒锅,"+msg);
+ RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-showlog-"+msg + "");
+ }
+
+ public static void showToastTip(String content){
+ LogUtils.d(TAG+" showToastTip content="+content);
+ if(ConfigName.getInstance().showCookingToast){
+ NewToastUtil.getInstance().showToast(content);
+ }
+ }
+ public static void showToastErrorTip(String content){
+ LogUtils.d(TAG+" showToastErrorTip content="+content);
+ NewToastUtil.getInstance().showToastError(content);
}
}
diff --git a/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java b/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
index 394f2e8c..31a0d030 100644
--- a/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
+++ b/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
@@ -224,6 +224,7 @@ public class ConfigName {
add(new Res_PLCADDRESS("炒锅工作范围下限", "VD206", 0, 1));
add(new Res_PLCADDRESS("炒锅工作范围上限", "VD210", 0, 1));
+
//自动投料-翻转轴
add(new Res_PLCADDRESS("翻转轴控制1", "-------------", 0, 0));
add(new Res_PLCADDRESS("翻转1-伺服当前值", "VD260", 1, 1));
@@ -551,6 +552,7 @@ public class ConfigName {
public final static String deviceLocationDetail="deviceLocationDetail";
public final static String storesNum="storesNum";
public final static String rootTip="rootTip";
+ public final static String cookToast="cookToast";
public final static String SHARE_KEY_loginNum="SHARE_KEY_loginNum";
/**
@@ -558,6 +560,8 @@ public class ConfigName {
*/
public String WhetherManualFeedingSuspended="是";
+ public boolean showCookingToast = true;
+
/**
* 判断重复点击
*/
diff --git a/app/src/main/java/com/bonait/bnframework/common/db/util/OrderDetailUtil.java b/app/src/main/java/com/bonait/bnframework/common/db/util/OrderDetailUtil.java
index 4f015da5..07d56dc7 100644
--- a/app/src/main/java/com/bonait/bnframework/common/db/util/OrderDetailUtil.java
+++ b/app/src/main/java/com/bonait/bnframework/common/db/util/OrderDetailUtil.java
@@ -12,6 +12,7 @@ import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP;
import com.bonait.bnframework.common.db.mode.BPA_ORDER_DETAIL;
import java.util.ArrayList;
+import java.util.List;
/**
* @author: liup
@@ -151,4 +152,24 @@ public class OrderDetailUtil {
ArrayList