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