Browse Source

888333

tags/old_version_1
fyf 1 year ago
parent
commit
daa03c635d
1 changed files with 12 additions and 8 deletions
  1. +12
    -8
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java

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

@@ -4,6 +4,7 @@ import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;

import androidx.annotation.NonNull;
@@ -44,7 +45,7 @@ public class ExecuteTheRecipe {
/**
* 等待超时时间
*/
public static int whileTime = 30;
public static int whileTime = 40;

/**
* 监听变量值
@@ -317,10 +318,10 @@ public class ExecuteTheRecipe {
for (HashMap.Entry<String, String> entry : data.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
ToastUtils.info("工序:" + key + "," + value);
if (key.contains("(秒)")) {
val = Integer.parseInt(value);
} else {
ToastUtils.info("工序:" + key + "," + value);
int writeValue = GetMXValue(key, value);
WritePLC(key, writeValue, new IWriteCallBack() {
@Override
@@ -356,7 +357,6 @@ public class ExecuteTheRecipe {
private static void Write_PLC_Location(HashMap<String, String> data) {
try {
int val=0;
ToastUtils.info("准备控制炒锅移动!!!");
for (HashMap.Entry<String, String> entry : data.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
@@ -371,15 +371,15 @@ public class ExecuteTheRecipe {
for (HashMap.Entry<String, String> entry : data.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
ToastUtils.info("工序:" + key + "," + value);
if (!key.contains("(秒)") && !key.contains("速度")) {
ToastUtils.info("工序:" + key + "," + value);
//原点位,等待机器移动倒响应位置
BottomClick(value);

//一直等待机器移动到该位置,否则就一直等待 6s超时
String name = value + "反馈";
final boolean[] IsComplete = {false};
long a = System.currentTimeMillis();
Log.e("等待反馈", name+",等待中");
while (!IsComplete[0]) {
if ((System.currentTimeMillis() - a) > 1000 * whileTime) {
break;
@@ -391,6 +391,8 @@ public class ExecuteTheRecipe {
}
Thread.sleep(100);//10 *6
}
Log.e("等待反馈", name+",等待结束");

ToastUtils.info("炒锅到达"+value+",继续制作!!!");
}
}
@@ -581,16 +583,18 @@ public class ExecuteTheRecipe {
{
try
{
Log.e("按钮按下", name );
WritePLC(name,true,null);
new Handler().postDelayed(new Runnable() {
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
Log.e("按钮复位", name );
ExecuteTheRecipe.WritePLC(name, false, null);
}
}, 500);
}catch (Exception ex)
{
Log.e("按钮异常", name +ex.getMessage());
}
}

@@ -615,10 +619,10 @@ public class ExecuteTheRecipe {
for (HashMap.Entry<String, String> entry : data.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
ToastUtils.info("工序:" + key + "," + value);
if (key.contains("(秒)")) {
val = Integer.parseInt(value);
} else {
ToastUtils.info("工序:" + key + "," + value);
int writeValue = GetMXValue(key, value);
WritePLC(key, writeValue, new IWriteCallBack() {
@Override


Loading…
Cancel
Save