更新
This commit is contained in:
@@ -2,6 +2,7 @@ package org.nl.acs.device_driver.maGang;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
@@ -185,6 +186,12 @@ public class MaGangConveyorDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
return false;
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
//查询任务表中是否有同一起点的任务
|
||||
List<TaskDto> taskDtos = taskserver.queryTaskByStartDeviceCode(this.getDevice_code());
|
||||
//如果有就不生成任务
|
||||
if (ObjectUtil.isNotEmpty(taskDtos)) {
|
||||
return false;
|
||||
}
|
||||
List<String> link_device_codes = this.getExtraDeviceCodes("link_device_code");
|
||||
String next_device_code = "";
|
||||
MaGangConveyorDeviceDriver maGangConveyorDeviceDriver;
|
||||
|
||||
@@ -104,6 +104,13 @@ public interface TaskService {
|
||||
*/
|
||||
List<TaskDto> queryTaskByDeviceCode(String device_code);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param device_code
|
||||
* @return
|
||||
*/
|
||||
List<TaskDto> queryTaskByStartDeviceCode(String device_code);
|
||||
|
||||
/**
|
||||
* 根据关联编号查询非立刻下发的关联任务
|
||||
*/
|
||||
|
||||
@@ -248,7 +248,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
public List<TaskDto> queryAllUnfinished(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
JSONArray arr = wo.query("task_status < 2 ").getResultJSONArray(0);
|
||||
List<TaskDto> list =arr.toJavaList(TaskDto.class);
|
||||
List<TaskDto> list = arr.toJavaList(TaskDto.class);
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -273,6 +273,19 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskDto> queryTaskByStartDeviceCode(String start_device_code) {
|
||||
List<TaskDto> list = new ArrayList<>();
|
||||
Iterator<TaskDto> iterator = tasks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
TaskDto task = iterator.next();
|
||||
if (task.getStart_device_code().equals(start_device_code)) {
|
||||
list.add(task);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskDto queryTaskByLinkNum(String link_num) {
|
||||
return null;
|
||||
@@ -390,7 +403,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
}
|
||||
}
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
|
||||
wo.insert(json);
|
||||
tasks.add(dto);
|
||||
@@ -492,7 +505,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(this.findByStartCode(start_device_code))
|
||||
|| ObjectUtil.isNotEmpty(this.findByNextCode(next_device_code))) {
|
||||
|| ObjectUtil.isNotEmpty(this.findByNextCode(next_device_code))) {
|
||||
throw new WDKException("已存在该起点或终点的任务!");
|
||||
}
|
||||
if (StrUtil.equals(material_type, "") || StrUtil.equals(quantity, "")) {
|
||||
@@ -523,7 +536,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
dto.setUpdate_by(currentUsername);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
|
||||
wo.update(json);
|
||||
|
||||
|
||||
@@ -107,8 +107,8 @@ public class QueryXZAgvDeviceStatus {
|
||||
if (!StrUtil.equals(kepType, task_type)) {
|
||||
maGangAgvDeviceDriver.writing("type", task_type);
|
||||
}
|
||||
maGangAgvDeviceDriver.writing("x_coordinate", hisFormat.format(x) + "");
|
||||
maGangAgvDeviceDriver.writing("y_coordinate", hisFormat.format(y) + "");
|
||||
maGangAgvDeviceDriver.writing("x_coordinate", hisFormat.format(x));
|
||||
maGangAgvDeviceDriver.writing("y_coordinate", hisFormat.format(y));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user