优化
This commit is contained in:
@@ -39,7 +39,7 @@ public class PlcDdj1Read extends Thread {
|
||||
try {
|
||||
if (IsConnect()) {
|
||||
readPlcDdj(msgDdj);
|
||||
Thread.sleep(1000);
|
||||
Thread.sleep(800);
|
||||
} else {
|
||||
reConnect();
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class PlcDdj2Read extends Thread {
|
||||
try {
|
||||
if (IsConnect()) {
|
||||
readPlcDdj(msgDdj);
|
||||
Thread.sleep(1000);
|
||||
Thread.sleep(800);
|
||||
} else {
|
||||
reConnect();
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class PlcSsjRead implements Runnable {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Thread.sleep(1000);
|
||||
Thread.sleep(800);
|
||||
} else {
|
||||
reConnect();
|
||||
}
|
||||
@@ -156,27 +156,27 @@ public class PlcSsjRead implements Runnable {
|
||||
String allot="";
|
||||
switch (ssjDevice.getDeviceCode()){
|
||||
case "G1005":
|
||||
trayCodeReadAddress = "DB5023.0";
|
||||
allot = "DB802.0";
|
||||
trayCodeReadAddress = "DB503.0";
|
||||
allot = "DB802.24";
|
||||
break;
|
||||
case "L2004":
|
||||
trayCodeReadAddress = "DB503.200";
|
||||
trayCodeReadAddress = "DB503.600";
|
||||
break;
|
||||
case "L2006":
|
||||
trayCodeReadAddress = "DB503.400";
|
||||
trayCodeReadAddress = "DB503.800";
|
||||
break;
|
||||
case "L1001":
|
||||
trayCodeReadAddress = "DB503.600";
|
||||
allot = "DB802.12";
|
||||
trayCodeReadAddress = "DB503.200";
|
||||
allot = "DB802.0";
|
||||
break;
|
||||
case "L1003":
|
||||
trayCodeReadAddress = "DB503.800";
|
||||
allot = "DB802.24";
|
||||
trayCodeReadAddress = "DB503.400";
|
||||
allot = "DB802.12";
|
||||
break;
|
||||
}
|
||||
|
||||
if(!"".equals(allot)){
|
||||
OperateResultExOne<byte[]> agvSsj = readWriteNet.Read(trayCodeReadAddress, Short.parseShort("12"));
|
||||
OperateResultExOne<byte[]> agvSsj = readWriteNet.Read(allot, Short.parseShort("2"));
|
||||
if (agvSsj.IsSuccess){
|
||||
//去除bytes中
|
||||
ddsx1 = SoftBasic.ByteToHexString(agvSsj.Content);
|
||||
@@ -184,11 +184,27 @@ public class PlcSsjRead implements Runnable {
|
||||
}
|
||||
}
|
||||
if(!"".equals(trayCodeReadAddress)){
|
||||
OperateResultExOne<byte[]> trayCodeRead = readWriteNet.Read(trayCodeReadAddress, Short.parseShort("220"));
|
||||
OperateResultExOne<byte[]> trayCodeRead = readWriteNet.Read(trayCodeReadAddress, Short.parseShort("200"));
|
||||
if (trayCodeRead.IsSuccess){
|
||||
byte[] content = trayCodeRead.Content;
|
||||
//去除bytes中
|
||||
ssjDevice.setTrayCode(ParseUtil.filterAndConvert(trayCodeRead.Content));
|
||||
// if("L2004".equals(ssjDevice.getDeviceCode())){
|
||||
// ssjDevice.setTrayCode("gMODEL:1 COLOR:1 SERIAL:2 V:1 Hz:1 PH:1 N.W.:1 G.W.:1 ITEM_CODE:12345 @:1$S0T0S1T0S1T0S1T0$40001015202@");
|
||||
// }else{
|
||||
// ssjDevice.setTrayCode("gMODEL:1 COLOR:1 SERIAL:1 V:1 Hz:1 PH:1 N.W.:1 G.W.:1 ITEM_CODE:123456 @:1$S0T0S1T0S1T0S1T0$40001015202@");
|
||||
// }
|
||||
}
|
||||
}
|
||||
OperateResultExOne<byte[]> agvSsjTask = readWriteNet.Read("DB501.280", Short.parseShort("8"));
|
||||
String ddsx2 = "0";
|
||||
if (agvSsjTask.IsSuccess) {
|
||||
ddsx2 = SoftBasic.ByteToHexString(agvSsjTask.Content);
|
||||
if("L1001".equals(ssjDevice.getDeviceCode())){
|
||||
ssjDevice.setTaskNo2(ParseUtil.optDInt(0, ddsx2));
|
||||
}
|
||||
if("L1003".equals(ssjDevice.getDeviceCode())){
|
||||
ssjDevice.setTaskNo2(ParseUtil.optDInt(4, ddsx2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class Tools implements Serializable {
|
||||
|
||||
public static void main(String[] arg) {
|
||||
int jym = getJYM(1, 2, 3);
|
||||
System.out.println(jym);
|
||||
//System.out.println(jym);
|
||||
}
|
||||
|
||||
/*4、CRC-16校验码计算方法:
|
||||
@@ -58,7 +58,7 @@ public class Tools implements Serializable {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
int s = j + i * 4;
|
||||
ints1[s] = son[j];
|
||||
System.out.println(Arrays.toString(ints1));
|
||||
//System.out.println(Arrays.toString(ints1));
|
||||
}
|
||||
}
|
||||
int a = 0;
|
||||
@@ -225,10 +225,10 @@ public class Tools implements Serializable {
|
||||
ints[22] = binaryTints8(printBits(a23));
|
||||
ints[23] = binaryTints8(printBits(a24));
|
||||
ints[24] = binaryTints8(printBits(a25));
|
||||
for (int anInt : ints) {
|
||||
System.out.print(anInt + " ");
|
||||
}
|
||||
System.out.println();
|
||||
// for (int anInt : ints) {
|
||||
// System.out.print(anInt + " ");
|
||||
// }
|
||||
// System.out.println();
|
||||
return BytesToInt(ints);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user