现场调试修改
This commit is contained in:
@@ -39,8 +39,9 @@ public class PlcDdj1Read extends Thread {
|
||||
try {
|
||||
if (IsConnect()) {
|
||||
readPlcDdj(msgDdj);
|
||||
Thread.sleep(800);
|
||||
Thread.sleep(1000);
|
||||
} else {
|
||||
Thread.sleep(2000);
|
||||
reConnect();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
@@ -54,7 +55,7 @@ public class PlcDdj1Read extends Thread {
|
||||
}
|
||||
|
||||
private void readPlcDdj(MsgDdj msgDdj) {
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(msgDdj.getPlcDbReadAddress(), Convert.toShort("38"));
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(msgDdj.getPlcDbReadAddress(), Convert.toShort("32"));
|
||||
String ddsx = "0";
|
||||
if (read2.IsSuccess) {
|
||||
ddsx = SoftBasic.ByteToHexString(read2.Content);
|
||||
@@ -71,6 +72,7 @@ public class PlcDdj1Read extends Thread {
|
||||
msgDdj.setMbch(ParseUtil.optInt(22, ddsx));
|
||||
msgDdj.setYxxf(ParseUtil.optInt(24, ddsx));
|
||||
msgDdj.setXtxh(ParseUtil.optInt(26, ddsx));
|
||||
msgDdj.setHeight(ParseUtil.optInt(30, ddsx));
|
||||
|
||||
msgDdj.setCurrentRow(ParseUtil.optInt(12, ddsx));
|
||||
msgDdj.setCurrentColumn(ParseUtil.optInt(14, ddsx));
|
||||
|
||||
@@ -39,8 +39,9 @@ public class PlcDdj2Read extends Thread {
|
||||
try {
|
||||
if (IsConnect()) {
|
||||
readPlcDdj(msgDdj);
|
||||
Thread.sleep(800);
|
||||
Thread.sleep(1000);
|
||||
} else {
|
||||
Thread.sleep(2000);
|
||||
reConnect();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
@@ -54,7 +55,7 @@ public class PlcDdj2Read extends Thread {
|
||||
}
|
||||
|
||||
private void readPlcDdj(MsgDdj msgDdj) {
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(msgDdj.getPlcDbReadAddress(), Convert.toShort("38"));
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(msgDdj.getPlcDbReadAddress(), Convert.toShort("34"));
|
||||
String ddsx = "0";
|
||||
if (read2.IsSuccess) {
|
||||
ddsx = SoftBasic.ByteToHexString(read2.Content);
|
||||
@@ -71,10 +72,12 @@ public class PlcDdj2Read extends Thread {
|
||||
msgDdj.setMbch(ParseUtil.optInt(22, ddsx));
|
||||
msgDdj.setYxxf(ParseUtil.optInt(24, ddsx));
|
||||
msgDdj.setXtxh(ParseUtil.optInt(26, ddsx));
|
||||
msgDdj.setDqxd(ParseUtil.optInt(30, ddsx));
|
||||
msgDdj.setHeight(ParseUtil.optInt(32, ddsx));
|
||||
|
||||
msgDdj.setCurrentRow(ParseUtil.optInt(26, ddsx));
|
||||
msgDdj.setCurrentColumn(ParseUtil.optInt(26, ddsx));
|
||||
msgDdj.setCurrentFloor(ParseUtil.optInt(26, ddsx));
|
||||
msgDdj.setCurrentRow(ParseUtil.optInt(12, ddsx));
|
||||
msgDdj.setCurrentColumn(ParseUtil.optInt(14, ddsx));
|
||||
msgDdj.setCurrentFloor(ParseUtil.optInt(16, ddsx));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,15 +53,16 @@ public class PlcSsjRead implements Runnable {
|
||||
DeviceSsj ssjDevice = deviceSsjMap.get(ssjCode);
|
||||
switch (ssjDevice.getType()) {
|
||||
case "1":
|
||||
readPlcInOutSsj(ssjDevice);//出入口输送机
|
||||
readPlcInSsj(ssjDevice);//出库输送机
|
||||
break;
|
||||
case "2":
|
||||
readPlcRoadWaySsj(ssjDevice);//巷道输送机
|
||||
readPlcRoadWaySsj(ssjDevice);//巷道输送机(入库)
|
||||
break;
|
||||
}
|
||||
}
|
||||
Thread.sleep(800);
|
||||
Thread.sleep(1000);
|
||||
} else {
|
||||
Thread.sleep(2000);
|
||||
reConnect();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
@@ -77,29 +78,30 @@ public class PlcSsjRead implements Runnable {
|
||||
|
||||
|
||||
/**
|
||||
* 其他输送机
|
||||
* 出库输送机 1001 1004 1006 1008
|
||||
*
|
||||
* @param ssjDevice
|
||||
*/
|
||||
private void readPlcOtherSsj(DeviceSsj ssjDevice) {
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("10"));
|
||||
private void readPlcInSsj(DeviceSsj ssjDevice) {
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("12"));
|
||||
String ddsx1 = "0";
|
||||
if (read2.IsSuccess) {
|
||||
ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
||||
ssjDevice.setKx(ParseUtil.optInt(0, ddsx1));
|
||||
ssjDevice.setDw(ParseUtil.optInt(2, ddsx1));
|
||||
ssjDevice.setSszt(ParseUtil.optInt(0, ddsx1));
|
||||
ssjDevice.setKx(ParseUtil.optInt(2, ddsx1));
|
||||
ssjDevice.setDw(ParseUtil.optInt(4, ddsx1));
|
||||
ssjDevice.setTaskNo(ParseUtil.optDInt(6, ddsx1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 入出库输送机
|
||||
* 入库输送机 1003 1005 1007 1010
|
||||
*
|
||||
* @param ssjDevice
|
||||
*/
|
||||
private void readPlcInOutSsj(DeviceSsj ssjDevice) {
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("30"));
|
||||
private void readPlcRoadWaySsj(DeviceSsj ssjDevice) {
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("26"));
|
||||
String ddsx1 = "0";
|
||||
if (read2.IsSuccess) {
|
||||
ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
||||
@@ -110,19 +112,19 @@ public class PlcSsjRead implements Runnable {
|
||||
ssjDevice.setRkqq(ParseUtil.optInt(10, ddsx1));
|
||||
ssjDevice.setHeight(ParseUtil.optInt(12, ddsx1));
|
||||
ssjDevice.setTraySize(ParseUtil.optInt(12, ddsx1)); //此处不修改device_ssj表,把托盘尺寸值当作高度使用
|
||||
ssjDevice.setTrayCode(ParseUtil.optString(14, ddsx1).replaceAll("\\s", ""));
|
||||
ssjDevice.setMode(ParseUtil.optInt(24, ddsx1));//todo 输送机操作模式
|
||||
ssjDevice.setException(ParseUtil.optInt(28, ddsx1));
|
||||
ssjDevice.setException(ParseUtil.optInt(14, ddsx1));
|
||||
ssjDevice.setTrayCode(ParseUtil.optString(18, ddsx1).replaceAll("\\s", ""));
|
||||
// ssjDevice.setMode(ParseUtil.optInt(24, ddsx1));//todo 输送机操作模式
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 巷道输送机
|
||||
* 出入口输送机
|
||||
*
|
||||
* @param ssjDevice
|
||||
*/
|
||||
private void readPlcRoadWaySsj(DeviceSsj ssjDevice) {
|
||||
private void readPlcInOutSsj(DeviceSsj ssjDevice) {
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("10"));
|
||||
String ddsx1 = "0";
|
||||
if (read2.IsSuccess) {
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ParseUtil {
|
||||
*/
|
||||
|
||||
public static String optString(int start, String data) {
|
||||
byte[] bytes = SoftBasic.HexStringToBytes(data.substring(start * 2, (start + 7) * 2));
|
||||
byte[] bytes = SoftBasic.HexStringToBytes(data.substring(start * 2, (start + 8) * 2));
|
||||
return Tools.bytetostringtool(bytes);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user