This commit is contained in:
2022-12-11 16:40:39 +08:00
parent 7e6373f44d
commit 4f613bfb28
7 changed files with 72 additions and 31 deletions

View File

@@ -181,32 +181,37 @@ public class MaGangConveyorDeviceDriver extends AbstractOpcDeviceDriver implemen
}
}
}
String taskType = String.valueOf(this.getExtraValue().get("taskType"));
String start_device_code = this.getDevice().getDevice_code();
if (StrUtil.isEmpty(next_device_code)) {
return false;
}
if (StrUtil.equals(taskType, "null") || StrUtil.isEmpty(taskType)) {
taskType = "0";
}
TaskDto taskDto = new TaskDto();
String now = DateUtil.now();
taskDto.setTask_id(IdUtil.simpleUUID());
taskDto.setTask_code("-" + CodeUtil.getNewCode("TASK_NO"));
taskDto.setTask_type("1");
taskDto.setTask_type(taskType);
taskDto.setRoute_plan_code("normal");
taskDto.setTask_status("0");
taskDto.setPriority("101");
taskDto.setAgv_system_type("1");
taskDto.setStart_device_code(this.getDevice().getDevice_code());
taskDto.setStart_point_code(this.getDevice().getDevice_code());
taskDto.setStart_device_code(start_device_code);
taskDto.setStart_point_code(start_device_code);
taskDto.setNext_point_code(next_device_code);
taskDto.setNext_point_code(next_device_code);
taskDto.setCreate_by(this.getDevice().getDevice_code());
taskDto.setUpdate_by(this.getDevice().getDevice_code());
taskDto.setCreate_by(start_device_code);
taskDto.setUpdate_by(start_device_code);
taskDto.setUpdate_time(now);
taskDto.setCreate_time(now);
try {
taskserver.create(taskDto);
} catch (Exception e) {
logServer.deviceExecuteLog(this.device_code, "", "", device_code + ":创建任务失败," + String.valueOf(e.getMessage()));
logServer.deviceExecuteLog(this.device_code, "", "", this.device_code + ":创建任务失败," + String.valueOf(e.getMessage()));
}
logServer.deviceExecuteLog(this.device_code, "", "", device_code + ":创建任务成功");
logServer.deviceExecuteLog(this.device_code, "", "", this.device_code + ":创建任务成功");
this.writing(1);
this.setRequireSucess(true);
return true;
@@ -220,7 +225,7 @@ public class MaGangConveyorDeviceDriver extends AbstractOpcDeviceDriver implemen
//将扩展表中的字符串数据转换成集合
public List<String> getExtraDeviceCodes(String extraName) {
String extraValue = (String) this.getDevice().getExtraValue().get(extraName);
if (StrUtil.isEmpty(extraValue)){
if (StrUtil.isEmpty(extraValue)) {
return new ArrayList<>();
}
String devicesString = extraValue.substring(1, extraValue.length() - 1);

View File

@@ -47,7 +47,8 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
map.put("status", 200);
map.put("message", "操作成功");
if (address.contains("INGET")) {
if (maGangConveyorDeviceDriver.getMove() == 1) {
maGangConveyorDeviceDriver.writing(4);
if (maGangConveyorDeviceDriver.getMove() == 1 && maGangConveyorDeviceDriver.getAction() == 1) {
logService.deviceExecuteLog(deviceCode, vehicle_code, inst_code, "请求路径api/agv/waitpointRequest请求参数" + param.toString() + ",请求成功-响应参数:" + map.toString());
return map;
} else {
@@ -64,7 +65,8 @@ public class AgvToAcsServiceImpl implements AgvToAcsService {
throw new BadRequestException("请求失败,取货完成后-取货点有货!");
}
} else if (address.contains("INPUT")) {
if (maGangConveyorDeviceDriver.getMove() == 0) {
maGangConveyorDeviceDriver.writing(5);
if (maGangConveyorDeviceDriver.getMove() == 0 && maGangConveyorDeviceDriver.getAction() == 2) {
logService.deviceExecuteLog(deviceCode, vehicle_code, inst_code, "请求路径api/agv/waitpointRequest请求参数" + param.toString() + ",请求成功-响应参数:" + map.toString());
return map;
} else {

View File

@@ -17,6 +17,7 @@ import org.nl.acs.device.service.dto.DeviceDto;
import org.nl.acs.device.service.impl.DeviceServiceImpl;
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.maGang.MaGangConveyorDeviceDriver;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.instruction.service.dto.InstructionDto;
@@ -345,7 +346,17 @@ public class HFHandServiceImpl implements HFHandService {
resultJson.put("result", "");
return resultJson;
}
Device device = deviceAppService.findDeviceByCode(start_devicecode);
if (device.getDeviceDriver() instanceof MaGangConveyorDeviceDriver){
MaGangConveyorDeviceDriver maGangConveyorDeviceDriver =
(MaGangConveyorDeviceDriver) device.getDeviceDriver();
String taskType = String.valueOf(maGangConveyorDeviceDriver.getExtraValue().get("taskType"));
if (StrUtil.equals(taskType,"null") || StrUtil.isEmpty(taskType)){
task_type = "0";
}else {
task_type = taskType;
}
}
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
TaskDto dto = new TaskDto();
dto.setIs_active("1");