编辑设备类型和出入库调度

This commit is contained in:
lsymicc
2026-03-30 14:00:32 +08:00
parent f6696e0b60
commit 14d3321b68
18 changed files with 347 additions and 199 deletions

View File

@@ -137,71 +137,71 @@ public class PlcSsjRead implements Runnable {
*
* @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));
// }
// }
// }
// }
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));
}
}
}
}