驱动更新
This commit is contained in:
@@ -415,8 +415,6 @@ public class MagicAgvServiceImpl implements MagicAgvService {
|
||||
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
Device addressdevice = appService.findDeviceByCode(address);
|
||||
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||
|
||||
//请求进入
|
||||
if ("onEntry".equals(type)) {
|
||||
@@ -445,16 +443,24 @@ public class MagicAgvServiceImpl implements MagicAgvService {
|
||||
if ("1".equals(addressdevice.getExtraValue().get("inspect_in_stocck"))) {
|
||||
if (driver.getMove() == 0) {
|
||||
driver.writing(2);
|
||||
inst.setExecute_status("1");
|
||||
inst.setExecute_status("3");
|
||||
is_feedback = true;
|
||||
}
|
||||
} else {
|
||||
driver.writing(2);
|
||||
inst.setExecute_status("1");
|
||||
inst.setExecute_status("3");
|
||||
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)) {
|
||||
@@ -462,7 +468,18 @@ public class MagicAgvServiceImpl implements MagicAgvService {
|
||||
if (addressdevice.getDeviceDriver() instanceof ModbusInspectSiteDeviceDriver) {
|
||||
//取货完成
|
||||
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");
|
||||
is_feedback = true;
|
||||
//放货完成
|
||||
@@ -471,7 +488,6 @@ public class MagicAgvServiceImpl implements MagicAgvService {
|
||||
inst.setExecute_status("4");
|
||||
is_feedback = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -539,12 +555,12 @@ public class MagicAgvServiceImpl implements MagicAgvService {
|
||||
if ((addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver)) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
|
||||
if (addressdevice.getDeviceDriver() instanceof ModbusInspectSiteDeviceDriver) {
|
||||
else if (addressdevice.getDeviceDriver() instanceof ModbusInspectSiteDeviceDriver) {
|
||||
ModbusInspectSiteDeviceDriver driver = (ModbusInspectSiteDeviceDriver) addressdevice.getDeviceDriver();
|
||||
flag = true;
|
||||
driver.writing(3);
|
||||
flag = true;
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
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.EqualsAndHashCode;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.instruction.service.InstructionService;
|
||||
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.dto.RouteLineDto;
|
||||
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.wql.core.bean.WQLObject;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 检测站点驱动
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
@@ -60,32 +51,30 @@ public class ModbusInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
|
||||
String device_code;
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
return this.device;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
|
||||
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();
|
||||
|
||||
if (heartbeat != last_heartbeat) {
|
||||
logServer.deviceItemValue(this.device_code, "move", String.valueOf(heartbeat));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_heartbeat + "->" + heartbeat);
|
||||
logServer.deviceItemValue(this.device_code, "heartbeat", String.valueOf(heartbeat));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号heartbeat:" + last_heartbeat + "->" + heartbeat);
|
||||
}
|
||||
if (move != last_move) {
|
||||
logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_move + "->" + move);
|
||||
if ("1".equals(device.getExtraValue().get("inspect_in_stocck"))) {
|
||||
if (move != last_move) {
|
||||
logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_move + "->" + move);
|
||||
}
|
||||
}
|
||||
if (action != last_action) {
|
||||
logServer.deviceItemValue(this.device_code, "move", String.valueOf(action));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_action + "->" + action);
|
||||
logServer.deviceItemValue(this.device_code, "action", String.valueOf(action));
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号action:" + last_action + "->" + action);
|
||||
}
|
||||
|
||||
} catch (Exception var17) {
|
||||
@@ -106,8 +95,13 @@ public class ModbusInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
}
|
||||
|
||||
public void writing(int command) {
|
||||
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + ItemProtocol.item_to_command;
|
||||
String to_command = this.getDevice().getOpc_server_code() +
|
||||
"." +
|
||||
this.getDevice().getOpc_plc_code() +
|
||||
"." +
|
||||
this.getDevice().getDevice_code() +
|
||||
"." +
|
||||
ItemProtocol.item_to_command;
|
||||
|
||||
String opcservcerid = this.getDevice().getOpc_server_id();
|
||||
Server server = ReadUtil.getServer(opcservcerid);
|
||||
@@ -115,5 +109,6 @@ public class ModbusInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
itemMap.put(to_command, command);
|
||||
ReadUtil.write(itemMap, server);
|
||||
|
||||
logServer.deviceExecuteLog(device_code, "", "", "to_command 写入 " + command);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,12 +8,9 @@ spring:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
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:rljn_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
|
||||
username: ${DB_USER:root}
|
||||
# password: ${DB_PWD:P@ssw0rd}
|
||||
password: ${DB_PWD:Root.123456}
|
||||
# password: ${DB_PWD:123456}
|
||||
password: ${DB_PWD:123456}
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
# 最小连接数
|
||||
|
||||
Reference in New Issue
Block a user