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

This commit is contained in:
yanps
2023-11-24 14:47:46 +08:00
parent 67f522ceae
commit 64f0daffda
7 changed files with 78 additions and 19 deletions

View File

@@ -58,6 +58,21 @@ 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

@@ -264,7 +264,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
break;
case 2:
//申请任务
if (task == 0 && !requireSucess) {
if (move == 1 && !requireSucess) {
instruction_require();
}
break;

View File

@@ -8,6 +8,7 @@ import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.enums.DeviceType;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.basedriver.belt_conveyor.BeltConveyorDeviceDriver;
@@ -386,9 +387,30 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
} else if (error != 0) {
message = "有报警";
//指定库位满入
if(error == 5){
}
//空出
if(error == 6){
}
//浅货位有货
if(error == 16){
//放货
if(cargoMove==1){
}else if(cargoMove==0){
//取货
}
}
} 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) {
@@ -400,6 +422,21 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
break;
case 2:
message = "取货完成";
if (StrUtil.equals(nextDevice.getDevice_type(), DeviceType.conveyor.name())) {
map.put("to_z", nextDevice.getZ());
map.put("to_x", nextDevice.getX());
map.put("to_y", nextDevice.getY());
}
if (StrUtil.equals(nextDevice.getDevice_type(), DeviceType.storage.name())) {
map.put("to_z", inst.getTo_z());
if (inst.getTo_x().length() > 1) {
String substring = inst.getTo_x().substring(1);
map.put("to_x", substring);
} else {
map.put("to_x", inst.getTo_x());
}
map.put("to_y", inst.getTo_y());
}
map.put("to_command", 2);
break;
case 3:
@@ -407,14 +444,11 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
break;
case 4:
message = "请求卸货(申请卸货)";
Instruction instruction = checkInst();
if (ObjectUtil.isNotNull(instruction)) {
//指令为执行
String next_device_code = instruction.getNext_device_code();
Device startDevice = deviceAppService.findDeviceByCode(next_device_code);
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
if (startDevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) startDevice.getDeviceDriver();
if (nextDevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) nextDevice.getDeviceDriver();
if (siemensConveyorDeviceDriver.getMode() != 2 || siemensConveyorDeviceDriver.getMove() == 1) {
notCreateInstMessage = "未下发电气信号原因->输送线-货架对接位:" + siemensConveyorDeviceDriver.getDevice_code() +
"有货或未联机,无法下发指令!指令号:" + inst.getInstruction_code();
@@ -560,14 +594,23 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
map.put("to_command", 1);
// map.put("to_type", inst.getMaterial());
map.put("to_task", inst.getInstruction_code());
map.put("to_z", inst.getTo_z());
if(inst.getTo_x().length()>1){
String substring = inst.getTo_x().substring(1);
map.put("to_x", substring);
}else {
map.put("to_x", inst.getTo_x());
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) {
map.put("to_z", startDevice.getZ());
map.put("to_x", startDevice.getX());
map.put("to_y", startDevice.getY());
}
map.put("to_y", inst.getTo_y());
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.storage.name())) {
map.put("to_z", inst.getFrom_z());
if (inst.getFrom_x().length() > 1) {
String substring = inst.getFrom_x().substring(1);
map.put("to_x", substring);
} else {
map.put("to_x", inst.getFrom_x());
}
map.put("to_y", inst.getFrom_y());
}
this.writing(map);
}
}

View File

@@ -37,9 +37,6 @@ public class InstructionController {
@ApiOperation("查询指令")
//@PreAuthorize("@el.check('instruction:list')")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
if(ObjectUtil.isEmpty(whereJson.get("status"))) {
whereJson.put("status", "1");
}
return new ResponseEntity<>(instructionService.queryAll(whereJson, page), HttpStatus.OK);
}

View File

@@ -21,6 +21,7 @@ import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.agv.server.XianGongAgvService;
import org.nl.acs.auto.initial.ApplicationAutoInitial;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.enums.DeviceType;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device.service.impl.DeviceServiceImpl;
import org.nl.acs.device_driver.DeviceDriver;
@@ -914,6 +915,9 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
for (int m = 0; m < pathlist.size(); m++) {
if (pathlist.get(m).equals(dto.getNext_device_code())) {
index = m + 1;
if(StrUtil.equals(deviceAppService.findDeviceTypeByCode(pathlist.get(index)), DeviceType.stacker.name())) {
index += 1;
}
break;
}
}

View File

@@ -297,7 +297,7 @@ public class DeviceAppServiceImpl implements DeviceAppService, ApplicationAutoIn
while (var3.hasNext()) {
Device device = (Device) var3.next();
if (ObjectUtil.equal(device.getDevice_code(), deviceCode)&&BeanUtil.isNotEmpty(device.getDeviceDriverDefination())) {
if (ObjectUtil.equal(device.getDevice_code(), deviceCode)&&ObjectUtil.isNotEmpty(device.getDeviceDriverDefination())) {
return device.getDeviceDriverDefination().getFitDeviceTypes().get(0).name();
}
}

View File

@@ -39,9 +39,9 @@ public class TaskController {
//@PreAuthorize("@el.check('task:list')")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
// return new ResponseEntity<>(taskService.queryAllByCache(whereJson, page), HttpStatus.OK);
if(ObjectUtil.isEmpty(whereJson.get("status"))) {
/*if(ObjectUtil.isEmpty(whereJson.get("status"))) {
whereJson.put("status", "1");
}
}*/
return new ResponseEntity<>(taskService.queryAll(whereJson, page), HttpStatus.OK);
}