|
|
@@ -15,8 +15,8 @@ import java.util.Arrays;
|
|
|
public class PlcUtil {
|
|
|
|
|
|
public static void getParamDyDl(S7PLC s7PLC){
|
|
|
- Boolean starta = s7PLC.readBoolean("DB1.2.2"); //A启动中
|
|
|
- Boolean startb = s7PLC.readBoolean("DB1.2.3"); //B启动中
|
|
|
+ Boolean starta = s7PLC.readBoolean("DB7.0.2"); //A面运行中
|
|
|
+ Boolean startb = s7PLC.readBoolean("DB7.1.2"); //B面运行中
|
|
|
|
|
|
String oprno = MesClient.mes_gw+"A";
|
|
|
if(startb){
|
|
|
@@ -173,11 +173,11 @@ public class PlcUtil {
|
|
|
MesClient.pxstatus1.setText("A:设备运行中");
|
|
|
// MesClient.formatScanType(1);
|
|
|
// MesClient.batch_scan_1.setEnabled(false);
|
|
|
- PlcUtil.changeEnable(s7PLC,false);
|
|
|
}
|
|
|
}else if(MesClient.tjFlaga == 2){
|
|
|
Boolean afinish = getAFinish(s7PLC); //A焊接完成
|
|
|
- if(afinish){ // B启动中,A当做完成
|
|
|
+ if(afinish){
|
|
|
+ PlcUtil.changeEnableA(s7PLC,false);
|
|
|
MesClient.tjFlaga = 3;
|
|
|
MesClient.pxstatus1.setText("A:设备运行结束,提交结果中");
|
|
|
MesClient.finish_ok_bt.setEnabled(true);
|
|
|
@@ -201,11 +201,11 @@ public class PlcUtil {
|
|
|
MesClient.pxstatus2.setText("B:设备运行中");
|
|
|
MesClient.batch_scan_2.setEnabled(false);
|
|
|
MesClient.formatScanType(1);
|
|
|
- PlcUtil.changeEnable(s7PLC,false);
|
|
|
}
|
|
|
}else if(MesClient.tjFlagb == 2){
|
|
|
Boolean bfinish = getBFinish(s7PLC); //B焊接完成
|
|
|
if(bfinish){
|
|
|
+ PlcUtil.changeEnableB(s7PLC,false);
|
|
|
MesClient.tjFlagb = 3;
|
|
|
MesClient.pxstatus2.setText("B:设备运行结束,提交结果中");
|
|
|
MesClient.finish_ng_bt2.setEnabled(true);
|
|
|
@@ -220,58 +220,51 @@ public class PlcUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 获取A启动状态
|
|
|
+ // 获取A面运行中
|
|
|
public static Boolean getAStart(S7PLC s7PLC){
|
|
|
try{
|
|
|
- return s7PLC.readBoolean("DB1.2.2");
|
|
|
+ return s7PLC.readBoolean("DB7.0.2");
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 获取A的结束状态
|
|
|
+ // 获取A面焊接完成
|
|
|
public static Boolean getAFinish(S7PLC s7PLC){
|
|
|
try{
|
|
|
- boolean a = s7PLC.readBoolean("DB1.2.5");
|
|
|
- boolean b = s7PLC.readBoolean("DB1.2.6");
|
|
|
- return a || b;
|
|
|
+ return s7PLC.readBoolean("DB7.0.3");
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 获取B启动状态
|
|
|
+ // 获取B面运行中
|
|
|
public static Boolean getBStart(S7PLC s7PLC){
|
|
|
try{
|
|
|
- return s7PLC.readBoolean("DB1.2.6");
|
|
|
+ return s7PLC.readBoolean("DB7.1.2");
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 获取B的结束状态
|
|
|
+ // 获取B面焊接完成
|
|
|
public static Boolean getBFinish(S7PLC s7PLC){
|
|
|
try{
|
|
|
- boolean a = s7PLC.readBoolean("DB1.2.7");
|
|
|
- boolean b = s7PLC.readBoolean("DB1.2.4");
|
|
|
- return a || b;
|
|
|
+ return s7PLC.readBoolean("DB7.1.3");
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 修改设备的禁用开关
|
|
|
-// DB9.26.4 MES允许启动信号
|
|
|
- public static Boolean changeEnable(S7PLC s7PLC,Boolean result){
|
|
|
+ // A面MES允许启动 DB7.0.0
|
|
|
+ public static Boolean changeEnableA(S7PLC s7PLC,Boolean result){
|
|
|
try{
|
|
|
- //DB9.21.7 A//DB9.26.4 B
|
|
|
- System.out.println("调用允许启动");
|
|
|
- s7PLC.writeBoolean("DB9.26.4",result);
|
|
|
-// s7PLC.writeBoolean("DB9.21.7",result);
|
|
|
+ System.out.println("调用A面MES允许启动:" + result);
|
|
|
+ s7PLC.writeBoolean("DB7.0.0",result);
|
|
|
return true;
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
@@ -279,15 +272,34 @@ public class PlcUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // B面MES允许启动 DB7.1.0
|
|
|
+ public static Boolean changeEnableB(S7PLC s7PLC,Boolean result){
|
|
|
+ try{
|
|
|
+ System.out.println("调用B面MES允许启动:" + result);
|
|
|
+ s7PLC.writeBoolean("DB7.1.0",result);
|
|
|
+ return true;
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 同时设置A/B面MES允许启动
|
|
|
+ public static Boolean changeEnable(S7PLC s7PLC,Boolean result){
|
|
|
+ changeEnableA(s7PLC,result);
|
|
|
+ changeEnableB(s7PLC,result);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
// 获取当前是A面还是B面
|
|
|
public static String getCurAside(S7PLC s7PLC){
|
|
|
String str = "A";
|
|
|
try{
|
|
|
- Boolean ret = s7PLC.readBoolean("DB1.2.0"); // 当前A面
|
|
|
- if(!ret){
|
|
|
+ Boolean aSide = s7PLC.readBoolean("DB7.0.1"); // A面识别
|
|
|
+ Boolean bSide = s7PLC.readBoolean("DB7.1.1"); // B面识别
|
|
|
+ if(bSide && !aSide){
|
|
|
str = "B";
|
|
|
}
|
|
|
-
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|