Browse Source

修改输送线启停问题

炒锅机器人_一拖多
liup 3 months ago
parent
commit
01b016cca2
3 changed files with 72 additions and 15 deletions
  1. +1
    -1
      app/release/output-metadata.json
  2. +67
    -10
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  3. +4
    -4
      app/src/main/java/com/bonait/bnframework/modbus/ModbusCenter.java

+ 1
- 1
app/release/output-metadata.json View File

@@ -13,7 +13,7 @@
"attributes": [],
"versionCode": 102,
"versionName": "1.0.2",
"outputFile": "robot-xiaochao-v102-202409241716-unsigned-release.apk"
"outputFile": "robot-xiaochao-v102-202409261248-unsigned-release.apk"
}
],
"elementType": "File"

+ 67
- 10
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java View File

@@ -74,6 +74,9 @@ public class ExecuteTheRecipe {
boolean isError = false;
long startTime = System.currentTimeMillis(); //起始时间
showlog("开始烹饪菜谱【" + orderDetail.goodsName + "】");
ModbusCenter.rackWritePlc("输送线停止",true,null);
Thread.sleep(500);
ModbusCenter.rackWritePlc("输送线停止",false,null);
try {
//获取工艺
ArrayList<BPA_GOODS_PROCESS_DETAIL> goodsrecipes = GoodsProcessDetailDBUtil.getByGroupId(orderDetail.groupId);
@@ -1150,6 +1153,7 @@ public class ExecuteTheRecipe {
try {
showlog("准备出菜!");
//先延迟

for (HashMap.Entry<String, String> entry : data.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
@@ -1244,6 +1248,9 @@ public class ExecuteTheRecipe {
});

Thread.sleep(100);
ModbusCenter.rackWritePlc("输送线停止",true,null);
Thread.sleep(500);
ModbusCenter.rackWritePlc("输送线停止",false,null);
ThreadWhile(deviceNum,deviceNum+"机器人到位请求炒锅出餐倒菜");
if(ConfigName.IsForcedEnd[deviceNum-1]){
Thread.sleep(100);
@@ -1319,11 +1326,36 @@ public class ExecuteTheRecipe {
try{
ThreadWhile(deviceNum,deviceNum+"炒锅出餐完成");
ConfigName.getInstance().isPutFinish = true;
// if((Boolean) ModbusCenter.rackReadPlc("输送线进料菜盆检测")){
ModbusCenter.rackWritePlc("输送线启动",true,null);
Thread.sleep(500);
ModbusCenter.rackWritePlc("输送线启动",false,null);
// }
ModbusCenter.rackWritePlc("输送线启动",true,null);
Thread.sleep(500);
ModbusCenter.rackWritePlc("输送线启动",false,null);

ThreadManager.get().execute(new Runnable() {
@Override
public void run() {
try{
if(ModbusCenter.getListingValue("输送线出料菜盆检测") instanceof Boolean){
boolean isStart = (boolean) ModbusCenter.getListingValue("输送线出料菜盆检测");
long a = System.currentTimeMillis();
Thread.sleep(15000);
while (!isStart) {
Thread.sleep(1000);
if ((System.currentTimeMillis() - a) > 1000 * 20) {
break;
}
isStart = (boolean) ModbusCenter.getListingValue("输送线出料菜盆检测");
if(isStart){
break;
}
}
}
ModbusCenter.rackWritePlc("输送线停止",true,null);
Thread.sleep(500);
ModbusCenter.rackWritePlc("输送线停止",false,null);
}catch (Exception e){
}
}
});
}catch (Exception e){

}
@@ -1334,11 +1366,36 @@ public class ExecuteTheRecipe {
try{
ThreadWhile(deviceNum,deviceNum+"炒锅出餐完成");
ConfigName.getInstance().isPutFinish = true;
// if((Boolean) ModbusCenter.rackReadPlc("输送线进料菜盆检测")){
ModbusCenter.rackWritePlc("输送线启动",true,null);
Thread.sleep(500);
ModbusCenter.rackWritePlc("输送线启动",false,null);
// }
ModbusCenter.rackWritePlc("输送线启动",true,null);
Thread.sleep(500);
ModbusCenter.rackWritePlc("输送线启动",false,null);

ThreadManager.get().execute(new Runnable() {
@Override
public void run() {
try{
if(ModbusCenter.getListingValue("输送线出料菜盆检测") instanceof Boolean){
boolean isStart = (boolean) ModbusCenter.getListingValue("输送线出料菜盆检测");
long a = System.currentTimeMillis();
Thread.sleep(15000);
while (!isStart) {
Thread.sleep(1000);
if ((System.currentTimeMillis() - a) > 1000 * 20) {
break;
}
isStart = (boolean) ModbusCenter.getListingValue("输送线出料菜盆检测");
if(isStart){
break;
}
}
}
ModbusCenter.rackWritePlc("输送线停止",true,null);
Thread.sleep(500);
ModbusCenter.rackWritePlc("输送线停止",false,null);
}catch (Exception e){
}
}
});
}catch (Exception e){

}


+ 4
- 4
app/src/main/java/com/bonait/bnframework/modbus/ModbusCenter.java View File

@@ -216,7 +216,7 @@ public class ModbusCenter {
listeningValue.put("输送线出料菜盆检测", val[1]);
listeningValue.put("输送线进料菜盆检测", val[0]);
if(val[0]){
LogUtils.d("输送线进料菜盆检测 M12.3 true");
LogUtils.d("输送线进料菜盆检测 M12.2 true");
if( ConfigName.getInstance().isPutFinish){
ThreadManager.get().execute(new Runnable() {
@Override
@@ -226,7 +226,7 @@ public class ModbusCenter {
if(RackModbusTcpServer.get().plcIsConnect){
if(val[0]){
ConfigName.getInstance().isPutFinish = false;
RackModbusTcpServer.get().WriteBool("输送线停止",true,null);
ModbusCenter.rackWritePlc("输送线停止",true,null);
Thread.sleep(500);
ModbusCenter.rackWritePlc("输送线停止",false,null);
}
@@ -239,10 +239,10 @@ public class ModbusCenter {
});
}
}else if(val[1]){
LogUtils.d("输送线出料菜盆检测 M12.2 true");
LogUtils.d("输送线出料菜盆检测 M12.3 true");
try{
ConfigName.getInstance().isPutFinish = false;
RackModbusTcpServer.get().WriteBool("输送线停止",true,null);
ModbusCenter.rackWritePlc("输送线停止",true,null);
Thread.sleep(500);
ModbusCenter.rackWritePlc("输送线停止",false,null);
}catch (Exception e){


Loading…
Cancel
Save