rev:彩涂机组
This commit is contained in:
@@ -51,25 +51,6 @@ public class RouteUtil {
|
||||
list.add(first_device_code + "02");
|
||||
list.add(first_device_code + "01");
|
||||
map.put(first_device_code + "01", list);
|
||||
} else if (StrUtil.equals(next_device_code, "E02")) {
|
||||
list = new ArrayList<>();
|
||||
list.add("E03");
|
||||
list.add("E04");
|
||||
list.add("E02");
|
||||
list.add("E03");
|
||||
list.add("E04");
|
||||
list.add("D01");
|
||||
map.put(first_device_code + "01", list);
|
||||
list = new ArrayList<>();
|
||||
list.add("E02");
|
||||
list.add("E03");
|
||||
list.add("E04");
|
||||
list.add("D01");
|
||||
map.put(first_device_code + "02", list);
|
||||
list = new ArrayList<>();
|
||||
list.add("E04");
|
||||
list.add("D01");
|
||||
map.put(first_device_code + "04", list);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
|
||||
@@ -66,11 +66,9 @@ public class MaGangConveyorDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
LuceneExecuteLogService lucene = SpringContextHolder.getBean(LuceneExecuteLogService.class);
|
||||
|
||||
private Date instruction_require_time = new Date();
|
||||
private Date instruction_finished_time = new Date();
|
||||
private Date instruction_apply_time = new Date();
|
||||
private Date feedHeartBeatTime = new Date();
|
||||
private int feedHeartBeatTimeOut = 30000;
|
||||
private int instruction_require_time_out = 3000;
|
||||
private int instruction_require_time_out = 5000;
|
||||
|
||||
int feedHeartbeat = 0;
|
||||
int last_feedHeartbeat = 0;
|
||||
@@ -132,7 +130,7 @@ public class MaGangConveyorDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
}
|
||||
}
|
||||
if (mode != last_mode) {
|
||||
if (mode == 3 || mode == 4) {
|
||||
if (mode == 3) {
|
||||
this.setRequireSucess(false);
|
||||
}
|
||||
}
|
||||
@@ -160,11 +158,6 @@ public class MaGangConveyorDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
if (mode == 3 && !requireSucess) {
|
||||
instruction_require();
|
||||
}
|
||||
|
||||
//3#彩涂机组申请任务
|
||||
if (mode == 4 && !requireSucess) {
|
||||
instruction_require2();
|
||||
}
|
||||
}
|
||||
|
||||
last_mode = mode;
|
||||
@@ -173,78 +166,18 @@ public class MaGangConveyorDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
last_action = action;
|
||||
}
|
||||
|
||||
public synchronized boolean instruction_require2() throws Exception {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
public synchronized boolean instruction_require() throws Exception {
|
||||
if (System.currentTimeMillis() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return false;
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
List<String> link_device_codes = this.getExtraDeviceCodes("link_device_code");
|
||||
String next_device_code = "";
|
||||
MaGangConveyorDeviceDriver maGangConveyorDeviceDriver;
|
||||
Device device = null;
|
||||
|
||||
for (int i = 0; i < link_device_codes.size(); i++) {
|
||||
String link_device_code = link_device_codes.get(i);
|
||||
device = deviceAppservice.findDeviceByCode(link_device_code);
|
||||
if (device.getDeviceDriver() instanceof MaGangConveyorDeviceDriver && !link_device_code.startsWith("D")) {
|
||||
maGangConveyorDeviceDriver = (MaGangConveyorDeviceDriver) device.getDeviceDriver();
|
||||
if (maGangConveyorDeviceDriver.getMove() == 0) {
|
||||
next_device_code = link_device_code;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//查询任务表中是否有同一起点和终点的任务
|
||||
List<TaskDto> taskDtos = taskserver.queryTaskByStartAndNextDeviceCode(this.getDevice_code(), next_device_code);
|
||||
this.instruction_require_time = new Date();
|
||||
//查询任务表中是否有同一起点任务
|
||||
List<TaskDto> taskDtos = taskserver.queryTaskByStartDeviceCode(this.getDevice_code());
|
||||
//如果有就不生成任务
|
||||
if (ObjectUtil.isNotEmpty(taskDtos)) {
|
||||
return false;
|
||||
}
|
||||
String taskType = String.valueOf(device.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(taskType);
|
||||
taskDto.setRoute_plan_code("normal");
|
||||
taskDto.setTask_status("0");
|
||||
taskDto.setPriority("101");
|
||||
taskDto.setAgv_system_type("1");
|
||||
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(start_device_code);
|
||||
taskDto.setUpdate_by(start_device_code);
|
||||
taskDto.setUpdate_time(now);
|
||||
taskDto.setCreate_time(now);
|
||||
try {
|
||||
taskserver.create(taskDto);
|
||||
this.writing(1);
|
||||
this.setRequireSucess(true);
|
||||
} catch (Exception e) {
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, "任务创建失败,原因:" + e.getMessage()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized boolean instruction_require() throws Exception {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return false;
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
List<String> link_device_codes = this.getExtraDeviceCodes("link_device_code");
|
||||
String next_device_code = "";
|
||||
MaGangConveyorDeviceDriver maGangConveyorDeviceDriver;
|
||||
@@ -259,12 +192,7 @@ public class MaGangConveyorDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
}
|
||||
}
|
||||
}
|
||||
//查询任务表中是否有同一起点和终点的任务
|
||||
List<TaskDto> taskDtos = taskserver.queryTaskByStartAndNextDeviceCode(this.getDevice_code(), next_device_code);
|
||||
//如果有就不生成任务
|
||||
if (ObjectUtil.isNotEmpty(taskDtos)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String taskType = String.valueOf(this.getExtraValue().get("taskType"));
|
||||
String start_device_code = this.getDevice().getDevice_code();
|
||||
if (StrUtil.isEmpty(next_device_code)) {
|
||||
|
||||
@@ -111,8 +111,6 @@ public interface TaskService {
|
||||
*/
|
||||
List<TaskDto> queryTaskByStartDeviceCode(String device_code);
|
||||
|
||||
List<TaskDto> queryTaskByStartAndNextDeviceCode(String start_device_code,String next_device_code);
|
||||
|
||||
/**
|
||||
* 根据关联编号查询非立刻下发的关联任务
|
||||
*/
|
||||
|
||||
@@ -287,14 +287,6 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskDto> queryTaskByStartAndNextDeviceCode(String start_device_code, String next_device_code) {
|
||||
return Optional.ofNullable(tasks)
|
||||
.orElse(new ArrayList<>())
|
||||
.stream()
|
||||
.filter(taskDto -> taskDto.getStart_device_code().equals(start_device_code) && taskDto.getNext_device_code().equals(next_device_code))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskDto queryTaskByLinkNum(String link_num) {
|
||||
|
||||
Reference in New Issue
Block a user