Browse Source

fix 驱动

master
汪菘 2 years ago
parent
commit
d46f71d913
  1. 60
      hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java
  2. 16
      hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_special_inspect_site/StandardSpecialInspectSiteDeviceDriver.java
  3. 2
      hd/nladmin-system/src/main/resources/config/application-prod.yml

60
hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java

@ -25,6 +25,7 @@ import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceD
import org.nl.acs.device_driver.standard_inspect_site_smart200.StandardInspectSiteSmartDeviceDriver;
import org.nl.acs.device_driver.standard_manipulator_inspect_site.StandardManipulatorInspectSiteDeviceDriver;
import org.nl.acs.device_driver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.standard_special_inspect_site.StandardSpecialInspectSiteDeviceDriver;
import org.nl.acs.device_driver.standard_storage.StandardStorageDeviceDriver;
import org.nl.acs.device_driver.weighing_site.WeighingSiteDeviceDriver;
import org.nl.acs.device_driver.ykbk_special.YkbkSpecialDeviceDriver;
@ -810,6 +811,7 @@ public class AgvServiceImpl implements AgvService {
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device addressdevice = appService.findDeviceByCode(address);
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
StandardSpecialInspectSiteDeviceDriver standardSpecialInspectSiteDeviceDriver;
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
SpecialOrdinarySiteDeviceDriver specialOrdinarySiteDeviceDriver;
YzjaSpecialDeviceDriver yzjaSpecialDeviceDriver;
@ -835,6 +837,32 @@ public class AgvServiceImpl implements AgvService {
}
}
}
if (addressdevice.getDeviceDriver() instanceof StandardSpecialInspectSiteDeviceDriver) {
standardSpecialInspectSiteDeviceDriver = (StandardSpecialInspectSiteDeviceDriver) addressdevice.getDeviceDriver();
//请求取货
if ("Load".equals(action)) {
if (standardSpecialInspectSiteDeviceDriver.getMode() == 2 && standardSpecialInspectSiteDeviceDriver.getMove() > 0) {
if(standardSpecialInspectSiteDeviceDriver.getAction()> 0){
inst.setExecute_status("1");
is_feedback = true;
} else {
standardSpecialInspectSiteDeviceDriver.writing(1);
}
}
//请求放货
} else if ("Unload".equals(action)) {
if (standardSpecialInspectSiteDeviceDriver.getMode() == 2 && standardSpecialInspectSiteDeviceDriver.getMove() == 0) {
if(standardSpecialInspectSiteDeviceDriver.getAction()>0){
inst.setExecute_status("1");
is_feedback = true;
} else {
standardSpecialInspectSiteDeviceDriver.writing(1);
}
}
}
}
if (addressdevice.getDeviceDriver() instanceof SpecialOrdinarySiteDeviceDriver) {
specialOrdinarySiteDeviceDriver = (SpecialOrdinarySiteDeviceDriver) addressdevice.getDeviceDriver();
//请求取货
@ -1010,6 +1038,22 @@ public class AgvServiceImpl implements AgvService {
is_feedback = true;
}
}
if (addressdevice.getDeviceDriver() instanceof StandardSpecialInspectSiteDeviceDriver) {
standardSpecialInspectSiteDeviceDriver = (StandardSpecialInspectSiteDeviceDriver) addressdevice.getDeviceDriver();
//取货完成
if ("Load".equals(action)) {
inst.setExecute_device_code(processingVehicle);
inst.setExecute_status("2");
is_feedback = true;
//放货完成
} else if ("Unload".equals(action)) {
inst.setExecute_device_code(address);
inst.setExecute_status("4");
is_feedback = true;
}
}
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
//取货完成
if ("Load".equals(action)) {
@ -1327,6 +1371,7 @@ public class AgvServiceImpl implements AgvService {
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
StandardStorageDeviceDriver standardStorageDeviceDriver;
StandardSpecialInspectSiteDeviceDriver standardSpecialInspectSiteDeviceDriver;
//mes = AgvClientXZ.mes(zlbh, device, type);
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
if ((addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver)) {
@ -1370,6 +1415,21 @@ public class AgvServiceImpl implements AgvService {
}
}
if (addressdevice.getDeviceDriver() instanceof StandardSpecialInspectSiteDeviceDriver) {
standardSpecialInspectSiteDeviceDriver = (StandardSpecialInspectSiteDeviceDriver) addressdevice.getDeviceDriver();
//取货完成离开
if (standardSpecialInspectSiteDeviceDriver.getFlag() == 2) {
flag = true;
standardSpecialInspectSiteDeviceDriver.setFlag(5);
}
//放货完成离开
if (standardSpecialInspectSiteDeviceDriver.getFlag() == 4) {
flag = true;
standardSpecialInspectSiteDeviceDriver.setFlag(6);
}
}
if (flag) {
log.info("AGV请求离开,反馈成功:{}", address);
System.out.println("AGV请求离开,反馈成功 " + address);

16
hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_special_inspect_site/StandardSpecialInspectSiteDeviceDriver.java

@ -56,6 +56,7 @@ public class StandardSpecialInspectSiteDeviceDriver extends AbstractOpcDeviceDri
String devicecode;
int mode = 0;
int error = 0;
int action = 0;
int move = 0;
int task = 0;
int last_mode = 0;
@ -89,6 +90,7 @@ public class StandardSpecialInspectSiteDeviceDriver extends AbstractOpcDeviceDri
private int instruction_finished_time_out;
int flag = 0;
int branchProtocol = 0;
//备注
String remark;
@ -120,6 +122,7 @@ public class StandardSpecialInspectSiteDeviceDriver extends AbstractOpcDeviceDri
mode = this.itemProtocol.getMode();
error = this.itemProtocol.getError();
action = this.getItemProtocol().getAction();
move = this.itemProtocol.getMove();
task = this.itemProtocol.getTask();
hasGoods = this.itemProtocol.hasGoods(move);
@ -310,6 +313,19 @@ public class StandardSpecialInspectSiteDeviceDriver extends AbstractOpcDeviceDri
}
}
public void writing(int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + org.nl.acs.device_driver.standard_inspect_site_smart200.ItemProtocol.item_to_command;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
server.dispose();
}
/**
* 完成并创建下一条指令
*

2
hd/nladmin-system/src/main/resources/config/application-prod.yml

@ -8,7 +8,7 @@ spring:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:tg_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:ykbk_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
username: ${DB_USER:root}
password: ${DB_PWD:123456}
# 初始连接数

Loading…
Cancel
Save