|
@@ -15,9 +15,9 @@ public class PlcUtil {
|
|
|
|
|
|
|
|
if(MesClient.sortA < cur){
|
|
if(MesClient.sortA < cur){
|
|
|
MesClient.sortA = cur;
|
|
MesClient.sortA = cur;
|
|
|
-// if (cur == 9){
|
|
|
|
|
-// plc.writeUInt16("DB1.DBW54",2);
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ if (cur == 16){
|
|
|
|
|
+ plc.writeUInt16("DB1.DBW54",2);
|
|
|
|
|
+ }
|
|
|
int fout = plc.readInt32("DB1.144.0");
|
|
int fout = plc.readInt32("DB1.144.0");
|
|
|
Float sout = plc.readFloat32("DB1.148.0");
|
|
Float sout = plc.readFloat32("DB1.148.0");
|
|
|
|
|
|
|
@@ -120,8 +120,17 @@ public class PlcUtil {
|
|
|
boolean rivetDoneB = (MesClient.sortB >= MesClient.bMax); // 1
|
|
boolean rivetDoneB = (MesClient.sortB >= MesClient.bMax); // 1
|
|
|
boolean allDone = torqueDone && rivetDoneA && rivetDoneB;
|
|
boolean allDone = torqueDone && rivetDoneA && rivetDoneB;
|
|
|
|
|
|
|
|
- if (rivetDoneA && rivetDoneB) {
|
|
|
|
|
- PlcUtil.setPowerOff(MesClient.plcA);
|
|
|
|
|
|
|
+// if (rivetDoneA && rivetDoneB) {
|
|
|
|
|
+// PlcUtil.setPowerOff(MesClient.plcA);
|
|
|
|
|
+// }
|
|
|
|
|
+
|
|
|
|
|
+ // A完成
|
|
|
|
|
+ if(rivetDoneA){
|
|
|
|
|
+ PlcUtil.setPowerOffA(MesClient.plcA);
|
|
|
|
|
+ }
|
|
|
|
|
+ // b 完成
|
|
|
|
|
+ if(rivetDoneB){
|
|
|
|
|
+ PlcUtil.setPowerOffB(MesClient.plcA);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -155,7 +164,8 @@ public class PlcUtil {
|
|
|
public static Boolean setPowerOn(S7PLC plc){
|
|
public static Boolean setPowerOn(S7PLC plc){
|
|
|
Boolean ret = false;
|
|
Boolean ret = false;
|
|
|
try{
|
|
try{
|
|
|
- plc.writeBoolean("DB4.DBX0.1",false);
|
|
|
|
|
|
|
+ plc.writeBoolean("DB4.DBX0.1",true);
|
|
|
|
|
+ plc.writeBoolean("DB4.DBX204.0",true);
|
|
|
ret = true;
|
|
ret = true;
|
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@@ -163,6 +173,30 @@ public class PlcUtil {
|
|
|
}
|
|
}
|
|
|
return ret;
|
|
return ret;
|
|
|
}
|
|
}
|
|
|
|
|
+//
|
|
|
|
|
+// public static Boolean setPowerOnA(S7PLC plc){
|
|
|
|
|
+// Boolean ret = false;
|
|
|
|
|
+// try{
|
|
|
|
|
+// plc.writeBoolean("DB4.DBX0.1",true);
|
|
|
|
|
+// ret = true;
|
|
|
|
|
+// }catch (Exception e){
|
|
|
|
|
+// e.printStackTrace();
|
|
|
|
|
+// ret = false;
|
|
|
|
|
+// }
|
|
|
|
|
+// return ret;
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// public static Boolean setPowerOnB(S7PLC plc){
|
|
|
|
|
+// Boolean ret = false;
|
|
|
|
|
+// try{
|
|
|
|
|
+// plc.writeBoolean("DB4.DBX204.0",true);
|
|
|
|
|
+// ret = true;
|
|
|
|
|
+// }catch (Exception e){
|
|
|
|
|
+// e.printStackTrace();
|
|
|
|
|
+// ret = false;
|
|
|
|
|
+// }
|
|
|
|
|
+// return ret;
|
|
|
|
|
+// }
|
|
|
|
|
|
|
|
public static Boolean setPowerOff(S7PLC plc){
|
|
public static Boolean setPowerOff(S7PLC plc){
|
|
|
Boolean ret = false;
|
|
Boolean ret = false;
|
|
@@ -176,6 +210,31 @@ public class PlcUtil {
|
|
|
return ret;
|
|
return ret;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public static Boolean setPowerOffA(S7PLC plc){
|
|
|
|
|
+ Boolean ret = false;
|
|
|
|
|
+ try{
|
|
|
|
|
+ plc.writeBoolean("DB4.DBX0.1",false);
|
|
|
|
|
+ ret = true;
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ ret = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ return ret;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public static Boolean setPowerOffB(S7PLC plc){
|
|
|
|
|
+ Boolean ret = false;
|
|
|
|
|
+ try{
|
|
|
|
|
+ plc.writeBoolean("DB4.DBX204.0",false);
|
|
|
|
|
+ ret = true;
|
|
|
|
|
+ }catch (Exception e){
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ ret = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ return ret;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
public static void setTask(S7PLC plc,int setNumA,int setNumB){
|
|
public static void setTask(S7PLC plc,int setNumA,int setNumB){
|
|
|
try{
|
|
try{
|
|
|
plc.writeUInt16("DB1.DBW54",1);
|
|
plc.writeUInt16("DB1.DBW54",1);
|