From bdbe601b1a927308881ed5714e4672892197f1da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=B1=9F=E7=8E=AE?= Date: Fri, 7 Apr 2023 20:10:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8E=E7=94=B5=E6=B0=94=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=BA=A4=E4=BA=92=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agv/server/impl/MagicAgvServiceImpl.java | 144 ++++-------------- 1 file changed, 33 insertions(+), 111 deletions(-) diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/MagicAgvServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/MagicAgvServiceImpl.java index a4d7472..8325d55 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/MagicAgvServiceImpl.java +++ b/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.server.AcsConfigService; 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.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; import org.nl.acs.device_driver.standard_storage.StandardStorageDeviceDriver; @@ -419,78 +420,46 @@ public class MagicAgvServiceImpl implements MagicAgvService { //请求进入 if ("onEntry".equals(type)) { - - if (addressdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { - 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 (addressdevice.getDeviceDriver() instanceof ModbusInspectSiteDeviceDriver) { + ModbusInspectSiteDeviceDriver driver = (ModbusInspectSiteDeviceDriver) addressdevice.getDeviceDriver(); //请求取货 if ("Load".equals(action)) { - if (addressdevice.getHas_goods() > 0) { - inst.setExecute_status("1"); - is_feedback = true; + driver.writing(1); + if (driver.getAction() == 1) { + 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)) { - if (addressdevice.getHas_goods() == 0) { - inst.setExecute_status("3"); - is_feedback = true; - } - } - } - - if (addressdevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { - //请求取货 - if ("Load".equals(action)) { - inst.setExecute_status("1"); - is_feedback = true; - //请求放货 - } else if ("Unload".equals(action)) { - inst.setExecute_status("3"); - if (!instructionService.hasInstInOneRow(inst)) { - is_feedback = true; + driver.writing(1); + if (driver.getAction() == 1) { + if ("1".equals(addressdevice.getExtraValue().get("inspect_in_stocck"))) { + if (driver.getMove() == 0) { + driver.writing(2); + inst.setExecute_status("1"); + is_feedback = true; + } + } else { + driver.writing(2); + inst.setExecute_status("1"); + is_feedback = true; + } } } } - //取放货完成 } 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) { - standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) addressdevice.getDeviceDriver(); + if (addressdevice.getDeviceDriver() instanceof ModbusInspectSiteDeviceDriver) { //取货完成 if ("Load".equals(action)) { 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(); @@ -577,9 +533,6 @@ public class MagicAgvServiceImpl implements MagicAgvService { DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); Device addressdevice = appService.findDeviceByCode(address); - StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; - StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; - StandardStorageDeviceDriver standardStorageDeviceDriver; //mes = AgvClientXZ.mes(zlbh, device, type); //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 @@ -587,42 +540,11 @@ public class MagicAgvServiceImpl implements MagicAgvService { 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) { - standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) addressdevice.getDeviceDriver(); + if (addressdevice.getDeviceDriver() instanceof ModbusInspectSiteDeviceDriver) { + ModbusInspectSiteDeviceDriver driver = (ModbusInspectSiteDeviceDriver) addressdevice.getDeviceDriver(); flag = true; - log.info("agvstatus:" + standardOrdinarySiteDeviceDriver.getFlag() + ""); - - //取货完成离开 - if (standardOrdinarySiteDeviceDriver.getFlag() == 2) { - flag = true; - standardOrdinarySiteDeviceDriver.setFlag(5); - } - //放货完成离开 - if (standardOrdinarySiteDeviceDriver.getFlag() == 4) { - flag = true; - standardOrdinarySiteDeviceDriver.setFlag(6); - } + driver.writing(3); } if (flag) {