驱动更新
This commit is contained in:
@@ -415,8 +415,6 @@ public class MagicAgvServiceImpl implements MagicAgvService {
|
|||||||
|
|
||||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||||
Device addressdevice = appService.findDeviceByCode(address);
|
Device addressdevice = appService.findDeviceByCode(address);
|
||||||
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
|
||||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
|
||||||
|
|
||||||
//请求进入
|
//请求进入
|
||||||
if ("onEntry".equals(type)) {
|
if ("onEntry".equals(type)) {
|
||||||
@@ -445,16 +443,24 @@ public class MagicAgvServiceImpl implements MagicAgvService {
|
|||||||
if ("1".equals(addressdevice.getExtraValue().get("inspect_in_stocck"))) {
|
if ("1".equals(addressdevice.getExtraValue().get("inspect_in_stocck"))) {
|
||||||
if (driver.getMove() == 0) {
|
if (driver.getMove() == 0) {
|
||||||
driver.writing(2);
|
driver.writing(2);
|
||||||
inst.setExecute_status("1");
|
inst.setExecute_status("3");
|
||||||
is_feedback = true;
|
is_feedback = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
driver.writing(2);
|
driver.writing(2);
|
||||||
inst.setExecute_status("1");
|
inst.setExecute_status("3");
|
||||||
is_feedback = true;
|
is_feedback = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if ("Load".equals(action)) {
|
||||||
|
inst.setExecute_status("1");
|
||||||
|
is_feedback = true;
|
||||||
|
} else if ("Unload".equals(action)) {
|
||||||
|
inst.setExecute_status("3");
|
||||||
|
is_feedback = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//取放货完成
|
//取放货完成
|
||||||
} else if ("onStation".equals(type)) {
|
} else if ("onStation".equals(type)) {
|
||||||
@@ -462,7 +468,18 @@ public class MagicAgvServiceImpl implements MagicAgvService {
|
|||||||
if (addressdevice.getDeviceDriver() instanceof ModbusInspectSiteDeviceDriver) {
|
if (addressdevice.getDeviceDriver() instanceof ModbusInspectSiteDeviceDriver) {
|
||||||
//取货完成
|
//取货完成
|
||||||
if ("Load".equals(action)) {
|
if ("Load".equals(action)) {
|
||||||
inst.setExecute_device_code(processingVehicle);
|
inst.setExecute_device_code(address);
|
||||||
|
inst.setExecute_status("2");
|
||||||
|
is_feedback = true;
|
||||||
|
//放货完成
|
||||||
|
} else if ("Unload".equals(action)) {
|
||||||
|
inst.setExecute_device_code(address);
|
||||||
|
inst.setExecute_status("4");
|
||||||
|
is_feedback = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ("Load".equals(action)) {
|
||||||
|
inst.setExecute_device_code(address);
|
||||||
inst.setExecute_status("2");
|
inst.setExecute_status("2");
|
||||||
is_feedback = true;
|
is_feedback = true;
|
||||||
//放货完成
|
//放货完成
|
||||||
@@ -471,7 +488,6 @@ public class MagicAgvServiceImpl implements MagicAgvService {
|
|||||||
inst.setExecute_status("4");
|
inst.setExecute_status("4");
|
||||||
is_feedback = true;
|
is_feedback = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -539,12 +555,12 @@ public class MagicAgvServiceImpl implements MagicAgvService {
|
|||||||
if ((addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver)) {
|
if ((addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver)) {
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
|
else if (addressdevice.getDeviceDriver() instanceof ModbusInspectSiteDeviceDriver) {
|
||||||
|
|
||||||
if (addressdevice.getDeviceDriver() instanceof ModbusInspectSiteDeviceDriver) {
|
|
||||||
ModbusInspectSiteDeviceDriver driver = (ModbusInspectSiteDeviceDriver) addressdevice.getDeviceDriver();
|
ModbusInspectSiteDeviceDriver driver = (ModbusInspectSiteDeviceDriver) addressdevice.getDeviceDriver();
|
||||||
flag = true;
|
|
||||||
driver.writing(3);
|
driver.writing(3);
|
||||||
|
flag = true;
|
||||||
|
} else {
|
||||||
|
flag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
package org.nl.acs.device_driver.inspect_site.modbus_inspect_site;
|
package org.nl.acs.device_driver.inspect_site.modbus_inspect_site;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||||
@@ -15,24 +12,18 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
|||||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||||
import org.nl.acs.instruction.service.InstructionService;
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||||
import org.nl.acs.opc.Device;
|
|
||||||
import org.nl.acs.opc.WcsConfig;
|
|
||||||
import org.nl.acs.route.service.RouteLineService;
|
import org.nl.acs.route.service.RouteLineService;
|
||||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
|
||||||
import org.nl.acs.task.service.TaskService;
|
import org.nl.acs.task.service.TaskService;
|
||||||
import org.nl.acs.task.service.dto.TaskDto;
|
|
||||||
import org.nl.modules.system.util.CodeUtil;
|
|
||||||
import org.nl.utils.SpringContextHolder;
|
import org.nl.utils.SpringContextHolder;
|
||||||
import org.nl.wql.core.bean.WQLObject;
|
|
||||||
import org.openscada.opc.lib.da.Server;
|
import org.openscada.opc.lib.da.Server;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检测站点驱动
|
* 检测站点驱动
|
||||||
*/
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Data
|
@Data
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@@ -60,32 +51,30 @@ public class ModbusInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
|
|
||||||
String device_code;
|
String device_code;
|
||||||
|
|
||||||
@Override
|
|
||||||
public Device getDevice() {
|
|
||||||
return this.device;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
try {
|
try {
|
||||||
device_code = this.getDeviceCode();
|
device_code = this.getDeviceCode();
|
||||||
|
|
||||||
heartbeat = this.itemProtocol.getHeartbeat();
|
heartbeat = this.itemProtocol.getHeartbeat();
|
||||||
move = this.itemProtocol.getMove();
|
if ("1".equals(device.getExtraValue().get("inspect_in_stocck"))) {
|
||||||
|
move = this.itemProtocol.getMove();
|
||||||
|
}
|
||||||
action = this.itemProtocol.getAction();
|
action = this.itemProtocol.getAction();
|
||||||
|
|
||||||
if (heartbeat != last_heartbeat) {
|
if (heartbeat != last_heartbeat) {
|
||||||
logServer.deviceItemValue(this.device_code, "move", String.valueOf(heartbeat));
|
logServer.deviceItemValue(this.device_code, "heartbeat", String.valueOf(heartbeat));
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_heartbeat + "->" + heartbeat);
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号heartbeat:" + last_heartbeat + "->" + heartbeat);
|
||||||
}
|
}
|
||||||
if (move != last_move) {
|
if ("1".equals(device.getExtraValue().get("inspect_in_stocck"))) {
|
||||||
logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
|
if (move != last_move) {
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_move + "->" + move);
|
logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
|
||||||
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_move + "->" + move);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (action != last_action) {
|
if (action != last_action) {
|
||||||
logServer.deviceItemValue(this.device_code, "move", String.valueOf(action));
|
logServer.deviceItemValue(this.device_code, "action", String.valueOf(action));
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_action + "->" + action);
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号action:" + last_action + "->" + action);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception var17) {
|
} catch (Exception var17) {
|
||||||
@@ -106,8 +95,13 @@ public class ModbusInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void writing(int command) {
|
public void writing(int command) {
|
||||||
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
String to_command = this.getDevice().getOpc_server_code() +
|
||||||
+ "." + ItemProtocol.item_to_command;
|
"." +
|
||||||
|
this.getDevice().getOpc_plc_code() +
|
||||||
|
"." +
|
||||||
|
this.getDevice().getDevice_code() +
|
||||||
|
"." +
|
||||||
|
ItemProtocol.item_to_command;
|
||||||
|
|
||||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||||
Server server = ReadUtil.getServer(opcservcerid);
|
Server server = ReadUtil.getServer(opcservcerid);
|
||||||
@@ -115,5 +109,6 @@ public class ModbusInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imple
|
|||||||
itemMap.put(to_command, command);
|
itemMap.put(to_command, command);
|
||||||
ReadUtil.write(itemMap, server);
|
ReadUtil.write(itemMap, server);
|
||||||
|
|
||||||
|
logServer.deviceExecuteLog(device_code, "", "", "to_command 写入 " + command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,12 +8,9 @@ spring:
|
|||||||
druid:
|
druid:
|
||||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||||
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:xugong_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:xugong_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:rljn_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
|
||||||
username: ${DB_USER:root}
|
username: ${DB_USER:root}
|
||||||
# password: ${DB_PWD:P@ssw0rd}
|
password: ${DB_PWD:123456}
|
||||||
password: ${DB_PWD:Root.123456}
|
|
||||||
# password: ${DB_PWD:123456}
|
|
||||||
# 初始连接数
|
# 初始连接数
|
||||||
initial-size: 5
|
initial-size: 5
|
||||||
# 最小连接数
|
# 最小连接数
|
||||||
|
|||||||
Reference in New Issue
Block a user