Browse Source

修改超时执行问题

上海闵中
liup 2 months ago
parent
commit
664aa7a253
5 changed files with 137 additions and 30 deletions
  1. +1
    -0
      .gitignore
  2. BIN
     
  3. +20
    -0
      app/release/output-metadata.json
  4. +116
    -30
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  5. BIN
     

+ 1
- 0
.gitignore View File

@@ -11,3 +11,4 @@
/build
/captures
.externalNativeBuild
*.apk

BIN
View File


+ 20
- 0
app/release/output-metadata.json View File

@@ -0,0 +1,20 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.bonait.shanghaiminzhong",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 105,
"versionName": "1.0.5",
"outputFile": "shmz-xiaochao-v105-202410090954-unsigned-release.apk"
}
],
"elementType": "File"
}

+ 116
- 30
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java View File

@@ -54,7 +54,7 @@ public class ExecuteTheRecipe {
* 等待超时时间
*/
//public static int whileTime = 40;
public static int whileTime = 1200;
public static int whileTime = 600;

//手动操作耗时时长
public static int HandTime = 0;
@@ -1044,6 +1044,9 @@ public class ExecuteTheRecipe {
ThreadWhile("料仓" + silos.num + "下料完成");
}

if(IsForcedEnd){
return;
}
if (val > 0 && !IsForcedEnd) {
ThreadDelay(val);
}
@@ -1150,22 +1153,29 @@ public class ExecuteTheRecipe {
//<<开门流程
ExecuteTheRecipe.WritePLC("档位选择", 0, null);
ExecuteTheRecipe.WritePLC("档位选择触发", true, null);
// ThreadWhile2("当前档位_关");
Thread.sleep(100);
ConfigName.getInstance().oven_wendu = 0+"";
ExecuteTheRecipe.WritePLC("温度选择", 0, null);
Thread.sleep(10);
ExecuteTheRecipe.WritePLC("温度选择触发", true, null);
// ThreadWhile2("温度设置完成");
Thread.sleep(100);
boolean isOpen = (boolean)ReadPLC("烤箱门开到位检测");
if(!isOpen){
Wait_Robot2_No_Working();//等待机器人空闲
if(IsForcedEnd2){
return;
}
ModbusCenter.robotWritePlc(true,"机器人烤箱开门",true,null);
ThreadWhile2("机器人烤箱开门完成");
if(IsForcedEnd2){
return;
}
ExecuteTheRecipe.WritePLC("烤箱门打开控制", true, null);
Thread.sleep(100);
ThreadWhile2("烤箱门开到位检测");
if(IsForcedEnd2){
return;
}
}
//>>

@@ -1173,24 +1183,41 @@ public class ExecuteTheRecipe {
ModbusCenter.robotWritePlc(true,"烤箱允许放料",true,null);
Thread.sleep(100);
Wait_Robot2_No_Working();//等待机器人空闲
if(IsForcedEnd2){
return;
}
ModbusCenter.robotWritePlc(true,position+"#库取烤架放至烤箱",true,null);
ConfigName.getInstance().oven_has_food = true;
PreferenceUtils.setBoolean(ConfigName.ovenHasPen,true);
ThreadWhile2("烤盘架放料至烤箱完成");

if(IsForcedEnd2){
return;
}
//<<关门流程
Thread.sleep(100);
ExecuteTheRecipe.WritePLC("烤箱门关闭控制", true, null);
ThreadWhileWithTime("烤箱关门成功",15);
ThreadWhileWithTime("烤箱关门成功",40);
if(IsForcedEnd2){
return;
}
boolean isClose2 = (boolean) ModbusCenter.ReadPlc("烤箱门关到位检测");
boolean checkClose = (boolean) ModbusCenter.ReadPlc("机器人允许关门");
if(!isClose2 && checkClose){
Wait_Robot2_No_Working();//等待机器人空闲
if(IsForcedEnd2){
return;
}
ModbusCenter.robotWritePlc(true,"机器人烤箱关门",true,null);
ThreadWhile2("机器人烤箱关门完成");
if(IsForcedEnd2){
return;
}
Thread.sleep(100);
ThreadWhileWithTime("烤箱关门成功",120);
}
if(IsForcedEnd2){
return;
}
isClose2 = (boolean) ModbusCenter.ReadPlc("烤箱关门成功");
if(!isClose2){
IsForcedEnd2 = true;
@@ -1261,29 +1288,11 @@ public class ExecuteTheRecipe {
ExecuteTheRecipe.WritePLC("档位选择", dangwei, null);
Thread.sleep(500);
ExecuteTheRecipe.WritePLC("档位选择触发", true, null);
// switch (dangwei){
// case 0:
// ThreadWhile2("当前档位_关");
// break;
// case 1:
// ThreadWhile2("当前档位_蒸");
// break;
// case 2:
// ThreadWhile2("当前档位_烤");
// break;
// case 3:
// ThreadWhile2("当前档位_蒸烤");
// break;
// case 4:
// ThreadWhile2("当前档位_其他");
// break;
// }

Thread.sleep(100);
ExecuteTheRecipe.WritePLC("温度选择", wendu, null);
Thread.sleep(500);
ExecuteTheRecipe.WritePLC("温度选择触发", true, null);
// ThreadWhile2("温度设置完成");

if((Boolean) ReadPLC("温度定位超时")||(Boolean) ReadPLC("档位定位超时")||
(Boolean) ReadPLC("档位回原点超时")||(Boolean) ReadPLC("温度回原点超时")){
@@ -1356,29 +1365,39 @@ public class ExecuteTheRecipe {
//<<开门流程
ExecuteTheRecipe.WritePLC("档位选择", 0, null);
ExecuteTheRecipe.WritePLC("档位选择触发", true, null);
// ThreadWhile2("当前档位_关");
Thread.sleep(100);
ConfigName.getInstance().oven_wendu = 0+"";
ExecuteTheRecipe.WritePLC("温度选择", 0, null);
Thread.sleep(10);
ExecuteTheRecipe.WritePLC("温度选择触发", true, null);
// ThreadWhile2("温度设置完成");
Thread.sleep(100);
boolean isOpen = (boolean)ReadPLC("烤箱门开到位检测");
boolean isClose = (boolean)ReadPLC("烤箱门关到位检测");
if(!isOpen && isClose){
Wait_Robot2_No_Working();//等待机器人空闲
if(IsForcedEnd2){
return;
}
ModbusCenter.robotWritePlc(true,"机器人烤箱开门",true,null);
ThreadWhile2("机器人烤箱开门完成");
if(IsForcedEnd2){
return;
}
ExecuteTheRecipe.WritePLC("烤箱门打开控制", true, null);
Thread.sleep(100);
ThreadWhileWithTime("烤箱门开到位检测",20);
ThreadWhileWithTime("烤箱门开到位检测",40);
}
if(IsForcedEnd2){
return;
}
if(!isOpen && !isClose){
ExecuteTheRecipe.WritePLC("烤箱门打开控制", true, null);
Thread.sleep(100);
}
ThreadWhileWithTime("烤箱门开到位检测",20);
ThreadWhileWithTime("烤箱门开到位检测",40);
if(IsForcedEnd2){
return;
}
isOpen = (boolean)ReadPLC("烤箱门开到位检测");
if(!isOpen){
IsForcedEnd2 = true;
@@ -1387,11 +1406,20 @@ public class ExecuteTheRecipe {
}
//>>
ThreadWhileFalse("出餐工位检测有无");
if(IsForcedEnd2){
return;
}
Thread.sleep(100);
Wait_Robot2_No_Working();//等待机器人空闲
if(IsForcedEnd2){
return;
}
ModbusCenter.robotWritePlc(true,"机器人取烤箱烤盘出餐",true,null);
Thread.sleep(100);
ThreadWhile2("烤盘出餐完成");
if(IsForcedEnd2){
return;
}
ConfigName.getInstance().oven_has_food = false;
PreferenceUtils.setBoolean(ConfigName.ovenHasPen,false);
}catch (Exception ex) {
@@ -1415,7 +1443,7 @@ public class ExecuteTheRecipe {
boolean robotNoWorking = false;
long a = System.currentTimeMillis();
while (!robotNoWorking && !ConfigName.TEST) {
if ((System.currentTimeMillis() - a) > 1000 * (whileTime * 3)) {
if ((System.currentTimeMillis() - a) > 1000 * (whileTime * 2)) {
break;
}
Object object1 = ModbusCenter.robotReadPlc("主任务读取");
@@ -1439,7 +1467,7 @@ public class ExecuteTheRecipe {
boolean robotNoWorking = false;
long a = System.currentTimeMillis();
while (!robotNoWorking && !IsForcedEnd2 && !ConfigName.TEST) {
if ((System.currentTimeMillis() - a) > 1000 * (whileTime * 3)) {
if ((System.currentTimeMillis() - a) > 1000 * (whileTime* 2)) {
break;
}
Object object1 = ModbusCenter.robotReadPlc("主任务读取");
@@ -1496,6 +1524,9 @@ public class ExecuteTheRecipe {
// ThreadWhile(foodPosition+"#料仓检测有无");

Wait_Robot_No_Working();//等待机器人空闲
if(IsForcedEnd){
return;
}
ModbusCenter.robotWritePlc(false,"炒锅允许倒料",true,null);
if(!MakeStatus){
return;
@@ -1503,7 +1534,9 @@ public class ExecuteTheRecipe {
ModbusCenter.robotWritePlc(true,foodPosition+"#库取原料倒至炒锅",true,null);
Thread.sleep(2000);
ThreadWhile("炒锅倒原料完成");

if(IsForcedEnd){
return;
}
if (isJre && ConfigName.getInstance().WhetherManualFeedingSuspended.contains("是")) {
ExecuteTheRecipe.WritePLC("加热", true, null);
}//再次释放加热
@@ -1568,12 +1601,18 @@ public class ExecuteTheRecipe {
ThreadWhile(foodPosition+"#料仓检测有无");

Wait_Robot_No_Working();//等待机器人空闲
if(IsForcedEnd){
return;
}
ModbusCenter.robotWritePlc(false,"炒锅允许倒料",true,null);

ModbusCenter.robotWritePlc(true,foodPosition+"#库取原料倒至炒锅",true,null);
Thread.sleep(100);
ThreadWhile("炒锅倒原料完成");

if(IsForcedEnd){
return;
}
if (isJre && ConfigName.getInstance().WhetherManualFeedingSuspended.contains("是")) {
ExecuteTheRecipe.WritePLC("加热", true, null);
}//再次释放加热
@@ -1627,6 +1666,9 @@ public class ExecuteTheRecipe {
//检测盆是否存在

Wait_Robot_No_Working();//等待机器人空闲
if(IsForcedEnd){
return;
}
ModbusCenter.robotWritePlc(false,"炒锅允许倒料",true,null);
if(!MakeStatus){
return;
@@ -1635,6 +1677,9 @@ public class ExecuteTheRecipe {
Thread.sleep(2000);
ThreadWhile("炒锅倒调料完成");

if(IsForcedEnd){
return;
}
if (isJre && ConfigName.getInstance().WhetherManualFeedingSuspended.contains("是")) {
ExecuteTheRecipe.WritePLC("加热", true, null);
}//再次释放加热
@@ -1698,12 +1743,18 @@ public class ExecuteTheRecipe {
ThreadWhile(foodPosition+"#调料检测有无");

Wait_Robot_No_Working();//等待机器人空闲
if(IsForcedEnd){
return;
}
ModbusCenter.robotWritePlc(false,"炒锅允许倒料",true,null);

ModbusCenter.robotWritePlc(true,foodPosition+"#库取调料倒至炒锅",true,null);
Thread.sleep(100);
ThreadWhile("炒锅倒调料完成");

if(IsForcedEnd){
return;
}
if (isJre && ConfigName.getInstance().WhetherManualFeedingSuspended.contains("是")) {
ExecuteTheRecipe.WritePLC("加热", true, null);
}//再次释放加热
@@ -1737,17 +1788,32 @@ public class ExecuteTheRecipe {
}
}
}
if(IsForcedEnd){
return;
}
ExecuteTheRecipe.WritePLC("加热", false, null);
ExecuteTheRecipe.showlog("关闭搅拌、关闭加热!");

ThreadWhile("出料空盆检测有无");
ThreadWhileFalse("出餐工位检测有无");
Wait_Robot_No_Working();//等待机器人空闲
if(IsForcedEnd){
return;
}
ModbusCenter.robotWritePlc(true,"机器人取空盆接菜出餐",null,null);
Thread.sleep(100);
ThreadWhile("机器人到位请求炒锅出餐倒菜");

if(IsForcedEnd){
return;
}
ModbusCenter.robotWritePlc(false,"炒锅出餐减速到位",false,null);
Thread.sleep(100);
BottomClick1("出菜");//自动去倒菜位

if(IsForcedEnd){
return;
}
//一直等待机器移动到该位置,否则就一直等待 6s超时
String name = "出餐启动反馈";
boolean IsComplete = false;
@@ -1767,7 +1833,15 @@ public class ExecuteTheRecipe {
}
Thread.sleep(100);//10 *6
}

if(IsForcedEnd){
return;
}
ThreadWhile("出餐启动反馈");

if(IsForcedEnd){
return;
}
Thread.sleep(100);
ModbusCenter.robotWritePlc(false,"炒锅出餐倒菜完成",true,null);
Thread.sleep(500);
@@ -2078,6 +2152,8 @@ public class ExecuteTheRecipe {
while (!IsComplete[0] && !IsForcedEnd && WokModbusTcpServer.get().plcIsConnect) {
if ((System.currentTimeMillis() - a) > 1000 * whileTime) {
ExecuteTheRecipe.showlog(name + ",异常超时退出!");
IsForcedEnd = true;
RecordManager.getInstance().addLogRecord("订单处理日志",name + ",异常超时退出 ThreadWhile_WL");
break;
} else {
Object sb = ReadPLC(name);
@@ -2122,6 +2198,8 @@ public class ExecuteTheRecipe {
while (!IsComplete[0] && !IsForcedEnd && WokModbusTcpServer.get().plcIsConnect&&RobotModbusTcpServer.get().plcIsConnect && !ConfigName.TEST) {
if ((System.currentTimeMillis() - a) > 1000 * whileTime) {
ExecuteTheRecipe.showlog(name + ",异常超时退出!");
IsForcedEnd = true;
RecordManager.getInstance().addLogRecord("订单处理日志",name + ",异常超时退出 ThreadWhile");
break;
} else {
Object sb = ReadPLC(name);
@@ -2155,6 +2233,8 @@ public class ExecuteTheRecipe {
while (!IsComplete[0] && !IsForcedEnd2 &&RobotModbusTcpServer.get().plcIsConnect&& OvenModbusTcpServer.get().plcIsConnect && !ConfigName.TEST) {
if ((System.currentTimeMillis() - a) > 1000 * whileTime) {
ExecuteTheRecipe.showlog(name + ",异常超时退出!");
IsForcedEnd2 = true;
RecordManager.getInstance().addLogRecord("订单处理日志",name + ",异常超时退出 ThreadWhile2");
break;
} else {
Object sb = ReadPLC(name);
@@ -2184,6 +2264,8 @@ public class ExecuteTheRecipe {
while (!IsComplete[0] && !IsForcedEnd2 &&RobotModbusTcpServer.get().plcIsConnect&& OvenModbusTcpServer.get().plcIsConnect && !ConfigName.TEST) {
if ((System.currentTimeMillis() - a) > 1000 * time) {
ExecuteTheRecipe.showlog(name + ",异常超时退出!");
IsForcedEnd2 = true;
RecordManager.getInstance().addLogRecord("订单处理日志",name + ",异常超时退出 ThreadWhileWithTime");
break;
} else {
Object sb = ReadPLC(name);
@@ -2215,6 +2297,8 @@ public class ExecuteTheRecipe {
while (IsComplete[0] && !IsForcedEnd2 && WokModbusTcpServer.get().plcIsConnect&&RobotModbusTcpServer.get().plcIsConnect&& !ConfigName.TEST) {
if ((System.currentTimeMillis() - a) > 1000 * whileTime) {
ExecuteTheRecipe.showlog(name + ",异常超时退出!");
IsForcedEnd2 = true;
RecordManager.getInstance().addLogRecord("订单处理日志",name + ",异常超时退出 ThreadWhileFalse");
break;
} else {
Object sb = ReadPLC(name);
@@ -2261,6 +2345,8 @@ public class ExecuteTheRecipe {
while (!IsComplete[0] && !IsForcedEnd && WokModbusTcpServer.get().plcIsConnect&&RobotModbusTcpServer.get().plcIsConnect&& OvenModbusTcpServer.get().plcIsConnect) {
if ((System.currentTimeMillis() - a) > 1000 * whileTime * k) {
ExecuteTheRecipe.showlog(name + ",异常超时退出!");
IsForcedEnd = true;
RecordManager.getInstance().addLogRecord("订单处理日志",name + ",异常超时退出 ThreadWhile3");
break;
} else {
Object sb = ReadPLC(name);//ListeningValue.get(name);


BIN
View File


Loading…
Cancel
Save