From 1fcd93aa8adfbb0300bd5aa6a1e2b017513cc7a9 Mon Sep 17 00:00:00 2001 From: gengby <858962040@qq.com> Date: Tue, 2 Apr 2024 10:46:09 +0800 Subject: [PATCH] =?UTF-8?q?init:=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/org/nl/acs/agv/AgvWaitUtil.java | 6 - .../agv/server/impl/ZheDaAgvServiceImpl.java | 37 +- .../service/impl/DeviceServiceImpl.java | 30 +- .../agv/ndctwo/AgvNdcTwoDeviceDriver.java | 350 +---- .../acs/ext/wms/rest/WmsToAcsController.java | 50 - .../acs/ext/wms/service/WmsToAcsService.java | 69 - .../wms/service/impl/WmsToAcsServiceImpl.java | 1275 ----------------- .../service/impl/InstructionServiceImpl.java | 10 - 8 files changed, 11 insertions(+), 1816 deletions(-) diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java index fc61d1d..f6034d9 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java @@ -1,20 +1,14 @@ package org.nl.acs.agv; -import cn.hutool.core.util.ObjectUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device.domain.Device; -import org.nl.acs.device.service.DeviceService; import org.nl.acs.device_driver.conveyor.standard_inspect_site.StandardInspectSiteDeviceDriver; -import org.nl.acs.device_driver.one_manipulator.box_storage_manipulator.BoxStorageManipulatorDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.opc.DeviceAppService; -import org.nl.common.exception.BadRequestException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/ZheDaAgvServiceImpl.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/ZheDaAgvServiceImpl.java index 0d66afd..67e55ed 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/ZheDaAgvServiceImpl.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/ZheDaAgvServiceImpl.java @@ -13,7 +13,6 @@ import org.nl.acs.agv.server.ZheDaAgvService; import org.nl.acs.common.base.CommonFinalParam; import org.nl.acs.device.domain.Device; -import org.nl.acs.device_driver.two_conveyor.hongxiang_device.HongXiangConveyorDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.service.InstructionService; @@ -187,31 +186,16 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); Device addressdevice = appService.findDeviceByCode(address); - HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; //取货的进入前等待和离开等待 if (LOAD.equals(action)) { if (ENTRY_REQUIRED.equals(type)) { - //豪凯自动线对接位 - if (addressdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { - hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) addressdevice.getDeviceDriver(); - if ((hongXiangConveyorDeviceDriver.getAction() == CommonFinalParam.ACTION_ONE || hongXiangConveyorDeviceDriver.getAction() == CommonFinalParam.ACTION_THREE)) { - if(hongXiangConveyorDeviceDriver.getMove() == 1){ - inst.setExecute_status(CommonFinalParam.ONE); - is_feedback = true; - } - } - } + } if (PAUSE_ON_STATION.equals(type)) { - if (addressdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { - hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) addressdevice.getDeviceDriver(); - inst.setExecute_status(CommonFinalParam.TWO); - hongXiangConveyorDeviceDriver.writing(2); - is_feedback = true; - } + } @@ -290,23 +274,10 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { //放货的进入前等待和离开等待 if (UNLOAD.equals(action)) { if (ENTRY_REQUIRED.equals(type)) { - if (addressdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { - hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) addressdevice.getDeviceDriver(); - if ((hongXiangConveyorDeviceDriver.getAction() == CommonFinalParam.ACTION_TWO || hongXiangConveyorDeviceDriver.getAction() == CommonFinalParam.ACTION_THREE)) { - if(hongXiangConveyorDeviceDriver.getMove() == 0){ - inst.setExecute_status("3"); - is_feedback = true; - } - } - } + } if (PAUSE_ON_STATION.equals(type)) { - if (addressdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { - hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) addressdevice.getDeviceDriver(); - inst.setExecute_status(CommonFinalParam.FOUR); - hongXiangConveyorDeviceDriver.writing(3); - is_feedback = true; - } + } } JSONObject requestjo = new JSONObject(); diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java index 608756d..e9c0500 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java @@ -28,10 +28,7 @@ import org.nl.acs.device.domain.DeviceRunpoint; import org.nl.acs.device.service.mapper.DeviceRunpointMapper; import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver; import org.nl.acs.device_driver.one_conveyor.scanner_weight_conveyor.ConveyorWithScannerWeightDeviceDriver; -import org.nl.acs.device_driver.one_manipulator.volume_two_manipulator.VolumeTwoManipulatorManipulatorDeviceDriver; import org.nl.acs.device_driver.stacker.standard_stacker.StandardStackerDeviceDriver; -import org.nl.acs.device_driver.two_conveyor.oven_manipulator.OvenGantryManipulatorDeviceDriver; -import org.nl.acs.device_driver.two_conveyor.slit_two_manipulator.SlitTwoManipulatorDeviceDriver; import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.acs.route.domain.RouteLine; import org.nl.acs.route.service.mapper.RouteLineMapper; @@ -45,8 +42,6 @@ import org.nl.acs.device.service.DeviceExtraService; import org.nl.acs.device_driver.DeviceDriverDefination; import org.nl.acs.device_driver.ScannerDeviceDriver; import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver; -import org.nl.acs.device_driver.conveyor.siemens_conveyor_ckk.SiemensConveyorCkkDeviceDriver; -import org.nl.acs.device_driver.conveyor.siemens_conveyor_labeling.SiemensConveyorLabelingDeviceDriver; import org.nl.acs.device_driver.conveyor.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver; import org.nl.acs.device_driver.conveyor.standard_inspect_site.StandardInspectSiteDeviceDriver; import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; @@ -931,7 +926,6 @@ public class DeviceServiceImpl extends CommonServiceImpl i throw new BadRequestException(LangProcess.msg("error_isNull", device_code)); } StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; - SlitTwoManipulatorDeviceDriver slitTwoManipulatorDeviceDriver; //检测站点 StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { @@ -996,35 +990,17 @@ public class DeviceServiceImpl extends CommonServiceImpl i standardInspectSiteDeviceDriver.setBatch(batch); device.setMaterial_type(material_type); device.setBatch(batch); - } else if (device.getDeviceDriver() instanceof SlitTwoManipulatorDeviceDriver) { - slitTwoManipulatorDeviceDriver = (SlitTwoManipulatorDeviceDriver) device.getDeviceDriver(); - slitTwoManipulatorDeviceDriver.setDeviceStatus(form); - } else if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { + } else if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { SiemensConveyorDeviceDriver siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver(); siemensConveyorDeviceDriver.setDeviceStatus(form); - } else if (device.getDeviceDriver() instanceof SiemensConveyorLabelingDeviceDriver) { - SiemensConveyorLabelingDeviceDriver siemensConveyorLabelingDeviceDriver = (SiemensConveyorLabelingDeviceDriver) device.getDeviceDriver(); - siemensConveyorLabelingDeviceDriver.setDeviceStatus(form); - } else if (device.getDeviceDriver() instanceof OvenGantryManipulatorDeviceDriver) { - OvenGantryManipulatorDeviceDriver ovenGantryManipulatorDeviceDriver = (OvenGantryManipulatorDeviceDriver) device.getDeviceDriver(); - ovenGantryManipulatorDeviceDriver.setDeviceStatus(form); - } else if (device.getDeviceDriver() instanceof SiemensConveyorCkkDeviceDriver) { - SiemensConveyorCkkDeviceDriver siemensConveyorCkkDeviceDriver = (SiemensConveyorCkkDeviceDriver) device.getDeviceDriver(); - siemensConveyorCkkDeviceDriver.setDeviceStatus(form); } else if (device.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver) { StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) device.getDeviceDriver(); standardCoveyorControlWithScannerDeviceDriver.setDeviceStatus(form); - }/* else if (device.getDeviceDriver() instanceof DeviceStageMonitor) { - DeviceStageMonitor deviceStageMonitor = (DeviceStageMonitor) device.getDeviceDriver(); - deviceStageMonitor.setDeviceStatus(form); - }*/else if (device.getDeviceDriver() instanceof StandardStackerDeviceDriver) { + }else if (device.getDeviceDriver() instanceof StandardStackerDeviceDriver) { StandardStackerDeviceDriver standardStackerDeviceDriver = (StandardStackerDeviceDriver) device.getDeviceDriver(); standardStackerDeviceDriver.setDeviceStatus(form); - } else if (device.getDeviceDriver() instanceof VolumeTwoManipulatorManipulatorDeviceDriver) { - VolumeTwoManipulatorManipulatorDeviceDriver volumeTwoManipulatorManipulatorDeviceDriver = (VolumeTwoManipulatorManipulatorDeviceDriver) device.getDeviceDriver(); - volumeTwoManipulatorManipulatorDeviceDriver.setDeviceStatus(form); - }else if (device.getDeviceDriver() instanceof ConveyorWithScannerWeightDeviceDriver) { + } else if (device.getDeviceDriver() instanceof ConveyorWithScannerWeightDeviceDriver) { ConveyorWithScannerWeightDeviceDriver conveyorWithScannerWeightDeviceDriver = (ConveyorWithScannerWeightDeviceDriver) device.getDeviceDriver(); conveyorWithScannerWeightDeviceDriver.setDeviceStatus(form); }else if (device.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java index f1ffe5a..d128412 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java @@ -16,11 +16,8 @@ import org.nl.acs.device_driver.FeedLmsRealFailed; import org.nl.acs.device_driver.agv.utils.TwoAgvPhase; import org.nl.acs.device_driver.conveyor.standard_inspect_site.StandardInspectSiteDeviceDriver; import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; -import org.nl.acs.device_driver.paper_tube_pick_site.PaperTubePickSiteDeviceDriver; import org.nl.acs.device_driver.storage.standard_storage.StandardStorageDeviceDriver; import org.nl.acs.device_driver.driver.AbstractDeviceDriver; -import org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor.HongXiangStationDeviceDriver; -import org.nl.acs.device_driver.two_conveyor.manipulator_agv_station.ManipulatorAgvStationDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; import org.nl.acs.history.ErrorUtil; @@ -150,13 +147,10 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic //货架 StandardStorageDeviceDriver standardStorageDeviceDriver; //纸管抓取位 - PaperTubePickSiteDeviceDriver paperTubePickSiteDeviceDriver; //标准-光电检测 StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; //烘箱对接位 - HongXiangStationDeviceDriver hongXiangStationDeviceDriver; //行架-agv对接位 - ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver; if (phase == 0x02) { if (ObjectUtil.isEmpty(inst)) { @@ -237,49 +231,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction() , standardInspectSiteDeviceDriver.getError(), ikey); } - } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { - manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); - - try { - manipulatorAgvStationDeviceDriver.writing(2); - } catch (Exception e) { - e.printStackTrace(); - } - if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); - } - } else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { - hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); - try { - hongXiangStationDeviceDriver.writing(1); - } catch (Exception e) { - e.printStackTrace(); - } - if (hongXiangStationDeviceDriver.getMove() > 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction() - , hongXiangStationDeviceDriver.getError(), ikey); - } - } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { - paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); - try { - paperTubePickSiteDeviceDriver.writing(2); - } catch (Exception e) { - e.printStackTrace(); - } - if (paperTubePickSiteDeviceDriver.getMove() > 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() - , paperTubePickSiteDeviceDriver.getError(), ikey); - } - } else { + } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) @@ -343,49 +295,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic standardOrdinarySiteDeviceDriver.setAgvphase(phase); standardOrdinarySiteDeviceDriver.setIndex(index); standardOrdinarySiteDeviceDriver.setInst(inst); - } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { - manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); - - try { - manipulatorAgvStationDeviceDriver.writing(3); - } catch (Exception e) { - e.printStackTrace(); - } - if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); - } - } else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { - hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); - try { - hongXiangStationDeviceDriver.writing(0); - } catch (Exception e) { - e.printStackTrace(); - } - if (hongXiangStationDeviceDriver.getMove() > 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction() - , hongXiangStationDeviceDriver.getError(), ikey); - } - } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { - paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); - try { - paperTubePickSiteDeviceDriver.writing(3); - } catch (Exception e) { - e.printStackTrace(); - } - if (paperTubePickSiteDeviceDriver.getMove() == 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() - , paperTubePickSiteDeviceDriver.getError(), ikey); - } - } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { + } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); try { @@ -458,49 +368,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic standardOrdinarySiteDeviceDriver.setAgvphase(phase); standardOrdinarySiteDeviceDriver.setIndex(index); standardOrdinarySiteDeviceDriver.setInst(inst); - } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { - manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); - - try { - manipulatorAgvStationDeviceDriver.writing(2); - } catch (Exception e) { - e.printStackTrace(); - } - if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); - } - } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { - paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); - try { - paperTubePickSiteDeviceDriver.writing(2); - } catch (Exception e) { - e.printStackTrace(); - } - if (paperTubePickSiteDeviceDriver.getMove() == 1) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() - , paperTubePickSiteDeviceDriver.getError(), ikey); - } - } else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { - hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); - try { - hongXiangStationDeviceDriver.writing(1); - } catch (Exception e) { - e.printStackTrace(); - } - if (hongXiangStationDeviceDriver.getMove() > 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction() - , hongXiangStationDeviceDriver.getError(), ikey); - } - } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { + } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); try { @@ -571,48 +439,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic standardOrdinarySiteDeviceDriver.setAgvphase(phase); standardOrdinarySiteDeviceDriver.setIndex(index); standardOrdinarySiteDeviceDriver.setInst(inst); - } else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { - hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); - try { - hongXiangStationDeviceDriver.writing(0); - } catch (Exception e) { - e.printStackTrace(); - } - if (hongXiangStationDeviceDriver.getMove() == 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction() - , hongXiangStationDeviceDriver.getError(), ikey); - } - } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { - manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); - - try { - manipulatorAgvStationDeviceDriver.writing(3); - } catch (Exception e) { - e.printStackTrace(); - } - if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); - } - } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { - paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); - try { - paperTubePickSiteDeviceDriver.writing(3); - } catch (Exception e) { - e.printStackTrace(); - } - if (paperTubePickSiteDeviceDriver.getMove() == 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() - , paperTubePickSiteDeviceDriver.getError(), ikey); - } } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); @@ -705,49 +531,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic standardOrdinarySiteDeviceDriver.setIndex(index); standardOrdinarySiteDeviceDriver.setInst(inst); - } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { - paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); - try { - paperTubePickSiteDeviceDriver.writing(4); - } catch (Exception e) { - e.printStackTrace(); - } - if (paperTubePickSiteDeviceDriver.getMove() == 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() - , paperTubePickSiteDeviceDriver.getError(), ikey); - } - } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { - manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); - - try { - manipulatorAgvStationDeviceDriver.writing(4); - } catch (Exception e) { - e.printStackTrace(); - } - if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); - } - } else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { - hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); - try { - hongXiangStationDeviceDriver.writing(1); - } catch (Exception e) { - e.printStackTrace(); - } - if (hongXiangStationDeviceDriver.getMove() == 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction() - , hongXiangStationDeviceDriver.getError(), ikey); - } - } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { + } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); standardInspectSiteDeviceDriver.writing(1); if ((standardInspectSiteDeviceDriver.getMove() == 0 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) { @@ -819,48 +603,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic standardOrdinarySiteDeviceDriver.setAgvphase(phase); standardOrdinarySiteDeviceDriver.setIndex(index); standardOrdinarySiteDeviceDriver.setInst(inst); - } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { - manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); - - try { - manipulatorAgvStationDeviceDriver.writing(5); - } catch (Exception e) { - e.printStackTrace(); - } - if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); - } - } else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { - hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); - try { - hongXiangStationDeviceDriver.writing(0); - } catch (Exception e) { - e.printStackTrace(); - } - if (hongXiangStationDeviceDriver.getMove() > 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction() - , hongXiangStationDeviceDriver.getError(), ikey); - } - } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { - paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); - try { - paperTubePickSiteDeviceDriver.writing(5); - } catch (Exception e) { - e.printStackTrace(); - } - if (paperTubePickSiteDeviceDriver.getMove() > 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() - , paperTubePickSiteDeviceDriver.getError(), ikey); - } } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); standardInspectSiteDeviceDriver.writing(0); @@ -932,48 +674,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic standardOrdinarySiteDeviceDriver.setIndex(index); standardOrdinarySiteDeviceDriver.setInst(inst); - } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { - manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); - - try { - manipulatorAgvStationDeviceDriver.writing(4); - } catch (Exception e) { - e.printStackTrace(); - } - if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); - } - } else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { - hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); - try { - hongXiangStationDeviceDriver.writing(1); - } catch (Exception e) { - e.printStackTrace(); - } - if (hongXiangStationDeviceDriver.getMove() == 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction() - , hongXiangStationDeviceDriver.getError(), ikey); - } - } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { - paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); - try { - paperTubePickSiteDeviceDriver.writing(4); - } catch (Exception e) { - e.printStackTrace(); - } - if (paperTubePickSiteDeviceDriver.getMove() == 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() - , paperTubePickSiteDeviceDriver.getError(), ikey); - } } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } @@ -1040,48 +740,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic standardOrdinarySiteDeviceDriver.setIndex(index); standardOrdinarySiteDeviceDriver.setInst(inst); - } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { - manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); - - try { - manipulatorAgvStationDeviceDriver.writing(5); - } catch (Exception e) { - e.printStackTrace(); - } - if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); - } - } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { - paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); - try { - paperTubePickSiteDeviceDriver.writing(5); - } catch (Exception e) { - e.printStackTrace(); - } - if (paperTubePickSiteDeviceDriver.getMove() > 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() - , paperTubePickSiteDeviceDriver.getError(), ikey); - } - } else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { - hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); - try { - hongXiangStationDeviceDriver.writing(0); - } catch (Exception e) { - e.printStackTrace(); - } - if (hongXiangStationDeviceDriver.getMove() > 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction() - , hongXiangStationDeviceDriver.getError(), ikey); - } } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java index 13b11b1..4952f73 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java @@ -48,59 +48,9 @@ public class WmsToAcsController { return new ResponseEntity<>(wmstoacsService.cancelFromWms(reqs), HttpStatus.OK); } - @PostMapping("/updateDeviceGoodsFromWms") - @Log(value = "WMS修改点位状态") - public ResponseEntity updateDeviceGoodsFromWms(@RequestBody String whereJson) { - return new ResponseEntity<>(wmstoacsService.updateDeviceGoodsFromWms(whereJson), HttpStatus.OK); - } - - @PostMapping("/areaControl") - @Log(value = "区域控制") - public ResponseEntity areaControl(@RequestBody JSONObject whereJson) { - return new ResponseEntity<>(wmstoacsService.areaControl(whereJson), HttpStatus.OK); - } - - @PostMapping("/action") - @Log(value = "WMS下发点位信号") - @SaIgnore - public ResponseEntity putAction(@RequestBody String whereJson) throws Exception { - return new ResponseEntity<>(wmstoacsService.putAction(whereJson), HttpStatus.OK); - } - - @PostMapping("/querydevice") - @Log(value = "WMS查询设备状态") - @SaIgnore - public ResponseEntity queryDevice(@RequestBody String whereJson) throws Exception { - return new ResponseEntity<>(wmstoacsService.queryDevice(whereJson), HttpStatus.OK); - } - @PostMapping("/queryDeviceDBValue") - @Log(value = "WMS查询设备DB值") - @SaIgnore - public ResponseEntity queryDeviceDBValue(@RequestBody String whereJson) { - return new ResponseEntity<>(wmstoacsService.queryDeviceDBValue(whereJson), HttpStatus.OK); - } - @PostMapping("/putPlusPullAction") - @Log(value = "WMS下发插拔轴动作") - @SaIgnore - public ResponseEntity putPlusPullAction(@RequestBody String whereJson) { - return new ResponseEntity<>(wmstoacsService.putPlusPullAction(whereJson), HttpStatus.OK); - } - @PostMapping("/notify") - @Log("wms下发任务动作") - @SaIgnore - public ResponseEntity notify(@RequestBody JSONObject param) { - return new ResponseEntity<>(wmstoacsService.notifyAcs(param), HttpStatus.OK); - } - - @PostMapping("/getWeight") - @Log("wms下发废箔重量") - @SaIgnore - public ResponseEntity getWeight(@RequestBody String whereJson) throws Exception { - return new ResponseEntity<>(wmstoacsService.putWeightAction(whereJson), HttpStatus.OK); - } } diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java index ec27c8d..9009333 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java @@ -34,79 +34,10 @@ public interface WmsToAcsService { */ CancelTaskResponse cancelFromWms(List reqs) throws Exception; - /** - * 修改设置有无货属性 - * - * @param jsonObject 条件 - * @return Map - */ - Map updateDeviceGoodsFromWms(String jsonObject); - /** - * 区域控制 - * - * @param jsonObject 条件 - * @return Map - */ - Map areaControl(JSONObject jsonObject); - /** - * 下发动作 - * @param jsonObject - * @return - * @throws Exception - */ - org.nl.acs.ext.wms.data.PutActionResponse putAction(String jsonObject) throws Exception; - /** - * 查询设备状态 - * - * @param jsonObject 条件 - * @return Map - */ - Map queryDevice(String jsonObject) throws Exception; - /** - * 查询设备DB值 - * - * @param whereJson - * @return - */ - Map queryDeviceDBValue(String whereJson); - /** - * ACS系统在获取空的托盘号 - * - * @param whereJson - * @return - */ - Map querydevice(String whereJson); - - - /** - * 下发插拔轴动作 - * - * @param whereJson 条件 - * @return Map - */ - Map putPlusPullAction(String whereJson); - - - /** - * 下发wms任务动作 - * - * @param param 条件 - * @return Map - */ - JSONObject notifyAcs(JSONObject param); - - /** - * 下发废箔称重动作 - * - * @param jsonObject - * @return - */ - Map putWeightAction(String jsonObject) throws Exception; - } diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java index a387ec0..fadffb8 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java @@ -7,48 +7,26 @@ import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; -import lombok.Builder; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.nl.acs.AcsConfig; import org.nl.acs.device.domain.Device; import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver; -import org.nl.acs.device_driver.one_manipulator.box_package_manipulator.BoxPackageManipulatorDeviceDriver; -import org.nl.acs.device_driver.conveyor.box_palletizing_manipulator.BoxPalletizingManipulatorDeviceDriver; -import org.nl.acs.device_driver.paper_tube_device2.PaperTubeConveyor2DeviceDriver; -import org.nl.acs.device_driver.two_conveyor.blank_manipulator.BlankManipulatorDeviceDriver; -import org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor.HongXiangStationDeviceDriver; -import org.nl.acs.device_driver.two_conveyor.inflatable_shaft_library.InflatableShaftLibraryDeviceDriver; -import org.nl.acs.device_driver.two_conveyor.lamp_three_color.LampThreecolorDeviceDriver; -import org.nl.acs.device_driver.two_conveyor.oven_manipulator.OvenGantryManipulatorDeviceDriver; -import org.nl.acs.device_driver.two_conveyor.plug_pull_device_site.PlugPullDeviceSiteDeviceDriver; -import org.nl.acs.device_driver.two_conveyor.subvolume_weighing_station.SubvolumeWeighingStationDriver; -import org.nl.acs.device_driver.two_conveyor.waste_foil_weighing_station.WasteFoilWeighingStationDriver; import org.nl.acs.ext.wms.data.*; -import org.nl.acs.ext.wms.liKuData.Resp; import org.nl.acs.ext.wms.service.AcsToLiKuService; import org.nl.acs.ext.wms.service.WmsToAcsService; -import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.storage_cell.domain.StorageCell; import org.nl.acs.storage_cell.service.mapper.StorageCellMapper; import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; -import org.nl.common.enums.LogTypeEnum; -import org.nl.common.exception.BadRequestException; import org.nl.config.SpringContextHolder; import org.nl.config.lucene.service.LuceneExecuteLogService; -import org.nl.config.lucene.service.dto.LuceneLogDto; -import org.nl.config.lucene.service.impl.LuceneExecuteLogServiceImpl; import org.nl.system.service.param.ISysParamService; import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; import java.util.List; @@ -394,1257 +372,4 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { return null; } - @Override - public Map updateDeviceGoodsFromWms(String jsonObject) { - return null; - } - - @Override - public Map areaControl(JSONObject jsonObject) { - return null; - } - - @Override - public PutActionResponse putAction(String jsonObject) throws Exception { - try { - MDC.put(log_file_type, log_type); - log.info("putAction--------------:输入参数" + jsonObject); - JSONArray datas = JSONArray.parseArray(jsonObject); - PutActionResponse response = new PutActionResponse(); - JSONArray errArr = new JSONArray(); - for (int i = 0; i < datas.size(); i++) { - String data = datas.get(i).toString(); - PutActionRequest request = JsonUtl.format(data, PutActionRequest.class); - String device_code = request.getDevice_code(); - String code = request.getCode(); - String value = request.getValue(); - Device device = deviceAppService.findDeviceByCode(device_code); - if (ObjectUtil.isEmpty(device)) { - throw new Exception("未找到对应设备:" + device_code); - } - InflatableShaftLibraryDeviceDriver inflatableShaftLibraryDeviceDriver; - HongXiangStationDeviceDriver hongXiangStationDeviceDriver; - LampThreecolorDeviceDriver lampThreecolorDeviceDriver; - SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; - WasteFoilWeighingStationDriver wasteFoilWeighingStationDriver; - if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { - hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); - hongXiangStationDeviceDriver.writing(code, value); - } - if (device.getDeviceDriver() instanceof LampThreecolorDeviceDriver) { - lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) device.getDeviceDriver(); - lampThreecolorDeviceDriver.writing(code, value); - } - if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { - siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver(); - siemensConveyorDeviceDriver.writing(code, value); - } - if (device.getDeviceDriver() instanceof InflatableShaftLibraryDeviceDriver) { - inflatableShaftLibraryDeviceDriver = (InflatableShaftLibraryDeviceDriver) device.getDeviceDriver(); - inflatableShaftLibraryDeviceDriver.writing(code, value); - } - if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) { - wasteFoilWeighingStationDriver = (WasteFoilWeighingStationDriver) device.getDeviceDriver(); - wasteFoilWeighingStationDriver.writing(code, value); - try { - Thread.sleep(1000); //休眠1秒 - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - } - response.setStatus(200); - response.setMessage("success"); - LuceneLogDto luceneLogDto = new LuceneLogDto("putAction", String.valueOf(response.getCode()), - jsonObject, String.valueOf(response), "LMS下发动作"); - luceneExecuteLogService.interfaceExecuteLog(luceneLogDto); - log.info("putAction--------------:输出参数:" + response); - return response; - } finally { - MDC.remove(log_file_type); - } - } - - @Override - public Map putWeightAction(String jsonObject) throws Exception { - try { - MDC.put(log_file_type, log_type); - log.info("putWeightAction--------------:输入参数" + jsonObject); - JSONArray datas = JSONArray.parseArray(jsonObject); - JSONObject jo = new JSONObject(); - for (int i = 0; i < datas.size(); i++) { - JSONObject data = (JSONObject) datas.get(i); - String device_code = data.getString("device_code"); - String type = data.getString("type"); - Device device = deviceAppService.findDeviceByCode(device_code); - if (ObjectUtil.isEmpty(device)) { - throw new Exception("未找到对应设备:" + device_code); - } - WasteFoilWeighingStationDriver wasteFoilWeighingStationDriver; - if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) { - wasteFoilWeighingStationDriver = (WasteFoilWeighingStationDriver) device.getDeviceDriver(); - try { - //称重完成 - if (StrUtil.equals("1", type)) { - Thread.sleep(1000); //休眠1秒 - if (wasteFoilWeighingStationDriver.getMode() == 6) { - jo.put("currentWeight", wasteFoilWeighingStationDriver.getWeight());//当前重量 - jo.put("lastWeight", wasteFoilWeighingStationDriver.getGap_weight());//上一次重量 - jo.put("weightGap", wasteFoilWeighingStationDriver.getOld_weight());//重量差 - wasteFoilWeighingStationDriver.writing("to_command", "6"); - } - } - //称重确认信号 - else if (StrUtil.equals("2", type)) { - Thread.sleep(1000); //休眠1秒 - if (wasteFoilWeighingStationDriver.getMode() == 7) { - wasteFoilWeighingStationDriver.writing("to_command", "8"); - } - } - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - } - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK.value()); - resultJson.put("message", "操作成功"); - resultJson.put("data", jo); - log.info("putWeightAction--------------:输出参数" + resultJson.toString()); - return resultJson; - } finally { - MDC.remove(log_file_type); - } - } - - @Override - public Map queryDevice(String jsonObject) throws Exception { - try { - MDC.put(log_file_type, log_type); - JSONArray backja = new JSONArray(); - JSONArray datas = JSONArray.parseArray(jsonObject); - //表处下料行架机械手 - BlankManipulatorDeviceDriver blankManipulatorDeviceDriver; - //烘箱行架机械手 - OvenGantryManipulatorDeviceDriver ovenGantryManipulatorDeviceDriver; - //装箱行架机械手 - BoxPackageManipulatorDeviceDriver boxManipulatorDeviceDriver; - //木箱码垛机械手 - BoxPalletizingManipulatorDeviceDriver boxPalletizingManipulatorDeviceDriver; - //纸管库2 - PaperTubeConveyor2DeviceDriver paperTubeConveyor2DeviceDriver; - //废箔称重位 - WasteFoilWeighingStationDriver wasteFoilWeighingStationDriver; - //子卷称重位 - SubvolumeWeighingStationDriver subvolumeWeighingStationDriver; - - PlugPullDeviceSiteDeviceDriver plugPullDeviceSiteDeviceDriver; - if (datas.size() == 0) { - throw new BadRequestException("缺少输入参数!"); - } - for (int i = 0; i < datas.size(); i++) { - JSONObject jo = new JSONObject(); - JSONObject data = datas.getJSONObject(i); - String parent_device_code = data.getString("device_code"); - String device_code = ""; - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(StringUtils.isNotBlank(parent_device_code), StorageCell::getParent_storage_code, parent_device_code); - StorageCell storageCell = storageCellMapper.selectOne(wrapper); - final JSONObject device_json = (JSONObject) JSON.toJSON(storageCell); - if (!ObjectUtil.isEmpty(device_json)) { - device_code = device_json.get("parent_storage_code") == null ? parent_device_code : (String) device_json.get("storage_code"); - } else { - device_code = parent_device_code; - } - Device device = deviceAppService.findDeviceByCode(device_code); - if (ObjectUtil.isEmpty(device)) { - throw new Exception("未找到对应设备:" + parent_device_code); - } - if (device.getDeviceDriver() instanceof BlankManipulatorDeviceDriver) { - blankManipulatorDeviceDriver = (BlankManipulatorDeviceDriver) device.getDeviceDriver(); - jo.put("device_code", blankManipulatorDeviceDriver.getDevice().getDevice_code()); - jo.put("device_name", blankManipulatorDeviceDriver.getDevice().getDevice_name()); - jo.put("status", Math.min(3, blankManipulatorDeviceDriver.getMode())); - jo.put("move", Math.min(3, blankManipulatorDeviceDriver.getMove())); - jo.put("action", Math.min(3, blankManipulatorDeviceDriver.getAction())); - jo.put("task", Math.min(3, blankManipulatorDeviceDriver.getTask())); - jo.put("error", blankManipulatorDeviceDriver.getError()); - } else if (device.getDeviceDriver() instanceof OvenGantryManipulatorDeviceDriver) { - ovenGantryManipulatorDeviceDriver = (OvenGantryManipulatorDeviceDriver) device.getDeviceDriver(); - jo.put("device_code", ovenGantryManipulatorDeviceDriver.getDevice().getDevice_code()); - jo.put("device_name", ovenGantryManipulatorDeviceDriver.getDevice().getDevice_name()); - jo.put("status", Math.min(3, ovenGantryManipulatorDeviceDriver.getMode())); - jo.put("x", ovenGantryManipulatorDeviceDriver.getX_position()); - jo.put("y", ovenGantryManipulatorDeviceDriver.getY_position()); - jo.put("mode", ovenGantryManipulatorDeviceDriver.getMode()); - jo.put("move", ovenGantryManipulatorDeviceDriver.getMove()); - jo.put("action", ovenGantryManipulatorDeviceDriver.getAction()); - jo.put("walk_y", ovenGantryManipulatorDeviceDriver.getWalk_y()); - jo.put("task", ovenGantryManipulatorDeviceDriver.getTask()); - jo.put("error", ovenGantryManipulatorDeviceDriver.getError()); - } else if (device.getDeviceDriver() instanceof BoxPackageManipulatorDeviceDriver) { - boxManipulatorDeviceDriver = (BoxPackageManipulatorDeviceDriver) device.getDeviceDriver(); - jo.put("device_code", boxManipulatorDeviceDriver.getDevice().getDevice_code()); - jo.put("device_name", boxManipulatorDeviceDriver.getDevice().getDevice_name()); - jo.put("status", Math.min(3, boxManipulatorDeviceDriver.getMode())); - jo.put("x", boxManipulatorDeviceDriver.getX_position()); - jo.put("y", boxManipulatorDeviceDriver.getY_position()); - jo.put("mode", boxManipulatorDeviceDriver.getMode()); - jo.put("move", boxManipulatorDeviceDriver.getMove()); - jo.put("action", boxManipulatorDeviceDriver.getAction()); - jo.put("walk_y", boxManipulatorDeviceDriver.getWalk_y()); - jo.put("task", boxManipulatorDeviceDriver.getTask()); - jo.put("error", boxManipulatorDeviceDriver.getError()); - } else if (device.getDeviceDriver() instanceof BoxPalletizingManipulatorDeviceDriver) { - boxPalletizingManipulatorDeviceDriver = (BoxPalletizingManipulatorDeviceDriver) device.getDeviceDriver(); - jo.put("device_code", boxPalletizingManipulatorDeviceDriver.getDevice().getDevice_code()); - jo.put("device_name", boxPalletizingManipulatorDeviceDriver.getDevice().getDevice_name()); - jo.put("status", Math.min(3, boxPalletizingManipulatorDeviceDriver.getMode())); - jo.put("x", boxPalletizingManipulatorDeviceDriver.getX_position()); - jo.put("y", boxPalletizingManipulatorDeviceDriver.getY_position()); - jo.put("mode", boxPalletizingManipulatorDeviceDriver.getMode()); - jo.put("move", boxPalletizingManipulatorDeviceDriver.getMove()); - jo.put("action", boxPalletizingManipulatorDeviceDriver.getAction()); - jo.put("walk_y", boxPalletizingManipulatorDeviceDriver.getWalk_y()); - jo.put("task", boxPalletizingManipulatorDeviceDriver.getTask()); - jo.put("error", boxPalletizingManipulatorDeviceDriver.getError()); - } else if (device.getDeviceDriver() instanceof PaperTubeConveyor2DeviceDriver) { - paperTubeConveyor2DeviceDriver = (PaperTubeConveyor2DeviceDriver) device.getDeviceDriver(); - jo.put("device_code", parent_device_code); - jo.put("heartbeat", paperTubeConveyor2DeviceDriver.getHeartbeat()); - jo.put("mode", paperTubeConveyor2DeviceDriver.getMode()); - jo.put("move", paperTubeConveyor2DeviceDriver.getMove()); - jo.put("carrier_direction", paperTubeConveyor2DeviceDriver.getCarrier_direction()); - jo.put("error", paperTubeConveyor2DeviceDriver.getError()); - jo.put("task", paperTubeConveyor2DeviceDriver.getTask()); - jo.put("out_seq_arr", paperTubeConveyor2DeviceDriver.getItem_out_seq_arr()); - jo.put("out_qty_arr", paperTubeConveyor2DeviceDriver.getItem_out_qty_arr()); - jo.put("material1", paperTubeConveyor2DeviceDriver.getItem_material1()); - jo.put("qty1", paperTubeConveyor2DeviceDriver.getItem_qty1()); - jo.put("material2", paperTubeConveyor2DeviceDriver.getItem_material2()); - jo.put("qty2", paperTubeConveyor2DeviceDriver.getItem_qty2()); - jo.put("material3", paperTubeConveyor2DeviceDriver.getItem_material3()); - jo.put("qty3", paperTubeConveyor2DeviceDriver.getItem_qty3()); - jo.put("material4", paperTubeConveyor2DeviceDriver.getItem_material4()); - jo.put("qty4", paperTubeConveyor2DeviceDriver.getItem_qty4()); - jo.put("material5", paperTubeConveyor2DeviceDriver.getItem_material5()); - jo.put("qty5", paperTubeConveyor2DeviceDriver.getItem_qty5()); - jo.put("material6", paperTubeConveyor2DeviceDriver.getItem_material6()); - jo.put("qty6", paperTubeConveyor2DeviceDriver.getItem_qty6()); - jo.put("material7", paperTubeConveyor2DeviceDriver.getItem_material7()); - jo.put("qty7", paperTubeConveyor2DeviceDriver.getItem_qty7()); - jo.put("material8", paperTubeConveyor2DeviceDriver.getItem_material8()); - jo.put("qty8", paperTubeConveyor2DeviceDriver.getItem_qty8()); - jo.put("material9", paperTubeConveyor2DeviceDriver.getItem_material9()); - jo.put("qty9", paperTubeConveyor2DeviceDriver.getItem_qty9()); - jo.put("material10", paperTubeConveyor2DeviceDriver.getItem_material10()); - jo.put("qty10", paperTubeConveyor2DeviceDriver.getItem_qty10()); - jo.put("material11", paperTubeConveyor2DeviceDriver.getItem_material11()); - jo.put("qty11", paperTubeConveyor2DeviceDriver.getItem_qty11()); - jo.put("material12", paperTubeConveyor2DeviceDriver.getItem_material12()); - jo.put("qty12", paperTubeConveyor2DeviceDriver.getItem_qty12()); - - } else if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) { - wasteFoilWeighingStationDriver = (WasteFoilWeighingStationDriver) device.getDeviceDriver(); - jo.put("device_code", parent_device_code); - jo.put("move", wasteFoilWeighingStationDriver.getMove()); - jo.put("mode", wasteFoilWeighingStationDriver.getMode()); - jo.put("action", wasteFoilWeighingStationDriver.getAction()); - jo.put("weight", wasteFoilWeighingStationDriver.getWeight()); - jo.put("old_weight", wasteFoilWeighingStationDriver.getOld_weight()); - jo.put("error", wasteFoilWeighingStationDriver.getError()); - } else if (device.getDeviceDriver() instanceof SubvolumeWeighingStationDriver) { - subvolumeWeighingStationDriver = (SubvolumeWeighingStationDriver) device.getDeviceDriver(); - jo.put("device_code", parent_device_code); - jo.put("move", subvolumeWeighingStationDriver.getMove()); - jo.put("mode", subvolumeWeighingStationDriver.getMode()); - jo.put("action", subvolumeWeighingStationDriver.getAction()); - jo.put("weight", subvolumeWeighingStationDriver.getWeight()); - jo.put("error", subvolumeWeighingStationDriver.getError()); - } else { - jo.put("device_code", parent_device_code); - } - backja.add(jo); - } - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK.value()); - resultJson.put("message", "操作成功"); - resultJson.put("data", backja); - LuceneLogDto luceneLogDto = new LuceneLogDto("queryDevice", String.valueOf(resultJson.get("status")), - jsonObject, String.valueOf(resultJson), "LMS查询设备状态"); - luceneExecuteLogService.interfaceExecuteLog(luceneLogDto); - return resultJson; - } finally { - MDC.remove(log_file_type); - } - } - - @Override - public Map queryDeviceDBValue(String whereJson) { - return null; - } - - @Override - public Map querydevice(String whereJson) { - return null; - } - - @Override - public Map putPlusPullAction(String whereJson) { - return null; - } - - @Override - public JSONObject notifyAcs(JSONObject param) { - return null; - } -/** - private final ApplicationContext applicationContext; - - private final InstructionService instructionService; - private final TaskService taskService; - private final DeviceService deviceService; - private final DeviceAppService deviceAppService; - private final RouteLineService routeLineService; - private final AcsToLiKuService acsToLiKuService; - private final DictDetailService dictDetailService; - private final DictService dictService; - - - private String log_file_type = "log_file_type"; - private String log_type = "LMS请求ACS"; - - @Override public CancelTaskResponse cancelFromWms(String param) throws Exception { - ParamService paramService = SpringContextHolder.getBean(ParamService.class); - InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); - JSONArray datas = JSONArray.parseArray(param); - CancelTaskResponse response = new CancelTaskResponse(); - JSONArray errArr = new JSONArray(); - for (int i = 0; i < datas.size(); i++) { - String data = datas.get(i).toString(); - CancelTaskRequest request = JsonUtl.format(param, CancelTaskRequest.class); - - String task_uuid = request.getExt_task_id(); - String task_code = request.getTask_code(); - String vehicle_code = request.getVehicle_code(); - - if (StrUtil.isEmpty(task_uuid)) { - throw new WDKException("任务标识不能为空"); - } - if (StrUtil.isEmpty(task_code)) { - throw new WDKException("任务号不能为空"); - } - String cancelTaskCheck = paramService.findByCode(AcsConfig.CANCELTASKCHECK).getValue(); - if (StrUtil.equals(cancelTaskCheck, CommonFinalParam.ONE)) { - taskService.cancel(task_uuid); - } else if (StrUtil.equals(cancelTaskCheck, "0")) { - Instruction inst = instructionService.findByTaskcode(task_code); - if (inst == null) { - taskService.cancel(task_uuid); - } else { - throw new RuntimeException("指令正在执行中,操作失败!"); - } - } - - } - - if (ObjectUtil.isEmpty(errArr)) { - response.setStatus(200); - } else { - response.setStatus(400); - } - response.setMessage("success"); - response.setErrArr(errArr); - log.info("cancelFromWms--------------:输出参数:" + response); - - return response; - } - - @Override public Map updateDeviceGoodsFromWms(String param) { - JSONArray datas = JSONArray.parseArray(param); - log.info("updateDeviceGoodsFromWms--------------:输入参数" + datas.toString()); - for (int i = 0; i < datas.size(); i++) { - JSONObject data = datas.getJSONObject(i); - String device_code = data.getString("point_code"); - String has_goods = data.getString("has_goods"); - - JSONObject jo = new JSONObject(); - jo.put("device_code", device_code); - jo.put("hasGoodStatus", has_goods); - deviceService.changeDeviceStatus(jo); - - } - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK); - resultJson.put("message", "操作成功"); - resultJson.put("data", new JSONObject()); - log.info("updateDeviceGoodsFromWms--------------:输出参数" + resultJson.toString()); - return resultJson; - } - - @Override public Map areaControl(JSONObject form) { - String device_code = form.getString("device_code"); - String type = form.getString("type"); - - Device device = deviceAppService.findDeviceByCode(device_code); - - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK); - resultJson.put("message", "操作成功"); - resultJson.put("data", new JSONObject()); - log.info("updateDeviceGoodsFromWms--------------:输出参数" + resultJson.toString()); - return resultJson; - } - - @Override public PutActionResponse putAction(String jsonObject) throws Exception { - try { - MDC.put(log_file_type, log_type); - log.info("putAction--------------:输出参数" + jsonObject); - JSONArray datas = JSONArray.parseArray(jsonObject); - PutActionResponse response = new PutActionResponse(); - JSONArray errArr = new JSONArray(); - for (int i = 0; i < datas.size(); i++) { - String data = datas.get(i).toString(); - PutActionRequest request = JsonUtl.format(data, PutActionRequest.class); - String device_code = request.getDevice_code(); - String code = request.getCode(); - String value = request.getValue(); - Device device = deviceAppService.findDeviceByCode(device_code); - if (ObjectUtil.isEmpty(device)) { - throw new Exception("未找到对应设备:" + device_code); - } - HongXiangStationDeviceDriver hongXiangStationDeviceDriver; - LampThreecolorDeviceDriver lampThreecolorDeviceDriver; - if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { - hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); - hongXiangStationDeviceDriver.writing(code, value); - } - if (device.getDeviceDriver() instanceof LampThreecolorDeviceDriver) { - lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) device.getDeviceDriver(); - lampThreecolorDeviceDriver.writing(code, value); - } - - - } - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK.value()); - resultJson.put("message", "操作成功"); - resultJson.put("data", backja); - // log.info("queryDevice--------------:输出参数" + resultJson.toString()); - return resultJson; - - } finally { - MDC.remove(log_file_type); - } - - - } - - - @Override public Map queryDeviceDBValue(String whereJson) { - JSONArray datas = JSONArray.parseArray(whereJson); - log.info("orderStatusUpdate--------------:输入参数" + datas.toString()); - JSONObject map = new JSONObject(); - if (datas.size() > 0) { - for (int i = 0; i < datas.size(); i++) { - JSONObject jsonObject = datas.getJSONObject(i); - String device_code = jsonObject.getString("device_code"); - String dbName = jsonObject.getString("DB"); - Device device = deviceAppService.findDeviceByCode(device_code); - List extra = device.getExtra(); - for (int j = 0; j < extra.size(); j++) { - DeviceExtraManageDto deviceExtraManageDto = extra.get(j); - String deviceCode = deviceExtraManageDto.getDevice_code(); - String extra_name = deviceExtraManageDto.getExtra_name(); - if (deviceCode.equals(device_code) && extra_name.equals(dbName)) { - String extra_code = deviceExtraManageDto.getExtra_code(); - String[] split = extra_code.split("\\."); - extra_code = split[split.length - 1]; - extra_code = extra_code.substring(0, 1).toUpperCase() + extra_code.substring(1); - IDriverService driverService = applicationContext.getBean(device.getDeviceDriverDefination().getDriverCode(), IDriverService.class); - Integer dbValue = driverService.getDbValue(device, extra_code); - map.put(dbName, dbValue); - break; - } - } - } - } - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK); - resultJson.put("message", "操作成功"); - resultJson.put("data", map); - return resultJson; - } - - @Override public Map querydevice(String whereJson) { - return null; - } - - - @Override public Map putPlusPullAction(String param) { - try { - MDC.put(log_file_type, log_type); - log.info("putPlusPullAction-----输入参数{}", param); - JSONObject jo = JSON.parseObject(param); - String device_code = jo.getString("device_code"); - String size = jo.getString("size"); - String type = jo.getString("type"); - Device device = deviceAppService.findDeviceByCode(device_code); - if (ObjectUtil.isEmpty(device)) { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "未找到对应的设备:" + device_code); - return resultJson; - } - PlugPullDeviceSiteDeviceDriver plugPullDeviceSiteDeviceDriver; - if (device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { - plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) device.getDeviceDriver(); - // 0 穿轴 1拔轴 - if (StrUtil.equals(type, CommonFinalParam.ONE)) { - - if (plugPullDeviceSiteDeviceDriver.getMode() == 1) { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "请求拔轴,当前设备工作模式未自动"); - return resultJson; - } - if (plugPullDeviceSiteDeviceDriver.getAction() == 0) { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "请求拔轴,当前设备未全自动"); - return resultJson; - } - if (plugPullDeviceSiteDeviceDriver.getStatus() != 0) { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "请求拔轴,当前设备未待机"); - return resultJson; - } - if (plugPullDeviceSiteDeviceDriver.getControl() != 0) { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "请求拔轴,当前设备未远程控制"); - return resultJson; - } - if (plugPullDeviceSiteDeviceDriver.getMove() != 0) { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "请求拔轴,当前设备有轴"); - return resultJson; - } - if (plugPullDeviceSiteDeviceDriver.getMode() == 0 && plugPullDeviceSiteDeviceDriver.getAction() == 1 - && plugPullDeviceSiteDeviceDriver.getStatus() == 0 && plugPullDeviceSiteDeviceDriver.getMove() == 0 - && plugPullDeviceSiteDeviceDriver.getControl() == 0) { - - List list = new ArrayList(); - Map map = new HashMap(); - map.put("code", "to_size"); - map.put("value", size); - list.add(map); - Map map2 = new HashMap(); - map2.put("code", "to_type"); - map2.put("value", type); - list.add(map2); - Map map3 = new HashMap(); - map3.put("code", "to_command"); - map3.put("value", "1"); - list.add(map3); - plugPullDeviceSiteDeviceDriver.writing(list); - - } else { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "当前设备状态不满足下发条件"); - return resultJson; - } - - } else if (StrUtil.equals(type, "0")) { - - if (plugPullDeviceSiteDeviceDriver.getMode() == 1) { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "请求插轴,当前设备工作模式未自动"); - return resultJson; - } - if (plugPullDeviceSiteDeviceDriver.getAction() == 0) { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "请求插轴,当前设备未全自动"); - return resultJson; - } - if (plugPullDeviceSiteDeviceDriver.getStatus() != 0) { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "请求插轴,当前设备未待机"); - return resultJson; - } - if (plugPullDeviceSiteDeviceDriver.getControl() != 0) { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "请求插轴,当前设备未远程控制"); - return resultJson; - } - if (plugPullDeviceSiteDeviceDriver.getMove() != 1) { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "请求插轴,当前设备没有轴"); - return resultJson; - } - - if (plugPullDeviceSiteDeviceDriver.getMode() == 0 && plugPullDeviceSiteDeviceDriver.getAction() == 1 - && plugPullDeviceSiteDeviceDriver.getStatus() == 0 && plugPullDeviceSiteDeviceDriver.getMove() == 1 - && plugPullDeviceSiteDeviceDriver.getControl() == 0) { - - List list = new ArrayList(); - Map map = new HashMap(); - map.put("code", "to_size"); - map.put("value", size); - list.add(map); - Map map2 = new HashMap(); - map2.put("code", "to_type"); - map2.put("value", type); - list.add(map2); - Map map3 = new HashMap(); - map3.put("code", "to_command"); - map3.put("value", CommonFinalParam.ONE); - list.add(map3); - plugPullDeviceSiteDeviceDriver.writing(list); - - } else { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "当前设备状态不满足下发条件"); - return resultJson; - } - } - } - - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK.value()); - resultJson.put("message", "操作成功"); - log.info("putPlusPullAction--------------:输出参数" + resultJson.toString()); - return resultJson; - - } finally { - MDC.remove(log_file_type); - } - } - - - @Override public CreateTaskResponse crateTask(String param) { - try { - MDC.put(log_file_type, log_type); - log.info("crateTask-----输入参数{}", param); - JSONArray datas = JSONArray.parseArray(param); - CreateTaskResponse response = new CreateTaskResponse(); - ParamService paramService = SpringContextHolder.getBean(ParamService.class); - String cancelTaskCheck = paramService.findByCode(AcsConfig.ISALLOWTASK).getValue(); - JSONArray errArr = new JSONArray(); - if (StrUtil.equals(cancelTaskCheck, "0")) { - response.setStatus(400); - response.setMessage("ACS系统需要更新,请稍等"); - response.setErrArr(datas); - return response; - } - for (int i = 0; i < datas.size(); i++) { - String data = datas.get(i).toString(); - CreateTaskRequest request = JsonUtl.format(data, CreateTaskRequest.class); - String paper_array = request.getPaper_array(); - String ext_task_id = request.getExt_task_id(); - String task_code = request.getTask_code(); - String start_device_code = request.getStart_device_code(); - String start_device_code2 = request.getStart_device_code2(); - String next_device_code = request.getNext_device_code(); - String next_device_code2 = request.getNext_device_code2(); - String put_device_code = request.getPut_device_code(); - String priority = request.getPriority(); - String vehicle_code = request.getVehicle_code(); - String vehicle_type = request.getVehicle_type(); - String route_plan_code = request.getRoute_plan_code(); - String task_type = request.getTask_type(); - String truss_type = request.getTruss_type(); - String is_bushing = request.getIs_bushing(); - String version = request.getVersion(); - String bushing_num = request.getBushing_num(); - String storage_task_type = request.getDtl_type(); - String agv_system_type = request.getAgv_system_type(); - String remark = request.getRemark(); - double oven_time = 0.00d; - if (StrUtil.isNotEmpty(request.getOven_time())) { - oven_time = Double.parseDouble(request.getOven_time()); - } - String temperature = request.getTemperature(); - String start_height = request.getStart_height(); - String next_height = request.getNext_height(); - Map params = request.getParams(); - - String start_point_code = ""; - String start_point_code2 = ""; - String next_point_code = ""; - String next_point_code2 = ""; - String put_point_code = ""; - if (StrUtil.isEmpty(task_code)) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", "任务号不能为空"); - errArr.add(json); - continue; - } - if (StrUtil.isEmpty(start_device_code)) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", "起点不能为空"); - errArr.add(json); - continue; - } - if (StrUtil.isEmpty(next_device_code)) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", "终点不能为空"); - errArr.add(json); - continue; - } - - if (StrUtil.equals(task_type, "8")) { - next_device_code = request.getPut_device_code(); - put_device_code = request.getNext_device_code(); - } - - JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_device_code + "'").uniqueResult(0); - if (!ObjectUtil.isEmpty(start_device_json)) { - start_point_code = (String) start_device_json.get("parent_storage_code") == null ? start_device_code : (String) start_device_json.get("storage_code"); - } - JSONObject next_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + next_device_code + "'").uniqueResult(0); - if (!ObjectUtil.isEmpty(next_device_json)) { - next_point_code = (String) next_device_json.get("parent_storage_code") == null ? next_point_code : (String) next_device_json.get("storage_code"); - } - JSONObject start_device_json2 = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_device_code2 + "'").uniqueResult(0); - if (!ObjectUtil.isEmpty(start_device_json2)) { - start_point_code2 = (String) start_device_json2.get("parent_storage_code") == null ? start_device_code2 : (String) start_device_json2.get("storage_code"); - } - JSONObject next_device_json2 = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + next_device_code2 + "'").uniqueResult(0); - if (!ObjectUtil.isEmpty(next_device_json2)) { - next_point_code2 = (String) next_device_json2.get("parent_storage_code") == null ? next_device_code2 : (String) next_device_json2.get("storage_code"); - } - JSONObject put_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + put_device_code + "'").uniqueResult(0); - if (!ObjectUtil.isEmpty(put_device_json)) { - put_point_code = (String) put_device_json.get("parent_storage_code") == null ? put_device_code : (String) put_device_json.get("storage_code"); - } - if (StrUtil.isNotEmpty(start_point_code) && start_point_code.indexOf("-") > 0) { - String str[] = start_point_code.split("-"); - start_device_code = str[0]; - } else { - start_device_code = start_point_code; - } - - if (StrUtil.isNotEmpty(next_point_code) && next_point_code.indexOf("-") > 0) { - String str[] = next_point_code.split("-"); - next_device_code = str[0]; - } else { - next_device_code = next_point_code; - } - - if (StrUtil.isNotEmpty(start_point_code2) && start_point_code2.indexOf("-") > 0) { - String str[] = start_point_code2.split("-"); - start_device_code2 = str[0]; - } else { - start_device_code2 = start_point_code2; - } - - if (StrUtil.isNotEmpty(next_point_code2) && next_point_code2.indexOf("-") > 0) { - String str[] = next_point_code2.split("-"); - next_device_code2 = str[0]; - } else { - next_device_code2 = next_point_code2; - } - - if (StrUtil.isNotEmpty(put_point_code) && put_point_code.indexOf("-") > 0) { - String str[] = put_point_code.split("-"); - put_device_code = str[0]; - } else { - put_device_code = put_point_code; - } - - if (StrUtil.isEmpty(route_plan_code)) { - route_plan_code = "normal"; - } - - if (StrUtil.equals(task_type, "5")) { - Device device = deviceAppService.findDeviceByCode(next_device_code); - SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; - if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { - siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver(); - if (ObjectUtil.equal("true", siemensConveyorDeviceDriver.getExtraValue().get("inspect_in_stock"))) { - if (siemensConveyorDeviceDriver.getMove() == 1) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", "终点" + siemensConveyorDeviceDriver.getDevice_code() + "有货无法生成任务"); - errArr.add(json); - continue; - } - } - } - - if (taskService.querySameDeviceReadyTask(start_device_code, next_device_code, "0") > 1) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", "已存在相同的起点:" + start_device_code + "终点:" + next_device_code + "未执行的输送任务"); - errArr.add(json); - continue; - } - } - - TaskDto taskDto = taskService.findByCodeFromCache(task_code); - if (taskDto != null) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", "存在相同的任务号:" + task_code); - errArr.add(json); - continue; - } - if (!StrUtil.isEmpty(vehicle_code)) { - TaskDto vehicle_dto = taskService.findByContainer(vehicle_code); - if (vehicle_dto != null) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", "已存在任务编号为" + vehicle_dto.getTask_code() + "托盘号:" + vehicle_code); - errArr.add(json); - continue; - } - } - - if (StrUtil.isEmpty(start_point_code)) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", request.getStart_device_code() + " 该设备号未找到对应点位"); - errArr.add(json); - continue; - } - if (StrUtil.isEmpty(next_point_code)) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", request.getNext_device_code() + " 该设备号未找到对应点位"); - errArr.add(json); - continue; - } - - JSONObject jo = new JSONObject(); - jo.put("task_id", IdUtil.simpleUUID()); - jo.put("task_code", task_code); - jo.put("start_point_code", start_point_code); - jo.put("next_point_code", next_point_code); - jo.put("start_point_code2", start_point_code2); - jo.put("next_point_code2", next_point_code2); - jo.put("put_point_code", put_point_code); - jo.put("start_parent_code", start_point_code); - jo.put("next_parent_code", next_point_code); - jo.put("start_device_code", start_device_code); - jo.put("next_device_code", next_device_code); - jo.put("start_device_code2", start_device_code2); - jo.put("next_device_code2", next_device_code2); - jo.put("put_device_code", put_device_code); - jo.put("priority", priority); - jo.put("vehicle_code", vehicle_code); - jo.put("vehicle_type", vehicle_type); - jo.put("storage_task_type", storage_task_type); - jo.put("agv_system_type", agv_system_type); - jo.put("start_height", start_height); - jo.put("next_height", next_height); - jo.put("oven_time", (int) Math.ceil(oven_time)); - jo.put("remark", remark); - jo.put("params", params); - jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type)); - jo.put("paper_array", JSONUtil.toJsonStr(paper_array)); - jo.put("truss_type", JSONUtil.toJsonStr(truss_type)); - jo.put("is_bushing", JSONUtil.toJsonStr(is_bushing)); - jo.put("version", JSONUtil.toJsonStr(version)); - jo.put("bushing_num", JSONUtil.toJsonStr(bushing_num)); - - - if (!StrUtil.isEmpty(ext_task_id)) { - jo.put("ext_task_id", ext_task_id); - } - - TaskDto task_dto = jo.toJavaObject(TaskDto.class); - try { - // task_type=7 则是立库任务需要下刻下发 - if (StrUtil.equals(task_dto.getTask_type(), "7")) { - //创建临时指令 不创建、不生成 - //等立库反馈成功才能创建任务和指令 - Instruction inst = null; - try { - inst = taskService.createTemporaryInst(task_dto); - } catch (Exception e) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", "起始点:"+ task_dto.getStart_point_code() + ",终点:"+ - task_dto.getNext_point_code()+",条码:" + task_dto.getVehicle_code() + - "," + e.getMessage()); - errArr.add(json); - continue; - } - Resp resp = acsToLiKuService.sendInst(task_dto.getStorage_task_type(), inst); - - if (StrUtil.equals(resp.result, "true")) { - //创建任务和指令 - taskService.create(task_dto); - inst.setSend_status(CommonFinalParam.ONE); - taskService.extCreateInst(inst); - - } else { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", resp.getComment()); - json.put("code", resp.code); - json.put("data", data); - errArr.add(json); - continue; - } - - } else { - taskService.create(task_dto); - } - } catch (Exception e) { - // e.printStackTrace(); - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", e.getMessage()); - errArr.add(json); - continue; - } - } - if (ObjectUtil.isEmpty(errArr)) { - response.setStatus(200); - response.setMessage("success"); - } else { - response.setStatus(400); - if (ObjectUtil.isNotEmpty(errArr)) { - response.setMessage(errArr.getJSONObject(0).getString("message")); - } else { - response.setMessage("false"); - } - response.setErrArr(errArr); - } - log.info("createFromWms--------------:输出参数:" + JSON.toJSONString(response)); - - return response; - } finally { - MDC.remove(log_file_type); - } - - } - - @Override public Map unLock(String param) { - try { - MDC.put(log_file_type, log_type); - log.info("unLock--------------:输入参数" + param); - JSONObject jo = JSONObject.parseObject(param); - String task_code = String.valueOf(jo.get("task_code")); - if (StrUtil.isEmpty(task_code)) { - throw new BadRequestException("任务号不能为空"); - } - String device_code = String.valueOf(jo.get("device_code")); - if (StrUtil.isEmpty(device_code)) { - throw new BadRequestException("设备号不能为空"); - } - String vehicle_code = String.valueOf(jo.get("vehicle_code")); - if (StrUtil.isEmpty(vehicle_code)) { - throw new BadRequestException("载具号不能为空"); - } - OutConfirmRequest outConfirmRequest = new OutConfirmRequest(); - outConfirmRequest.setOutPortNo(device_code); - outConfirmRequest.setPalletCode(vehicle_code); - Instruction instruction = instructionService.findByCode(String.valueOf(task_code)); - if (ObjectUtil.isNotEmpty(instruction)) { - task_code = instruction.getInstruction_code(); - outConfirmRequest.setOrderId(task_code); - } - Resp resp = acsToLiKuService.outConfirm(outConfirmRequest); - if (StrUtil.equals(resp.getResult(), "false")) { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", 400); - resultJson.put("message", resp.getComment()); - log.info("unLock--------------:输出参数" + resultJson); - return resultJson; - } - } catch (Exception e) { - e.printStackTrace(); - JSONObject resultJson = new JSONObject(); - resultJson.put("status", 400); - resultJson.put("message", e.getMessage()); - log.info("unLock--------------:输出参数" + resultJson); - return resultJson; - } finally { - MDC.remove(log_file_type); - } - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK.value()); - resultJson.put("message", "操作成功"); - log.info("unLock--------------:输出参数" + resultJson); - return resultJson; - } - - // @Override - // public Map sendAgvChargeTask(JSONObject param) { - // log.info("sendAgvChargeTask--------------:输入参数" + param.toString()); - // String agv_system = param.getString("agv_system"); - // String car_no = param.getString("car_no"); - // if (StrUtil.isEmpty(agv_system)) { - // throw new BadRequestException("AGV系统类型不能为空"); - // } - // if (StrUtil.isEmpty(car_no)) { - // throw new BadRequestException("AGV车号不能为空"); - // } - // Device device = deviceAppService.findDeviceByCode(car_no); - // if (device == null) { - // throw new BadRequestException("agv车号在ACS系统中不存在!"); - // } - // NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvServiceImpl.class); - // agvService.createChargingTaskToNDC(agv_system, car_no); - // JSONObject resp = new JSONObject(); - // resp.put("status", 200); - // resp.put("message", "操作成功"); - // return resp; - // } - // - // @Override - // public Map queryDeviceInfo(JSONObject param) { - // log.info("queryDeviceInfo--------------:输入参数" + param.toString()); - // String region_code = param.getString("region_code"); - //// if (StrUtil.isEmpty(region_code)) { - //// throw new BadRequestException("区域编码不能为空"); - //// } - // AgvNdcTwoDeviceDriver agvNdcTwoDeviceDriver; - // AgvNdcOneDeviceDriver agvNdcOneDeviceDriver; - // List devices = deviceAppService.findDevice(DeviceType.agv); - // JSONArray data = new JSONArray(); - // if (StrUtil.isEmpty(region_code)) { - // throw new BadRequestException("区域编码不能为空"); - // } - AgvNdcTwoDeviceDriver agvNdcTwoDeviceDriver; - AgvNdcOneDeviceDriver agvNdcOneDeviceDriver; - List devices = deviceAppService.findDevice(DeviceType.agv); - JSONArray data = new JSONArray(); - if (StrUtil.isEmpty(region_code)) { - if (ObjectUtil.isNotEmpty(devices)) { - for (int i = 0; i < devices.size(); i++) { - Device device = devices.get(i); - Device agvDevice = deviceAppService.findDeviceByCode(device.getDevice_code()); - if (agvDevice.getDeviceDriver() instanceof DeviceStageMonitor) { - DeviceStageMonitor deviceStageMonitor = (DeviceStageMonitor) agvDevice.getDeviceDriver(); - try { - JSONObject jo = deviceStageMonitor.getDeviceStatusName(); - data.add(jo); - } catch (Exception e) { - log.error("反馈AGV信息失败:{}", e.getMessage()); - } - } - } - } - } else { - if (ObjectUtil.isNotEmpty(devices)) { - for (int i = 0; i < devices.size(); i++) { - Device device = devices.get(i); - Device agvDevice = deviceAppService.findDeviceByCode(device.getDevice_code()); - if (agvDevice.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) { - if (StrUtil.equals(region_code, "1")) { - agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) agvDevice.getDeviceDriver(); - JSONObject jo = agvNdcTwoDeviceDriver.getDeviceStatusName(); - data.add(jo); - } - } - if (agvDevice.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) { - if (StrUtil.equals(region_code, "5")) { - agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) agvDevice.getDeviceDriver(); - JSONObject jo = agvNdcOneDeviceDriver.getDeviceStatusName(); - data.add(jo); - } - } - } - } - } - JSONObject resp = new JSONObject(); - resp.put("status", 200); - resp.put("message", "操作成功"); - resp.put("data", data); - return resp; - } - - @Override public Map syncfaultInfo() { - log.info("syncfaultInfo--------------:输入参数"); - JSONArray data = new JSONArray(); - List dicts = dictService.queryAll(); - if (ObjectUtil.isNotEmpty(dicts)) { - List error_dists = dicts - .stream() - .filter(dict -> dict.getName().contains("error_type")) - .collect(Collectors.toList()); - if (ObjectUtil.isNotEmpty(error_dists)) { - for (int i = 0; i < error_dists.size(); i++) { - Dict dict = error_dists.get(i); - String dictName = dict.getName(); - List dictDetailDtos = dictDetailService.getDictByName(dictName); - for (DictDetailDto dictDetailDto : dictDetailDtos) { - JSONObject faultInfo = new JSONObject(); - faultInfo.put("fault_type", dictName); - faultInfo.put("fault_code", dictDetailDto.getValue()); - faultInfo.put("fault_info", dictDetailDto.getLabel()); - data.add(faultInfo); - } - } - } - } - JSONObject resp = new JSONObject(); - resp.put("status", 200); - resp.put("message", "操作成功"); - resp.put("data", data); - return resp; - } - - @Override public Map realTimefaultInfo(JSONObject param) { - log.info("realTimefaultInfo--------------:输入参数" + param.toString()); - String device_code = param.getString("device_code"); - JSONArray data = new JSONArray(); - if (StrUtil.isNotEmpty(device_code)) { - String[] devices = device_code.split(","); - Device device = null; - for (String deviceCode : devices) { - device = deviceAppService.findDeviceByCode(deviceCode); - if (device == null) { - continue; - } - if (device.getDeviceDriver() instanceof FeedLmsRealFailed) { - FeedLmsRealFailed feedLmsRealFailed = (FeedLmsRealFailed) device.getDeviceDriver(); - JSONObject jsonObject = feedLmsRealFailed.feedLmsRealFailedInfo(); - data.add(jsonObject); - } - } - } - JSONObject resp = new JSONObject(); - resp.put("status", 200); - resp.put("message", "操作成功"); - resp.put("data", data); - return resp; - } - - - @Override public Map paperTubeAction(JSONObject param) { - log.info("paperTubeAction--------------:输入参数" + param.toString()); - JSONObject resp = new JSONObject(); - String device_code = param.getString("device_code"); - String type = param.getString("type"); - String material_code = param.getString("material_code"); - String qty = param.getString("qty"); - - if (StrUtil.isNotEmpty(device_code)) { - - Device device = deviceAppService.findDeviceByCode(device_code); - if (device == null) { - resp.put("status", 400); - resp.put("message", "未找到对应设备"); - log.info("paperTubeAction--------------:输出参数" + resp.toString()); - return resp; - } - if (device.getDeviceDriver() instanceof PaperTubeConveyorDeviceDriver) { - PaperTubeConveyorDeviceDriver paperTubeConveyorDeviceDriver = (PaperTubeConveyorDeviceDriver) device.getDeviceDriver(); - if (paperTubeConveyorDeviceDriver.getMode() != 2) { - resp.put("status", 400); - resp.put("message", "设备:" + device_code + "未待机,无法下发信号"); - log.info("paperTubeAction--------------:输出参数" + resp.toString()); - return resp; - } - if (StrUtil.equals(type, "1")) { - if (paperTubeConveyorDeviceDriver.getInventory_qty() > 0) { - resp.put("status", 400); - resp.put("message", "设备:" + device_code + "当前数量为" + paperTubeConveyorDeviceDriver.getInventory_qty() + "无法设置物料"); - log.info("paperTubeAction--------------:输出参数" + resp.toString()); - return resp; - } - try{ - List list = new ArrayList(); - Map map = new HashMap(); - map.put("code", "to_material"); - map.put("value", material_code); - list.add(map); - paperTubeConveyorDeviceDriver.writing(list); - - } catch (Exception e){ - e.printStackTrace(); - } - } else if (StrUtil.equals(type, "2")) { - if (paperTubeConveyorDeviceDriver.getInventory_qty() < Integer.parseInt(qty)) { - resp.put("status", 400); - resp.put("message", "设备:" + device_code + "当前数量为" + paperTubeConveyorDeviceDriver.getInventory_qty() + "小于出库数量" + qty); - log.info("paperTubeAction--------------:输出参数" + resp.toString()); - return resp; - } - if (StrUtil.isEmpty(paperTubeConveyorDeviceDriver.getMaterial())) { - resp.put("status", 400); - resp.put("message", "设备:" + device_code + "设备上报物料为空无法出库"); - log.info("paperTubeAction--------------:输出参数" + resp.toString()); - return resp; - } else { - if (!StrUtil.equals(paperTubeConveyorDeviceDriver.getMaterial(), material_code)) { - resp.put("status", 400); - resp.put("message", "设备:" + device_code + "设备上报物料为" + paperTubeConveyorDeviceDriver.getMaterial() + "与出库物料" + material_code + "不匹配"); - log.info("paperTubeAction--------------:输出参数" + resp.toString()); - return resp; - } - } - if (paperTubeConveyorDeviceDriver.getTo_command() != 0 || paperTubeConveyorDeviceDriver.getTo_target() != 0) { - resp.put("status", 400); - resp.put("message", "设备:" + device_code + "下发命令信号值为" + paperTubeConveyorDeviceDriver.getTo_command() + ",下发目标站:" + paperTubeConveyorDeviceDriver.getTo_target() + ",已存在待执行的任务"); - log.info("paperTubeAction--------------:输出参数" + resp.toString()); - return resp; - } - List list = new ArrayList(); - Map map = new HashMap(); - map.put("code", "to_out_qty"); - map.put("value", qty); - list.add(map); - Map map2 = new HashMap(); - map2.put("code", "to_target"); - map2.put("value", device.getAddress()); - list.add(map2); - Map map3 = new HashMap(); - map3.put("code", "to_command"); - map3.put("value", 2); - list.add(map3); - try{ - // paperTubeConveyorDeviceDriver.writing("to_out_qty", qty); - // paperTubeConveyorDeviceDriver.writing("to_target", device.getAddress()); - // paperTubeConveyorDeviceDriver.writing("to_command", "2"); - paperTubeConveyorDeviceDriver.writing(list); - } catch (Exception e){ - e.printStackTrace(); - } - - } else if(StrUtil.equals(type, "3")){ - List list = new ArrayList(); - Map map = new HashMap(); - map.put("code", "to_command"); - map.put("value", 3); - list.add(map); - paperTubeConveyorDeviceDriver.writing(list); - } - } - - } - resp.put("status", 200); - resp.put("message", "操作成功"); - return resp; - }**/ - } diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 786e802..df90691 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -35,7 +35,6 @@ import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver; import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver; import org.nl.acs.device_driver.conveyor.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver; import org.nl.acs.device_driver.conveyor.standard_inspect_site.StandardInspectSiteDeviceDriver; -import org.nl.acs.device_driver.two_conveyor.hongxiang_device.HongXiangConveyorDeviceDriver; import org.nl.acs.ext.wms.liKuData.*; import org.nl.acs.ext.wms.service.AcsToLiKuService; import org.nl.acs.instruction.domain.InstructionMybatis; @@ -433,7 +432,6 @@ public class InstructionServiceImpl extends CommonServiceImpl