|
|
@@ -44,7 +44,7 @@ import java.util.concurrent.atomic.AtomicBoolean; |
|
|
|
*/ |
|
|
|
public class ExecuteTheRecipe { |
|
|
|
|
|
|
|
//region 变量 |
|
|
|
//region 通用变量 |
|
|
|
/** |
|
|
|
* 等待超时时间 |
|
|
|
*/ |
|
|
@@ -52,7 +52,7 @@ public class ExecuteTheRecipe { |
|
|
|
public static int whileTime = 100; |
|
|
|
|
|
|
|
//手动操作耗时时长 |
|
|
|
public static int HandTime=0; |
|
|
|
public static int HandTime = 0; |
|
|
|
|
|
|
|
/** |
|
|
|
* 监听变量值 |
|
|
@@ -99,7 +99,7 @@ public class ExecuteTheRecipe { |
|
|
|
/** |
|
|
|
* plc 当前版本号 |
|
|
|
*/ |
|
|
|
public static String PlcVersion="0001"; |
|
|
|
public static String PlcVersion = "0001"; |
|
|
|
/** |
|
|
|
* 通知版本号更新显示 |
|
|
|
*/ |
|
|
@@ -113,7 +113,7 @@ public class ExecuteTheRecipe { |
|
|
|
/** |
|
|
|
* 当前工序预计剩余时间 |
|
|
|
*/ |
|
|
|
public static IRunT NoticeAtPresentTime=null; |
|
|
|
public static IRunT NoticeAtPresentTime = null; |
|
|
|
//endregion |
|
|
|
|
|
|
|
//region 强制结束 |
|
|
@@ -154,10 +154,9 @@ public class ExecuteTheRecipe { |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
if(!ConfigName.getInstance().PlcIsConnect) |
|
|
|
{ |
|
|
|
if (!ConfigName.getInstance().PlcIsConnect) { |
|
|
|
ExecuteTheRecipe.showlog("客官,检测到硬件已经断开连接,主动停止炒制!!!"); |
|
|
|
IsForcedEnd=true; |
|
|
|
IsForcedEnd = true; |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
@@ -165,13 +164,12 @@ public class ExecuteTheRecipe { |
|
|
|
boolean isJre = false; |
|
|
|
Object K = ReadPLC("加热"); |
|
|
|
isJre = K == null ? false : (boolean) K; |
|
|
|
if(isJre)//判断是否加热异常 |
|
|
|
if (isJre)//判断是否加热异常 |
|
|
|
{ |
|
|
|
Object gz = ReadPLC("异常加热故障信息"); |
|
|
|
if(gz!=null && (boolean) gz) |
|
|
|
{ |
|
|
|
if (gz != null && (boolean) gz) { |
|
|
|
ExecuteTheRecipe.showlog("客官,检测到硬件加热异常,已主动停止炒制,请联系海科人员!!!"); |
|
|
|
IsForcedEnd=true; |
|
|
|
IsForcedEnd = true; |
|
|
|
final boolean[] IsComplete = {false}; |
|
|
|
String title = "加热异常-温馨提示!"; |
|
|
|
String message = "客官硬件加热异常,请联系海科人员,已强制停止炒制!"; |
|
|
@@ -205,7 +203,9 @@ public class ExecuteTheRecipe { |
|
|
|
} |
|
|
|
|
|
|
|
ExecuteTheRecipe.showlog("开始执行:" + recipe.sort + "、" + recipe.processms); |
|
|
|
if (NoticeAtPresentTime!=null){NoticeAtPresentTime.Run(0);} |
|
|
|
if (NoticeAtPresentTime != null) { |
|
|
|
NoticeAtPresentTime.Run(0); |
|
|
|
} |
|
|
|
|
|
|
|
if (recipe.materialType == 0)//正常物料 |
|
|
|
{ |
|
|
@@ -251,12 +251,14 @@ public class ExecuteTheRecipe { |
|
|
|
try { |
|
|
|
if (!text.isEmpty()) { |
|
|
|
long startTime = System.currentTimeMillis(); //起始时间 |
|
|
|
if(NoticeHandSuspension!=null){NoticeHandSuspension.Run(true);} |
|
|
|
if (NoticeHandSuspension != null) { |
|
|
|
NoticeHandSuspension.Run(true); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//仓号 值 |
|
|
|
HashMap<BPA_SILOS, Integer> formulation = new HashMap<>(); |
|
|
|
int MaxValue=0; |
|
|
|
int MaxValue = 0; |
|
|
|
//region 获取仓号和值 |
|
|
|
List<String> data = new ArrayList<>(); |
|
|
|
if (text.contains("|")) { |
|
|
@@ -278,20 +280,18 @@ public class ExecuteTheRecipe { |
|
|
|
List<BPA_SILOS> bpa_silos = QueryDB.GetSolisByMaterialName(name); |
|
|
|
if (bpa_silos.size() > 0 && val > 0) { |
|
|
|
BPA_SILOS silos = bpa_silos.get(0); |
|
|
|
if(val>=32767) |
|
|
|
{ |
|
|
|
val=32767; |
|
|
|
if (val >= 32767) { |
|
|
|
val = 32767; |
|
|
|
ExecuteTheRecipe.showlog("料仓" + silos.num + "出量克数溢出,已按照最大出量出料!!!"); |
|
|
|
} |
|
|
|
formulation.put(silos, val); |
|
|
|
|
|
|
|
Object jz_z=ReadPLC("料仓"+silos.num+"校准值"); |
|
|
|
if(jz_z!=null) |
|
|
|
{ |
|
|
|
int jzzz= Integer.parseInt(String.valueOf(jz_z)); |
|
|
|
int jzzz_1=jzzz==0?500:jzzz; |
|
|
|
int ztime= (int)(val/ (jzzz_1/5.0)); |
|
|
|
MaxValue=ztime>MaxValue?ztime:MaxValue; |
|
|
|
Object jz_z = ReadPLC("料仓" + silos.num + "校准值"); |
|
|
|
if (jz_z != null) { |
|
|
|
int jzzz = Integer.parseInt(String.valueOf(jz_z)); |
|
|
|
int jzzz_1 = jzzz == 0 ? 500 : jzzz; |
|
|
|
int ztime = (int) (val / (jzzz_1 / 5.0)); |
|
|
|
MaxValue = ztime > MaxValue ? ztime : MaxValue; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@@ -310,13 +310,15 @@ public class ExecuteTheRecipe { |
|
|
|
//一直等待下料完成 否则就一直等待 40s超时 |
|
|
|
for (Map.Entry<BPA_SILOS, Integer> entry : formulation.entrySet()) { |
|
|
|
BPA_SILOS silos = entry.getKey(); |
|
|
|
ThreadWhile_WL("料仓" + silos.num + "下料完成",MaxValue); |
|
|
|
ThreadWhile_WL("料仓" + silos.num + "下料完成", MaxValue); |
|
|
|
} |
|
|
|
|
|
|
|
long endTime = System.currentTimeMillis(); //结束时间 |
|
|
|
int time = (int) ((endTime - startTime) / 1000); |
|
|
|
HandTime=HandTime+time; |
|
|
|
if(NoticeHandSuspension!=null){NoticeHandSuspension.Run(false);} |
|
|
|
HandTime = HandTime + time; |
|
|
|
if (NoticeHandSuspension != null) { |
|
|
|
NoticeHandSuspension.Run(false); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception ex) { |
|
|
|
ToastUtils.error("异常信息:" + ex.getMessage()); |
|
|
@@ -465,7 +467,8 @@ public class ExecuteTheRecipe { |
|
|
|
*/ |
|
|
|
private static void Write_PLC_Stir(HashMap<String, String> data) { |
|
|
|
try { |
|
|
|
int val = 0; int writeValue=0; |
|
|
|
int val = 0; |
|
|
|
int writeValue = 0; |
|
|
|
for (HashMap.Entry<String, String> entry : data.entrySet()) { |
|
|
|
String key = entry.getKey(); |
|
|
|
String value = entry.getValue(); |
|
|
@@ -504,21 +507,16 @@ public class ExecuteTheRecipe { |
|
|
|
} |
|
|
|
|
|
|
|
//region 回读验证 |
|
|
|
Object obj= ReadPLC("搅拌"); |
|
|
|
if(obj!=null) |
|
|
|
{ |
|
|
|
Object obj = ReadPLC("搅拌"); |
|
|
|
if (obj != null) { |
|
|
|
ExecuteTheRecipe.showlog("搅拌回读信号,挡位-" + writeValue + ",开关状态:" + obj); |
|
|
|
if(writeValue==0) |
|
|
|
{ |
|
|
|
if((boolean) obj) |
|
|
|
{ |
|
|
|
if (writeValue == 0) { |
|
|
|
if ((boolean) obj) { |
|
|
|
ExecuteTheRecipe.showlog("搅拌重写,写入开关状态:false,写入成功!"); |
|
|
|
WritePLC("搅拌", false, null); |
|
|
|
} |
|
|
|
}else |
|
|
|
{ |
|
|
|
if(!(boolean) obj) |
|
|
|
{ |
|
|
|
} else { |
|
|
|
if (!(boolean) obj) { |
|
|
|
ExecuteTheRecipe.showlog("搅拌重写,写入开关状态:true,写入成功!"); |
|
|
|
WritePLC("搅拌", true, null); |
|
|
|
} |
|
|
@@ -633,7 +631,9 @@ public class ExecuteTheRecipe { |
|
|
|
} |
|
|
|
ModbusTcpServer.get().WriteBool("M52.1", (boolean) true, null); |
|
|
|
long startTime = System.currentTimeMillis(); //起始时间 |
|
|
|
if(NoticeHandSuspension!=null){NoticeHandSuspension.Run(true);} |
|
|
|
if (NoticeHandSuspension != null) { |
|
|
|
NoticeHandSuspension.Run(true); |
|
|
|
} |
|
|
|
|
|
|
|
final boolean[] IsComplete = {false}; |
|
|
|
Activity activity = findActivity(context); |
|
|
@@ -669,8 +669,10 @@ public class ExecuteTheRecipe { |
|
|
|
ModbusTcpServer.get().WriteBool("M52.1", (boolean) false, null); |
|
|
|
long endTime = System.currentTimeMillis(); //结束时间 |
|
|
|
int time = (int) ((endTime - startTime) / 1000); |
|
|
|
HandTime=HandTime+time; |
|
|
|
if(NoticeHandSuspension!=null){NoticeHandSuspension.Run(false);} |
|
|
|
HandTime = HandTime + time; |
|
|
|
if (NoticeHandSuspension != null) { |
|
|
|
NoticeHandSuspension.Run(false); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ExecuteTheRecipe.showlog("手动已确认投入主料:" + name + "-继续流程"); |
|
|
@@ -797,7 +799,8 @@ public class ExecuteTheRecipe { |
|
|
|
*/ |
|
|
|
private static void Write_PLC_Heating(HashMap<String, String> data) { |
|
|
|
try { |
|
|
|
int val = 0;int writeValue=0; |
|
|
|
int val = 0; |
|
|
|
int writeValue = 0; |
|
|
|
for (HashMap.Entry<String, String> entry : data.entrySet()) { |
|
|
|
String key = entry.getKey(); |
|
|
|
String value = entry.getValue(); |
|
|
@@ -842,21 +845,16 @@ public class ExecuteTheRecipe { |
|
|
|
} |
|
|
|
|
|
|
|
//region 回读验证 |
|
|
|
Object obj= ReadPLC("加热"); |
|
|
|
if(obj!=null) |
|
|
|
{ |
|
|
|
Object obj = ReadPLC("加热"); |
|
|
|
if (obj != null) { |
|
|
|
ExecuteTheRecipe.showlog("加热回读信号,挡位-" + writeValue + ",开关状态:" + obj); |
|
|
|
if(writeValue==0) |
|
|
|
{ |
|
|
|
if((boolean) obj) |
|
|
|
{ |
|
|
|
if (writeValue == 0) { |
|
|
|
if ((boolean) obj) { |
|
|
|
ExecuteTheRecipe.showlog("加热重写,写入开关状态:false,写入成功!"); |
|
|
|
WritePLC("加热", false, null); |
|
|
|
} |
|
|
|
}else |
|
|
|
{ |
|
|
|
if(!(boolean) obj) |
|
|
|
{ |
|
|
|
} else { |
|
|
|
if (!(boolean) obj) { |
|
|
|
ExecuteTheRecipe.showlog("加热重写,写入开关状态:true,写入成功!"); |
|
|
|
WritePLC("加热", true, null); |
|
|
|
} |
|
|
@@ -995,6 +993,8 @@ public class ExecuteTheRecipe { |
|
|
|
private static void Write_PLC_CleanPan(HashMap<String, String> data) { |
|
|
|
try { |
|
|
|
ExecuteTheRecipe.showlog("准备清洗!"); |
|
|
|
String qx_type = "一般清洗"; |
|
|
|
int val_csl=0; |
|
|
|
|
|
|
|
//先延迟 |
|
|
|
for (HashMap.Entry<String, String> entry : data.entrySet()) { |
|
|
@@ -1004,14 +1004,26 @@ public class ExecuteTheRecipe { |
|
|
|
if (key.contains("(秒)") && !IsForcedEnd) { |
|
|
|
int val = Integer.parseInt(value); |
|
|
|
ThreadDelay(val); |
|
|
|
} else if (key.contains("清洗方式")) { |
|
|
|
qx_type = value; |
|
|
|
}else if (key.contains("抽水量")) { |
|
|
|
val_csl = Integer.parseInt(value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//复位反馈信号 |
|
|
|
ExecuteTheRecipe.WritePLC("炒锅清洗反馈", false, null); |
|
|
|
|
|
|
|
//开始清洗 |
|
|
|
BottomClick1("炒锅清洗"); |
|
|
|
if (qx_type.equals("深度清洗")) { |
|
|
|
WritePLC("清洗抽水量", val_csl, null); |
|
|
|
|
|
|
|
Thread.sleep(500);//等待写入成功 |
|
|
|
|
|
|
|
BottomClick1("深度清洗"); |
|
|
|
} else //开始清洗 |
|
|
|
{ |
|
|
|
BottomClick1("炒锅清洗"); |
|
|
|
} |
|
|
|
|
|
|
|
//等待清洗完成 |
|
|
|
ThreadWhile3("炒锅清洗反馈", 5); |
|
|
@@ -1077,7 +1089,9 @@ public class ExecuteTheRecipe { |
|
|
|
} |
|
|
|
ModbusTcpServer.get().WriteBool("M52.1", (boolean) true, null); |
|
|
|
long startTime = System.currentTimeMillis(); //起始时间 |
|
|
|
if(NoticeHandSuspension!=null){NoticeHandSuspension.Run(true);} |
|
|
|
if (NoticeHandSuspension != null) { |
|
|
|
NoticeHandSuspension.Run(true); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
final boolean[] IsComplete = {false}; |
|
|
@@ -1111,8 +1125,10 @@ public class ExecuteTheRecipe { |
|
|
|
ModbusTcpServer.get().WriteBool("M52.1", (boolean) false, null); |
|
|
|
long endTime = System.currentTimeMillis(); //结束时间 |
|
|
|
int time = (int) ((endTime - startTime) / 1000); |
|
|
|
HandTime=HandTime+time; |
|
|
|
if(NoticeHandSuspension!=null){NoticeHandSuspension.Run(false);} |
|
|
|
HandTime = HandTime + time; |
|
|
|
if (NoticeHandSuspension != null) { |
|
|
|
NoticeHandSuspension.Run(false); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ExecuteTheRecipe.showlog("确定完成,继续制作!"); |
|
|
@@ -1220,7 +1236,9 @@ public class ExecuteTheRecipe { |
|
|
|
} |
|
|
|
ModbusTcpServer.get().WriteBool("M52.1", (boolean) true, null); |
|
|
|
long startTime = System.currentTimeMillis(); //起始时间 |
|
|
|
if(NoticeHandSuspension!=null){NoticeHandSuspension.Run(true);} |
|
|
|
if (NoticeHandSuspension != null) { |
|
|
|
NoticeHandSuspension.Run(true); |
|
|
|
} |
|
|
|
|
|
|
|
final boolean[] IsComplete = {false}; |
|
|
|
Activity activity = findActivity(context); |
|
|
@@ -1255,8 +1273,10 @@ public class ExecuteTheRecipe { |
|
|
|
ModbusTcpServer.get().WriteBool("M52.1", (boolean) false, null); |
|
|
|
long endTime = System.currentTimeMillis(); //结束时间 |
|
|
|
int time = (int) ((endTime - startTime) / 1000); |
|
|
|
HandTime=HandTime+time; |
|
|
|
if(NoticeHandSuspension!=null){NoticeHandSuspension.Run(false);} |
|
|
|
HandTime = HandTime + time; |
|
|
|
if (NoticeHandSuspension != null) { |
|
|
|
NoticeHandSuspension.Run(false); |
|
|
|
} |
|
|
|
|
|
|
|
ExecuteTheRecipe.showlog("确定完成,继续制作!"); |
|
|
|
} else { |
|
|
@@ -1586,9 +1606,8 @@ public class ExecuteTheRecipe { |
|
|
|
ModbusTcpServer.get().WriteBool("M52.1", (boolean) false, null); |
|
|
|
//读取版本号 |
|
|
|
ModbusTcpServer.get().ReadInt("VD1100", 1, val -> { |
|
|
|
PlcVersion= String.valueOf(val[0]+""); |
|
|
|
if(NotifyVersionNumUpdates!=null) |
|
|
|
{ |
|
|
|
PlcVersion = String.valueOf(val[0] + ""); |
|
|
|
if (NotifyVersionNumUpdates != null) { |
|
|
|
NotifyVersionNumUpdates.Run(); |
|
|
|
} |
|
|
|
}); |
|
|
@@ -1761,7 +1780,7 @@ public class ExecuteTheRecipe { |
|
|
|
ModbusTcpServer.get().ReadShort(plcaddress.address, 1, val -> { |
|
|
|
ReturnsVariable[0] = val[0]; |
|
|
|
}); |
|
|
|
}else if (plcaddress.address.toUpperCase().startsWith("VR"))//float |
|
|
|
} else if (plcaddress.address.toUpperCase().startsWith("VR"))//float |
|
|
|
{ |
|
|
|
ModbusTcpServer.get().ReadFloat(plcaddress.address, 1, val -> { |
|
|
|
ReturnsVariable[0] = val[0]; |
|
|
@@ -2112,37 +2131,44 @@ public class ExecuteTheRecipe { |
|
|
|
*/ |
|
|
|
public static void ThreadDelay(int delay) { |
|
|
|
ExecuteTheRecipe.showlog("工序线程等待-------时长:" + delay + "秒,请耐心等待,开始计时!"); |
|
|
|
int AtPresentTime=delay; |
|
|
|
if (NoticeAtPresentTime!=null){NoticeAtPresentTime.Run(AtPresentTime);} |
|
|
|
int AtPresentTime = delay; |
|
|
|
if (NoticeAtPresentTime != null) { |
|
|
|
NoticeAtPresentTime.Run(AtPresentTime); |
|
|
|
} |
|
|
|
long startTime = System.currentTimeMillis();// && ConfigName.getInstance().PlcIsConnect |
|
|
|
while ((System.currentTimeMillis() - startTime) <= (delay * 1000) && !IsForcedEnd && ConfigName.getInstance().PlcIsConnect) |
|
|
|
{ |
|
|
|
while ((System.currentTimeMillis() - startTime) <= (delay * 1000) && !IsForcedEnd && ConfigName.getInstance().PlcIsConnect) { |
|
|
|
try { |
|
|
|
Thread.sleep(100); |
|
|
|
int mmmm=delay- (int) ((System.currentTimeMillis() - startTime)/1000); |
|
|
|
if (AtPresentTime!=mmmm) |
|
|
|
{ |
|
|
|
AtPresentTime=mmmm; |
|
|
|
if (NoticeAtPresentTime!=null){NoticeAtPresentTime.Run(mmmm);} |
|
|
|
int mmmm = delay - (int) ((System.currentTimeMillis() - startTime) / 1000); |
|
|
|
if (AtPresentTime != mmmm) { |
|
|
|
AtPresentTime = mmmm; |
|
|
|
if (NoticeAtPresentTime != null) { |
|
|
|
NoticeAtPresentTime.Run(mmmm); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (InterruptedException ex) { |
|
|
|
} |
|
|
|
} |
|
|
|
AtPresentTime=0; |
|
|
|
if (NoticeAtPresentTime!=null){NoticeAtPresentTime.Run(AtPresentTime);} |
|
|
|
AtPresentTime = 0; |
|
|
|
if (NoticeAtPresentTime != null) { |
|
|
|
NoticeAtPresentTime.Run(AtPresentTime); |
|
|
|
} |
|
|
|
long endTime = System.currentTimeMillis(); //结束时间 |
|
|
|
int time = (int) ((endTime - startTime) / 1000); |
|
|
|
ExecuteTheRecipe.showlog("工序线程等待结束-------总耗时:" + time); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 线程等待 |
|
|
|
* |
|
|
|
* @param name |
|
|
|
*/ |
|
|
|
public static void ThreadWhile_WL(String name,int time) { |
|
|
|
public static void ThreadWhile_WL(String name, int time) { |
|
|
|
//"炒菜位1反馈"; |
|
|
|
int AtPresentTime=time; |
|
|
|
if (NoticeAtPresentTime!=null){NoticeAtPresentTime.Run(AtPresentTime);} |
|
|
|
int AtPresentTime = time; |
|
|
|
if (NoticeAtPresentTime != null) { |
|
|
|
NoticeAtPresentTime.Run(AtPresentTime); |
|
|
|
} |
|
|
|
final boolean[] IsComplete = {false}; |
|
|
|
long a = System.currentTimeMillis(); |
|
|
|
ExecuteTheRecipe.showlog(name + ",等待中"); |
|
|
@@ -2154,18 +2180,18 @@ public class ExecuteTheRecipe { |
|
|
|
Object sb = ReadPLC(name); |
|
|
|
if (sb != null) { |
|
|
|
IsComplete[0] = (boolean) (sb); |
|
|
|
if(IsComplete[0]) |
|
|
|
{ |
|
|
|
if (IsComplete[0]) { |
|
|
|
ExecuteTheRecipe.showlog(name + ",接收到信号!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
int mmmm=time- (int) ((System.currentTimeMillis() - a)/1000); |
|
|
|
if (AtPresentTime!=mmmm) |
|
|
|
{ |
|
|
|
AtPresentTime=mmmm; |
|
|
|
if (NoticeAtPresentTime!=null){NoticeAtPresentTime.Run(mmmm);} |
|
|
|
int mmmm = time - (int) ((System.currentTimeMillis() - a) / 1000); |
|
|
|
if (AtPresentTime != mmmm) { |
|
|
|
AtPresentTime = mmmm; |
|
|
|
if (NoticeAtPresentTime != null) { |
|
|
|
NoticeAtPresentTime.Run(mmmm); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Thread.sleep(100);//10 *6 |
|
|
@@ -2174,9 +2200,12 @@ public class ExecuteTheRecipe { |
|
|
|
ExecuteTheRecipe.showlog(name + ",异常退出!" + e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
if (NoticeAtPresentTime!=null){NoticeAtPresentTime.Run(0);} |
|
|
|
if (NoticeAtPresentTime != null) { |
|
|
|
NoticeAtPresentTime.Run(0); |
|
|
|
} |
|
|
|
ExecuteTheRecipe.showlog(name + ",等待结束!"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 线程等待 |
|
|
|
* |
|
|
@@ -2195,8 +2224,7 @@ public class ExecuteTheRecipe { |
|
|
|
Object sb = ReadPLC(name); |
|
|
|
if (sb != null) { |
|
|
|
IsComplete[0] = (boolean) (sb); |
|
|
|
if(IsComplete[0]) |
|
|
|
{ |
|
|
|
if (IsComplete[0]) { |
|
|
|
ExecuteTheRecipe.showlog(name + ",接收到信号!"); |
|
|
|
} |
|
|
|
} |
|
|
@@ -2218,9 +2246,11 @@ public class ExecuteTheRecipe { |
|
|
|
*/ |
|
|
|
public static void ThreadWhile3(String name, int k) { |
|
|
|
//"炒菜位1反馈"; |
|
|
|
int time=name.contains("清洗")?ConfigName.getInstance().AutoQXTime:ConfigName.getInstance().AutoCCTime; |
|
|
|
int AtPresentTime=time; |
|
|
|
if (NoticeAtPresentTime!=null){NoticeAtPresentTime.Run(AtPresentTime);} |
|
|
|
int time = name.contains("清洗") ? ConfigName.getInstance().AutoQXTime : ConfigName.getInstance().AutoCCTime; |
|
|
|
int AtPresentTime = time; |
|
|
|
if (NoticeAtPresentTime != null) { |
|
|
|
NoticeAtPresentTime.Run(AtPresentTime); |
|
|
|
} |
|
|
|
|
|
|
|
final boolean[] IsComplete = {false}; |
|
|
|
long a = System.currentTimeMillis(); |
|
|
@@ -2233,18 +2263,18 @@ public class ExecuteTheRecipe { |
|
|
|
Object sb = ReadPLC(name);//ListeningValue.get(name); |
|
|
|
if (sb != null) { |
|
|
|
IsComplete[0] = (boolean) (sb); |
|
|
|
if(IsComplete[0]) |
|
|
|
{ |
|
|
|
if (IsComplete[0]) { |
|
|
|
ExecuteTheRecipe.showlog(name + ",接收到信号!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
int mmmm=time- (int) ((System.currentTimeMillis() - a)/1000); |
|
|
|
if (AtPresentTime!=mmmm) |
|
|
|
{ |
|
|
|
AtPresentTime=mmmm; |
|
|
|
if (NoticeAtPresentTime!=null){NoticeAtPresentTime.Run(mmmm);} |
|
|
|
int mmmm = time - (int) ((System.currentTimeMillis() - a) / 1000); |
|
|
|
if (AtPresentTime != mmmm) { |
|
|
|
AtPresentTime = mmmm; |
|
|
|
if (NoticeAtPresentTime != null) { |
|
|
|
NoticeAtPresentTime.Run(mmmm); |
|
|
|
} |
|
|
|
} |
|
|
|
Thread.sleep(100);//10 *6 |
|
|
|
} catch (InterruptedException e) { |
|
|
@@ -2252,13 +2282,11 @@ public class ExecuteTheRecipe { |
|
|
|
ExecuteTheRecipe.showlog(name + ",异常退出!" + e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
int xhtime= (int) ((System.currentTimeMillis() - a)/1000); |
|
|
|
if(name.contains("清洗")) |
|
|
|
{ |
|
|
|
ConfigName.getInstance().AutoQXTime=xhtime; |
|
|
|
}else |
|
|
|
{ |
|
|
|
ConfigName.getInstance().AutoCCTime=xhtime; |
|
|
|
int xhtime = (int) ((System.currentTimeMillis() - a) / 1000); |
|
|
|
if (name.contains("清洗")) { |
|
|
|
ConfigName.getInstance().AutoQXTime = xhtime; |
|
|
|
} else { |
|
|
|
ConfigName.getInstance().AutoCCTime = xhtime; |
|
|
|
} |
|
|
|
|
|
|
|
Activity activity = findActivity(context); |
|
|
@@ -2269,7 +2297,9 @@ public class ExecuteTheRecipe { |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
if (NoticeAtPresentTime!=null){NoticeAtPresentTime.Run(0);} |
|
|
|
if (NoticeAtPresentTime != null) { |
|
|
|
NoticeAtPresentTime.Run(0); |
|
|
|
} |
|
|
|
ExecuteTheRecipe.showlog(name + ",等待结束!"); |
|
|
|
} |
|
|
|
//endregion |
|
|
@@ -2281,7 +2311,6 @@ public class ExecuteTheRecipe { |
|
|
|
*/ |
|
|
|
public static void showlog(String msg) { |
|
|
|
Log.e("hbl", msg); |
|
|
|
|
|
|
|
ToastUtils.info(msg); |
|
|
|
} |
|
|
|
//endregion |
|
|
|