|
|
@@ -465,7 +465,7 @@ public class ExecuteTheRecipe { |
|
|
|
*/ |
|
|
|
private static void Write_PLC_Stir(HashMap<String, String> data) { |
|
|
|
try { |
|
|
|
int val = 0; |
|
|
|
int val = 0; int writeValue=0; |
|
|
|
for (HashMap.Entry<String, String> entry : data.entrySet()) { |
|
|
|
String key = entry.getKey(); |
|
|
|
String value = entry.getValue(); |
|
|
@@ -473,15 +473,16 @@ public class ExecuteTheRecipe { |
|
|
|
val = Integer.parseInt(value); |
|
|
|
} else { |
|
|
|
ToastUtils.info("工序:" + key + "," + value); |
|
|
|
int writeValue = GetMXValue(key, value); |
|
|
|
writeValue = GetMXValue(key, value); |
|
|
|
if (ExecuteCurrentOperation != null) { |
|
|
|
ExecuteCurrentOperation.Run("搅拌" + "|" + writeValue); |
|
|
|
} |
|
|
|
int finalWriteValue = writeValue; |
|
|
|
WritePLC(key, writeValue, new IWriteCallBack() { |
|
|
|
@Override |
|
|
|
public void onSuccess() { |
|
|
|
ExecuteTheRecipe.showlog("搅拌,挡位-" + writeValue + ",写入成功!"); |
|
|
|
if (writeValue == 0) { |
|
|
|
ExecuteTheRecipe.showlog("搅拌,挡位-" + finalWriteValue + ",写入成功!"); |
|
|
|
if (finalWriteValue == 0) { |
|
|
|
WritePLC("搅拌", false, null); |
|
|
|
} else { |
|
|
|
WritePLC("搅拌", true, null); |
|
|
@@ -490,9 +491,9 @@ public class ExecuteTheRecipe { |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onFailure(String ErrorMsg) { |
|
|
|
ExecuteTheRecipe.showlog("搅拌,挡位-" + writeValue + ",写入失败!原因:" + ErrorMsg); |
|
|
|
WritePLC(key, writeValue, null); |
|
|
|
if (writeValue == 0) { |
|
|
|
ExecuteTheRecipe.showlog("搅拌,挡位-" + finalWriteValue + ",写入失败!原因:" + ErrorMsg); |
|
|
|
WritePLC(key, finalWriteValue, null); |
|
|
|
if (finalWriteValue == 0) { |
|
|
|
WritePLC("搅拌", false, null); |
|
|
|
} else { |
|
|
|
WritePLC("搅拌", true, null); |
|
|
@@ -502,7 +503,30 @@ public class ExecuteTheRecipe { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (val > 0) { |
|
|
|
//region 回读验证 |
|
|
|
Object obj= ReadPLC("搅拌"); |
|
|
|
if(obj!=null) |
|
|
|
{ |
|
|
|
ExecuteTheRecipe.showlog("搅拌回读信号,挡位-" + writeValue + ",开关状态:" + obj); |
|
|
|
if(writeValue==0) |
|
|
|
{ |
|
|
|
if((boolean) obj) |
|
|
|
{ |
|
|
|
ExecuteTheRecipe.showlog("搅拌重写,写入开关状态:false,写入成功!"); |
|
|
|
WritePLC("搅拌", false, null); |
|
|
|
} |
|
|
|
}else |
|
|
|
{ |
|
|
|
if(!(boolean) obj) |
|
|
|
{ |
|
|
|
ExecuteTheRecipe.showlog("搅拌重写,写入开关状态:true,写入成功!"); |
|
|
|
WritePLC("搅拌", true, null); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//endregion |
|
|
|
|
|
|
|
if (val > 0 && !IsForcedEnd) { |
|
|
|
ThreadDelay(val); |
|
|
|
} |
|
|
|
} catch (Exception ex) { |
|
|
@@ -773,7 +797,7 @@ public class ExecuteTheRecipe { |
|
|
|
*/ |
|
|
|
private static void Write_PLC_Heating(HashMap<String, String> data) { |
|
|
|
try { |
|
|
|
int val = 0; |
|
|
|
int val = 0;int writeValue=0; |
|
|
|
for (HashMap.Entry<String, String> entry : data.entrySet()) { |
|
|
|
String key = entry.getKey(); |
|
|
|
String value = entry.getValue(); |
|
|
@@ -781,16 +805,17 @@ public class ExecuteTheRecipe { |
|
|
|
val = Integer.parseInt(value); |
|
|
|
} else { |
|
|
|
ExecuteTheRecipe.showlog("工序:" + key + "," + value); |
|
|
|
int writeValue = GetMXValue(key, value); |
|
|
|
writeValue = GetMXValue(key, value); |
|
|
|
if (ExecuteCurrentOperation != null) { |
|
|
|
ExecuteCurrentOperation.Run("加热" + "|" + writeValue); |
|
|
|
} |
|
|
|
//写加热挡位 |
|
|
|
int finalWriteValue = writeValue; |
|
|
|
WritePLC(key, writeValue, new IWriteCallBack() { |
|
|
|
@Override |
|
|
|
public void onSuccess() { |
|
|
|
ExecuteTheRecipe.showlog("写加热挡位:" + writeValue + "成功"); |
|
|
|
if (writeValue == 0) { |
|
|
|
ExecuteTheRecipe.showlog("写加热挡位:" + finalWriteValue + "成功"); |
|
|
|
if (finalWriteValue == 0) { |
|
|
|
ConfigName.getInstance().IsOpenHuoLi = false; |
|
|
|
WritePLC("加热", false, null); |
|
|
|
} else { |
|
|
@@ -801,9 +826,9 @@ public class ExecuteTheRecipe { |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onFailure(String ErrorMsg) { |
|
|
|
ExecuteTheRecipe.showlog("写加热挡位:" + writeValue + "失败,错误原因:" + ErrorMsg); |
|
|
|
WritePLC(key, writeValue, null); |
|
|
|
if (writeValue == 0) { |
|
|
|
ExecuteTheRecipe.showlog("写加热挡位:" + finalWriteValue + "失败,错误原因:" + ErrorMsg); |
|
|
|
WritePLC(key, finalWriteValue, null); |
|
|
|
if (finalWriteValue == 0) { |
|
|
|
ConfigName.getInstance().IsOpenHuoLi = false; |
|
|
|
WritePLC("加热", false, null); |
|
|
|
} else { |
|
|
@@ -816,6 +841,29 @@ public class ExecuteTheRecipe { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//region 回读验证 |
|
|
|
Object obj= ReadPLC("加热"); |
|
|
|
if(obj!=null) |
|
|
|
{ |
|
|
|
ExecuteTheRecipe.showlog("加热回读信号,挡位-" + writeValue + ",开关状态:" + obj); |
|
|
|
if(writeValue==0) |
|
|
|
{ |
|
|
|
if((boolean) obj) |
|
|
|
{ |
|
|
|
ExecuteTheRecipe.showlog("加热重写,写入开关状态:false,写入成功!"); |
|
|
|
WritePLC("加热", false, null); |
|
|
|
} |
|
|
|
}else |
|
|
|
{ |
|
|
|
if(!(boolean) obj) |
|
|
|
{ |
|
|
|
ExecuteTheRecipe.showlog("加热重写,写入开关状态:true,写入成功!"); |
|
|
|
WritePLC("加热", true, null); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//endregion |
|
|
|
|
|
|
|
if (val > 0 && !IsForcedEnd) { |
|
|
|
ThreadDelay(val); |
|
|
|
} |
|
|
@@ -2233,6 +2281,7 @@ public class ExecuteTheRecipe { |
|
|
|
*/ |
|
|
|
public static void showlog(String msg) { |
|
|
|
Log.e("hbl", msg); |
|
|
|
|
|
|
|
ToastUtils.info(msg); |
|
|
|
} |
|
|
|
//endregion |
|
|
|