fix: 双工位堆垛机修改

This commit is contained in:
2023-12-05 17:45:26 +08:00
parent b50fb70cd6
commit 1156f212cf

View File

@@ -91,8 +91,8 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
Integer lastFrontTask = 0; Integer lastFrontTask = 0;
//行走激光数值 //行走激光数值
Integer distancex = 0; Integer distanceX = 0;
Integer lastDistancex = 0; Integer lastDistanceX = 0;
//特殊开关量1 //特殊开关量1
Float special1 = 0F; Float special1 = 0F;
@@ -173,8 +173,8 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
private int instructionUpdateTimeOut = 3000; private int instructionUpdateTimeOut = 3000;
private Date instructionRequireTime = new Date(); private Date instructionRequireTime = new Date();
private Date instructionUpdateTime = new Date(); private Date instructionUpdateTime = new Date();
List<String> getdevice_codeList = null; List<String> getDeviceCodeList = null;
List<String> putdevice_codeList = null; List<String> putDeviceCodeList = null;
//请求成功标记 //请求成功标记
Boolean requireSucess = false; Boolean requireSucess = false;
@@ -219,14 +219,14 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
LinkedList<Instruction> inst = new LinkedList<>(); LinkedList<Instruction> inst = new LinkedList<>();
getIns(inst); getIns(inst);
if (CollectionUtil.isNotEmpty(inst)&&ObjectUtil.isNotEmpty(inst.get(0))) { if (CollectionUtil.isNotEmpty(inst)&&ObjectUtil.isNotEmpty(inst.get(0))) {
String startdevice_code = inst.get(0).getStart_device_code(); String startDeviceCode = inst.get(0).getStart_device_code();
Device startDevice = deviceAppService.findDeviceByCode(startdevice_code); Device startDevice = deviceAppService.findDeviceByCode(startDeviceCode);
writeStorageOrConveyor(inst,startdevice_code,startDevice,map); writeStorageOrConveyor(inst,startDeviceCode,startDevice,map);
} }
if (CollectionUtil.isNotEmpty(inst)&&ObjectUtil.isEmpty(inst.get(0))) { if (CollectionUtil.isNotEmpty(inst)&&ObjectUtil.isEmpty(inst.get(0))) {
String startdevice_code = inst.get(1).getStart_device_code(); String startDeviceCode = inst.get(1).getStart_device_code();
Device startDevice = deviceAppService.findDeviceByCode(startdevice_code); Device startDevice = deviceAppService.findDeviceByCode(startDeviceCode);
writeStorageOrConveyor(inst,startdevice_code,startDevice,map); writeStorageOrConveyor(inst,startDeviceCode,startDevice,map);
} }
map.put("to_command", CommandEnum.PICKUP_COMPLETE.getStatus()); map.put("to_command", CommandEnum.PICKUP_COMPLETE.getStatus());
requireSucess = true; requireSucess = true;
@@ -239,16 +239,16 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
LinkedList<Instruction> inst = new LinkedList<>(); LinkedList<Instruction> inst = new LinkedList<>();
getIns(inst); getIns(inst);
if (CollectionUtil.isNotEmpty(inst)&&ObjectUtil.isNotEmpty(inst.get(0))) { if (CollectionUtil.isNotEmpty(inst)&&ObjectUtil.isNotEmpty(inst.get(0))) {
String nextdevice_code = inst.get(0).getNext_device_code(); String nextDeviceCode = inst.get(0).getNext_device_code();
Device nextDevice = deviceAppService.findDeviceByCode(nextdevice_code); Device nextDevice = deviceAppService.findDeviceByCode(nextDeviceCode);
//指令为执行 //指令为执行
if (unloadCheck(nextDevice)) return; if (unloadCheck(nextDevice)) return;
map.put("to_command", 3); map.put("to_command", 3);
requireSucess = true; requireSucess = true;
} }
if (CollectionUtil.isNotEmpty(inst)&&ObjectUtil.isEmpty(inst.get(0))) { if (CollectionUtil.isNotEmpty(inst)&&ObjectUtil.isEmpty(inst.get(0))) {
String nextdevice_code = inst.get(1).getNext_device_code(); String nextDeviceCode = inst.get(1).getNext_device_code();
Device nextDevice = deviceAppService.findDeviceByCode(nextdevice_code); Device nextDevice = deviceAppService.findDeviceByCode(nextDeviceCode);
if (unloadCheck(nextDevice)) return; if (unloadCheck(nextDevice)) return;
map.put("to_command", 3); map.put("to_command", 3);
requireSucess = true; requireSucess = true;
@@ -308,7 +308,7 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
lastFrontY = frontY; lastFrontY = frontY;
lastBackY = backY; lastBackY = backY;
lastAction = action; lastAction = action;
lastDistancex = distancex; lastDistanceX = distanceX;
lastFrontForkCargo = frontForkCargo; lastFrontForkCargo = frontForkCargo;
lastBackForkCargo = backForkCargo; lastBackForkCargo = backForkCargo;
lastFrontForkLocation = frontForkLocation; lastFrontForkLocation = frontForkLocation;
@@ -446,17 +446,17 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
return true; return true;
} }
for (Instruction instruction : instructions) { for (Instruction instruction : instructions) {
List<RouteLineDto> routeLineDtos = routeLineService.selectDeviceCodeList(instruction.getStart_device_code()); List<RouteLineDto> routeLines = routeLineService.selectDeviceCodeList(instruction.getStart_device_code());
if (CollUtil.isEmpty(routeLineDtos) || routeLineDtos.size() < 1) { if (CollUtil.isEmpty(routeLines) || routeLines.size() < 1) {
message = "没有输送线到堆垛机的路由"; message = "没有输送线到堆垛机的路由";
logServer.deviceExecuteLog(this.device_code, "", "", "没有" + instruction.getStart_device_code() + "->" logServer.deviceExecuteLog(this.device_code, "", "", "没有" + instruction.getStart_device_code() + "->"
+ this.device_code + "的路由"); + this.device_code + "的路由");
continue; continue;
} }
for (RouteLineDto routeLineDto : routeLineDtos) { for (RouteLineDto routeLineDto : routeLines) {
if (this.getDeviceCode().equals(routeLineDto.getNext_device_code())) { if (this.getDeviceCode().equals(routeLineDto.getNext_device_code())) {
List<RouteLineDto> routeLineDtoList = routeLineService.selectDeviceCodeList(this.getDeviceCode()); List<RouteLineDto> routeLineDtoList = routeLineService.selectDeviceCodeList(this.getDeviceCode());
if (CollUtil.isEmpty(routeLineDtos) || routeLineDtos.size() < 1) { if (CollUtil.isEmpty(routeLines) || routeLines.size() < 1) {
message = "没有输送线到堆垛机的路由"; message = "没有输送线到堆垛机的路由";
logServer.deviceExecuteLog(this.device_code, "", "", "没有" + instruction.getStart_device_code() + "->" logServer.deviceExecuteLog(this.device_code, "", "", "没有" + instruction.getStart_device_code() + "->"
+ this.device_code + "的路由"); + this.device_code + "的路由");
@@ -475,8 +475,8 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
private boolean wirteData(LinkedList<Instruction> inst) { private boolean wirteData(LinkedList<Instruction> inst) {
if (StrUtil.equals(inst.get(0).getInstruction_status(), InstructionStatusEnum.READY.getIndex())) { if (StrUtil.equals(inst.get(0).getInstruction_status(), InstructionStatusEnum.READY.getIndex())) {
String startdevice_code = inst.get(0).getStart_device_code(); String startDeviceCode = inst.get(0).getStart_device_code();
Device startDevice = deviceAppService.findDeviceByCode(startdevice_code); Device startDevice = deviceAppService.findDeviceByCode(startDeviceCode);
BeltConveyorDeviceDriver beltConveyorDeviceDriver; BeltConveyorDeviceDriver beltConveyorDeviceDriver;
if (startDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { if (startDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) startDevice.getDeviceDriver(); beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) startDevice.getDeviceDriver();
@@ -504,7 +504,7 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
map.put("to_front_task", inst.get(0).getInstruction_code()); map.put("to_front_task", inst.get(0).getInstruction_code());
map.put("to_back_task", inst.get(1).getInstruction_code()); map.put("to_back_task", inst.get(1).getInstruction_code());
} }
writeStorageOrConveyor(inst, startdevice_code, startDevice, map); writeStorageOrConveyor(inst, startDeviceCode, startDevice, map);
this.writing(map); this.writing(map);
} }
@@ -818,9 +818,9 @@ public class DoubleStationStackerDeviceDriver extends AbstractOpcDeviceDriver im
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(action)); logServer.deviceItemValue(this.device_code, "mode", String.valueOf(action));
logServer.deviceExecuteLog(this.device_code, "", "", "信号action" + lastAction + "->" + action); logServer.deviceExecuteLog(this.device_code, "", "", "信号action" + lastAction + "->" + action);
} }
if (!distancex.equals(lastDistancex)) { if (!distanceX.equals(lastDistanceX)) {
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(distancex)); logServer.deviceItemValue(this.device_code, "mode", String.valueOf(distanceX));
logServer.deviceExecuteLog(this.device_code, "", "", "信号distancex" + lastDistancex + "->" + distancex); logServer.deviceExecuteLog(this.device_code, "", "", "信号distancex" + lastDistanceX + "->" + distanceX);
} }
if (!frontForkCargo.equals(lastFrontForkCargo)) { if (!frontForkCargo.equals(lastFrontForkCargo)) {