opt:标准版-单工位堆垛机驱动优化

This commit is contained in:
yanps
2023-11-24 15:36:28 +08:00
parent f5b34cca82
commit 28c02b328c
2 changed files with 19 additions and 21 deletions

View File

@@ -58,21 +58,6 @@ public class Device implements Serializable {
@TableField(exist = false)
private String device_type_name;
/**
* 排
*/
private String x;
/**
* 列
*/
private String y;
/**
* 层
*/
private String z;
@TableField(exist = false)
private String region_name;

View File

@@ -228,6 +228,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
}
if (!command.equals(last_command)) {
requireSucess = false;
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(command));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_command + "->" + command);
}
@@ -408,20 +409,21 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
}
} else {
HashMap map = new HashMap();
Instruction instruction = checkInst();
String next_device_code = instruction.getNext_device_code();
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
switch (command) {
case 0:
if (task == 0) {
applyTask();
}
requireSucess = true;
break;
case 1:
message = "取货中";
break;
case 2:
message = "取货完成";
Instruction instruction = checkInst();
String next_device_code = instruction.getNext_device_code();
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
if (StrUtil.equals(nextDevice.getDevice_type(), DeviceType.conveyor.name())) {
map.put("to_z", nextDevice.getZ());
map.put("to_x", nextDevice.getX());
@@ -438,17 +440,21 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
map.put("to_y", inst.getTo_y());
}
map.put("to_command", 2);
requireSucess = true;
break;
case 3:
message = "放货中";
break;
case 4:
message = "请求卸货(申请卸货)";
if (ObjectUtil.isNotNull(instruction)) {
Instruction instruction1 = checkInst();
String next_device_code1 = instruction1.getNext_device_code();
Device nextDevice1 = deviceAppService.findDeviceByCode(next_device_code1);
if (ObjectUtil.isNotNull(instruction1)) {
//指令为执行
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
if (nextDevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) nextDevice.getDeviceDriver();
if (nextDevice1.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) nextDevice1.getDeviceDriver();
if (siemensConveyorDeviceDriver.getMode() != 2 || siemensConveyorDeviceDriver.getMove() == 1) {
notCreateInstMessage = "未下发电气信号原因->输送线-货架对接位:" + siemensConveyorDeviceDriver.getDevice_code() +
"有货或未联机,无法下发指令!指令号:" + inst.getInstruction_code();
@@ -457,30 +463,37 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
}
map.put("to_command", 3);
}
requireSucess = true;
break;
case 5:
message = "放货完成";
map.put("to_command", 5);
Instruction inst = checkInst();
try {
finish_instruction(inst);
} catch (Exception e) {
e.printStackTrace();
}
requireSucess = true;
break;
case 6:
message = "取货准备(会库位台)";
map.put("to_command", 6);
requireSucess = true;
break;
case 7:
message = "召回";
map.put("to_command", 7);
requireSucess = true;
break;
case 8:
message = "急停";
map.put("to_command", 8);
requireSucess = true;
break;
default:
message = "不明";
requireSucess = true;
break;
}
if (ObjectUtil.isNotNull(map)) {