Browse Source

add: 变动开发

master
lishuai 6 months ago
parent
commit
747e9120b3
  1. 34
      acs/nladmin-system/pom.xml
  2. 16
      acs/nladmin-system/src/main/java/org/nl/acs/agv/server/AgvWaitUtil.java
  3. 103
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv_conveyor/AgvConveyorDeviceDriver.java
  4. 16
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv_conveyor/ItemProtocol.java
  5. 7
      acs/nladmin-system/src/main/java/org/nl/acs/task/service/TaskService.java
  6. 25
      acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java
  7. 2
      acs/nladmin-ui/public/config.js
  8. 44
      acs/nladmin-ui/src/views/acs/device/driver/agv_conveyor.vue

34
acs/nladmin-system/pom.xml

@ -57,6 +57,12 @@
<artifactId>org.openscada.jinterop.deps</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.54</version>
</dependency>
<dependency>
<groupId>org.openscada.utgard</groupId>
<artifactId>org.openscada.opc.dcom</artifactId>
@ -415,7 +421,33 @@
<artifactId>ik-analyzer</artifactId>
<version>${lucene.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.openscada.jinterop</groupId>
<artifactId>org.openscada.jinterop.core</artifactId>
<version>2.1.8</version>
<exclusions>
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.openscada.jinterop</groupId>
<artifactId>org.openscada.jinterop.deps</artifactId>
<version>1.5.0</version>
<exclusions>
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--支持中文分词 -->
<dependency>
<groupId>org.apache.lucene</groupId>

16
acs/nladmin-system/src/main/java/org/nl/acs/agv/server/AgvWaitUtil.java

@ -1,5 +1,6 @@
package org.nl.acs.agv.server;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
@ -14,6 +15,7 @@ import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.core.bean.WQLObject;
import org.springframework.stereotype.Service;
/**
@ -127,6 +129,7 @@ public class AgvWaitUtil {
AgvConveyorDeviceDriver driver = (AgvConveyorDeviceDriver) executeDevice.getDeviceDriver();
if ("down".equals(task.getExecute_message())) {
driver.writing("to_down_finished", 1);
this.deviceExecuteLogService.deviceExecuteLog(deviceCode, "", "", "下料完成");
}
}
}
@ -308,6 +311,16 @@ public class AgvWaitUtil {
// 普通站点驱动
String message = "允许AGV放货后离开。";
this.deviceExecuteLogService.deviceExecuteLog(deviceCode, "", "", message);
//人工放货位到缓存区需要将货位信息写入缓存区
if (task.getStart_device_code().startsWith("R_")&& deviceCode.endsWith("CH_")){
WQLObject wo = WQLObject.getWQLObject("acs_device_runpoint");
JSONObject json = wo.query("device_code ='" + task.getStart_device_code() + "'").uniqueResult(0);
if (MapUtil.isNotEmpty(json)) {
JSONObject rpUpdate = new JSONObject();
rpUpdate.put("material_type", json.get("material_type"));
WQLObject.getWQLObject("acs_device_runpoint").update(rpUpdate, "device_code = '" + deviceCode + "'");
}
}
// agv上料完成后写信号
String executeCode = task.getExecute_code();
if (StrUtil.isNotEmpty(executeCode)) {
@ -316,9 +329,10 @@ public class AgvWaitUtil {
AgvConveyorDeviceDriver driver = (AgvConveyorDeviceDriver) executeDevice.getDeviceDriver();
if ("up".equals(task.getExecute_message())) {
driver.writing("to_up_finished", 1);
this.deviceExecuteLogService.deviceExecuteLog(deviceCode, "", "", "上料完成");
}
}
}
flag = true;
} else {

103
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv_conveyor/AgvConveyorDeviceDriver.java

@ -71,11 +71,14 @@ public class AgvConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
int heartbeat = 0;
int error = 0;
int task = 0;
String on_off_site;
String tray_Information;
int on_off_site;
int tray_Information;
int down_request;
int up_request;
String on_off_site_str;
String tray_Information_str;
Boolean isonline = true;
Boolean iserror = false;
@ -99,12 +102,12 @@ public class AgvConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
String message = null;
device_code = this.getDeviceCode();
heartbeat = this.itemProtocol.getItem_heartbeat();
on_off_site = this.itemProtocol.getItem_on_off_site();
tray_Information = this.itemProtocol.getItem_tray_Information();
down_request = this.itemProtocol.getItem_down_request();
up_request = this.itemProtocol.getItem_up_request();
on_off_site_str = String.valueOf(on_off_site);
tray_Information_str = String.valueOf(tray_Information);
@ -116,10 +119,12 @@ public class AgvConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
this.setIsonline(false);
this.setIserror(true);
//未联机
logServer.deviceExecuteLog(this.device_code, "", "", "未联机");
} else {
this.setIsonline(true);
this.setIserror(false);
if ((down_request == 1 || up_request == 1) && StringUtils.isNoneEmpty(on_off_site)){
if ((down_request == 1 || up_request == 1) && StringUtils.isNoneEmpty(on_off_site_str)){
task_apply();
}
}
@ -135,42 +140,88 @@ public class AgvConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
} else {
this.instruction_require_time = date;
WQLObject wo = WQLObject.getWQLObject("acs_device_runpoint");
JSONObject json = wo.query("device_code ='" + on_off_site + "'").uniqueResult(0);
if (MapUtil.isNotEmpty(json) && "0".equals(json.get("hasgoods"))){
logServer.deviceExecuteLog(this.device_code, "", "", on_off_site + "无上下料货物");
return false;
}
//上料设备
List<String> putDeviceCodeList = this.getExtraDeviceCodes("put_device_code");
//下料设备
List<String> getDeviceCodeList = this.getExtraDeviceCodes("get_device_code");
//请求下料
if (down_request == 1){
List<RouteLineDto> routeLineDtos = routeLineService.getsByCode(on_off_site,"normal");
if (CollUtil.isEmpty(routeLineDtos) || routeLineDtos.size() < 1) {
logServer.deviceExecuteLog(this.device_code, "", "", "没有"+ on_off_site + "的路由");
String nextCode = null;
//下料点要有货,终点要无货
JSONObject json = wo.query("device_code ='" + on_off_site_str + "'").uniqueResult(0);
if (MapUtil.isNotEmpty(json) && "0".equals(json.get("hasgoods"))){
logServer.deviceExecuteLog(this.device_code, "", "", on_off_site_str + "下料点无货物");
return false;
}
RouteLineDto routeLineDto = routeLineDtos.get(0);
if (CollUtil.isNotEmpty(getDeviceCodeList)){
//查找无货的防货点
for (String deviceCode : getDeviceCodeList) {
JSONObject jsonEnd = wo.query("device_code ='" + deviceCode + "'").uniqueResult(0);
if (MapUtil.isNotEmpty(jsonEnd) && "0".equals(jsonEnd.get("hasgoods"))){
nextCode = deviceCode;
break;
}
}
}
if (nextCode == null){
logServer.deviceExecuteLog(this.device_code, "", "", "终点货物占满");
return false;
}
List<TaskDto> taskDtos = taskserver.queryTaskByDeviceCodeAndStatus(on_off_site_str);
if (CollUtil.isNotEmpty(taskDtos)){
logServer.deviceExecuteLog(this.device_code, "", "", "已存在"+on_off_site_str+"为起点就绪或执行的任务");
return false;
}
TaskDto taskDto = new TaskDto();
taskDto.setStart_device_code(on_off_site);
taskDto.setNext_device_code(routeLineDto.getNext_device_code());
taskDto.setStart_point_code(on_off_site);
taskDto.setNext_point_code(routeLineDto.getNext_device_code());
taskDto.setStart_device_code(on_off_site_str);
taskDto.setNext_device_code(nextCode);
taskDto.setStart_point_code(on_off_site_str);
taskDto.setNext_point_code(nextCode);
taskDto.setExecute_code(this.device_code);
taskDto.setExecute_message("down");
taskDto.setTask_type("3");
taskserver.create(taskDto);
}
//请求上料
if (up_request == 1){
List<RouteLineDto> routeLineDtos = routeLineService.getPathLinesByCode(on_off_site,"normal");
if (CollUtil.isEmpty(routeLineDtos) || routeLineDtos.size() < 1) {
logServer.deviceExecuteLog(this.device_code, "", "", "没有"+ on_off_site + "的路由");
String startCode = null;
//起点要有货,上料点要无货
JSONObject json = wo.query("device_code ='" + on_off_site_str + "'").uniqueResult(0);
if (MapUtil.isNotEmpty(json) && "1".equals(json.get("hasgoods"))){
logServer.deviceExecuteLog(this.device_code, "", "", on_off_site_str + "上料点存在货物");
return false;
}
if (CollUtil.isNotEmpty(putDeviceCodeList)){
//查找无货的防货点
for (String deviceCode : putDeviceCodeList) {
JSONObject jsonStar = wo.query("device_code ='" + deviceCode + "'").uniqueResult(0);
if (MapUtil.isNotEmpty(jsonStar) && "1".equals(jsonStar.get("hasgoods")) && tray_Information_str.equals(jsonStar.get("material_type"))){
startCode = deviceCode;
break;
}
}
}
if (startCode == null){
logServer.deviceExecuteLog(this.device_code, "", "", "起点无货物可取或者物料类型不匹配");
return false;
}
List<TaskDto> taskDtos = taskserver.queryTaskByEndDeviceCodeAndStatus(on_off_site_str);
if (CollUtil.isNotEmpty(taskDtos)){
logServer.deviceExecuteLog(this.device_code, "", "", "已存在"+startCode+"为终点就绪或执行的任务");
return false;
}
RouteLineDto routeLineDto = routeLineDtos.get(0);
TaskDto taskDto = new TaskDto();
taskDto.setStart_device_code(routeLineDto.getDevice_code());
taskDto.setNext_device_code(on_off_site);
taskDto.setStart_point_code(routeLineDto.getDevice_code());
taskDto.setNext_point_code(on_off_site);
taskDto.setStart_device_code(startCode);
taskDto.setNext_device_code(on_off_site_str);
taskDto.setStart_point_code(startCode);
taskDto.setNext_point_code(on_off_site_str);
taskDto.setExecute_code(this.device_code);
taskDto.setExecute_message("up");
taskDto.setTask_type("3");
taskserver.create(taskDto);
}
return true;

16
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv_conveyor/ItemProtocol.java

@ -13,12 +13,11 @@ import java.util.List;
@Setter
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_on_off_site = "on_off_site";
public static String item_tray_Information = "tray_Information";
public static String item_down_request = "down_request";
public static String item_up_request = "up_request";
public static String item_to_up_finished = "to_up_finished ";
public static String item_to_up_finished = "to_up_finished";
public static String item_to_down_finished = "to_down_finished";
@ -29,16 +28,14 @@ public class ItemProtocol {
this.driver = driver;
}
public int getItem_heartbeat() {
return this.getOpcIntegerValue(item_heartbeat);
}
public String getItem_on_off_site() {
return this.getOpcStringValue(item_on_off_site);
public int getItem_on_off_site() {
return this.getOpcIntegerValue(item_on_off_site);
}
public String getItem_tray_Information() {
return this.getOpcStringValue(item_tray_Information);
public int getItem_tray_Information() {
return this.getOpcIntegerValue(item_tray_Information);
}
public int getItem_down_request() {
@ -75,7 +72,6 @@ public class ItemProtocol {
public static List<ItemDTO> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDTO(item_heartbeat, "心跳", "VW0"));
list.add(new ItemDTO(item_on_off_site, "上下站点", "VW2"));
list.add(new ItemDTO(item_tray_Information, "料盘信息", "VW4"));
list.add(new ItemDTO(item_down_request, "下料请求", "VW6"));

7
acs/nladmin-system/src/main/java/org/nl/acs/task/service/TaskService.java

@ -242,4 +242,11 @@ public interface TaskService {
*/
List<TaskDto> queryTaskByDeviceCodeAndStatus(String device_code);
/**
* 根据终点设备号和任务状态查询
* @param device_code
* @return
*/
List<TaskDto> queryTaskByEndDeviceCodeAndStatus(String device_code);
}

25
acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java

@ -728,10 +728,10 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
rpUpdate.put("update_time", DateUtil.now());
String device_code3 = "";
String device_code4 = "";
if (device3 != null){
if (device3 != null) {
device_code3 = device3.getDevice_code();
}
if (device4 != null){
if (device4 != null) {
device_code4 = device4.getDevice_code();
}
WQLObject.getWQLObject("acs_device_runpoint").update(rpUpdate, "device_code IN ('" + device1.getDevice_code() + "', '" + device2.getDevice_code() + "', '" + device_code3 + "', '" + device_code4 + "')");
@ -1226,11 +1226,22 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
Iterator<TaskDto> iterator = tasks.iterator();
while (iterator.hasNext()) {
TaskDto task = iterator.next();
if (task.getStart_device_code().equals(device_code) && StrUtil.equals(task.getTask_status(), "1")) {
Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code());
if (ObjectUtil.isNotEmpty(instruction)) {
list.add(task);
}
if (task.getStart_device_code().equals(device_code) && (StrUtil.equals(task.getTask_status(), "1") || StrUtil.equals(task.getTask_status(), "0"))) {
list.add(task);
}
}
return list;
}
@Override
public List<TaskDto> queryTaskByEndDeviceCodeAndStatus(String device_code) {
List<TaskDto> list = new ArrayList<>();
Iterator<TaskDto> iterator = tasks.iterator();
while (iterator.hasNext()) {
TaskDto task = iterator.next();
if (task.getNext_device_code().equals(device_code) && (StrUtil.equals(task.getTask_status(), "1") || StrUtil.equals(task.getTask_status(), "0"))) {
list.add(task);
}
}
return list;

2
acs/nladmin-ui/public/config.js

@ -3,7 +3,7 @@ window.g = {
VUE_APP_BASE_API: 'http://127.0.0.1:8010'
},
prod: {
VUE_APP_BASE_API: 'http://10.93.41.198:8010'
VUE_APP_BASE_API: 'http://188.188.69.101:8010'
}

44
acs/nladmin-ui/src/views/acs/device/driver/agv_conveyor.vue

@ -67,17 +67,14 @@
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-row>
<el-col :span="8">
<el-form-item label="最大数量">
<el-input v-model="form.max_emptypalletnum" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="关联设备" prop="device_code">
<el-col :span="10">
<el-form-item label="下料配置" prop="device_code">
<el-select
v-model="form.link_device_code"
clearable
v-model="form.get_device_code"
filterable
multiple
clearable
placeholder="请选择"
>
<el-option
@ -89,11 +86,12 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="关联三色灯" prop="device_code" label-width="100px">
<el-col :span="10">
<el-form-item label="上料配置" prop="device_code">
<el-select
v-model="form.link_three_lamp"
v-model="form.put_device_code"
filterable
multiple
clearable
placeholder="请选择"
>
@ -107,23 +105,7 @@
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-tooltip class="item" effect="dark" content="创建设备点位记录有无货信号" placement="bottom-end">
<el-form-item label="站点管理" label-width="150px">
<el-switch v-model="form.station_manager" />
</el-form-item>
</el-tooltip>
<el-col :span="8">
<el-form-item label="清除" label-width="80px">
<el-switch v-model="form.auto_clean_task" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="是否输入物料" label-width="150px">
<el-switch v-model="form.input_material" />
</el-form-item>
</el-col>
</el-row>
<el-row />
</el-form>
</el-card>
@ -294,7 +276,9 @@ export default {
manual_create_task: true,
is_pickup: true,
is_release: true,
link_device_code: ''
link_device_code: '',
get_device_code: [],
put_device_code: []
},
rules: {}
}

Loading…
Cancel
Save