|
|
@@ -44,7 +44,7 @@ public class ExecuteTheRecipe { |
|
|
|
/** |
|
|
|
* 等待超时时间 |
|
|
|
*/ |
|
|
|
public static int whileTime = 20; |
|
|
|
public static int whileTime = 30; |
|
|
|
|
|
|
|
/** |
|
|
|
* 监听变量值 |
|
|
@@ -120,6 +120,8 @@ public class ExecuteTheRecipe { |
|
|
|
*/ |
|
|
|
private static void ExecuteMaterialIssuance(String text) { |
|
|
|
try { |
|
|
|
ToastUtils.info("准备下料!!!"); |
|
|
|
|
|
|
|
if (!text.isEmpty()) { |
|
|
|
//仓号 值 |
|
|
|
HashMap<Integer, Integer> formulation = new HashMap<>(); |
|
|
@@ -156,7 +158,9 @@ public class ExecuteTheRecipe { |
|
|
|
Write_PLC_Material(key, value); |
|
|
|
} |
|
|
|
|
|
|
|
//一直等待下料完成 否则就一直等待 6s超时 |
|
|
|
Thread.sleep(200);//等待写入完成 |
|
|
|
|
|
|
|
//一直等待下料完成 否则就一直等待 40s超时 |
|
|
|
for (Map.Entry<Integer, Integer> entry : formulation.entrySet()) { |
|
|
|
Integer num = entry.getKey(); |
|
|
|
Integer val = entry.getValue(); |
|
|
@@ -253,18 +257,31 @@ public class ExecuteTheRecipe { |
|
|
|
*/ |
|
|
|
private static void Write_PLC_Material(int num, int val) { |
|
|
|
try { |
|
|
|
ToastUtils.info("准备写入PLC仓号需求:" + num + "," + val/10.0); |
|
|
|
|
|
|
|
String name = "料仓" + num + "下料完成"; |
|
|
|
ExecuteTheRecipe.WritePLC(name, false, null); |
|
|
|
|
|
|
|
final boolean[] IsComplete = {false}; |
|
|
|
|
|
|
|
WritePLC("料仓" + num + "需求值", val, new IWriteCallBack() { |
|
|
|
@Override |
|
|
|
public void onSuccess() { |
|
|
|
BottomClick("料仓" + num + "下料"); |
|
|
|
IsComplete[0] = true; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onFailure(String ErrorMsg) { |
|
|
|
} |
|
|
|
}); |
|
|
|
long a = System.currentTimeMillis(); |
|
|
|
while (!IsComplete[0]) { |
|
|
|
if ((System.currentTimeMillis() - a) > 1000 * whileTime) { |
|
|
|
break; |
|
|
|
} |
|
|
|
Thread.sleep(100);//10 *6 |
|
|
|
} |
|
|
|
ToastUtils.info("写入PLC仓号需求:" + num + "," + val/10.0); |
|
|
|
} catch (Exception ex) { |
|
|
|
ToastUtils.error("异常信息:" + ex.getMessage()); |
|
|
@@ -289,7 +306,6 @@ public class ExecuteTheRecipe { |
|
|
|
ToastUtils.info("工序:" + key + "," + value); |
|
|
|
if (key.contains("(秒)")) { |
|
|
|
val = Integer.parseInt(value); |
|
|
|
Thread.sleep(val * 1000); |
|
|
|
} else { |
|
|
|
int writeValue = GetMXValue(key, value); |
|
|
|
WritePLC(key, writeValue, new IWriteCallBack() { |
|
|
@@ -326,18 +342,23 @@ 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(); |
|
|
|
ToastUtils.info("工序:" + key + "," + value); |
|
|
|
if (key.contains("(秒)")) { |
|
|
|
val = Integer.parseInt(value); |
|
|
|
Thread.sleep(val * 1000); |
|
|
|
} else if (key.contains("速度")) { |
|
|
|
int writeValue = GetMXValue(key, value); |
|
|
|
WritePLC(key, writeValue, null); |
|
|
|
} else { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
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("速度")) { |
|
|
|
//原点位,等待机器移动倒响应位置 |
|
|
|
BottomClick(value); |
|
|
|
|
|
|
@@ -378,6 +399,7 @@ public class ExecuteTheRecipe { |
|
|
|
try { |
|
|
|
//是否手动 |
|
|
|
boolean ishand=true; |
|
|
|
ToastUtils.info("准备倒入主料!"); |
|
|
|
|
|
|
|
//region 判断是否手动 |
|
|
|
if(ConfigName.getInstance().versionSelectionEnum.equals("大炒版本")) |
|
|
@@ -529,13 +551,33 @@ public class ExecuteTheRecipe { |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
final boolean[] IsComplete = {false}; |
|
|
|
long a = System.currentTimeMillis(); |
|
|
|
|
|
|
|
WritePLC(name,true,null); |
|
|
|
new Handler().postDelayed(new Runnable() { |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
ExecuteTheRecipe.WritePLC(name, false, null); |
|
|
|
ExecuteTheRecipe.WritePLC(name, false, new IWriteCallBack() { |
|
|
|
@Override |
|
|
|
public void onSuccess() { |
|
|
|
IsComplete[0]=true; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onFailure(String ErrorMsg) { |
|
|
|
IsComplete[0]=true; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}, 500); |
|
|
|
|
|
|
|
while (!IsComplete[0]) { |
|
|
|
if ((System.currentTimeMillis() - a) > 1000 * 3) { |
|
|
|
break; |
|
|
|
} |
|
|
|
Thread.sleep(100);//10 *6 |
|
|
|
} |
|
|
|
}catch (Exception ex) |
|
|
|
{ |
|
|
|
|
|
|
@@ -623,6 +665,7 @@ public class ExecuteTheRecipe { |
|
|
|
*/ |
|
|
|
private static void Write_PLC_Outdishes(HashMap<String, String> data) { |
|
|
|
try { |
|
|
|
ToastUtils.info("准备出菜!"); |
|
|
|
|
|
|
|
BottomClick("出菜"); |
|
|
|
|
|
|
|