diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java index 6991af4ad..19e4a904f 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java @@ -247,6 +247,15 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } + } else { + + inst.setInstruction_status("2"); + try { + instructionService.finish(inst); + } catch (Exception e) { + e.printStackTrace(); + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } } } @@ -290,17 +299,17 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { if (device.getDeviceDriver() instanceof LiftDoorDeviceDriver) { liftDoorDeviceDriver = (LiftDoorDeviceDriver) device.getDeviceDriver(); try { - liftDoorDeviceDriver.writing("to_open1", "1"); - liftDoorDeviceDriver.writing("to_close1", "0"); + liftDoorDeviceDriver.writing("to_open", "1"); + liftDoorDeviceDriver.writing("to_close", "0"); } catch (Exception e) { log.info("下发电梯门电气信号失败:" + e.getMessage()); e.printStackTrace(); } - if (liftDoorDeviceDriver.getOpen1() == 1 && liftDoorDeviceDriver.getToOpen1() == 1 ) { - log.info("下发电梯门开门信号值为:{},读取开门信号值为:{}", liftDoorDeviceDriver.getToOpen1(), liftDoorDeviceDriver.getOpen1()); + if (liftDoorDeviceDriver.getOpen() == 1 && liftDoorDeviceDriver.getToOpen() == 1 ) { + log.info("下发电梯门开门信号值为:{},读取开门信号值为:{}", liftDoorDeviceDriver.getToOpen(), liftDoorDeviceDriver.getOpen()); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } else { - log.info("未下发NDC信号原因: 下发开门信号值为:{},读取开门信号值为:{}", liftDoorDeviceDriver.getToOpen1(), liftDoorDeviceDriver.getOpen1()); + log.info("未下发NDC信号原因: 下发开门信号值为:{},读取开门信号值为:{}", liftDoorDeviceDriver.getToOpen(), liftDoorDeviceDriver.getOpen()); } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java index 33a4b68db..77057f04d 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java @@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.sun.xml.bind.v2.TODO; import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -557,7 +558,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); try { -// manipulatorAgvStationDeviceDriver.writing(3); + manipulatorAgvStationDeviceDriver.writing(3); } catch (Exception e) { e.printStackTrace(); } @@ -996,62 +997,33 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic String start_device_code2 = inst.getStart_device_code2(); String next_device_code2 = inst.getNext_device_code2(); //取空锟或去烘箱放货的时候需要请求进入 - if (ObjectUtil.isNotEmpty(start_device_code) && StrUtil.equals(device_code, start_device_code)) { - if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { - manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); - try { - manipulatorAgvStationDeviceDriver.writing(6); - } catch (Exception e) { - e.printStackTrace(); - } - if (ObjectUtil.isNotEmpty(manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("ignore_release_check")) - && StrUtil.equals("true", manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("ignore_release_check").toString())) { - if (manipulatorAgvStationDeviceDriver.getAction() == 1 && manipulatorAgvStationDeviceDriver.getMode() == 2 && manipulatorAgvStationDeviceDriver.getMove() == 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } else { - message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "mode信号:" + manipulatorAgvStationDeviceDriver.getMode() + "光电信号:" + manipulatorAgvStationDeviceDriver.getMove() + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode()) - .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } - } else { - if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } else { - message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode()) - .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } - } + if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { + manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); + try { + manipulatorAgvStationDeviceDriver.writing(6); + } catch (Exception e) { + e.printStackTrace(); } - } else if (ObjectUtil.isNotEmpty(start_device_code) && StrUtil.equals(device_code, next_device_code)) { - if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { - manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); - - try { - manipulatorAgvStationDeviceDriver.writing(4); - } catch (Exception e) { - e.printStackTrace(); + if (ObjectUtil.isNotEmpty(manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("ignore_release_check")) + && StrUtil.equals("true", manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("ignore_release_check").toString())) { + if (manipulatorAgvStationDeviceDriver.getAction() == 1 && manipulatorAgvStationDeviceDriver.getMode() == 2 && manipulatorAgvStationDeviceDriver.getMove() == 0) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(this.getDeviceCode()) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } else { + message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "mode信号:" + manipulatorAgvStationDeviceDriver.getMode() + "光电信号:" + manipulatorAgvStationDeviceDriver.getMove() + ",指令号:" + ikey + "不满足取货条件"; + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode()) + .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "不满足取货条件") + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } + } else { if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); LuceneLogDto logDto = LuceneLogDto.builder() @@ -1070,90 +1042,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic luceneExecuteLogService.deviceExecuteLog(logDto); } } - } else if (ObjectUtil.isNotEmpty(start_device_code) && StrUtil.equals(device_code, start_device_code2)) { - 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, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } else { - message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } - } - } else if (ObjectUtil.isNotEmpty(start_device_code) && StrUtil.equals(device_code, next_device_code2)) { - if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { - manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); - try { - manipulatorAgvStationDeviceDriver.writing(6); - } catch (Exception e) { - e.printStackTrace(); - } - if (ObjectUtil.isNotEmpty(manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("ignore_release_check")) - && StrUtil.equals("true", manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("ignore_release_check").toString())) { - if (manipulatorAgvStationDeviceDriver.getAction() == 1 && manipulatorAgvStationDeviceDriver.getMode() == 2 && manipulatorAgvStationDeviceDriver.getMove() == 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } else { - message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "mode信号:" + manipulatorAgvStationDeviceDriver.getMode() + "光电信号:" + manipulatorAgvStationDeviceDriver.getMove() + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode()) - .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } - } else { - if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } else { - message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode()) - .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } - } - } } -// else { -// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); -// LuceneLogDto logDto = LuceneLogDto.builder() -// .device_code(this.getDeviceCode()) -// .content("agvphase:" + phase + "反馈:" + data) -// .build(); -// logDto.setLog_level(4); -// luceneExecuteLogService.deviceExecuteLog(logDto); -// } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } //请求离开 else if (phase == 0x4E) { @@ -1227,6 +1117,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } // 取货完毕 @@ -2089,42 +1980,23 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic //申请烘箱行架任务 if (ObjectUtil.isNotEmpty(manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("request_robot_task")) && StrUtil.equals("true", manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("request_robot_task").toString())) { - if (manipulatorAgvStationDeviceDriver.getTo_command() != 4) { - String task_code = inst.getTask_code(); - JSONObject jsonObject = new JSONObject(); - jsonObject.put("task_code", task_code); - String response = acsToWmsService.applyOvenGantryTask(jsonObject); - JSONObject jo = JSON.parseObject(response); - if (jo.getInteger("status") == 200) { - log.info("申请烘箱行架任务成功返回参数:"+ jo); - try { - manipulatorAgvStationDeviceDriver.writing(4); - } catch (Exception e) { - e.printStackTrace(); - } - } else { - log.info("申请烘箱行架任务失败返回参数:"+ jo); + String task_code = inst.getTask_code(); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("task_code", task_code); + String response = acsToWmsService.applyOvenGantryTask(jsonObject); + JSONObject jo = JSON.parseObject(response); + if (jo.getInteger("status") == 200) { + log.info("申请烘箱行架任务成功返回参数:" + jo); + try { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + } catch (Exception e) { + e.printStackTrace(); } - } - //行架取货完成后反馈ndc - if ((manipulatorAgvStationDeviceDriver.getAction() == 2)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); } else { - log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", manipulatorAgvStationDeviceDriver.getDeviceCode(), manipulatorAgvStationDeviceDriver.getAction(), ikey); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode()) - .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); + log.info("申请烘箱行架任务失败返回参数:" + jo); } - }else { + manipulatorAgvStationDeviceDriver.writing(4); + } else { try { manipulatorAgvStationDeviceDriver.writing(4); } catch (Exception e) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/air_shower_door/AirShowerDoorDefination.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/air_shower_door/AirShowerDoorDefination.java index 7601d92f9..e9cea3dda 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/air_shower_door/AirShowerDoorDefination.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/air_shower_door/AirShowerDoorDefination.java @@ -45,7 +45,7 @@ public class AirShowerDoorDefination implements OpcDeviceDriverDefination { @Override public List getFitDeviceTypes() { List types = new LinkedList(); - types.add(DeviceType.conveyor); + types.add(DeviceType.autodoor); return types; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/fast_door/FastDoorDefination.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/fast_door/FastDoorDefination.java new file mode 100644 index 000000000..19e30aede --- /dev/null +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/fast_door/FastDoorDefination.java @@ -0,0 +1,63 @@ +package org.nl.acs.device_driver.autodoor.fast_door; + +import org.nl.acs.device.device_driver.standard_inspect.ItemDto; +import org.nl.acs.device.domain.Device; +import org.nl.acs.device.enums.DeviceType; +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; +import org.springframework.stereotype.Service; + +import java.util.LinkedList; +import java.util.List; + +/** + * 快卷门驱动定义 + */ +@Service +public class FastDoorDefination implements OpcDeviceDriverDefination { + @Override + public String getDriverCode() { + return "fast_door"; + } + + @Override + public String getDriverName() { + return "快卷门"; + } + + @Override + public String getDriverDescription() { + return "快卷门"; + } + + + @Override + public DeviceDriver getDriverInstance(Device device) { + return (new FastDoorDeviceDriver()).setDevice(device).setDriverDefination(this); + + } + + @Override + public Class getDeviceDriverType() { + return FastDoorDeviceDriver.class; + } + + @Override + public List getFitDeviceTypes() { + List types = new LinkedList(); + types.add(DeviceType.autodoor); + return types; + } + + + @Override + public List getReadableItemDtos() { + return ItemProtocol.getReadableItemDtos(); + } + + @Override + public List getWriteableItemDtos() { + return ItemProtocol.getWriteableItemDtos(); + } + +} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/fast_door/FastDoorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/fast_door/FastDoorDeviceDriver.java new file mode 100644 index 000000000..ccef67777 --- /dev/null +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/fast_door/FastDoorDeviceDriver.java @@ -0,0 +1,139 @@ +package org.nl.acs.device_driver.autodoor.fast_door; + +import com.alibaba.fastjson.JSONObject; +import lombok.Data; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device.domain.Device; +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; +import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.log.service.DeviceExecuteLogService; +import org.nl.acs.monitor.DeviceStageMonitor; +import org.nl.acs.utils.ReadUtil; +import org.nl.config.SpringContextHolder; +import org.nl.config.lucene.service.LuceneExecuteLogService; +import org.nl.config.lucene.service.dto.LuceneLogDto; +import org.openscada.opc.lib.da.Server; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.HashMap; +import java.util.Map; + + +/** + * 快卷门驱动 + */ +@Slf4j +@Data +@RequiredArgsConstructor +public class FastDoorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, DeviceStageMonitor { + protected ItemProtocol itemProtocol = new ItemProtocol(this); + protected ToDoorCommandControl toDoorCommandControl = new ToDoorCommandControl(this); + DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); + @Autowired + LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class); + + int open = 0; + int close = 0; + + int last_open = 0; + int last_close = 0; + + int toOpen = 0; + int last_toOpen = 0; + int toClose = 0; + int last_toClose = 0; + String device_code = null; + + @Override + public Device getDevice() { + return this.device; + } + + + @Override + public void execute() { + String message = null; + + device_code = this.getDevice().getDevice_code(); + open = this.itemProtocol.getOpen(); + close = this.itemProtocol.getClose(); + toOpen = this.itemProtocol.getToOpen(); + toClose = this.itemProtocol.getToClose(); + if (open != last_open) { + logServer.deviceExecuteLog(this.device_code, "", "", "信号open:" + last_open + "->" + open); + } + if (close != last_close) { + if(close ==1 ){ + this.writing("to_close","0"); + } + } + + last_open = open; + last_close = close; + last_toClose = toClose; + last_toOpen = toOpen; + } + + + public void writing(String param, String value) { + String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + param; + Map itemMap = new HashMap(); + itemMap.put(to_param, Integer.parseInt(value)); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("下发多个电气信号" + itemMap) + .build(); + luceneExecuteLogService.deviceExecuteLog(logDto); + try { + this.toDoorCommandControl.control(param,value); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void writing(String param, int command) { + String to_command = String.format("%s.%s.%s.%s", this.getDevice().getOpc_server_code(), this.getDevice().getOpc_plc_code(), this.getDevice().getDevice_code(), param); + + String opcservcerid = this.getDevice().getOpc_server_id(); + Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); + itemMap.put(to_command, command); + ReadUtil.write(itemMap, server); + log.info("下发PLC信号:{},{}", to_command, command); + System.out.println("设备:" + this.device_code + ",下发PLC信号:" + to_command + ",value:" + command); + + } + + @Override + public JSONObject getDeviceStatusName() { + JSONObject jo = new JSONObject(); + String open = ""; + String close = ""; + if (this.getOpen() == 0) { + open = "未知"; + } else if (this.getOpen() == 1) { + open = "开到位"; + } + if (this.getClose() == 0) { + open = "未知"; + } else if (this.getClose() == 1) { + open = "关到位"; + } + jo.put("device_name", this.getDevice().getDevice_name()); + jo.put("open", open); + jo.put("close", close); + jo.put("isOnline", true); + + return jo; + } + + @Override + public void setDeviceStatus(JSONObject data) { + + } + + +} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/fast_door/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/fast_door/ItemProtocol.java new file mode 100644 index 000000000..2c3246eb9 --- /dev/null +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/fast_door/ItemProtocol.java @@ -0,0 +1,85 @@ +package org.nl.acs.device_driver.autodoor.fast_door; + +import cn.hutool.core.util.StrUtil; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device.device_driver.standard_inspect.ItemDto; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +public class ItemProtocol { + public static String item_open = "open"; + public static String item_close = "close"; + public static String item_to_stop = "stop"; + public static String item_to_relieve_stop = "to_relieve_stop"; + public static String item_to_open = "to_open"; + public static String item_to_close = "to_close"; + + + + private FastDoorDeviceDriver driver; + + public ItemProtocol(FastDoorDeviceDriver driver) { + this.driver = driver; + } + + public int getOpen() { + return this.getOpcIntegerValue(item_open); + } + + public int getClose() { + return this.getOpcIntegerValue(item_close); + } + + + public int getToOpen() { + return this.getOpcIntegerValue(item_to_open); + } + + public int getToClose() { + return this.getOpcIntegerValue(item_to_close); + } + + public int getOpcIntegerValue(String protocol) { + Integer value = this.driver.getIntegeregerValue(protocol); + if (value == null) { + // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); + } else { + return value; + } + return 0; + + } + + public String getOpcStringValue(String protocol) { + String value = this.driver.getStringValue(protocol); + if (StrUtil.isEmpty(value)) { + + } else { + return value; + } + return "0"; + } + + public static List getReadableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_open, "开到位", "10001")); + list.add(new ItemDto(item_close, "关到位", "10002")); + return list; + } + + public static List getWriteableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_to_open, "下发开门", "00001" )); + list.add(new ItemDto(item_to_close, "下发关门", "00002")); + return list; + } + + + @Override + public String toString() { + return ""; + } +} + diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/fast_door/ToDoorCommandControl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/fast_door/ToDoorCommandControl.java new file mode 100644 index 000000000..d8e6e0f84 --- /dev/null +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/fast_door/ToDoorCommandControl.java @@ -0,0 +1,27 @@ +package org.nl.acs.device_driver.autodoor.fast_door; + + +import java.util.HashMap; +import java.util.Map; + +public class ToDoorCommandControl { + + private FastDoorDeviceDriver driver; + + public ToDoorCommandControl(FastDoorDeviceDriver driver){ + this.driver = driver; + } + + public void control(String param, String value) throws Exception { +// ItemValue[] itemValues = new ItemValue[]{new ItemValue(this.driver.getItem(ItemProtocol.item_to_command), command)}; + Map itemMap = new HashMap(); + String to_param = this.driver.getDevice().getOpc_server_code() + "." + this.driver.getDevice().getOpc_plc_code() + "." + this.driver.getDevice().getDevice_code() + + "."+ param; + itemMap.put(to_param, Integer.parseInt(value)); + try { + this.driver.checkcontrol(itemMap); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/lift_door/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/lift_door/ItemProtocol.java index 7ebb29f61..3cf1e03d5 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/lift_door/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/lift_door/ItemProtocol.java @@ -22,27 +22,30 @@ public class ItemProtocol { //机器人状态 public static String item_robot_status = "lift_robot_status"; - //主门开到位 - public static String item_open1 = "open"; + //门开到位 + public static String item_open = "open"; + //门关到位 + public static String item_close = "close"; - //主门关到位 - public static String item_close1 = "close1"; - - //主门关到位 - public static String item_close2 = "close2"; //楼层 public static String item_floor= "floor"; - //开主门 - public static String item_to_open1 = "to_open1"; - - public static String item_to_call= "to_call"; + //开门 + public static String item_to_open = "to_open"; + + //关门 + public static String item_to_close = "to_close"; + + //报警 + public static String item_error = "error"; + + private LiftDoorDeviceDriver driver; public ItemProtocol(LiftDoorDeviceDriver driver) { @@ -51,8 +54,8 @@ public class ItemProtocol { - public int getOpen1() { - return this.getOpcIntegerValue(item_open1); + public int getOpen() { + return this.getOpcIntegerValue(item_open); } public int getLiftStatus() { @@ -71,18 +74,13 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_to_call); } - public int getClose2() { - return this.getOpcIntegerValue(item_close2); - } - public int getClose1() { - return this.getOpcIntegerValue(item_close1); + public int getClose() { + return this.getOpcIntegerValue(item_close); } - public int getToOpen1() { - return this.getOpcIntegerValue(item_to_open1); - } + public int getHeartbeat() { @@ -118,20 +116,21 @@ public class ItemProtocol { public static List getReadableItemDtos() { ArrayList list = new ArrayList(); list.add(new ItemDto(item_heartbeat, "心跳", "10003")); - list.add(new ItemDto(item_open1, "主开到位", "10001")); - list.add(new ItemDto(item_close1, "主关到位", "10002")); - list.add(new ItemDto(item_close2, "副关到位", "10002")); + list.add(new ItemDto(item_open, "门开到位", "10001")); + list.add(new ItemDto(item_close, "门关到位", "10002")); list.add(new ItemDto(item_mode, "工作模式", "10004")); list.add(new ItemDto(item_lift_status, "状态(拥挤 空闲 一般)", "10002")); list.add(new ItemDto(item_robot_status, "机器人状态", "10002")); list.add(new ItemDto(item_floor, "楼层", "10002")); + list.add(new ItemDto(item_error, "异常", "10002")); return list; } public static List getWriteableItemDtos() { ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_open1, "下发开主门", "10002")); + list.add(new ItemDto(item_to_open, "下发开门", "10002")); + list.add(new ItemDto(item_to_close, "下发关门", "00002")); list.add(new ItemDto(item_to_call, "呼叫", "10002")); return list; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/lift_door/LiftDoorDefination.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/lift_door/LiftDoorDefination.java index 25f1f950b..6c422ac50 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/lift_door/LiftDoorDefination.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/lift_door/LiftDoorDefination.java @@ -17,7 +17,7 @@ import java.util.List; public class LiftDoorDefination implements OpcDeviceDriverDefination { @Override public String getDriverCode() { - return "standard_autodoor"; + return "lift_door"; } @Override @@ -45,7 +45,7 @@ public class LiftDoorDefination implements OpcDeviceDriverDefination { @Override public List getFitDeviceTypes() { List types = new LinkedList(); - types.add(DeviceType.conveyor); + types.add(DeviceType.autodoor); return types; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/lift_door/LiftDoorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/lift_door/LiftDoorDeviceDriver.java index e45219290..326739b62 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/lift_door/LiftDoorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/lift_door/LiftDoorDeviceDriver.java @@ -34,12 +34,12 @@ public class LiftDoorDeviceDriver extends AbstractOpcDeviceDriver implements Dev @Autowired LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class); - int open1 = 0; - int close1 = 0; - int last_open1 = 0; - int last_close1 = 0; - int toOpen1 = 0; - int last_toOpen1 = 0; + int open = 0; + int close = 0; + int last_open = 0; + int last_close = 0; + int toOpen = 0; + int last_toOpen = 0; int toClose = 0; int last_toClose = 0; String device_code = null; @@ -55,22 +55,23 @@ public class LiftDoorDeviceDriver extends AbstractOpcDeviceDriver implements Dev String message = null; device_code = this.getDevice().getDevice_code(); - open1 = this.itemProtocol.getOpen1(); - close1 = this.itemProtocol.getClose1(); - toOpen1 = this.itemProtocol.getToOpen1(); + open = this.itemProtocol.getOpen(); + close = this.itemProtocol.getClose(); - if (open1 != last_open1) { - logServer.deviceExecuteLog(this.device_code, "", "", "信号open:" + last_open1 + "->" + open1); + + if (open != last_open) { + logServer.deviceExecuteLog(this.device_code, "", "", "信号open:" + last_open + "->" + open); } - if (close1 != last_close1) { - if(close1 ==1 ){ + if (close != last_close) { + if(close ==1 ){ this.writing("to_close","0"); } } - last_open1 = open1; - last_close1 = close1; - last_toOpen1 = toOpen1; + last_open = open; + last_close = close; + last_toOpen = toOpen; + last_toClose = toClose; } @@ -109,14 +110,14 @@ public class LiftDoorDeviceDriver extends AbstractOpcDeviceDriver implements Dev JSONObject jo = new JSONObject(); String open = ""; String close = ""; - if (this.getOpen1() == 0) { + if (this.getOpen() == 0) { open = "未知"; - } else if (this.getOpen1() == 1) { + } else if (this.getOpen() == 1) { open = "开到位"; } - if (this.getClose1() == 0) { + if (this.getClose() == 0) { open = "未知"; - } else if (this.getClose1() == 1) { + } else if (this.getClose() == 1) { open = "关到位"; } jo.put("device_name", this.getDevice().getDevice_name()); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDefination.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDefination.java index 77ae81092..9ba9a385a 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDefination.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDefination.java @@ -45,7 +45,7 @@ public class StandardAutodoorDefination implements OpcDeviceDriverDefination { @Override public List getFitDeviceTypes() { List types = new LinkedList(); - types.add(DeviceType.conveyor); + types.add(DeviceType.autodoor); return types; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index f3b8a0632..7bda716cc 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -543,8 +543,20 @@ public class InstructionServiceImpl extends CommonServiceImpl byStarCodeAndExcute1 = taskService.findByNextCodeAndExcute(nextLift1); + List byStarCodeAndExcute2 = taskService.findByNextCodeAndExcute(nextLift2); + if (byStarCodeAndExcute1.size() <= byStarCodeAndExcute2.size() ) { +// if (lift1.getDeviceDriver()){ +// +// } + dto.setNext_device_code(nextLift1); + } else { + dto.setNext_device_code(nextLift2); + } } } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/TaskService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/TaskService.java index 0feaaf72c..7b27289a7 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/TaskService.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/TaskService.java @@ -556,4 +556,12 @@ public interface TaskService extends CommonService { TaskDto findByTaskCode(String task_code); List queryAllHJReadyTask(); + + + /** + * 根据终点查询就绪执行中的任务 + * @param nextLift1 + * @return + */ + List findByNextCodeAndExcute(String nextLift1); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java index 2d35a9f9f..840d4aed7 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java @@ -971,6 +971,7 @@ public class TaskServiceImpl extends CommonServiceImpl impleme routeLineService.getShortPathLines( start_device_code, acsTask.getNext_device_code(), route_plan_code); Device startDevice = deviceAppService.findDeviceByCode(start_device_code); + Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); RouteLineDto routeLineDto = shortPathsList.get(0); String path = routeLineDto.getPath(); String type = routeLineDto.getType(); @@ -980,7 +981,7 @@ public class TaskServiceImpl extends CommonServiceImpl impleme for (int m = 0; m < pathlist.size(); m++) { if (pathlist.get(m).equals(start_device_code)) { //起点为货架跳过堆垛机 - if (startDevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { + if (startDevice.getDeviceDriver() instanceof StandardStorageDeviceDriver || nextDevice.getDeviceDriver() instanceof StandardStorageDeviceDriver ) { index = m + 2; }else { index = m + 1; @@ -1660,6 +1661,14 @@ public class TaskServiceImpl extends CommonServiceImpl impleme .collect(Collectors.toList()); } + @Override + public List findByNextCodeAndExcute(String nextLift) { + List taskDtoList = tasks.stream() + .filter(task -> StrUtil.equals(task.getStart_device_code(), nextLift) + && (StrUtil.equals(task.getTask_status(), TaskStatusEnum.BUSY.getIndex()) || StrUtil.equals(task.getTask_status(), TaskStatusEnum.READY.getIndex()))).collect(Collectors.toList()); + return taskDtoList; + } + /** * 把多个字符串拼接的inst_nextDevice_code解析成集合 diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml b/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml index f46698dc0..a5eea0bb3 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml @@ -1,5 +1,5 @@ server: - port: 8011 + port: 8012 #配置数据源 spring: messages: diff --git a/acs2/nladmin-ui/.env.development b/acs2/nladmin-ui/.env.development index e37a9a4f0..412e65231 100644 --- a/acs2/nladmin-ui/.env.development +++ b/acs2/nladmin-ui/.env.development @@ -1,8 +1,8 @@ ENV = 'development' # 接口地址 -VUE_APP_BASE_API = 'http://localhost:8011' -VUE_APP_WS_API = 'ws://localhost:8011' +VUE_APP_BASE_API = 'http://localhost:8012' +VUE_APP_WS_API = 'ws://localhost:8012' # 是否启用 babel-plugin-dynamic-import-node插件 VUE_CLI_BABEL_TRANSPILE_MODULES = true diff --git a/acs2/nladmin-ui/dist.zip b/acs2/nladmin-ui/dist.zip index 7383c79f8..6ec00622e 100644 Binary files a/acs2/nladmin-ui/dist.zip and b/acs2/nladmin-ui/dist.zip differ diff --git a/acs2/nladmin-ui/public/config.js b/acs2/nladmin-ui/public/config.js index 4f5976990..7e53e8eb6 100644 --- a/acs2/nladmin-ui/public/config.js +++ b/acs2/nladmin-ui/public/config.js @@ -1,6 +1,6 @@ window.g = { dev: { - VUE_APP_BASE_API: 'http://127.0.0.1:8011' + VUE_APP_BASE_API: 'http://127.0.0.1:8012' }, prod: { VUE_APP_BASE_API: 'http://10.1.3.96:8011' diff --git a/acs2/nladmin-ui/src/views/acs/device/config.vue b/acs2/nladmin-ui/src/views/acs/device/config.vue index b7b45ad04..7111003f6 100644 --- a/acs2/nladmin-ui/src/views/acs/device/config.vue +++ b/acs2/nladmin-ui/src/views/acs/device/config.vue @@ -74,6 +74,9 @@ import crud from '@/mixins/crud' import { get, selectDriverCodeList } from '@/api/acs/device/driverConfig' import { getDicts } from '@/views/system/dict/dict' import standard_autodoor from '@/views/acs/device/driver/standard_autodoor' +import air_shower_door from '@/views/acs/device/driver/air_shower_door' +import fast_door from '@/views/acs/device/driver/fast_door' +import lift_door from '@/views/acs/device/driver/lift_door' import standard_inspect_site from './driver/standard_inspect_site' import ranging_stations from './driver/ranging_stations' import standard_ordinary_site from './driver/standard_ordinary_site' @@ -144,6 +147,9 @@ export default { name: 'DeviceConfig', components: { standard_autodoor, + air_shower_door, + fast_door, + lift_door, standard_ordinary_site, standard_inspect_site, standard_storage, diff --git a/acs2/nladmin-ui/src/views/acs/device/driver/air_shower_door.vue b/acs2/nladmin-ui/src/views/acs/device/driver/air_shower_door.vue new file mode 100644 index 000000000..527895b09 --- /dev/null +++ b/acs2/nladmin-ui/src/views/acs/device/driver/air_shower_door.vue @@ -0,0 +1,413 @@ + + + + + diff --git a/acs2/nladmin-ui/src/views/acs/device/driver/fast_door.vue b/acs2/nladmin-ui/src/views/acs/device/driver/fast_door.vue new file mode 100644 index 000000000..de72cb598 --- /dev/null +++ b/acs2/nladmin-ui/src/views/acs/device/driver/fast_door.vue @@ -0,0 +1,413 @@ +fast_door + + + + diff --git a/acs2/nladmin-ui/src/views/acs/device/driver/lift_door.vue b/acs2/nladmin-ui/src/views/acs/device/driver/lift_door.vue new file mode 100644 index 000000000..b9366cbaf --- /dev/null +++ b/acs2/nladmin-ui/src/views/acs/device/driver/lift_door.vue @@ -0,0 +1,413 @@ + + + + + diff --git a/lms2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml b/lms2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml index b40c4f9ad..ac11cb5d0 100644 --- a/lms2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml +++ b/lms2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml @@ -7,7 +7,7 @@ nl: ip: 127.0.0.1 port: 3306 username: root - password: 12356 + password: 123456 database: ldnx_lms2 redis: ip: 127.0.0.1