新增1线,是从2线平移过去的。
This commit is contained in:
parent
4e10024bc8
commit
11b41b18f1
@ -224,8 +224,8 @@ public class KukaEvent2ThreadLine2 implements ApplicationRunner {
|
||||
}
|
||||
|
||||
//一. 从plc 中获取 subIdList 和 lineNum
|
||||
String[] subIdList = (String[])read(S7Client.S7_DDJ1,Step2Plc2MesVar.SubIdList);
|
||||
Integer listSize = (Integer)read(S7Client.S7_DDJ1,Step2Plc2MesVar.PackageNumberSet)-1;
|
||||
String[] subIdList = (String[])read(S7Client.S7_DDJ2,Step2Plc2MesVar.SubIdList);
|
||||
Integer listSize = (Integer)read(S7Client.S7_DDJ2,Step2Plc2MesVar.PackageNumberSet)-1;
|
||||
|
||||
|
||||
//二. MES 业务
|
||||
@ -301,11 +301,11 @@ public class KukaEvent2ThreadLine2 implements ApplicationRunner {
|
||||
//=============== MES 业务 结束 =================
|
||||
|
||||
//三. 把生成的BoxId 告诉kuka
|
||||
write(S7Client.S7_DDJ1,Step2Mes2PlcVar.BoxId,boxId);
|
||||
write(S7Client.S7_DDJ2,Step2Mes2PlcVar.BoxId,boxId);
|
||||
logger.info("BOXID生成Event-------boxId :"+ boxId+"传给PLC 成功");
|
||||
|
||||
//四. 当MES完成任务后,把MesToPlc.ShelfIsFullFinish变量置为true,告诉plc,我操作完成了
|
||||
write(S7Client.S7_DDJ1,Step2Mes2PlcVar.ShelfIsFullFinish,true);
|
||||
write(S7Client.S7_DDJ2,Step2Mes2PlcVar.ShelfIsFullFinish,true);
|
||||
logger.info("BOXID生成Event-------boxId :"+ boxId+"ShelfIsFullFinish 置为true 成功");
|
||||
//四. mes 监控 到PlcToMes.SubArrived==false,就把MesToPlc.SubArrivedFinish置为false
|
||||
Integer subArrived2 = waitingForTarget(Step2Plc2MesVar.ShelfIsFull, false);
|
||||
@ -314,7 +314,7 @@ public class KukaEvent2ThreadLine2 implements ApplicationRunner {
|
||||
}else if(subArrived2 == 2){
|
||||
throw new Exception("MES 监听值出现异常。");
|
||||
}
|
||||
write(S7Client.S7_DDJ1,Step2Mes2PlcVar.ShelfIsFullFinish,false);
|
||||
write(S7Client.S7_DDJ2,Step2Mes2PlcVar.ShelfIsFullFinish,false);
|
||||
logger.info("BOXID生成Event-------boxId :"+ boxId+"ShelfIsFullFinish 置为false 成功,Event2 成功结束");
|
||||
logger.info("================================== 现在开始执行 过程二 任务( 结束 ) ===================================");
|
||||
logger.info("");
|
||||
@ -342,7 +342,7 @@ public class KukaEvent2ThreadLine2 implements ApplicationRunner {
|
||||
while (true){
|
||||
try {
|
||||
|
||||
Boolean now = (Boolean) read(S7Client.S7_DDJ1,var);
|
||||
Boolean now = (Boolean) read(S7Client.S7_DDJ2,var);
|
||||
//注意:即使now为null ,这里也不会抛出异常,这里很容易产生 空轮询。
|
||||
if(now == null){
|
||||
throw new Exception("");
|
||||
@ -373,7 +373,7 @@ public class KukaEvent2ThreadLine2 implements ApplicationRunner {
|
||||
Integer res = 0;
|
||||
while (true){
|
||||
try {
|
||||
Boolean now = (Boolean) read(S7Client.S7_DDJ1,var);
|
||||
Boolean now = (Boolean) read(S7Client.S7_DDJ2,var);
|
||||
if(now == null){
|
||||
throw new Exception("");
|
||||
}
|
||||
@ -403,7 +403,7 @@ public class KukaEvent2ThreadLine2 implements ApplicationRunner {
|
||||
Integer res = 0;
|
||||
while (true){
|
||||
try {
|
||||
Boolean now = (Boolean) read(S7Client.S7_DDJ1,var);
|
||||
Boolean now = (Boolean) read(S7Client.S7_DDJ2,var);
|
||||
if(now == null){
|
||||
throw new Exception("");
|
||||
}
|
||||
|
@ -216,8 +216,8 @@ public class KukaEvent3ThreadLine2 implements ApplicationRunner {
|
||||
}
|
||||
|
||||
//一. 从plc 中获取 subIdList 和 lineNum
|
||||
String boxId = (String)read(S7Client.S7_DDJ1,Step3Plc2MesVar.BoxId);
|
||||
Integer lineNum = (Integer) read(S7Client.S7_DDJ1,Step3Plc2MesVar.LineNum);
|
||||
String boxId = (String)read(S7Client.S7_DDJ2,Step3Plc2MesVar.BoxId);
|
||||
Integer lineNum = (Integer) read(S7Client.S7_DDJ2,Step3Plc2MesVar.LineNum);
|
||||
if(boxId == null){
|
||||
logger.info("装箱单打印Event-------失败"+" --- "+"从plc里面获取到的boxId 为null");
|
||||
throw new Exception("装箱单打印Event-------boxId 为null");
|
||||
@ -233,7 +233,7 @@ public class KukaEvent3ThreadLine2 implements ApplicationRunner {
|
||||
|
||||
|
||||
//四. 当MES完成任务后,把MesToPlc.ShelfIsFullArrivedFinish变量置为true,告诉plc,我操作完成了
|
||||
write(S7Client.S7_DDJ1,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,true);
|
||||
write(S7Client.S7_DDJ2,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,true);
|
||||
logger.info("装箱单打印Event------boxId :"+boxId+", ShelfIsFullArrivedFinish置为true 成功");
|
||||
//四. mes 监控 到PlcToMes.SubArrived==false,就把MesToPlc.SubArrivedFinish置为false
|
||||
Integer subArrived2 = waitingForTarget(Step3Plc2MesVar.ShelfIsFullArrived, false);
|
||||
@ -243,7 +243,7 @@ public class KukaEvent3ThreadLine2 implements ApplicationRunner {
|
||||
throw new Exception("MES 监听值出现异常。");
|
||||
}
|
||||
logger.info("装箱单打印Event------boxId :"+boxId+", 监听到subArrived=false 成功");
|
||||
write(S7Client.S7_DDJ1,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,false);
|
||||
write(S7Client.S7_DDJ2,Step3Mes2PlcVar.ShelfIsFullArrivedFinish,false);
|
||||
logger.info("装箱单打印Event------boxId :"+boxId+", Even3 成功");
|
||||
|
||||
logger.info("================================== 现在开始执行 过程三 任务( 结束 ) ===================================");
|
||||
@ -273,7 +273,7 @@ public class KukaEvent3ThreadLine2 implements ApplicationRunner {
|
||||
while (true){
|
||||
try {
|
||||
|
||||
Boolean now = (Boolean) read(S7Client.S7_DDJ1,var);
|
||||
Boolean now = (Boolean) read(S7Client.S7_DDJ2,var);
|
||||
//注意:即使now为null ,这里也不会抛出异常,这里很容易产生 空轮询。
|
||||
if(now == null){
|
||||
throw new Exception("");
|
||||
@ -304,7 +304,7 @@ public class KukaEvent3ThreadLine2 implements ApplicationRunner {
|
||||
Integer res = 0;
|
||||
while (true){
|
||||
try {
|
||||
Boolean now = (Boolean) read(S7Client.S7_DDJ1,var);
|
||||
Boolean now = (Boolean) read(S7Client.S7_DDJ2,var);
|
||||
if(now == null){
|
||||
throw new Exception("");
|
||||
}
|
||||
@ -334,7 +334,7 @@ public class KukaEvent3ThreadLine2 implements ApplicationRunner {
|
||||
Integer res = 0;
|
||||
while (true){
|
||||
try {
|
||||
Boolean now = (Boolean) read(S7Client.S7_DDJ1,var);
|
||||
Boolean now = (Boolean) read(S7Client.S7_DDJ2,var);
|
||||
if(now == null){
|
||||
throw new Exception("");
|
||||
}
|
||||
|
@ -265,6 +265,37 @@ public class TestController {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping("/testReadAll2")
|
||||
public R testReadAll2() throws UnsupportedEncodingException, ParseException {
|
||||
for(Step1Plc2MesVar actual:Step1Plc2MesVar.values()){
|
||||
logger.info(read(S7Client.S7_DDJ2,actual).toString());
|
||||
System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_DDJ2,actual).toString());
|
||||
}
|
||||
for(Step1Mes2PlcVar actual:Step1Mes2PlcVar.values()){
|
||||
logger.info(read(S7Client.S7_DDJ2,actual).toString());
|
||||
System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_DDJ2,actual).toString());
|
||||
}
|
||||
|
||||
for(Step2Plc2MesVar actual:Step2Plc2MesVar.values()){
|
||||
logger.info(read(S7Client.S7_DDJ2,actual).toString());
|
||||
System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_DDJ2,actual).toString());
|
||||
}
|
||||
for(Step2Mes2PlcVar actual:Step2Mes2PlcVar.values()){
|
||||
logger.info(read(S7Client.S7_DDJ2,actual).toString());
|
||||
System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_DDJ2,actual).toString());
|
||||
}
|
||||
|
||||
for(Step3Plc2MesVar actual:Step3Plc2MesVar.values()){
|
||||
logger.info(read(S7Client.S7_DDJ2,actual).toString());
|
||||
System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_DDJ2,actual).toString());
|
||||
}
|
||||
for(Step3Mes2PlcVar actual:Step3Mes2PlcVar.values()){
|
||||
logger.info(read(S7Client.S7_DDJ2,actual).toString());
|
||||
System.out.println(actual.getName().toString()+" : "+read(S7Client.S7_DDJ2,actual).toString());
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
BigDecimal voc = new BigDecimal(59.799);
|
||||
System.out.println(Float.valueOf(voc.toString()));
|
||||
|
@ -29,12 +29,13 @@ public enum S7Client {
|
||||
// S7_1500("192.168.0.51",0,1,1),
|
||||
|
||||
//1线
|
||||
S7_DDJ1("10.10.3.158",0,1,2),
|
||||
|
||||
//S7_DDJ1("10.10.3.152",0,1,2),
|
||||
S7_DDJ1("10.10.3.152",0,1,2),
|
||||
//2线
|
||||
S7_DDJ2("10.10.3.158",0,1,2),
|
||||
|
||||
//1500 机架-0 插槽-1
|
||||
|
||||
//1500 机架-0 插槽-1
|
||||
//后续 在这里扩展 多PLC应用。
|
||||
;
|
||||
private String host;
|
||||
|
Loading…
Reference in New Issue
Block a user