编辑设备类型和出入库调度
This commit is contained in:
@@ -53,16 +53,10 @@ public class PlcSsjRead implements Runnable {
|
||||
DeviceSsj ssjDevice = deviceSsjMap.get(ssjCode);
|
||||
switch (ssjDevice.getType()) {
|
||||
case "1":
|
||||
readPlcSmSsj(ssjDevice);
|
||||
readPlcInOutSsj(ssjDevice);//出入口输送机
|
||||
break;
|
||||
case "2":
|
||||
readPlcInOutSsj(ssjDevice);
|
||||
break;
|
||||
case "3":
|
||||
readPlcOtherSsj(ssjDevice);
|
||||
break;
|
||||
case "4":
|
||||
readPlcRoadWaySsj(ssjDevice);
|
||||
readPlcRoadWaySsj(ssjDevice);//巷道输送机
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -81,6 +75,7 @@ public class PlcSsjRead implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 其他输送机
|
||||
*
|
||||
@@ -97,22 +92,6 @@ public class PlcSsjRead implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 巷道输送机
|
||||
*
|
||||
* @param ssjDevice
|
||||
*/
|
||||
private void readPlcRoadWaySsj(DeviceSsj ssjDevice) {
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("10"));
|
||||
String ddsx1 = "0";
|
||||
if (read2.IsSuccess) {
|
||||
ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
||||
ssjDevice.setDw(ParseUtil.optInt(0, ddsx1));
|
||||
ssjDevice.setKx(ParseUtil.optInt(2, ddsx1));
|
||||
ssjDevice.setTaskNo(ParseUtil.optDInt(4, ddsx1));
|
||||
ssjDevice.setSszt(ParseUtil.optInt(8, ddsx1));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 入出库输送机
|
||||
@@ -134,13 +113,14 @@ public class PlcSsjRead implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 产线输送机
|
||||
* 巷道输送机
|
||||
*
|
||||
* @param ssjDevice
|
||||
*/
|
||||
private void readPlcSmSsj(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("10"));
|
||||
String ddsx1 = "0";
|
||||
if (read2.IsSuccess) {
|
||||
ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
||||
@@ -148,76 +128,82 @@ public class PlcSsjRead implements Runnable {
|
||||
ssjDevice.setKx(ParseUtil.optInt(2, ddsx1));
|
||||
ssjDevice.setTaskNo(ParseUtil.optDInt(4, ddsx1));
|
||||
ssjDevice.setSszt(ParseUtil.optInt(8, ddsx1));
|
||||
ssjDevice.setRkqq(ParseUtil.optInt(10, ddsx1));
|
||||
ssjDevice.setTraySize(ParseUtil.optInt(12, ddsx1));
|
||||
ssjDevice.setInOrOut(ParseUtil.optInt(24, ddsx1));
|
||||
ssjDevice.setException(ParseUtil.optInt(28, ddsx1));
|
||||
|
||||
String trayCodeReadAddress="";
|
||||
String allot="";
|
||||
switch (ssjDevice.getDeviceCode()){
|
||||
case "G1005":
|
||||
trayCodeReadAddress = "DB503.0";
|
||||
allot = "DB802.24";
|
||||
break;
|
||||
case "L2004":
|
||||
trayCodeReadAddress = "DB503.600";
|
||||
break;
|
||||
case "L2006":
|
||||
trayCodeReadAddress = "DB503.800";
|
||||
break;
|
||||
case "L1001":
|
||||
trayCodeReadAddress = "DB503.200";
|
||||
allot = "DB802.0";
|
||||
break;
|
||||
case "L1003":
|
||||
trayCodeReadAddress = "DB503.400";
|
||||
allot = "DB802.12";
|
||||
break;
|
||||
}
|
||||
|
||||
if(!"".equals(allot)){
|
||||
OperateResultExOne<byte[]> agvSsj = readWriteNet.Read(allot, Short.parseShort("2"));
|
||||
if (agvSsj.IsSuccess){
|
||||
//去除bytes中
|
||||
ddsx1 = SoftBasic.ByteToHexString(agvSsj.Content);
|
||||
ssjDevice.setAllowPut(ParseUtil.optInt(0, ddsx1));
|
||||
}
|
||||
}
|
||||
if(!"".equals(trayCodeReadAddress)){
|
||||
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("16"));
|
||||
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));
|
||||
}
|
||||
if("L2004".equals(ssjDevice.getDeviceCode())){
|
||||
ssjDevice.setTaskNo2(ParseUtil.optDInt(8, ddsx2));
|
||||
}
|
||||
if("L2006".equals(ssjDevice.getDeviceCode())){
|
||||
ssjDevice.setTaskNo2(ParseUtil.optDInt(12, ddsx2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 产线输送机
|
||||
*
|
||||
* @param ssjDevice
|
||||
*/
|
||||
// private void readPlcSmSsj(DeviceSsj ssjDevice) {
|
||||
// OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("30"));
|
||||
// String ddsx1 = "0";
|
||||
// if (read2.IsSuccess) {
|
||||
// ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
||||
// ssjDevice.setDw(ParseUtil.optInt(0, ddsx1));
|
||||
// ssjDevice.setKx(ParseUtil.optInt(2, ddsx1));
|
||||
// ssjDevice.setTaskNo(ParseUtil.optDInt(4, ddsx1));
|
||||
// ssjDevice.setSszt(ParseUtil.optInt(8, ddsx1));
|
||||
// ssjDevice.setRkqq(ParseUtil.optInt(10, ddsx1));
|
||||
// ssjDevice.setTraySize(ParseUtil.optInt(12, ddsx1));
|
||||
// ssjDevice.setInOrOut(ParseUtil.optInt(24, ddsx1));
|
||||
// ssjDevice.setException(ParseUtil.optInt(28, ddsx1));
|
||||
//
|
||||
// String trayCodeReadAddress="";
|
||||
// String allot="";
|
||||
// switch (ssjDevice.getDeviceCode()){
|
||||
// case "G1005":
|
||||
// trayCodeReadAddress = "DB503.0";
|
||||
// allot = "DB802.24";
|
||||
// break;
|
||||
// case "L2004":
|
||||
// trayCodeReadAddress = "DB503.600";
|
||||
// break;
|
||||
// case "L2006":
|
||||
// trayCodeReadAddress = "DB503.800";
|
||||
// break;
|
||||
// case "L1001":
|
||||
// trayCodeReadAddress = "DB503.200";
|
||||
// allot = "DB802.0";
|
||||
// break;
|
||||
// case "L1003":
|
||||
// trayCodeReadAddress = "DB503.400";
|
||||
// allot = "DB802.12";
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// if(!"".equals(allot)){
|
||||
// OperateResultExOne<byte[]> agvSsj = readWriteNet.Read(allot, Short.parseShort("2"));
|
||||
// if (agvSsj.IsSuccess){
|
||||
// //去除bytes中
|
||||
// ddsx1 = SoftBasic.ByteToHexString(agvSsj.Content);
|
||||
// ssjDevice.setAllowPut(ParseUtil.optInt(0, ddsx1));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// OperateResultExOne<byte[]> agvSsjTask = readWriteNet.Read("DB501.280", Short.parseShort("16"));
|
||||
// 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));
|
||||
// }
|
||||
// if("L2004".equals(ssjDevice.getDeviceCode())){
|
||||
// ssjDevice.setTaskNo2(ParseUtil.optDInt(8, ddsx2));
|
||||
// }
|
||||
// if("L2006".equals(ssjDevice.getDeviceCode())){
|
||||
// ssjDevice.setTaskNo2(ParseUtil.optDInt(12, ddsx2));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
void ConnectServer() {
|
||||
siemensS7Net = new SiemensS7Net(SiemensPLCS.S1500);
|
||||
|
||||
Reference in New Issue
Block a user