Browse Source

添加提示

炒锅机器人_一拖多
liup 3 months ago
parent
commit
dd3aae1329
4 changed files with 39 additions and 33 deletions
  1. +2
    -1
      app/src/main/java/com/bonait/bnframework/CrashHandler.java
  2. +31
    -31
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  3. +4
    -0
      app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
  4. +2
    -1
      app/src/main/java/com/bonait/bnframework/newui/activity/MainHActivity.java

+ 2
- 1
app/src/main/java/com/bonait/bnframework/CrashHandler.java View File

@@ -117,7 +117,8 @@ public class CrashHandler implements UncaughtExceptionHandler {
ThreadManager.get().release();
ModbusCenter.closePLC();

ExecuteTheRecipe.reset1();
ExecuteTheRecipe.reset1(1);
ExecuteTheRecipe.reset1(2);
OrderDetailUtil.resetOrder();

SystemClock.sleep(3000);


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

@@ -39,29 +39,23 @@ public class ExecuteTheRecipe {
/**
* 等待超时时间
*/
public static int whileTime = 300;

public static void reset1(){
Arrays.fill(ConfigName.IsForcedEnd, false);
Arrays.fill(ConfigName.IsPause, false);
Arrays.fill(ConfigName.MakeStatus, false);
Arrays.fill(ConfigName.IsStart, false);

ConfigName.IsForcedEnd[0] = false;
ConfigName.IsForcedEnd[1] = false;
ConfigName.IsPause[0] = false;
ConfigName.IsPause[1] = false;
ConfigName.MakeStatus[0] = false;
ConfigName.MakeStatus[1] = false;
ConfigName.IsStart[0] = false;
ConfigName.IsStart[1] = false;
public static int whileTime = 600;

public static void reset1(int deviceNum){
if(deviceNum == 1){
ConfigName.IsForcedEnd[0] = false;
ConfigName.IsPause[0] = false;
ConfigName.MakeStatus[0] = false;
ConfigName.IsStart[0] = false;

}else if(deviceNum == 2){
ConfigName.IsForcedEnd[1] = false;
ConfigName.IsPause[1] = false;
ConfigName.MakeStatus[1] = false;
ConfigName.IsStart[1] = false;
}
}

/**
* 是否有清洗 出菜完成反馈后立刻清洗
*/
public static boolean hasClear = false;

/**
* 制作线程
*/
@@ -91,7 +85,7 @@ public class ExecuteTheRecipe {
}
int m = 0;
if(!goodsrecipes.isEmpty()){
hasClear = goodsrecipes.get(goodsrecipes.size()-1).processname.contains("清洗");
ConfigName.hasClear[orderDetail.type-1] = goodsrecipes.get(goodsrecipes.size()-1).processname.contains("清洗");
}

for (BPA_GOODS_PROCESS_DETAIL item : goodsrecipes) {
@@ -130,7 +124,7 @@ public class ExecuteTheRecipe {
OrderDetailUtil.update(orderDetail);
NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage());
EventBus.getDefault().post(new MakingStepEvent(orderDetail.type,-1));
RecordManager.getInstance().addLogRecord("订单处理日志",orderDetail.type+"号炒锅("+orderDetail.goodsName+"-"+orderDetail.groupName+")-制作异常");
RecordManager.getInstance().addLogRecord("订单处理日志",orderDetail.type+"号炒锅("+orderDetail.goodsName+"-"+orderDetail.groupName+")-制作异常"+ex.getMessage());
RecordManager.getInstance().addOrderRecords(orderDetail,orderDetail.type+"号炒锅-"+"异常");
} finally {
ConfigName.RobotIsWorking[orderDetail.type-1] = false;
@@ -178,7 +172,7 @@ public class ExecuteTheRecipe {
RecordManager.getInstance().addOrderRecords(orderDetail,orderDetail.type+"号炒锅-"+"完成");
}
}
reset1();
reset1(orderDetail.type);
}
}
Thread.sleep(1000);
@@ -1184,13 +1178,14 @@ public class ExecuteTheRecipe {
if(pan1 !=null){
if(deviceNum == 1){
isCheck = (Boolean) pan1;
if( (Boolean)pan1){
index = 21;
}
}else {
isCheck = (Boolean) pan2;
}
if( (Boolean)pan1){
index = 21;
}else if( (Boolean)pan2){
index = 22;
if( (Boolean)pan2){
index = 22;
}
}
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-" + ",空盆库位检测有无:"+isCheck);
}else{
@@ -1318,7 +1313,7 @@ public class ExecuteTheRecipe {
});
Thread.sleep(500);
Make位置(deviceNum,"原点位");
if(hasClear){
if(ConfigName.hasClear[deviceNum-1]){
LogUtils.d(" 有清洗,直接下一步");
ThreadManager.get().execute(new Runnable() {
@Override
@@ -1523,7 +1518,7 @@ public class ExecuteTheRecipe {
int mmmm = delay - (int) ((System.currentTimeMillis() - startTime) / 1000);
if (AtPresentTime != mmmm) {
AtPresentTime = mmmm;
NewToastUtil.getInstance().showToast(deviceNum+"号炒锅,延迟等待中,剩余"+AtPresentTime+"秒");
}
} catch (InterruptedException ex) {
}
@@ -1556,6 +1551,7 @@ public class ExecuteTheRecipe {
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhile_WL-"+"true");
}else {
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhile_WL-"+"false");
NewToastUtil.getInstance().showToast(deviceNum+"号炒锅,等待"+name);
}
}else {
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhile_WL-"+"null");
@@ -1604,6 +1600,7 @@ public class ExecuteTheRecipe {
NewToastUtil.getInstance().showToastError("出料空盆没有盆,请检查传感器或放置空盆!");
}
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhile-"+name + ",false");
NewToastUtil.getInstance().showToast(deviceNum+"号炒锅,等待"+name);
LogUtils.d(TAG+" ThreadWhile name="+name+" false");
}
}else {
@@ -1642,6 +1639,7 @@ public class ExecuteTheRecipe {
}
LogUtils.d(TAG+" ThreadWhile name="+name+" true");
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhileFalse-"+name + ",true");
NewToastUtil.getInstance().showToast("输送线进料盆有盆,等待拿走");
}else {
LogUtils.d(TAG+" ThreadWhile name="+name+" false");
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhileFalse-"+name + ",false");
@@ -1683,9 +1681,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+"号炒锅,清洗完成");
}else {
LogUtils.d(TAG+" ThreadWhileClear name="+name+" false");
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhileClear-"+name + ",false");
NewToastUtil.getInstance().showToast(deviceNum+"号炒锅,清洗中...");
}
}else {
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhileClear-"+name + ",null");


+ 4
- 0
app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java View File

@@ -85,6 +85,10 @@ public class ConfigName {
* 是否暂停
*/
public static boolean[] IsPause = new boolean[2];
/**
* 是否有清洗
*/
public static boolean[] hasClear = new boolean[2];

/**
* 正在炒制菜品


+ 2
- 1
app/src/main/java/com/bonait/bnframework/newui/activity/MainHActivity.java View File

@@ -386,7 +386,8 @@ public class MainHActivity extends BaseActivity {

private void reset(){
ModbusCenter.closePLC();
ExecuteTheRecipe.reset1();
ExecuteTheRecipe.reset1(1);
ExecuteTheRecipe.reset1(2);
OrderDetailUtil.resetOrder();
}



Loading…
Cancel
Save