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_inspect_site_smart200.StandardInspectSiteSmartDeviceDriver;
import org.nl.acs.device_driver.standard_manipulator_inspect_site.StandardManipulatorInspectSiteDeviceDriver; 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_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.standard_storage.StandardStorageDeviceDriver;
import org.nl.acs.device_driver.weighing_site.WeighingSiteDeviceDriver; import org.nl.acs.device_driver.weighing_site.WeighingSiteDeviceDriver;
import org.nl.acs.device_driver.ykbk_special.YkbkSpecialDeviceDriver; import org.nl.acs.device_driver.ykbk_special.YkbkSpecialDeviceDriver;
@ -810,6 +811,7 @@ public class AgvServiceImpl implements AgvService {
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device addressdevice = appService.findDeviceByCode(address); Device addressdevice = appService.findDeviceByCode(address);
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
StandardSpecialInspectSiteDeviceDriver standardSpecialInspectSiteDeviceDriver;
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
SpecialOrdinarySiteDeviceDriver specialOrdinarySiteDeviceDriver; SpecialOrdinarySiteDeviceDriver specialOrdinarySiteDeviceDriver;
YzjaSpecialDeviceDriver yzjaSpecialDeviceDriver; 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) { if (addressdevice.getDeviceDriver() instanceof SpecialOrdinarySiteDeviceDriver) {
specialOrdinarySiteDeviceDriver = (SpecialOrdinarySiteDeviceDriver) addressdevice.getDeviceDriver(); specialOrdinarySiteDeviceDriver = (SpecialOrdinarySiteDeviceDriver) addressdevice.getDeviceDriver();
//请求取货 //请求取货
@ -1010,6 +1038,22 @@ public class AgvServiceImpl implements AgvService {
is_feedback = true; 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 (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
//取货完成 //取货完成
if ("Load".equals(action)) { if ("Load".equals(action)) {
@ -1327,6 +1371,7 @@ public class AgvServiceImpl implements AgvService {
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
StandardStorageDeviceDriver standardStorageDeviceDriver; StandardStorageDeviceDriver standardStorageDeviceDriver;
StandardSpecialInspectSiteDeviceDriver standardSpecialInspectSiteDeviceDriver;
//mes = AgvClientXZ.mes(zlbh, device, type); //mes = AgvClientXZ.mes(zlbh, device, type);
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
if ((addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver)) { 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) { if (flag) {
log.info("AGV请求离开,反馈成功:{}", address); log.info("AGV请求离开,反馈成功:{}", address);
System.out.println("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; String devicecode;
int mode = 0; int mode = 0;
int error = 0; int error = 0;
int action = 0;
int move = 0; int move = 0;
int task = 0; int task = 0;
int last_mode = 0; int last_mode = 0;
@ -89,6 +90,7 @@ public class StandardSpecialInspectSiteDeviceDriver extends AbstractOpcDeviceDri
private int instruction_finished_time_out; private int instruction_finished_time_out;
int flag = 0;
int branchProtocol = 0; int branchProtocol = 0;
//备注 //备注
String remark; String remark;
@ -120,6 +122,7 @@ public class StandardSpecialInspectSiteDeviceDriver extends AbstractOpcDeviceDri
mode = this.itemProtocol.getMode(); mode = this.itemProtocol.getMode();
error = this.itemProtocol.getError(); error = this.itemProtocol.getError();
action = this.getItemProtocol().getAction();
move = this.itemProtocol.getMove(); move = this.itemProtocol.getMove();
task = this.itemProtocol.getTask(); task = this.itemProtocol.getTask();
hasGoods = this.itemProtocol.hasGoods(move); 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: 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: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} username: ${DB_USER:root}
password: ${DB_PWD:123456} password: ${DB_PWD:123456}
# 初始连接数 # 初始连接数

Loading…
Cancel
Save