Browse Source

与电气逻辑交互更新

master
张江玮 2 years ago
parent
commit
bdbe601b1a
  1. 144
      acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/MagicAgvServiceImpl.java

144
acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/MagicAgvServiceImpl.java

@ -13,6 +13,7 @@ import org.nl.acs.agv.server.dto.AgvDto;
import org.nl.acs.config.AcsConfig; import org.nl.acs.config.AcsConfig;
import org.nl.acs.config.server.AcsConfigService; import org.nl.acs.config.server.AcsConfigService;
import org.nl.acs.device_driver.autodoor.standard_autodoor.StandardAutodoorDeviceDriver; import org.nl.acs.device_driver.autodoor.standard_autodoor.StandardAutodoorDeviceDriver;
import org.nl.acs.device_driver.inspect_site.modbus_inspect_site.ModbusInspectSiteDeviceDriver;
import org.nl.acs.device_driver.inspect_site.standard_inspect_site.StandardInspectSiteDeviceDriver; import org.nl.acs.device_driver.inspect_site.standard_inspect_site.StandardInspectSiteDeviceDriver;
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_storage.StandardStorageDeviceDriver; import org.nl.acs.device_driver.standard_storage.StandardStorageDeviceDriver;
@ -419,78 +420,46 @@ public class MagicAgvServiceImpl implements MagicAgvService {
//请求进入 //请求进入
if ("onEntry".equals(type)) { if ("onEntry".equals(type)) {
if (addressdevice.getDeviceDriver() instanceof ModbusInspectSiteDeviceDriver) {
if (addressdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { ModbusInspectSiteDeviceDriver driver = (ModbusInspectSiteDeviceDriver) addressdevice.getDeviceDriver();
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) addressdevice.getDeviceDriver();
//请求取货
if ("Load".equals(action)) {
if (standardInspectSiteDeviceDriver.getMode() == 2 && standardInspectSiteDeviceDriver.getMove() > 0) {
inst.setExecute_status("1");
is_feedback = true;
}
//请求放货
} else if ("Unload".equals(action)) {
if (standardInspectSiteDeviceDriver.getMode() == 2 && standardInspectSiteDeviceDriver.getMove() == 0) {
inst.setExecute_status("3");
is_feedback = true;
}
}
}
if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) addressdevice.getDeviceDriver();
//请求取货 //请求取货
if ("Load".equals(action)) { if ("Load".equals(action)) {
if (addressdevice.getHas_goods() > 0) { driver.writing(1);
inst.setExecute_status("1"); if (driver.getAction() == 1) {
is_feedback = true; if ("1".equals(addressdevice.getExtraValue().get("inspect_in_stocck"))) {
if (driver.getMove() == 1) {
driver.writing(2);
inst.setExecute_status("1");
is_feedback = true;
}
} else {
driver.writing(2);
inst.setExecute_status("1");
is_feedback = true;
}
} }
//请求放货 //请求放货
} else if ("Unload".equals(action)) { } else if ("Unload".equals(action)) {
if (addressdevice.getHas_goods() == 0) { driver.writing(1);
inst.setExecute_status("3"); if (driver.getAction() == 1) {
is_feedback = true; if ("1".equals(addressdevice.getExtraValue().get("inspect_in_stocck"))) {
} if (driver.getMove() == 0) {
} driver.writing(2);
} inst.setExecute_status("1");
is_feedback = true;
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { }
//请求取货 } else {
if ("Load".equals(action)) { driver.writing(2);
inst.setExecute_status("1"); inst.setExecute_status("1");
is_feedback = true; is_feedback = true;
//请求放货 }
} else if ("Unload".equals(action)) {
inst.setExecute_status("3");
if (!instructionService.hasInstInOneRow(inst)) {
is_feedback = true;
} }
} }
} }
//取放货完成 //取放货完成
} else if ("onStation".equals(type)) { } else if ("onStation".equals(type)) {
System.out.println("取放货完成");
if (addressdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) addressdevice.getDeviceDriver();
//取货完成
if ("Load".equals(action)) {
if (standardInspectSiteDeviceDriver.getMode() == 2 && standardInspectSiteDeviceDriver.getMove() == 0) {
inst.setExecute_device_code(processingVehicle);
inst.setExecute_status("2");
is_feedback = true;
}
//放货完成
} else if ("Unload".equals(action)) {
if (standardInspectSiteDeviceDriver.getMode() == 2 && standardInspectSiteDeviceDriver.getMove() > 0) {
inst.setExecute_device_code(address);
inst.setExecute_status("4");
is_feedback = true;
}
}
}
if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { if (addressdevice.getDeviceDriver() instanceof ModbusInspectSiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) addressdevice.getDeviceDriver();
//取货完成 //取货完成
if ("Load".equals(action)) { if ("Load".equals(action)) {
inst.setExecute_device_code(processingVehicle); inst.setExecute_device_code(processingVehicle);
@ -504,19 +473,6 @@ public class MagicAgvServiceImpl implements MagicAgvService {
} }
} }
if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
//取货完成
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(processingVehicle);
inst.setExecute_status("4");
is_feedback = true;
}
}
} }
JSONObject requestjo = new JSONObject(); JSONObject requestjo = new JSONObject();
@ -577,9 +533,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;
StandardStorageDeviceDriver standardStorageDeviceDriver;
//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请求离开区域
@ -587,42 +540,11 @@ public class MagicAgvServiceImpl implements MagicAgvService {
flag = true; flag = true;
} }
if (addressdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) addressdevice.getDeviceDriver();
flag = true;
log.info("agvstatus:" + standardInspectSiteDeviceDriver.getFlag() + "");
//取货完成离开
if (standardInspectSiteDeviceDriver.getFlag() == 2) {
if (standardInspectSiteDeviceDriver.getMove() == 0) {
flag = true;
standardInspectSiteDeviceDriver.setFlag(5);
}
}
//放货完成离开
if (standardInspectSiteDeviceDriver.getFlag() == 4) {
if (standardInspectSiteDeviceDriver.getMove() == 1) {
flag = true;
standardInspectSiteDeviceDriver.setFlag(6);
}
}
}
if (addressdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { if (addressdevice.getDeviceDriver() instanceof ModbusInspectSiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) addressdevice.getDeviceDriver(); ModbusInspectSiteDeviceDriver driver = (ModbusInspectSiteDeviceDriver) addressdevice.getDeviceDriver();
flag = true; flag = true;
log.info("agvstatus:" + standardOrdinarySiteDeviceDriver.getFlag() + ""); driver.writing(3);
//取货完成离开
if (standardOrdinarySiteDeviceDriver.getFlag() == 2) {
flag = true;
standardOrdinarySiteDeviceDriver.setFlag(5);
}
//放货完成离开
if (standardOrdinarySiteDeviceDriver.getFlag() == 4) {
flag = true;
standardOrdinarySiteDeviceDriver.setFlag(6);
}
} }
if (flag) { if (flag) {

Loading…
Cancel
Save