diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java index 7c74d4e71..ce04c7aef 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java @@ -1,22 +1,21 @@ 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_conveyor.box_subvolumes_conveyor.BoxSubvolumesConveyorDeviceDriver; -import org.nl.acs.device_driver.one_manipulator.box_storage_manipulator.BoxStorageManipulatorDeviceDriver; import org.nl.acs.device_driver.two_conveyor.manipulator_agv_station.ManipulatorAgvStationDeviceDriver; 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.acs.task.enums.ActionTypeEnum; +import org.nl.acs.task.enums.AgvSystemTypeEnum; import org.nl.common.exception.BadRequestException; +import org.nl.config.lucene.service.LuceneExecuteLogService; +import org.nl.config.lucene.service.dto.LuceneLogDto; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; @@ -40,6 +39,9 @@ public class AgvWaitUtil { @Autowired private DeviceAppService deviceAppService; + @Autowired + private LuceneExecuteLogService luceneExecuteLogService; + //取货前等待 public JSONObject waitInGet(String startDeviceCode, Instruction inst) { log.info("仙工AGV请求取货,设备号 - {}", startDeviceCode); @@ -47,18 +49,57 @@ public class AgvWaitUtil { ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver; BoxSubvolumesConveyorDeviceDriver boxSubvolumesConveyorDeviceDriver; //agv诺宝对接位安全信号交互 - if(startDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver){ + if (startDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver(); - manipulatorAgvStationDeviceDriver.writing(2); - if(manipulatorAgvStationDeviceDriver.getAction() != 1){ - throw new BadRequestException("上位系统不允许取货"); + if (manipulatorAgvStationDeviceDriver.getTo_command() != 2) { + manipulatorAgvStationDeviceDriver.writing(2); } + if (manipulatorAgvStationDeviceDriver.getAction() == 1) { + LuceneLogDto logDto1 = LuceneLogDto.builder() + .device_code(inst.getCarno()) + .content("诺宝agv允许取货" + "点位" + startDeviceCode) + .build(); + logDto1.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto1); + JSONObject map = new JSONObject(); + map.put("status", 200); + map.put("message", "允许取货!"); + log.info("允许仙工AGV取货,设备号 - {}", startDeviceCode); + return map; + } else { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(inst.getCarno()) + .content("agv诺宝对接位行架不允许取货:" + inst.getCarno() + "点位号" + manipulatorAgvStationDeviceDriver.getDevice_code()) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + throw new BadRequestException("行架不允许取货"); + } + } //agv叉车对接位安全信号交互 - if(startDevice.getDeviceDriver() instanceof BoxSubvolumesConveyorDeviceDriver){ + if (startDevice.getDeviceDriver() instanceof BoxSubvolumesConveyorDeviceDriver) { boxSubvolumesConveyorDeviceDriver = (BoxSubvolumesConveyorDeviceDriver) startDevice.getDeviceDriver(); - if(boxSubvolumesConveyorDeviceDriver.getMode() != 2){ + if (boxSubvolumesConveyorDeviceDriver.getMode() == 2) { + LuceneLogDto logDto1 = LuceneLogDto.builder() + .device_code(inst.getCarno()) + .content("叉车允许取货") + .build(); + logDto1.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto1); + JSONObject map = new JSONObject(); + map.put("status", 200); + map.put("message", "允许取货!"); + log.info("允许仙工AGV取货,设备号 - {}", startDeviceCode); + return map; + } else { + LuceneLogDto logDto1 = LuceneLogDto.builder() + .device_code(inst.getCarno()) + .content("agv叉车对接位输送线不允许取货:" + inst.getCarno() + "点位号" + boxSubvolumesConveyorDeviceDriver.getDevice_code()) + .build(); + logDto1.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto1); throw new BadRequestException("上位系统不允许取货"); } } @@ -74,6 +115,29 @@ public class AgvWaitUtil { log.info("仙工AGV取货完成后请求离开,设备号 - {}", startDeviceCode); inst.setExecute_status("2"); instructionService.update(inst); + //如果是叉车,取货完成给输送线完成信号 + Device startDevice = deviceAppService.findDeviceByCode(startDeviceCode); + ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver; + if (inst.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())) { + if (startDevice.getDeviceDriver() instanceof BoxSubvolumesConveyorDeviceDriver) { + BoxSubvolumesConveyorDeviceDriver boxSubvolumesConveyorDeviceDriver; + boxSubvolumesConveyorDeviceDriver = (BoxSubvolumesConveyorDeviceDriver) startDevice.getDeviceDriver(); + if (boxSubvolumesConveyorDeviceDriver.getTo_command() != 3) { + boxSubvolumesConveyorDeviceDriver.writing(3); + } + } + } + //诺宝agv调lms更新点位 + if (inst.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) { + applyLmsGetOut(inst); + if (startDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { + manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver(); + if (manipulatorAgvStationDeviceDriver.getTo_command() != 3) { + manipulatorAgvStationDeviceDriver.writing(3); + } + } + + } JSONObject map = new JSONObject(); map.put("status", 200); map.put("message", "允许离开!"); @@ -81,19 +145,68 @@ public class AgvWaitUtil { return map; } + private void applyLmsGetOut(Instruction inst) { + try { + JSONObject param = new JSONObject(); + param.put("taskCode", inst.getTask_code()); + param.put("actionType", ActionTypeEnum.IN_FINISHING.getCode().toString()); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(inst.getCarno()) + .content("诺宝取货完成请求lms:" + inst.getTask_code() + "--" + ActionTypeEnum.IN_FINISHING.getCode().toString()) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + String response = acsToWmsService.secondaryAllocationPoint(param); + JSONObject jo = JSON.parseObject(response); + if (jo.getInteger("status") == 200) { + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code(inst.getCarno()) + .content("诺宝取货完成请求lms,参数,接口返回:" + jo) + .build(); + logDto2.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto2); + } else { + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code(inst.getCarno()) + .content("追加动诺宝作块失败,返回参数:" + jo.getString("body")) + .build(); + logDto2.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto2); + throw new BadRequestException("追加动诺宝作块返回失败"); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + //放货前等待 public JSONObject waitInPut(String endDeviceCode, Instruction inst) { log.info("仙工AGV请求放货,设备号 - {}", endDeviceCode); Device endDevice = deviceAppService.findDeviceByCode(endDeviceCode); ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver; - if(endDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver){ + if (endDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) endDevice.getDeviceDriver(); - manipulatorAgvStationDeviceDriver.writing(2); - if(manipulatorAgvStationDeviceDriver.getAction() != 1){ + if (manipulatorAgvStationDeviceDriver.getTo_command() != 4) { + manipulatorAgvStationDeviceDriver.writing(4); + } + if (manipulatorAgvStationDeviceDriver.getAction() != 1) { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(inst.getCarno()) + .content("agv诺宝对接位行架不允许放货:" + inst.getCarno() + "点位号" + manipulatorAgvStationDeviceDriver.getDevice_code()) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); log.info("不允许仙工AGV取货,对接位有报警,设备号 - {}", endDevice); throw new BadRequestException("上位系统不允许取货"); } + } + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(inst.getCarno()) + .content("允许放货" + "点位" + endDeviceCode) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); JSONObject map = new JSONObject(); map.put("status", 200); map.put("message", "允许放货!"); @@ -104,6 +217,17 @@ public class AgvWaitUtil { //放货完成等待 public JSONObject waitOutPut(String endDeviceCode, Instruction inst) { + Device nextDevice = deviceAppService.findDeviceByCode(endDeviceCode); + ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver; + if (inst.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) { + if (nextDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { + manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) nextDevice.getDeviceDriver(); + if (manipulatorAgvStationDeviceDriver.getTo_command() != 5) { + manipulatorAgvStationDeviceDriver.writing(5); + } + } + + } log.info("仙工AGV放货完成后请求离开,设备号 - {}", endDeviceCode); inst.setExecute_status("2"); instructionService.update(inst); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/QueryAGVStatus.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/QueryAGVStatus.java index a754c6ce6..b30688d40 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/QueryAGVStatus.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/QueryAGVStatus.java @@ -13,7 +13,10 @@ import lombok.extern.slf4j.Slf4j; import org.nl.acs.AcsConfig; import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.service.InstructionService; +import org.nl.acs.task.domain.Task; import org.nl.acs.task.enums.AgvSystemTypeEnum; +import org.nl.acs.task.service.TaskService; +import org.nl.acs.task.service.dto.TaskDto; import org.nl.config.SpringContextHolder; import org.nl.system.service.param.ISysParamService; import org.springframework.stereotype.Component; @@ -30,6 +33,7 @@ public class QueryAGVStatus { public void run() { InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); + TaskService taskService = SpringContextHolder.getBean(TaskService.class); ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class); List allInstFromCache = instructionService.findAllInstFromCache(); List agvInstruction = allInstFromCache.stream().filter(item -> AgvSystemTypeEnum.One_NDC_System_Type.getIndex().equals(item.getAgv_system_type()) || AgvSystemTypeEnum.XG_System_Type.getIndex().equals(item.getAgv_system_type())).collect(Collectors.toList()); @@ -59,9 +63,16 @@ public class QueryAGVStatus { // 等待=WAITING //执行中 String state = json.getString("state"); + String carNo = json.getString("vehicle"); if ("RUNNING".equals(state) || "CREATED".equals(state) || "TOBEDISPATCHED".equals(state) || "WAITING".equals(state)) { instruction.setInstruction_status("1"); + instruction.setCarno(carNo); + TaskDto task = new TaskDto(); instructionService.update(instruction); + task.setCarno(carNo); + task.setTask_id(instruction.getTask_id()); + instructionService.update(instruction); + taskService.update(task); } else if ("FINISHED".equals(state)) { instruction.setInstruction_status("2"); try { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/NDCAgvService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/NDCAgvService.java index d94524c3e..59adfc9a8 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/NDCAgvService.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/NDCAgvService.java @@ -62,7 +62,7 @@ public interface NDCAgvService { * @param result * @return */ - public byte[] sendAgvTwoModeInst(int phase, int index, int result,int offset,int quantity); + /*public byte[] sendAgvTwoModeInst(int phase, int index, int result,int offset,int quantity);*/ /** * 下发一号agv指令 diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java index a28a12359..4e96ed7b2 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java @@ -336,7 +336,7 @@ public class NDCAgvServiceImpl implements NDCAgvService { return b; } - @Override + /*@Override public byte[] sendAgvTwoModeInst(int phase, int index, int result,int offset,int quantity) { if (phase < 0 || index < 0) return null; @@ -368,7 +368,7 @@ public class NDCAgvServiceImpl implements NDCAgvService { System.out.println("反馈agv动作数据:" + Bytes2HexString(b)); return b; - } + }*/ @Override diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java index ce0f3a873..c08f6dca4 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java @@ -8,6 +8,7 @@ import cn.hutool.http.HttpResponse; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import jodd.util.StringUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.acs.AcsConfig; @@ -18,6 +19,7 @@ import org.nl.acs.agv.server.dto.AgvDto; import org.nl.acs.angle.service.IAcsPointAngleService; import org.nl.acs.common.base.CommonFinalParam; import org.nl.acs.device.domain.Device; +import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.service.InstructionService; @@ -27,6 +29,8 @@ import org.nl.acs.device.enums.DeviceType; import org.nl.acs.task.enums.ActionTypeEnum; import org.nl.acs.task.enums.AgvActionTypeEnum; import org.nl.acs.task.enums.AgvSystemTypeEnum; +import org.nl.acs.task.service.TaskService; +import org.nl.acs.task.service.dto.TaskDto; import org.nl.common.exception.BadRequestException; import org.nl.config.language.LangProcess; import org.nl.config.lucene.service.LuceneExecuteLogService; @@ -56,8 +60,14 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { @Autowired private InstructionService instructionService; + @Autowired + private TaskService taskserver; + @Autowired private LuceneExecuteLogService luceneExecuteLogService; + @Autowired + private DeviceAppService deviceAppservice; + @Autowired private AgvWaitUtil agvWaitUtil; @@ -336,10 +346,18 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { //动作块id jo.put("blockId", IdUtil.simpleUUID()); //目的地名称 - jo.put("location", pointCode + "INGET"); + if (AgvActionTypeEnum.IN_STOCK.getCode().equals(agv_action_type) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(agv_action_type)) { + jo.put("location", pointCode + "WAIT"); + } else { + jo.put("location", pointCode + "INGET"); + } //执行脚本 jo.put("operation", "script"); - jo.put("id", pointCode + "INGET"); + if (AgvActionTypeEnum.IN_STOCK.getCode().equals(agv_action_type) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(agv_action_type)) { + jo.put("id", pointCode + "WAIT"); + } else { + jo.put("id", pointCode + "INGET"); + } //通信脚本,动作前后与现场设备交互的场景 jo.put("script_name", "userpy/interact.py"); JSONObject script_args = new JSONObject(); @@ -348,7 +366,11 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { JSONObject data = new JSONObject(); JSONObject reach = new JSONObject(); reach.put("task_code", instCode); - reach.put("address", pointCode + "INGET"); + if (AgvActionTypeEnum.IN_STOCK.getCode().equals(agv_action_type) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(agv_action_type)) { + reach.put("address", pointCode + "WAIT"); + } else { + reach.put("address", pointCode + "INGET"); + } data.put("reach", reach); script_args.put("data", data); script_args.put("protocol", "HTTP"); @@ -361,12 +383,8 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { jo1.put("blockId", IdUtil.simpleUUID()); jo1.put("location", pointCode); jo1.put("operation", "JackLoad"); - jo1.put("operationArgs", new JSONObject() {{ - put("recognize", true); - }}); + inspectInStocckSet(pointCode, jo1); ja.add(jo1); - - JSONObject jo2 = new JSONObject(); jo2.put("blockId", IdUtil.simpleUUID()); jo2.put("location", pointCode + "OUTGET"); @@ -387,6 +405,27 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { } } + private void inspectInStocckSet(String pointCode, JSONObject jo1) { + Device device = deviceAppservice.findDeviceByCode(pointCode); + StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; + if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { + String inspectInStocck = (String) device.getExtraValue().get("inspect_in_stocck"); + if (StrUtil.isNotEmpty(inspectInStocck) && inspectInStocck.equals("true")) { + jo1.put("operationArgs", new JSONObject() {{ + put("recognize", false); + }}); + } else { + jo1.put("operationArgs", new JSONObject() {{ + put("recognize", true); + }}); + } + } else { + jo1.put("operationArgs", new JSONObject() {{ + put("recognize", true); + }}); + } + } + /** * 下发放货信号 * @@ -403,16 +442,28 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { //放货前等待 JSONObject jo3 = new JSONObject(); jo3.put("blockId", IdUtil.simpleUUID()); - jo3.put("location", pointCode + "INPUT"); + if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(agv_action_type) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(agv_action_type)) { + jo3.put("location", pointCode + "WAIT"); + } else { + jo3.put("location", pointCode + "INPUT"); + } jo3.put("operation", "script"); - jo3.put("id", pointCode + "INPUT"); + if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(agv_action_type) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(agv_action_type)) { + jo3.put("id", pointCode + "WAIT"); + } else { + jo3.put("id", pointCode + "INPUT"); + } jo3.put("script_name", "userpy/interact.py"); JSONObject script_args3 = new JSONObject(); script_args3.put("addr", addr); JSONObject data3 = new JSONObject(); JSONObject reach3 = new JSONObject(); reach3.put("task_code", instCode); - reach3.put("address", pointCode + "INPUT"); + if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(agv_action_type) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(agv_action_type)) { + reach3.put("address", pointCode + "WAIT"); + } else { + reach3.put("address", pointCode + "INPUT"); + } data3.put("reach", reach3); script_args3.put("data", data3); script_args3.put("protocol", "HTTP"); @@ -695,35 +746,72 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { if (StrUtil.isBlank(address)) { throw new BadRequestException("请求失败,地址为空!"); } - if (address.contains("IN")) { - String instructionCode = instructionDto.getInstruction_code(); - String deviceCodeNow = address.substring(0, address.length() - 5); + if (address.contains("IN") || address.contains("WAIT")) { + String task_code = instructionDto.getTask_code(); + String deviceCodeNow; + if (address.contains("WAIT")) { + deviceCodeNow = address.substring(0, address.length() - 4); + } else { + deviceCodeNow = address.substring(0, address.length() - 5); + } if (ObjectUtil.isEmpty(deviceAppService.findDeviceByCode(deviceCodeNow))) { throw new BadRequestException("设备号 " + deviceCodeNow + " 不存在!"); } - if (address.contains("GET")) { - if (instructionDto.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) { - //如果是取货二次分配,取放货二次分配需要重新追加动作块 - if (AgvActionTypeEnum.IN_STOCK.getCode().equals(instructionDto.getAgv_action_type()) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { - Integer actionType = ActionTypeEnum.IN_STOCK.getCode(); - deviceCodeNow = applyXGAgvTask(instructionCode, actionType, instructionDto); - } - } else if (instructionDto.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())) { + //一楼诺宝agv + if (instructionDto.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) { + if (address.contains("GET")) { + return agvWaitUtil.waitInGet(deviceCodeNow, instructionDto); + } else if (address.contains("PUT")) { + return agvWaitUtil.waitInPut(deviceCodeNow, instructionDto); } - return agvWaitUtil.waitInGet(deviceCodeNow, instructionDto); - } else if (address.contains("PUT")) { - if (instructionDto.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) { - //如果是放货二次分配,取放货二次分配需要重新追加动作块 - if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type()) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { - Integer actionType = ActionTypeEnum.OUT_STOCK.getCode(); - deviceCodeNow = applyXGAgvTask(instructionCode, actionType, instructionDto); - } - } else if (instructionDto.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())) { + //如果是取货二次分配,取放货二次分配需要重新追加动作块 + if (AgvActionTypeEnum.IN_STOCK.getCode().equals(instructionDto.getAgv_action_type()) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { + Integer actionType = ActionTypeEnum.IN_STOCK.getCode(); + String newPointCode = applyXGAgvTask(task_code, actionType, instructionDto); + log.info("取货二次分配追加诺宝成功,新点位 - {}", newPointCode); + JSONObject map = new JSONObject(); + map.put("status", 200); + map.put("message", "取货二次分配追加诺宝成功!"); + return map; + } + //如果是放货二次分配,取放货二次分配需要重新追加动作块 + if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type()) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { Integer actionType = ActionTypeEnum.OUT_STOCK.getCode(); - deviceCodeNow = applyCCAgvTask(instructionCode, actionType, instructionDto); + String newPointCode = applyXGAgvTask(task_code, actionType, instructionDto); +// sendAddSequencesToNBAgv(instructionDto.getInstruction_code(), deviceCodeNow, instructionDto); + log.info("放货二次分配追加诺宝成功,新点位 - {}", newPointCode); + JSONObject map = new JSONObject(); + map.put("status", 200); + map.put("message", "放货二次分配追加诺宝成功!"); + return map; + } + } + //一楼叉车 + if (instructionDto.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())) { + if (address.contains("GET")) { + //取货前等待 + return agvWaitUtil.waitInGet(deviceCodeNow, instructionDto); + } else { + //放货前二次分配 + if (address.contains("WAIT")) { + String newPointCode = applyCCAgvTask(task_code, instructionDto); + LuceneLogDto logDto = LuceneLogDto.builder() + .content("叉车允许放货" + "新点位:" + newPointCode) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + JSONObject map = new JSONObject(); + map.put("status", 200); + map.put("message", "允许叉车放货!" + "点位" + newPointCode); + log.info("允许仙工AGV放货,设备号 - {}", newPointCode); + return map; + } + //放货前等待 + if (address.contains("PUT")) { + return agvWaitUtil.waitInPut(deviceCodeNow, instructionDto); + } } - return agvWaitUtil.waitInPut(deviceCodeNow, instructionDto); } } if (address.contains("OUT")) { @@ -733,47 +821,57 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { } if (address.contains("GET")) { - return agvWaitUtil.waitOutGet(deviceCodeNow, instructionDto); + //取货完成 + JSONObject jsonObject = agvWaitUtil.waitOutGet(deviceCodeNow, instructionDto); + if (StringUtil.equals("200",jsonObject.getString("status"))){ + log.info("仙工AGV取货完成后离开,设备号 - {}", deviceCodeNow); + return jsonObject; + } } else if (address.contains("PUT")) { - return agvWaitUtil.waitOutPut(deviceCodeNow, instructionDto); + //放货完成 + JSONObject jsonObject = agvWaitUtil.waitOutPut(deviceCodeNow, instructionDto); + if (StringUtil.equals("200",jsonObject.getString("status"))){ + log.info("仙工AGV放货完成后离开,设备号 - {}", deviceCodeNow); + return jsonObject; + } + } } throw new BadRequestException("请求失败,IN OUT 站点错误!"); } - private String applyCCAgvTask(String instructionCode, Integer actionType, Instruction instructionDto) { + private String applyCCAgvTask(String task_code, Instruction instructionDto) { try { JSONObject param = new JSONObject(); - param.put("taskCode", instructionCode); - param.put("actionType", actionType.toString()); + param.put("task_code", task_code); LuceneLogDto logDto = LuceneLogDto.builder() - .device_code("追加动叉车作块:") - .content("追加动叉车作块,参数:" + instructionCode + "--" + actionType) + .device_code(instructionDto.getCarno()) + .content("叉车二次分配请求lms,参数:" + task_code) .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); - String response = acsToWmsService.secondaryAllocationPoint(param); + String response = acsToWmsService.applySendOutTwo(param); JSONObject jo = JSON.parseObject(response); if (jo.getInteger("status") == 200) { LuceneLogDto logDto2 = LuceneLogDto.builder() - .device_code("追加动叉车作块:") - .content("追加动叉车作块,参数,接口返回:" + jo) + .device_code(instructionDto.getCarno()) + .content("叉车二次分配请求lms,参数,接口返回:" + jo) .build(); logDto2.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto2); //请求成功调用叉车追加动作块 - sendAddSequencesToCCAgv(instructionCode, jo.getString("data"), instructionDto); + sendAddSequencesToCCAgv(instructionDto.getInstruction_code(), jo.getString("data"), instructionDto); return jo.getString("data"); } else { LuceneLogDto logDto2 = LuceneLogDto.builder() - .device_code("追加动叉车作块:") - .content("追加动叉车作块失败,返回参数:" + jo.getString("body")) + .device_code(instructionDto.getCarno()) + .content("叉车二次分配请求lms失败,返回参数:" + jo.getString("message")) .build(); logDto2.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto2); - throw new BadRequestException("追加动叉车作块返回失败"); + throw new BadRequestException("叉车二次分配请求lms返回失败"); } } catch (Exception e) { e.printStackTrace(); @@ -788,14 +886,15 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { jo.put("id", instructionCode); //动作块 jo.put("blocks", createBlocksDataTowCCStart(nextPoint)); - + //追加订单封口 + jo.put("complete", true); LuceneLogDto logDto = LuceneLogDto.builder() - .device_code("追加诺宝运单") - .content("指令号:" + instructionCode + ",追加诺宝运单参数:" + jo) + .device_code("追加叉车运单") + .content("指令号:" + instructionCode + ",追加叉车运单参数:" + jo) .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); - log.info("任务号:{},指令号{},追加诺宝运单:{}", instructionCode, instructionCode, jo); + log.info("任务号:{},指令号{},追加诺宝叉车运单:{}", instructionCode, instructionCode, jo); if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) { String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); @@ -811,12 +910,12 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { .timeout(20000) .execute(); LuceneLogDto logDto1 = LuceneLogDto.builder() - .device_code("叉车运单响应") - .content("指令号:" + instructionCode + ",下发追加诺宝运单反馈参数:" + jo) + .device_code("叉车追加运单响应") + .content("指令号:" + instructionCode + ",下发追加诺宝叉车运单反馈参数:" + jo) .build(); - logDto.setLog_level(4); + logDto1.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto1); - log.info("指令号{},状态{},下发追加诺宝运单序列反馈:{}", instructionCode, result.getStatus(), result.body()); + log.info("指令号{},状态{},下发追加叉车运单序列反馈:{}", instructionCode, result.getStatus(), result.body()); } @@ -856,14 +955,14 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { } } - private String applyXGAgvTask(String instructionCode, Integer actionType, Instruction instructionDto) { + private String applyXGAgvTask(String task_code, Integer actionType, Instruction instructionDto) { try { JSONObject param = new JSONObject(); - param.put("taskCode", instructionCode); + param.put("taskCode", task_code); param.put("actionType", actionType.toString()); LuceneLogDto logDto = LuceneLogDto.builder() - .device_code("追加动诺宝作块:") - .content("追加动诺宝作块,参数:" + instructionCode + "--" + actionType) + .device_code(instructionDto.getCarno()) + .content("二次分配请求lms,参数:" + task_code + "--" + actionType) .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -871,25 +970,27 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { JSONObject jo = JSON.parseObject(response); if (jo.getInteger("status") == 200) { LuceneLogDto logDto2 = LuceneLogDto.builder() - .device_code("追加动诺宝作块:") - .content("追加动诺宝作块,参数,接口返回:" + jo) + .device_code(instructionDto.getCarno()) + .content("二次分配请求lms,参数,接口返回:" + jo) .build(); logDto2.setLog_level(4); + //二次分配更新点位 + updataTask(instructionDto, jo.getString("data")); luceneExecuteLogService.deviceExecuteLog(logDto2); if (!ActionTypeEnum.IN_FINISHING.getCode().equals(actionType)) { //请求成功调用诺宝追加动作块 - sendAddSequencesToNBAgv(instructionCode, jo.getString("data"), instructionDto); + sendAddSequencesToNBAgv(instructionDto.getInstruction_code(), jo.getString("data"), instructionDto); } return jo.getString("data"); } else { LuceneLogDto logDto2 = LuceneLogDto.builder() - .device_code("追加动诺宝作块:") - .content("追加动诺宝作块失败,返回参数:" + jo.getString("body")) + .device_code(instructionDto.getCarno()) + .content("二次分配请求lms,返回参数:" + jo.getString("body")) .build(); logDto2.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto2); - throw new BadRequestException("追加动诺宝作块返回失败"); + throw new BadRequestException("二次分配请求lms返回失败"); } } catch (Exception e) { e.printStackTrace(); @@ -898,13 +999,32 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { return null; } + private void updataTask(Instruction instructionDto, String newPoint) { + + TaskDto taskUpdate = new TaskDto(); + if (AgvActionTypeEnum.IN_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { + instructionDto.setStart_point_code(newPoint); + taskUpdate.setStart_point_code(newPoint); + instructionDto.setStart_device_code(newPoint); + taskUpdate.setStart_device_code(newPoint); + } + if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { + instructionDto.setNext_point_code(newPoint); + taskUpdate.setNext_point_code(newPoint); + instructionDto.setNext_device_code(newPoint); + taskUpdate.setNext_device_code(newPoint); + } + taskUpdate.setTask_id(instructionDto.getTask_id()); + instructionService.update(instructionDto); + taskserver.update(taskUpdate); + } + @Override public HttpResponse sendOrderSequencesToForklift(Instruction inst, InteractionJsonDTO interactionJsonDTO) { com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject(); jo.put("id", inst.getInstruction_code()); //运单封口,true=创建运单之后不可添加动作块;false=创建运单可以添加动作块 - //运单封口,true=创建运单之后不可添加动作块;false=创建运单可以添加动作块 if (AgvActionTypeEnum.ORDINARY.getCode().equals(inst.getAgv_action_type())) { jo.put("complete", true); } else { @@ -967,6 +1087,8 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type()) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { jo.put("blocks", createBlocksDataTowEnd(instructionCode, point, instructionDto)); } + //追加订单封口 + jo.put("complete", true); LuceneLogDto logDto = LuceneLogDto.builder() .device_code("追加诺宝运单") .content("指令号:" + instructionCode + ",追加诺宝运单参数:" + jo) @@ -989,10 +1111,10 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { .timeout(20000) .execute(); LuceneLogDto logDto1 = LuceneLogDto.builder() - .device_code("叉车运单响应") + .device_code("追加诺宝运单参数") .content("指令号:" + instructionCode + ",下发追加诺宝运单反馈参数:" + jo) .build(); - logDto.setLog_level(4); + logDto1.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto1); log.info("指令号{},状态{},下发追加诺宝运单序列反馈:{}", instructionCode, result.getStatus(), result.body()); @@ -1001,14 +1123,32 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { private Object createBlocksDataTowEnd(String instructionCode, String point, Instruction instructionDto) { JSONArray ja = new JSONArray(); - String nextDeviceCode = instructionDto.getNext_device_code(); //终点2 - sendEndDeviceOrder3(ja, nextDeviceCode, instructionCode, instructionDto); + sendEndDeviceOrder3(ja, point, instructionCode, instructionDto); return ja; } private void sendEndDeviceOrder3(JSONArray ja, String nextDeviceCode, String instructionCode, Instruction instructionDto) { + JSONObject jo3 = new JSONObject(); + jo3.put("blockId", IdUtil.simpleUUID()); + jo3.put("location", nextDeviceCode + "INPUT"); + jo3.put("operation", "script"); + jo3.put("id", nextDeviceCode + "INPUT"); + jo3.put("script_name", "userpy/interact.py"); + JSONObject script_args3 = new JSONObject(); + script_args3.put("addr", addr); + JSONObject data3 = new JSONObject(); + JSONObject reach3 = new JSONObject(); + reach3.put("task_code", instructionCode); + reach3.put("address", nextDeviceCode + "INPUT"); + data3.put("reach", reach3); + script_args3.put("data", data3); + script_args3.put("protocol", "HTTP"); + jo3.put("script_args", script_args3); + ja.add(jo3); + + //将货物放下 com.alibaba.fastjson.JSONObject jo4 = new com.alibaba.fastjson.JSONObject(); jo4.put("blockId", IdUtil.simpleUUID()); @@ -1041,7 +1181,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { JSONArray ja = new JSONArray(); String nextDeviceCode = instructionDto.getNext_device_code(); //起点2 - sendStartDeviceOrder2(ja, startPoint, instructionCode); + sendStartDeviceOrder2(ja, startPoint, instructionCode, instructionDto); //终点2 sendEndDeviceOrder2(ja, nextDeviceCode, instructionCode, instructionDto); return ja; @@ -1049,25 +1189,25 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { } private void sendEndDeviceOrder2(JSONArray ja, String nextDeviceCode, String instructionCode, Instruction instructionDto) { - //放货前等待 - JSONObject jo3 = new JSONObject(); - jo3.put("blockId", IdUtil.simpleUUID()); - jo3.put("location", nextDeviceCode + "INPUT"); - jo3.put("operation", "script"); - jo3.put("id", nextDeviceCode + "INPUT"); - jo3.put("script_name", "userpy/interact.py"); - JSONObject script_args3 = new JSONObject(); - script_args3.put("addr", addr); - JSONObject data3 = new JSONObject(); - JSONObject reach3 = new JSONObject(); - reach3.put("task_code", instructionCode); - reach3.put("address", nextDeviceCode + "INPUT"); - data3.put("reach", reach3); - script_args3.put("data", data3); - script_args3.put("protocol", "HTTP"); - jo3.put("script_args", script_args3); - ja.add(jo3); if (AgvActionTypeEnum.IN_STOCK.getCode().equals(instructionDto.getAgv_action_type())) { + //放货前等待 + JSONObject jo3 = new JSONObject(); + jo3.put("blockId", IdUtil.simpleUUID()); + jo3.put("location", nextDeviceCode + "INPUT"); + jo3.put("operation", "script"); + jo3.put("id", nextDeviceCode + "INPUT"); + jo3.put("script_name", "userpy/interact.py"); + JSONObject script_args3 = new JSONObject(); + script_args3.put("addr", addr); + JSONObject data3 = new JSONObject(); + JSONObject reach3 = new JSONObject(); + reach3.put("task_code", instructionCode); + reach3.put("address", nextDeviceCode + "INPUT"); + data3.put("reach", reach3); + script_args3.put("data", data3); + script_args3.put("protocol", "HTTP"); + jo3.put("script_args", script_args3); + ja.add(jo3); //将货物放下 com.alibaba.fastjson.JSONObject jo4 = new com.alibaba.fastjson.JSONObject(); jo4.put("blockId", IdUtil.simpleUUID()); @@ -1095,18 +1235,39 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { } } - private void sendStartDeviceOrder2(JSONArray ja, String startPoint, String instructionCode) { + private void sendStartDeviceOrder2(JSONArray ja, String startPoint, String instructionCode, Instruction instructionDto) { + //取货前等待 + JSONObject jo = new JSONObject(); + //动作块id + jo.put("blockId", IdUtil.simpleUUID()); + //目的地名称 + jo.put("location", startPoint + "INGET"); + //执行脚本 + jo.put("operation", "script"); + jo.put("id", startPoint + "INGET"); + //通信脚本,动作前后与现场设备交互的场景 + jo.put("script_name", "userpy/interact.py"); + JSONObject script_args = new JSONObject(); + //更改为现场设备IP及PORT + script_args.put("addr", addr); + JSONObject data = new JSONObject(); + JSONObject reach = new JSONObject(); + reach.put("task_code", instructionCode); + reach.put("address", startPoint + "INGET"); + data.put("reach", reach); + script_args.put("data", data); + script_args.put("protocol", "HTTP"); + jo.put("script_args", script_args); + ja.add(jo); + + //将货物顶起来,机器识别提升高度 JSONObject jo1 = new JSONObject(); jo1.put("blockId", IdUtil.simpleUUID()); jo1.put("location", startPoint); jo1.put("operation", "JackLoad"); - jo1.put("operationArgs", new JSONObject() {{ - put("recognize", true); - }}); + inspectInStocckSet(startPoint, jo1); ja.add(jo1); - - JSONObject jo2 = new JSONObject(); jo2.put("blockId", IdUtil.simpleUUID()); jo2.put("location", startPoint + "OUTGET"); @@ -1346,16 +1507,16 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { JSONObject jo9 = new JSONObject(); jo9.put("blockId", IdUtil.simpleUUID()); - jo9.put("location", pointCode + "INPUT"); + jo9.put("location", inst.getNext_device_code() + "WAIT"); jo9.put("operation", "script"); - jo9.put("id", pointCode + "INPUT"); + jo9.put("id", inst.getNext_device_code() + "WAIT"); jo9.put("script_name", "userpy/interact.py"); JSONObject script_args5 = new JSONObject(); script_args5.put("addr", addr); JSONObject data3 = new JSONObject(); JSONObject reach3 = new JSONObject(); reach3.put("task_code", inst.getInstruction_code()); - reach3.put("address", pointCode + "INPUT"); + reach3.put("address", inst.getNext_device_code() + "WAIT"); data3.put("reach", reach3); script_args5.put("data", data3); script_args5.put("protocol", "HTTP"); 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 52656158c..af398b9e6 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 @@ -1,5 +1,6 @@ package org.nl.acs.auto.run; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import lombok.extern.slf4j.Slf4j; @@ -10,6 +11,8 @@ import org.nl.acs.device.service.DeviceService; import org.nl.acs.device_driver.agv.ndcone.AgvNdcOneDeviceDriver; import org.nl.acs.device_driver.agv.ndctwo.AgvNdcTwoDeviceDriver; import org.nl.acs.device_driver.autodoor.standard_autodoor.StandardAutodoorDeviceDriver; +import org.nl.acs.device_driver.conveyor.standard_inspect_site.StandardInspectSiteDeviceDriver; +import org.nl.acs.device_driver.two_conveyor.oven_manipulator.OvenGantryManipulatorDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; import org.nl.acs.instruction.domain.Instruction; @@ -27,9 +30,13 @@ import org.springframework.stereotype.Component; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; +import java.lang.reflect.Field; import java.net.InetSocketAddress; import java.net.Socket; import java.util.Date; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString; @@ -52,6 +59,11 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { boolean bConnected = true; boolean isReConnect = false; + int i = 1 ; + boolean requireSucessRegion = false; + boolean requireSucessTake = false; + boolean requireSucessPut = false; + @Autowired ISysParamService paramService; @@ -195,7 +207,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { if (agvDevice.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) { agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) agvDevice.getDeviceDriver(); agvNdcTwoDeviceDriver.setInstruction(null); - }else if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) { + } else if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) { agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) device.getDeviceDriver(); agvNdcOneDeviceDriver.setInstruction(null); } @@ -231,20 +243,49 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { if (ObjectUtil.isNotEmpty(device)) { if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); - try { - standardAutodoorDeviceDriver.writing("to_open", "1"); - standardAutodoorDeviceDriver.writing("to_close", "0"); - } catch (Exception e) { - log.info("下发电气信号失败:" + e.getMessage()); - e.printStackTrace(); +// String region = (String) standardAutodoorDeviceDriver.getDevice().getExtraValue().get("region"); +// if (StrUtil.isNotEmpty(region) && !(" ".equals(region))) { +// String linkDeviceCode = (String) standardAutodoorDeviceDriver.getDevice().getExtraValue().get("link_device_code"); +// Device deviceByCode = deviceAppService.findDeviceByCode(linkDeviceCode); +// if (ObjectUtil.isNotEmpty(deviceByCode) && deviceByCode.getDeviceDriver() instanceof OvenGantryManipulatorDeviceDriver) { +// OvenGantryManipulatorDeviceDriver hxhj = (OvenGantryManipulatorDeviceDriver) deviceByCode.getDeviceDriver(); +// String s = Integer.parseInt(region) == 1 ? "one" : Integer.parseInt(region) == 2 ? +// "two" : Integer.parseInt(region) == 3 ? "three" : null; +// Class aClass = hxhj.getClass(); +// String regionCode = "region_" + s; +// String s1 = Integer.parseInt(region) == 1 ? "2" : Integer.parseInt(region) == 2 ? +// "6" : Integer.parseInt(region) == 3 ? "8" : null; +// if (StrUtil.isNotEmpty(s) && ((Integer) aClass.getField(regionCode).get(hxhj) == 0)) { +// hxhj.writing("to_"+regionCode, s1); +// log.info("下发AGV进入区域{}信号值为:{}", region, s1); +// } else { +// log.info("区域{}信号{}未清除,导致不满足下发AGV进入区域信号", region, regionCode); +// } +// if (hxhj.getMode() == 2 && StrUtil.isNotEmpty(s1) && ((Integer) aClass.getField(regionCode).get(hxhj) == 2)) { +// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); +// requireSucessRegion = true; +// } else { +// log.error("AGV进入区域{}信号{}行架未接收{},请检查;或行架正在执行中:{}", region, regionCode,s1, hxhj.getMode()); +// } +// } else { +// log.error("未设置关联设备或关联的不是烘箱行架设备{}导致信号未反馈", linkDeviceCode); +// } +// } else { + try { + standardAutodoorDeviceDriver.writing("to_open", "1"); + standardAutodoorDeviceDriver.writing("to_close", "0"); + } catch (Exception e) { + log.info("下发电气信号失败:" + e.getMessage()); + e.printStackTrace(); + } + if (standardAutodoorDeviceDriver.getOpen() == 1 && standardAutodoorDeviceDriver.getToOpen() == 1) { + log.info("下发开门信号值为:{},下发关门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getToClose()); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + } else { + log.info("未下发NDC信号原因: 下发开门信号值为:{},下发关门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getToClose()); + } } - if (standardAutodoorDeviceDriver.getOpen() == 1 && standardAutodoorDeviceDriver.getToOpen() == 1 ) { - log.info("下发开门信号值为:{},下发关门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getToClose()); - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - }else { - log.info("未下发NDC信号原因: 下发开门信号值为:{},下发关门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getToClose()); - } - } +// } } else { log.info(agvaddr + "对应设备号为空!"); } @@ -257,19 +298,50 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { if (ObjectUtil.isNotEmpty(device)) { if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); - try { - standardAutodoorDeviceDriver.writing("to_close", "1"); - standardAutodoorDeviceDriver.writing("to_open", "0"); - } catch (Exception e) { - log.info("下发电气信号失败:" + e.getMessage()); - e.printStackTrace(); +// String region = (String) standardAutodoorDeviceDriver.getDevice().getExtraValue().get("region"); +// if (StrUtil.isNotEmpty(region) && !(" ".equals(region))) { +// String linkDeviceCode = (String) standardAutodoorDeviceDriver.getDevice().getExtraValue().get("link_device_code"); +// if(requireSucessTake || requireSucessPut){ +// Device deviceByCode = deviceAppService.findDeviceByCode(linkDeviceCode); +// if (ObjectUtil.isNotEmpty(deviceByCode) && deviceByCode.getDeviceDriver() instanceof OvenGantryManipulatorDeviceDriver) { +// OvenGantryManipulatorDeviceDriver hxhj = (OvenGantryManipulatorDeviceDriver) deviceByCode.getDeviceDriver(); +// String s = Integer.parseInt(region) == 1 ? "one" : Integer.parseInt(region) == 2 ? +// "two" : Integer.parseInt(region) == 3 ? "three" : null; +// Class aClass = hxhj.getClass(); +// String regionCode = "region_" + s; +// if (StrUtil.isNotEmpty(s) && ((Integer) aClass.getField(regionCode).get(hxhj) != 0)) { +// hxhj.writing("to_"+regionCode, "0"); +// log.info("下发AGV离开区域{}信号值为:{}", region, 0); +// } else { +// log.info("区域{}信号{}为0,不需要下发AGV离开区域信号", region, regionCode); +// } +// if (hxhj.getMode() == 2 && ((Integer) aClass.getField(regionCode).get(hxhj) == 0)) { +// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); +// requireSucessPut = false; +// requireSucessTake = false; +// } else { +// log.error("AGV离开区域{}信号{}行架未接收0,请检查;或行架正在执行中:{}", region, regionCode, hxhj.getMode()); +// } +// } else { +// log.error("未设置关联设备或关联的不是烘箱行架设备{}导致信号未反馈", linkDeviceCode); +// } +// }else{ +// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); +// } +// } else { + try { + standardAutodoorDeviceDriver.writing("to_close", "1"); + standardAutodoorDeviceDriver.writing("to_open", "0"); + } catch (Exception e) { + log.info("下发电气信号失败:" + e.getMessage()); + e.printStackTrace(); + } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } +// } } else { log.info(device_code + "对应设备号为空!"); } - } else { //上报异常信息 //(不需要WCS反馈) @@ -283,6 +355,13 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { if (device.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) { agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) device.getDeviceDriver(); agvNdcTwoDeviceDriver.processSocket(arr); + if(phase == 0x05 && "3".equals(inst.getInstruction_type()) && requireSucessRegion){ + requireSucessPut = true; + requireSucessRegion = false; + }else if(phase == 0x0E && "8".equals(inst.getInstruction_type()) && requireSucessRegion){ + requireSucessTake = true; + requireSucessRegion = false; + } } else if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) { agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) device.getDeviceDriver(); agvNdcOneDeviceDriver.processSocket(arr); @@ -298,12 +377,10 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { if (!ObjectUtil.isEmpty(data)) { write(data); } - } else { System.out.println("agv上报不是0073类型动作,不处理"); } } - } catch (Exception e) { 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 d122e90d4..be5499a15 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 @@ -23,6 +23,7 @@ import org.nl.acs.device_driver.storage.standard_storage.StandardStorageDeviceDr 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.device_driver.two_conveyor.oven_manipulator.OvenGantryManipulatorDeviceDriver; import org.nl.acs.device_driver.two_conveyor.ranging_stations.RangingStationsDeviceDriver; import org.nl.acs.device_driver.two_conveyor.waste_foil_weighing_station.WasteFoilWeighingStationDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; @@ -44,11 +45,14 @@ import org.nl.config.language.LangProcess; import org.nl.config.lucene.enums.LogTypeEnum; import org.nl.config.lucene.service.LuceneExecuteLogService; import org.nl.config.lucene.service.dto.LuceneLogDto; +import org.nl.config.thread.ThreadPoolExecutorUtil; import org.nl.system.service.param.ISysParamService; import org.nl.config.SpringContextHolder; +import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; +import java.util.concurrent.ThreadPoolExecutor; /** @@ -69,6 +73,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class); DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class); LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class); + final ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll(); TwoAgvPhase twoAgvPhase = new TwoAgvPhase(); String error_code = "0"; @@ -130,7 +135,20 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic // message = "该指令号未找到对应指令:" + ikey; // logServer.deviceExecuteLog(this.device_code, "", "", "该指令号未找到对应指令:" + ikey); // return; + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("当前指令号为:" + inst.getInstruction_code()) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); task = taskService.findByTaskCode(inst.getTask_code()); + } else { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("指令号为空!") + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } @@ -184,7 +202,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic .device_code(device_code) .content("agvphase:" + "反馈:" + data) .build(); - logDto.setLog_level(2); + logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); } //到达取货点 @@ -220,7 +238,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic .device_code(device_code) .content(agvaddr + "对应设备号为空") .build(); - logDto.setLog_level(2); + logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); return; } @@ -242,19 +260,40 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic String task_code = standardOrdinarySiteDeviceDriver.getTask_code(); log.info("当前任务号{},创建任务号{}", task.getTask_code(), task_code); if (StrUtil.isEmpty(task_code) || !task_code.equals(task.getTask_code())) { - log.info("等待LMS系统进行确认允许取货,设备号{},指令号{},任务号{}", device_code, ikey, task.getTask_code()); - message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey; - logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("任务号为空") + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else { log.info("等待LMS系统进行确认允许取货,设备号{},指令号{}", device_code, ikey); message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey; logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); @@ -266,11 +305,47 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } if ((standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - } else { - message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction() - , standardInspectSiteDeviceDriver.getError(), ikey); + String region = (String) standardInspectSiteDeviceDriver.getDevice().getExtraValue().get("region"); + if (StrUtil.isNotEmpty(region) && !(" ".equals(region))) { + String linkDeviceCode = (String) standardInspectSiteDeviceDriver.getDevice().getExtraValue().get("link_device_code"); + Device deviceByCode = deviceAppService.findDeviceByCode(linkDeviceCode); + if (ObjectUtil.isNotEmpty(deviceByCode) && deviceByCode.getDeviceDriver() instanceof OvenGantryManipulatorDeviceDriver) { + OvenGantryManipulatorDeviceDriver hxhj = (OvenGantryManipulatorDeviceDriver) deviceByCode.getDeviceDriver(); + String s = Integer.parseInt(region) == 2 ? "one" : Integer.parseInt(region) == 6 ? + "two" : Integer.parseInt(region) == 8 ? "three" : null; + Class aClass = hxhj.getClass(); + String regionCode = "region_" + s; + if (StrUtil.isNotEmpty(s) && ((Integer) aClass.getField(regionCode).get(hxhj) == 0)) { + hxhj.writing("to_" + regionCode, region); + log.info("下发AGV进入区域{}信号值为:{}", s, region); + } else { + log.info("区域{}信号{}未清除,导致不满足下发AGV进入区域信号", s, regionCode); + } + if (hxhj.getMode() == 2 && StrUtil.isNotEmpty(region) && ((Integer) aClass.getField(regionCode).get(hxhj) == Integer.parseInt(region))) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + } else { + log.error("AGV进入区域{}信号{}行架未接收{},请检查;或行架正在执行中:{}", region, regionCode, Integer.parseInt(region), hxhj.getMode()); + } + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } + } else { + message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; + log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction() + , standardInspectSiteDeviceDriver.getError(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } } } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); @@ -281,10 +356,22 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); @@ -294,11 +381,23 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if (hongXiangStationDeviceDriver.getMove() > 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction() , hongXiangStationDeviceDriver.getError(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); @@ -309,13 +408,25 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } if (paperTubePickSiteDeviceDriver.getAction() == 1 && paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else { - message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; + message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() , paperTubePickSiteDeviceDriver.getError(), paperTubePickSiteDeviceDriver.getMode(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } - } else if (device.getDeviceDriver() instanceof RangingStationsDeviceDriver) { + }/* else if (device.getDeviceDriver() instanceof RangingStationsDeviceDriver) { rangingStationsDeviceDriver = (RangingStationsDeviceDriver) device.getDeviceDriver(); ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class); String device_code1 = device.getDevice_code(); @@ -328,56 +439,86 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic len2 = Float.parseFloat(length2); } if (len1 * len2 < 0) { - if (ObjectUtil.isNotEmpty(device_code1) && (('A') == (device_code1.charAt(device_code1.length()-1)))) { + if (ObjectUtil.isNotEmpty(device_code1) && (('A') == (device_code1.charAt(device_code1.length() - 1)))) { String offSet_A = paramService.findByCode(AcsConfig.OFFSET_A).getValue(); if (ObjectUtil.isNotEmpty(offSet_A) && !"null".equals(offSet_A)) { Integer integer = Integer.valueOf(offSet_A); len1 = len1 - integer; } - } else if (ObjectUtil.isNotEmpty(device_code1) && (('B') == (device_code1.charAt(device_code1.length()-1)))) { + } else if (ObjectUtil.isNotEmpty(device_code1) && (('B') == (device_code1.charAt(device_code1.length() - 1)))) { String offSet_B = paramService.findByCode(AcsConfig.OFFSET_B).getValue(); if (ObjectUtil.isNotEmpty(offSet_B) && !"null".equals(offSet_B)) { Integer integer = Integer.valueOf(offSet_B); len1 = integer + len1; } - }else{ + } else { log.info("{}设备名不符合条件,指令号{}", device_code, ikey); } int roundedNumber = ObjectUtil.isNotEmpty(len1) ? NumberUtil.round(len1, 0).intValue() : 0; if (roundedNumber == 0) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber); - } else if(roundedNumber > -50 || roundedNumber < 50){ + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } else if (roundedNumber > -50 || roundedNumber < 50) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber); - }else if(roundedNumber > 50 || roundedNumber < -50){ + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } else if (roundedNumber > 50 || roundedNumber < -50) { log.info("设备{},偏移数据超出范围导致未反馈{},指令号{}", device_code, roundedNumber, ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(device_code + "设备,偏移数据超出范围导致未反馈" + roundedNumber + "指令号" + ikey) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } - }else{ - log.info("设备{},偏移数据出错导致未反馈{},指令号{}", device_code, rangingStationsDeviceDriver.getLength1() + ","+ rangingStationsDeviceDriver.getLength2(), ikey); + } else { + log.info("设备{},偏移数据出错导致未反馈{},指令号{}", device_code, rangingStationsDeviceDriver.getLength1() + "," + rangingStationsDeviceDriver.getLength2(), ikey); } - } else if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) { + }*/ else if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) { wasteFoilWeighingStationDriver = (WasteFoilWeighingStationDriver) device.getDeviceDriver(); - if(wasteFoilWeighingStationDriver.getMove() == 1 && wasteFoilWeighingStationDriver.getAction() == 1 - && wasteFoilWeighingStationDriver.getError() == 0 && wasteFoilWeighingStationDriver.getMode() == 2){ + if (wasteFoilWeighingStationDriver.getMove() == 1 && wasteFoilWeighingStationDriver.getAction() == 1 + && wasteFoilWeighingStationDriver.getError() == 0 && wasteFoilWeighingStationDriver.getMode() == 2) { try { Map map = new LinkedHashMap<>(); map.put("to_command", "2"); wasteFoilWeighingStationDriver.writing(map); - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } catch (Exception e) { e.printStackTrace(); } - }else{ + } else { message = "设备号:" + device_code + "光电信号:" + wasteFoilWeighingStationDriver.getMove() + ",动作信号:" + wasteFoilWeighingStationDriver.getAction() + "报警信号:" + wasteFoilWeighingStationDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足取货条件,指令号{}", device_code, wasteFoilWeighingStationDriver.getMove(), wasteFoilWeighingStationDriver.getAction() , wasteFoilWeighingStationDriver.getError(), wasteFoilWeighingStationDriver.getMode(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) .content("agvphase:" + phase + "反馈:" + data) .build(); - logDto.setLog_level(2); + logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); } } @@ -419,7 +560,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic .device_code(device_code) .content("对应设备号为空" + device_code) .build(); - logDto.setLog_level(2); + logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); return; } @@ -438,25 +579,67 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic && StrUtil.equals("true", this.device.getExtraValue().get("wait").toString()) && StrUtil.equals(task.getTask_type(), "1")) { standardOrdinarySiteDeviceDriver.setOption(0); - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } + String task_code = inst.getTask_code(); + EXECUTOR.submit(() -> { + if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("feedbackToLms")) + && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("feedbackToLms").toString())) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("task_code", task_code); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(standardOrdinarySiteDeviceDriver.getDevice_code()) + .content("取货完成反馈:" + jsonObject.toJSONString() + ";设备:" + standardOrdinarySiteDeviceDriver.getDeviceCode()) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + acsToWmsService.actionFinishRequest2(jsonObject); + } + }); this.setPhase(phase); } 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, 0, 0); - } else { - message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); - } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + String task_code = inst.getTask_code(); + EXECUTOR.submit(() -> { + if (ObjectUtil.isNotEmpty(manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("feedbackToLms")) + && StrUtil.equals("true", manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("feedbackToLms").toString())) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("task_code", task_code); + LuceneLogDto logDto1 = LuceneLogDto.builder() + .device_code(manipulatorAgvStationDeviceDriver.getDevice_code()) + .content("取货完成反馈:" + jsonObject.toJSONString() + ";设备:" + manipulatorAgvStationDeviceDriver.getDeviceCode()) + .build(); + logDto1.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto1); + acsToWmsService.actionFinishRequest2(jsonObject); + } + }); } else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); try { @@ -465,11 +648,23 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if (hongXiangStationDeviceDriver.getMove() > 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction() , hongXiangStationDeviceDriver.getError(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); @@ -480,11 +675,23 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } if (paperTubePickSiteDeviceDriver.getAction() == 1 && paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else { - message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; + message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足取货完成反馈,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() , paperTubePickSiteDeviceDriver.getError(), paperTubePickSiteDeviceDriver.getMode(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); @@ -495,36 +702,84 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if ((standardInspectSiteDeviceDriver.getMove() != 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + String region = (String) standardInspectSiteDeviceDriver.getDevice().getExtraValue().get("region"); + if (StrUtil.isNotEmpty(region) && !(" ".equals(region))) { + String linkDeviceCode = (String) standardInspectSiteDeviceDriver.getDevice().getExtraValue().get("link_device_code"); + Device deviceByCode = deviceAppService.findDeviceByCode(linkDeviceCode); + if (ObjectUtil.isNotEmpty(deviceByCode) && deviceByCode.getDeviceDriver() instanceof OvenGantryManipulatorDeviceDriver) { + OvenGantryManipulatorDeviceDriver hxhj = (OvenGantryManipulatorDeviceDriver) deviceByCode.getDeviceDriver(); + String s = Integer.parseInt(region) == 2 ? "one" : Integer.parseInt(region) == 6 ? + "two" : Integer.parseInt(region) == 8 ? "three" : null; + Class aClass = hxhj.getClass(); + String regionCode = "region_" + s; + if (StrUtil.isNotEmpty(s) && ((Integer) aClass.getField(regionCode).get(hxhj) != 0)) { + hxhj.writing("to_"+regionCode, "0"); + log.info("下发AGV离开区域{}信号值为:{}", region, 0); + } else { + log.info("区域{}信号{}为0,不需要下发AGV离开区域信号", s, regionCode); + } + if (hxhj.getMode() == 2 && ((Integer) aClass.getField(regionCode).get(hxhj) == 0)) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + } else { + log.error("AGV离开区域{}信号{}行架未接收0,请检查;或行架正在执行中:{}", s, regionCode, hxhj.getMode()); + } + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } + } } else { message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction() , standardInspectSiteDeviceDriver.getError(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) { wasteFoilWeighingStationDriver = (WasteFoilWeighingStationDriver) device.getDeviceDriver(); - if(wasteFoilWeighingStationDriver.getMove() == 0 && wasteFoilWeighingStationDriver.getAction() == 1 - && wasteFoilWeighingStationDriver.getError() == 0 && wasteFoilWeighingStationDriver.getMode() == 2){ + if (wasteFoilWeighingStationDriver.getMove() == 0 && wasteFoilWeighingStationDriver.getAction() == 1 + && wasteFoilWeighingStationDriver.getError() == 0 && wasteFoilWeighingStationDriver.getMode() == 2) { try { Map map = new LinkedHashMap<>(); map.put("to_command", "3"); wasteFoilWeighingStationDriver.writing(map); - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } catch (Exception e) { e.printStackTrace(); } - }else{ + } else { message = "设备号:" + device_code + "光电信号:" + wasteFoilWeighingStationDriver.getMove() + ",动作信号:" + wasteFoilWeighingStationDriver.getAction() + "报警信号:" + wasteFoilWeighingStationDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足取货条件,指令号{}", device_code, wasteFoilWeighingStationDriver.getMove(), wasteFoilWeighingStationDriver.getAction() , wasteFoilWeighingStationDriver.getError(), wasteFoilWeighingStationDriver.getMode(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) .content("agvphase:" + phase + "反馈:" + data) .build(); - logDto.setLog_level(2); + logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); } } @@ -538,7 +793,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic .device_code(device_code) .content("agv地址参数有误,phase:" + phase) .build(); - logDto.setLog_level(2); + logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); return; } @@ -582,19 +837,40 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic String task_code = standardOrdinarySiteDeviceDriver.getTask_code(); log.info("当前任务号{},创建任务号{}", task.getTask_code(), task_code); if (StrUtil.isEmpty(task_code) || !task_code.equals(task.getTask_code())) { - log.info("等待LMS系统进行确认允许取货,设备号{},指令号{},任务号{}", device_code, ikey, task.getTask_code()); - message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey; - logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("任务号为空!") + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else { log.info("等待LMS系统进行确认允许取货,设备号{},指令号{}", device_code, ikey); message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey; logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code()); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); @@ -605,10 +881,22 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); @@ -619,11 +907,23 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } if (paperTubePickSiteDeviceDriver.getAction() == 1 && paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() , paperTubePickSiteDeviceDriver.getError(), paperTubePickSiteDeviceDriver.getMode(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); @@ -633,11 +933,23 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if (hongXiangStationDeviceDriver.getMove() > 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction() , hongXiangStationDeviceDriver.getError(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); @@ -648,13 +960,25 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if ((standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction() , standardInspectSiteDeviceDriver.getError(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } - } else if (device.getDeviceDriver() instanceof RangingStationsDeviceDriver) { + }/* else if (device.getDeviceDriver() instanceof RangingStationsDeviceDriver) { rangingStationsDeviceDriver = (RangingStationsDeviceDriver) device.getDeviceDriver(); ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class); String device_code1 = device.getDevice_code(); @@ -679,27 +1003,39 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic Integer integer = Integer.valueOf(offSet_B); len1 = integer + len1; } - }else{ + } else { log.info("{}设备名不符合条件,指令号{}", device_code, ikey); } int roundedNumber = ObjectUtil.isNotEmpty(len1) ? NumberUtil.round(len1, 0).intValue() : 0; if (roundedNumber == 0) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber); - } else if(roundedNumber > -50 || roundedNumber < 50){ + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } else if (roundedNumber > -50 || roundedNumber < 50) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber); - }else if(roundedNumber > 50 || roundedNumber < -50){ + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } else if (roundedNumber > 50 || roundedNumber < -50) { log.info("设备{},偏移数据超出范围导致未反馈{},指令号{}", device_code, roundedNumber, ikey); } - }else{ - log.info("设备{},偏移数据出错导致未反馈{},指令号{}", device_code, rangingStationsDeviceDriver.getLength1() + ","+ rangingStationsDeviceDriver.getLength2(), ikey); + } else { + log.info("设备{},偏移数据出错导致未反馈{},指令号{}", device_code, rangingStationsDeviceDriver.getLength1() + "," + rangingStationsDeviceDriver.getLength2(), ikey); } - } else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + }*/ else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) .content("agvphase:" + phase + "反馈:" + data) .build(); - logDto.setLog_level(2); + logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); } } @@ -715,7 +1051,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic .device_code(device_code) .content("agv地址参数有误,phase:" + phase) .build(); - logDto.setLog_level(2); + logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); return; } @@ -752,11 +1088,24 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic standardOrdinarySiteDeviceDriver.setOption(0); } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); standardOrdinarySiteDeviceDriver.setAgvphase(phase); standardOrdinarySiteDeviceDriver.setIndex(index); standardOrdinarySiteDeviceDriver.setInst(inst); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); try { @@ -766,10 +1115,22 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } if (hongXiangStationDeviceDriver.getMove() == 0) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction() , hongXiangStationDeviceDriver.getError(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); @@ -779,12 +1140,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } 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); - } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); try { @@ -795,10 +1157,22 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic if (paperTubePickSiteDeviceDriver.getAction() == 1 && paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else { - message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; + message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() , paperTubePickSiteDeviceDriver.getError(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); @@ -810,10 +1184,22 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } if ((standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction() , standardInspectSiteDeviceDriver.getError(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); @@ -821,7 +1207,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic .device_code(device_code) .content("agvphase:" + phase + "反馈:" + data) .build(); - logDto.setLog_level(2); + logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); } } @@ -842,6 +1228,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic if (ObjectUtil.isNotEmpty(task)) { logServer.deviceExecuteLog(this.device_code, "", "", "上报满卷重量,weight:" + weight); message = "上报满卷重量,weight:" + weight + ",指令号:" + ikey; + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); task.setWeight(String.valueOf(weight)); task.setCarno(this.device_code); taskService.update(task); @@ -851,7 +1243,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic .device_code(device_code) .content("agvphase:" + phase + "反馈:" + data) .build(); - logDto.setLog_level(2); + logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); } } @@ -866,7 +1258,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic .device_code(device_code) .content("agv地址参数有误,phase:" + phase) .build(); - logDto.setLog_level(2); + logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); return; } @@ -897,8 +1289,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); standardOrdinarySiteDeviceDriver.setAgvphase(phase); standardOrdinarySiteDeviceDriver.setIndex(index); standardOrdinarySiteDeviceDriver.setInst(inst); @@ -912,11 +1309,23 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } if (paperTubePickSiteDeviceDriver.getAction() == 1 && paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else { - message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; + message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足放货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() , paperTubePickSiteDeviceDriver.getError(), paperTubePickSiteDeviceDriver.getMode(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); @@ -927,10 +1336,22 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); @@ -940,23 +1361,47 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if (hongXiangStationDeviceDriver.getMove() == 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction() , hongXiangStationDeviceDriver.getError(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); standardInspectSiteDeviceDriver.writing(1); if ((standardInspectSiteDeviceDriver.getMove() == 0 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足放货条件"; log.info("设备{}当前光电信号{},动作信号{} ,报警信号{},不满足放货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction() , standardInspectSiteDeviceDriver.getError(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } - } else if (device.getDeviceDriver() instanceof RangingStationsDeviceDriver) { + }/* else if (device.getDeviceDriver() instanceof RangingStationsDeviceDriver) { rangingStationsDeviceDriver = (RangingStationsDeviceDriver) device.getDeviceDriver(); ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class); String device_code1 = device.getDevice_code(); @@ -981,39 +1426,69 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic Integer integer = Integer.valueOf(offSet_B); len1 = integer + len1; } - }else{ + } else { log.info("{}设备名不符合条件,指令号{}", device_code, ikey); } int roundedNumber = ObjectUtil.isNotEmpty(len1) ? NumberUtil.round(len1, 0).intValue() : 0; if (roundedNumber == 0) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber); - } else if(roundedNumber > -50 || roundedNumber < 50){ + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } else if (roundedNumber > -50 || roundedNumber < 50) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber); - }else if(roundedNumber > 50 || roundedNumber < -50){ + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } else if (roundedNumber > 50 || roundedNumber < -50) { log.info("设备{},偏移数据超出范围导致未反馈{},指令号{}", device_code, roundedNumber, ikey); } - }else{ - log.info("设备{},偏移数据出错导致未反馈{},指令号{}", device_code, rangingStationsDeviceDriver.getLength1() + ","+ rangingStationsDeviceDriver.getLength2(), ikey); + } else { + log.info("设备{},偏移数据出错导致未反馈{},指令号{}", device_code, rangingStationsDeviceDriver.getLength1() + "," + rangingStationsDeviceDriver.getLength2(), ikey); } - } else if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) { + }*/ else if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) { wasteFoilWeighingStationDriver = (WasteFoilWeighingStationDriver) device.getDeviceDriver(); - if(wasteFoilWeighingStationDriver.getMove() == 0 && wasteFoilWeighingStationDriver.getAction() == 1 - && wasteFoilWeighingStationDriver.getError() == 0 && wasteFoilWeighingStationDriver.getMode() == 2){ + if (wasteFoilWeighingStationDriver.getMove() == 0 && wasteFoilWeighingStationDriver.getAction() == 1 + && wasteFoilWeighingStationDriver.getError() == 0 && wasteFoilWeighingStationDriver.getMode() == 2) { try { Map map = new LinkedHashMap<>(); map.put("to_command", "4"); wasteFoilWeighingStationDriver.writing(map); - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } catch (Exception e) { e.printStackTrace(); } - }else{ + } else { message = "设备号:" + device_code + "光电信号:" + wasteFoilWeighingStationDriver.getMove() + ",动作信号:" + wasteFoilWeighingStationDriver.getAction() + "报警信号:" + wasteFoilWeighingStationDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足取货条件,指令号{}", device_code, wasteFoilWeighingStationDriver.getMove(), wasteFoilWeighingStationDriver.getAction() , wasteFoilWeighingStationDriver.getError(), wasteFoilWeighingStationDriver.getMode(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } //放货完成 @@ -1027,7 +1502,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic .device_code(device_code) .content("agv地址参数有误,phase:" + phase) .build(); - logDto.setLog_level(2); + logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); return; } @@ -1056,7 +1531,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic return; } if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { - standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); +// standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); // if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait")) // && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString()) // && StrUtil.equals(task.getTask_type(), "1")) { @@ -1071,7 +1546,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic // } else { // data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); // } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); this.setPhase(phase); } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); @@ -1081,12 +1562,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } catch (Exception e) { e.printStackTrace(); } - if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - } else { - message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; - log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); - } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); try { @@ -1095,53 +1577,141 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if (hongXiangStationDeviceDriver.getMove() > 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足放货完成反馈,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction() , hongXiangStationDeviceDriver.getError(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); try { - paperTubePickSiteDeviceDriver.writing(5); + TaskDto byTaskCode = taskService.findByTaskCode(inst.getTask_code()); + Map map = new HashMap(); + if (StrUtil.isNotEmpty(byTaskCode.getInteraction_json())) { + String interaction_json = byTaskCode.getInteraction_json(); + JSONObject jsonObject = JSONObject.parseObject(interaction_json); + String to_material = jsonObject.getString("to_material"); + String to_spec = jsonObject.getString("to_spec"); + String to_qty = jsonObject.getString("to_qty"); + map.put("to_command", 5); + map.put("to_material", to_material); + map.put("to_spec", to_spec); + map.put("to_qty", to_qty); + paperTubePickSiteDeviceDriver.writing(map); + } else { + map.put("to_command", 5); + paperTubePickSiteDeviceDriver.writing(map); + } } catch (Exception e) { e.printStackTrace(); } if (paperTubePickSiteDeviceDriver.getAction() == 1 && paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); paperTubePickSiteDeviceDriver.setFlag(3); } else { message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() , paperTubePickSiteDeviceDriver.getError(), paperTubePickSiteDeviceDriver.getMode(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); standardInspectSiteDeviceDriver.writing(0); if ((standardInspectSiteDeviceDriver.getMove() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + String region = (String) standardInspectSiteDeviceDriver.getDevice().getExtraValue().get("region"); + if (StrUtil.isNotEmpty(region) && !(" ".equals(region))) { + String linkDeviceCode = (String) standardInspectSiteDeviceDriver.getDevice().getExtraValue().get("link_device_code"); + Device deviceByCode = deviceAppService.findDeviceByCode(linkDeviceCode); + if (ObjectUtil.isNotEmpty(deviceByCode) && deviceByCode.getDeviceDriver() instanceof OvenGantryManipulatorDeviceDriver) { + OvenGantryManipulatorDeviceDriver hxhj = (OvenGantryManipulatorDeviceDriver) deviceByCode.getDeviceDriver(); + String s = Integer.parseInt(region) == 2 ? "one" : Integer.parseInt(region) == 6 ? + "two" : Integer.parseInt(region) == 8 ? "three" : null; + Class aClass = hxhj.getClass(); + String regionCode = "region_" + s; + if (StrUtil.isNotEmpty(s) && ((Integer) aClass.getField(regionCode).get(hxhj) != 0)) { + hxhj.writing("to_"+ regionCode, "0"); + log.info("下发AGV离开区域{}信号值为:{}", region, 0); + } else { + log.info("区域{}信号{}为0,不需要下发AGV离开区域信号", s, regionCode); + } + if (hxhj.getMode() == 2 && ((Integer) aClass.getField(regionCode).get(hxhj) == 0)) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + } else { + log.error("AGV离开区域{}信号{}行架未接收0,请检查;或行架正在执行中:{}", s, regionCode, hxhj.getMode()); + } + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } + } } } else if (device.getDeviceDriver() instanceof WasteFoilWeighingStationDriver) { wasteFoilWeighingStationDriver = (WasteFoilWeighingStationDriver) device.getDeviceDriver(); - if(wasteFoilWeighingStationDriver.getMove() == 1 && wasteFoilWeighingStationDriver.getAction() == 1 - && wasteFoilWeighingStationDriver.getError() == 0 && wasteFoilWeighingStationDriver.getMode() == 2){ + if (wasteFoilWeighingStationDriver.getMove() == 1 && wasteFoilWeighingStationDriver.getAction() == 1 + && wasteFoilWeighingStationDriver.getError() == 0 && wasteFoilWeighingStationDriver.getMode() == 2) { try { Map map = new LinkedHashMap<>(); map.put("to_command", "5"); wasteFoilWeighingStationDriver.writing(map); - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } catch (Exception e) { e.printStackTrace(); } - }else{ + } else { message = "设备号:" + device_code + "光电信号:" + wasteFoilWeighingStationDriver.getMove() + ",动作信号:" + wasteFoilWeighingStationDriver.getAction() + "报警信号:" + wasteFoilWeighingStationDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},设备状态{},不满足取货条件,指令号{}", device_code, wasteFoilWeighingStationDriver.getMove(), wasteFoilWeighingStationDriver.getAction() , wasteFoilWeighingStationDriver.getError(), wasteFoilWeighingStationDriver.getMode(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } //到达放货点 @@ -1155,7 +1725,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic .device_code(device_code) .content("agv地址参数有误,phase:" + phase) .build(); - logDto.setLog_level(2); + logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); return; } @@ -1186,7 +1756,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic String agv_inst_type = inst.getAgv_inst_type(); if (StrUtil.equals(agv_inst_type, CommonFinalParam.ONE) || StrUtil.equals(agv_inst_type, "3")) { if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { - standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); +// standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); // if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait")) // && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString()) // && StrUtil.equals(task.getTask_type(), "1")) { @@ -1201,7 +1771,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic // } else { // data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); // } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); this.setPhase(phase); } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { @@ -1213,10 +1789,22 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); @@ -1226,11 +1814,23 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if (hongXiangStationDeviceDriver.getMove() == 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction() , hongXiangStationDeviceDriver.getError(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); @@ -1241,13 +1841,25 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } if (paperTubePickSiteDeviceDriver.getAction() == 1 && paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() , paperTubePickSiteDeviceDriver.getError(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } - } else if (device.getDeviceDriver() instanceof RangingStationsDeviceDriver) { + }/* else if (device.getDeviceDriver() instanceof RangingStationsDeviceDriver) { rangingStationsDeviceDriver = (RangingStationsDeviceDriver) device.getDeviceDriver(); ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class); String device_code1 = device.getDevice_code(); @@ -1272,22 +1884,46 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic Integer integer = Integer.valueOf(offSet_B); len1 = integer + len1; } - }else{ + } else { log.info("{}设备名不符合条件,指令号{}", device_code, ikey); } int roundedNumber = ObjectUtil.isNotEmpty(len1) ? NumberUtil.round(len1, 0).intValue() : 0; if (roundedNumber == 0) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber); - } else if(roundedNumber > -50 || roundedNumber < 50){ + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } else if (roundedNumber > -50 || roundedNumber < 50) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber); - }else if(roundedNumber > 50 || roundedNumber < -50){ + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } else if (roundedNumber > 50 || roundedNumber < -50) { log.info("设备{},偏移数据超出范围导致未反馈{},指令号{}", device_code, roundedNumber, ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("设备" + device_code + "偏移数据超出范围导致未反馈" + roundedNumber + "指令号" + ikey) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } - }else{ - log.info("设备{},偏移数据出错导致未反馈{},指令号{}", device_code, rangingStationsDeviceDriver.getLength1() + ","+ rangingStationsDeviceDriver.getLength2(), ikey); + } else { + log.info("设备{},偏移数据出错导致未反馈{},指令号{}", device_code, rangingStationsDeviceDriver.getLength1() + "," + rangingStationsDeviceDriver.getLength2(), ikey); } - } else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + }*/ else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } } @@ -1302,7 +1938,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic .device_code(device_code) .content("agv地址参数有误,phase:" + phase) .build(); - logDto.setLog_level(2); + logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); return; } @@ -1333,7 +1969,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic String agv_inst_type = inst.getAgv_inst_type(); if (StrUtil.equals(agv_inst_type, CommonFinalParam.ONE) || StrUtil.equals(agv_inst_type, "3")) { if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { - standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); +// standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); // if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait")) // && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString()) // && StrUtil.equals(task.getTask_type(), "1")) { @@ -1349,22 +1985,28 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic // data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); // } data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); this.setPhase(phase); } 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); - } + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); try { @@ -1375,10 +2017,22 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic if (paperTubePickSiteDeviceDriver.getAction() == 1 && paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() , paperTubePickSiteDeviceDriver.getError(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); @@ -1389,13 +2043,31 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } if (hongXiangStationDeviceDriver.getMove() > 0) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else { message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction() , hongXiangStationDeviceDriver.getError(), ikey); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(message) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } } @@ -1403,18 +2075,48 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic else if (phase == 0x70) { //x坐标 x = ikey; + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "x坐标:" + x) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else if (phase == 0x71) { //y坐标 y = ikey; + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "y坐标:" + y) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else if (phase == 0x72) { //车辆角度 angle = ikey; + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "车辆角度:" + angle) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else if (phase == 0x73) { //agv电量 electric_qty = ikey; + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "agv电量:" + electric_qty) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } else if (phase == 0x74) { //三色灯状态 status = ikey; + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "三色灯状态:" + status) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); if (status != last_status && status != 6 && status != 7) { boolean flag = true; @@ -1441,15 +2143,31 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic last_status = status; } //进入区域(phase值) else if (phase == 0x50) { - + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "自动门开门") + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } //离开区域(phase值) else if (phase == 0x51) { - + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "自动门关门") + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } //上报异常信息 //(不需要WCS反馈) else if (phase == 0x67) { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("agvphase:" + phase + "异常信息:" + error) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); //故障信息 if (ikey == 0) { this.setErrorInfo(ikey, "0", "正常"); @@ -1482,7 +2200,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic .device_code(device_code) .content("agvphase:" + phase + "反馈:" + data) .build(); - logDto.setLog_level(2); + logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); // if (StrUtil.equals(inst.getAgv_system_type(), "2")) { // TwoNDCSocketConnectionAutoRun.write(data); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/box_manipulator_site/BoxManipulatorSiteDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/box_manipulator_site/BoxManipulatorSiteDeviceDriver.java index 2f13780ec..626608dea 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/box_manipulator_site/BoxManipulatorSiteDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/box_manipulator_site/BoxManipulatorSiteDeviceDriver.java @@ -240,7 +240,7 @@ public class BoxManipulatorSiteDeviceDriver extends AbstractOpcDeviceDriver impl } catch (Exception var17) { var17.printStackTrace(); - feedMessage = var17.getMessage(); + // feedMessage = var17.getMessage(); logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java index 04a1f0b95..283793348 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java @@ -209,6 +209,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements JSONObject led_message = null; + @Override public Device getDevice() { return this.device; @@ -237,12 +238,15 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements to_container_no = this.itemProtocol.getContainer_direction(); - if (move != last_move && move == 0 && last_move == 1) { + if (move != last_move) { requireSucess = false; clearWrite(); } if (move != 0 && task > 0) { + if (null!=inst) { + inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code(); + } CompletableFuture.runAsync(() -> { // 异步更新指令状态 try { @@ -368,7 +372,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements public void writing(int command) { String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.conveyor.standard_conveyor_control_with_scanner.ItemProtocol.item_to_command; + + "." + org.nl.acs.device_driver.conveyor.belt_conveyor.ItemProtocol.item_to_command; Map itemMap = new HashMap(); itemMap.put(to_command, command); this.control(itemMap); @@ -478,6 +482,14 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements } else { //查看是否存在输送线到对接为的指令 Instruction byNextDeviceCodeFromCache = instructionService.findByNextDeviceCodeFromCache(this.device_code); + if (ObjectUtil.isNotEmpty(byNextDeviceCodeFromCache)){ + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("存在堆垛机对接为的指令") + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } //补码生成堆垛机对接位到货架的指令 if (StrUtil.isNotEmpty(hand_barcode) && ObjectUtil.isEmpty(byNextDeviceCodeFromCache)) { TaskDto taskDtoHandCode = taskserver.findByVehicleCodeCodeAndReady(hand_barcode); @@ -593,12 +605,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements } else { next_point_code = next_device_code; } - //判断是否存在终点到达ddj对接位的指令(包含货架到达ddj对接位的指令、输送线到对接位的指令) - Instruction byNextDeviceCodeDDJ = instructionService.findByNextDeviceCodeFromCache(next_device_code); - if (ObjectUtil.isNotEmpty(byNextDeviceCodeDDJ)) { - this.setNotCreateInstMessage("universal_notCreateInstMessage5"); - return false; - } + //判断下一个输送线点位是否有货 BeltConveyorDeviceDriver beltConveyorDeviceDriver; //异常位到叠盘位 @@ -826,6 +833,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements jo.put("requireSucess", requireSucess); jo.put("hand_barcode", hand_barcode); jo.put("materiel", material_barcode); + jo.put("inst_message", this.inst_message); jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage)); return jo; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java index 8a30e9cc5..c0eba6b43 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java @@ -113,6 +113,11 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple * 申请搬运任务 */ private Boolean apply_handling = false; + + /** + * 忽略校验 + */ + private Boolean standard_ordinary_site = false; /** * 申请物料 */ diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator/standard_manipulator/BlankManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator/standard_manipulator/BlankManipulatorDeviceDriver.java index d7ad1df74..86cf129a7 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator/standard_manipulator/BlankManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator/standard_manipulator/BlankManipulatorDeviceDriver.java @@ -229,7 +229,7 @@ // // } catch (Exception var17) { // var17.printStackTrace(); -// feedMessage = var17.getMessage(); +// // feedMessage = var17.getMessage(); // logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.standardItemProtocol)); // // } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator/standard_manipulator/DryManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator/standard_manipulator/DryManipulatorDeviceDriver.java index 3f92e2a9f..770827595 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator/standard_manipulator/DryManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator/standard_manipulator/DryManipulatorDeviceDriver.java @@ -228,7 +228,7 @@ // // } catch (Exception var17) { // var17.printStackTrace(); -// feedMessage = var17.getMessage(); +// // feedMessage = var17.getMessage(); // logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.standardItemProtocol)); // // } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator/standard_manipulator/OvenGantryManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator/standard_manipulator/OvenGantryManipulatorDeviceDriver.java index 994fadc57..5238059e9 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator/standard_manipulator/OvenGantryManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/manipulator/standard_manipulator/OvenGantryManipulatorDeviceDriver.java @@ -234,7 +234,7 @@ // // } catch (Exception var17) { // var17.printStackTrace(); -// feedMessage = var17.getMessage(); +// // feedMessage = var17.getMessage(); // logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.standardItemProtocol)); // // } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java index 593383cda..1de443dc8 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java @@ -167,6 +167,7 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i String vehicle_code; String last_vehicle_code; + @Override public Device getDevice() { return this.device; @@ -199,7 +200,9 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i } if (move != 0 && task > 0) { - update_instruction_status(); + if (null!=inst) { + inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code(); + } update_instruction_status(); } } catch (Exception var17) { var17.printStackTrace(); @@ -217,7 +220,6 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i message = "脱机"; //有报警 - } else { this.setIsonline(true); this.setIserror(false); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDeviceDriver.java index 6dc8e9a3c..95fbef8db 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDeviceDriver.java @@ -184,6 +184,7 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i to_task = this.itemProtocol.getTo_task(); heartbeat = this.itemProtocol.getHeartbeat(); material_barcode = this.itemProtocol.getMaterialBarCode(); + // 更新指令状态 if (mode != last_mode) { JSONObject param = new JSONObject(); @@ -196,8 +197,9 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode); } if (move != 0 && task > 0) { - - update_instruction_status(); + if (null!=inst) { + inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code(); + } update_instruction_status(); } } catch (Exception var17) { var17.printStackTrace(); @@ -327,8 +329,12 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i JSONObject apply = new JSONObject(); apply.put("device_code", device_code); apply.put("vehicle_code", hand_barcode); - - String str = acsToWmsService.applyTaskToWms(apply); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("申请AGV任务,请求参数:" + apply) + .build(); + luceneExecuteLogService.deviceExecuteLog(logDto); + String str = acsToWmsService.applySendOutTwo(apply); JSONObject jo = JSON.parseObject(str); LuceneLogDto logDto2 = LuceneLogDto.builder() .device_code(device_code) @@ -344,12 +350,12 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i map.put("value", 19); list1.add(map); this.writing(list1); - LuceneLogDto logDto = LuceneLogDto.builder() + LuceneLogDto logDto1 = LuceneLogDto.builder() .device_code(device_code) .content("申请AGV任务,返回参数:" + jo.getString("body")) .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); + logDto1.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto1); requireSucess = true; } return; @@ -359,11 +365,20 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i apply.put("vehicle_code", material_barcode); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("申请AGV任务,请求参数:" + apply) + .build(); + luceneExecuteLogService.deviceExecuteLog(logDto); String str = acsToWmsService.applySendOutTwo(apply); logServer.deviceExecuteLog(this.device_code, "", "", "申请AGV任务,请求参数:" + apply + ",响应参数"); JSONObject jo = JSON.parseObject(str); - + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code(device_code) + .content("申请AGV任务,参数,接口返回:" + jo) + .build(); + luceneExecuteLogService.deviceExecuteLog(logDto2); message = "申请AGV任务,参数,接口返回:" + jo; if (jo.getInteger("status") == 200) { List list = new ArrayList(); @@ -401,10 +416,12 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i } public void writing(int command) { + String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor.ItemProtocol.item_to_command; Map itemMap = new HashMap(); + itemMap.put(to_command, command); this.control(itemMap); } - @Override public JSONObject getDeviceStatusName() { JSONObject jo = new JSONObject(); @@ -447,7 +464,7 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i jo.put("isError", this.getIserror()); jo.put("message", message); jo.put("hand_barcode", hand_barcode); - jo.put("barcode", this.getMove() == 0 ? null : checkInst() == null ? vehicle_code : checkInst().getVehicle_code()); + jo.put("material_barcode", material_barcode); jo.put("is_click", true); jo.put("requireSucess", requireSucess); jo.put("driver_type", "siemens_conveyor"); @@ -731,7 +748,6 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i this.instruction_update_time = date; inst = checkInst(); if (inst != null) { - inst_message = "当前指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code(); vehicle_code = inst.getVehicle_code(); task_code = inst.getTask_code(); if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java index ad2dbc819..01ee64eb8 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java @@ -199,7 +199,6 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr if (move != 0 && task > 0) { - update_instruction_status(); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/fold_disc_site/FoldDiscSiteDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/fold_disc_site/FoldDiscSiteDeviceDriver.java index 26a219819..ead7b4e15 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/fold_disc_site/FoldDiscSiteDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/fold_disc_site/FoldDiscSiteDeviceDriver.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.one_conveyor.fold_disc_site; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; @@ -204,7 +205,6 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements } catch (Exception var17) { var17.printStackTrace(); - feedMessage = var17.getMessage(); logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)); } @@ -385,6 +385,8 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements String route_plan_code = taskdto.getRoute_plan_code(); String next_device_code = ""; + + /** * 开始平均分配 */ @@ -414,6 +416,13 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements if (ObjectUtils.isEmpty(shortPathsList)) { throw new RuntimeException("路由不通!"); } + //判断有没有DDJ对接位出入库的指令 + List byCodeAndExcute = instructionService.findByCodeAndExcute(next_device_code); + if (CollUtil.isNotEmpty(byCodeAndExcute)){ + this.message="有DDJ对接位出入库的指令"; + requireSucess = false; + return true; + } Device startdevice = deviceAppservice.findDeviceByCode(start_device_code); Device nextdevice = deviceAppservice.findDeviceByCode(next_device_code); @@ -671,6 +680,7 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements jo.put("notCreateTaskMessage", notCreateTaskMessage); jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage)); jo.put("feedMessage", LangProcess.msg(feedMessage)); + jo.put("inst_message", this.inst_message); jo.put("driver_type", "siemens_conveyor"); jo.put("is_click", true); return jo; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java index 8132f0ff5..49d3e1b78 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.one_conveyor.scanner_weight_conveyor; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; @@ -25,6 +26,7 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.device_driver.led.led_screen.LedScreenDeviceDriver; import org.nl.acs.device_driver.one_manipulator.box_package_manipulator.InteractionJsonDTO; +import org.nl.acs.device_driver.stacker.standard_stacker.StandardStackerDeviceDriver; import org.nl.acs.enums.StorageTypeEnum; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.history.ErrorUtil; @@ -646,6 +648,9 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv if (StrUtil.isNotEmpty(hand_material_barcode)) { param.put("material_barcode", hand_material_barcode); } + if (mode == 7 && weight != 0){ + param.put("weight", weight); + } param.put("type", type); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) @@ -780,6 +785,13 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv String next_device_code = pathlist.get(start + 1); //判断有无出入库任务是相同路线 + //判断有没有DDJ对接位出入库的指令 + List byCodeAndExcute = instructionService.findByCodeAndExcute(next_device_code); + if (CollUtil.isNotEmpty(byCodeAndExcute)){ + this.message="有DDJ对接位出入库的指令"; + requireSucess = false; + return true; + } TaskDto dto = taskserver.findByCodeAndExcute(taskdto.getNext_device_code(), taskdto.getStart_device_code()); if (ObjectUtil.isNotEmpty(dto)) { requireSucess = false; @@ -1017,6 +1029,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv jo.put("feedMessage", LangProcess.msg(feedMessage)); jo.put("driver_type", "conveyor_with_scanner_weight"); jo.put("is_click", true); + jo.put("inst_message", this.inst_message); return jo; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/UnBoxLableConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/UnBoxLableConveyorDeviceDriver.java index a44f5d923..63259bcdd 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/UnBoxLableConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/UnBoxLableConveyorDeviceDriver.java @@ -202,6 +202,10 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl this.setIserror(true); message = "有报警"; } + inst = checkInst(); + if (inst != null) { + inst_message = "当前指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code(); + } Instruction instruction = instructionService.findByCode(String.valueOf(task)); //空箱出库开盖位,申请开盖 @@ -295,7 +299,7 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl String length = datas.getString("boxLength"); String weight = datas.getString("boxWidth"); String height = datas.getString("boxHigh"); - String desiccant = datas.getString("desiccantTemplat"); + String desiccant = datas.getString("desiccantTemplate"); List list = new ArrayList(); Map map4 = new HashMap(); map4.put("code", "to_length"); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/BoxPackageManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/BoxPackageManipulatorDeviceDriver.java index b437e7dd3..c608b2a05 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/BoxPackageManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/BoxPackageManipulatorDeviceDriver.java @@ -43,6 +43,7 @@ import org.nl.config.lucene.service.LuceneExecuteLogService; import org.nl.config.lucene.service.dto.LuceneLogDto; import java.util.*; +import java.util.stream.Collectors; /** * 装箱智能行架 @@ -86,6 +87,7 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i // y坐标 float y = 0.0f; float last_y = 0.0f; + String inst_message; int heartbeat = 0; int last_heartbeat = 0; @@ -188,6 +190,9 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } // 更新指令状态 if (mode == 3 && task > 0) { + if (null!=inst) { + inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code(); + } updateInstrction(); } @@ -336,8 +341,9 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i String startDeviceCode = getDeviceCodeList.get(i); //先查指令 List taskDtoInstruction = taskserver.queryTaskByDeviceCodeAndStatus2(startDeviceCode); - if (CollUtil.isNotEmpty(taskDtoInstruction)){ - TaskDto taskDtoIns = taskDtoInstruction.get(0); + List taskDtoStream = taskDtoInstruction.stream().sorted(Comparator.comparing(TaskDto::getCreate_time)).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(taskDtoStream)) { + TaskDto taskDtoIns = taskDtoStream.get(0); if (TaskTypeEnum.Truss_Task.getIndex().equals(taskDtoIns.getTask_type())) { Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDtoIns.getTask_code()); String interactionJson = taskDtoIns.getInteraction_json(); @@ -644,6 +650,7 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i jo.put("is_click", true); jo.put("x", x); jo.put("y", y); + jo.put("inst_message", this.inst_message); return jo; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java index 805c7e618..866f2ec9a 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java @@ -46,6 +46,7 @@ import org.nl.config.lucene.service.LuceneExecuteLogService; import org.nl.config.lucene.service.dto.LuceneLogDto; import java.util.*; +import java.util.stream.Collectors; /** * 木箱入库行架 @@ -106,6 +107,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i int branchProtocol = 0; private String error_type = "hxhj_error_type"; + String inst_message; //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 int flag; @@ -158,6 +160,9 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } // 更新指令状态 if (mode == 3 && task > 0 && !requireActionSucess) { + if (null!=inst) { + inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code(); + } updateInstructionStatus(); } @@ -302,8 +307,9 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i String startDeviceCode = getDeviceCodeList.get(i); //先查指令 List taskDtoInstruction = taskserver.queryTaskByDeviceCodeAndStatus2(startDeviceCode); - if (CollUtil.isNotEmpty(taskDtoInstruction)) { - TaskDto taskDtoIns = taskDtoInstruction.get(0); + List taskDtoStream = taskDtoInstruction.stream().sorted(Comparator.comparing(TaskDto::getCreate_time)).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(taskDtoStream)) { + TaskDto taskDtoIns = taskDtoStream.get(0); if (TaskTypeEnum.Truss_Task.getIndex().equals(taskDtoIns.getTask_type())) { Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDtoIns.getTask_code()); String interactionJson = taskDtoIns.getInteraction_json(); @@ -596,6 +602,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i jo.put("feedMessage", LangProcess.msg(feedMessage)); jo.put("driver_type", "box_storage_manipulator"); jo.put("is_click", true); + jo.put("inst_message", this.inst_message); return jo; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java index c0f1da0ba..2a4e902d2 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java @@ -47,6 +47,7 @@ import org.nl.config.lucene.service.LuceneExecuteLogService; import org.nl.config.lucene.service.dto.LuceneLogDto; import java.util.*; +import java.util.stream.Collectors; /** * 退货入库行架 @@ -141,6 +142,7 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i List getDeviceCodeList = null; List putDeviceCodeList = null; + String inst_message; @Override @@ -171,6 +173,9 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i // 更新指令状态 if (mode == 3 && task > 0) { + if (null!=inst) { + inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code(); + } updateInstructionStatus(); } @@ -319,8 +324,9 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i String startDeviceCode = getDeviceCodeList.get(i); //先查指令 List taskDtoInstruction = taskserver.queryTaskByDeviceCodeAndStatus2(startDeviceCode); - if (CollUtil.isNotEmpty(taskDtoInstruction)) { - TaskDto taskDtoIns = taskDtoInstruction.get(0); + List taskDtoStream = taskDtoInstruction.stream().sorted(Comparator.comparing(TaskDto::getCreate_time)).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(taskDtoStream)) { + TaskDto taskDtoIns = taskDtoStream.get(0); if (TaskTypeEnum.Truss_Task.getIndex().equals(taskDtoIns.getTask_type())) { Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDtoIns.getTask_code()); String interactionJson = taskDtoIns.getInteraction_json(); @@ -610,6 +616,7 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i jo.put("feedMessage", LangProcess.msg(feedMessage)); jo.put("driver_type", "siemens_conveyor"); jo.put("is_click", true); + jo.put("inst_message", this.inst_message); return jo; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java index 54ad24ca5..1956493ce 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java @@ -42,6 +42,8 @@ import org.nl.config.lucene.service.LuceneExecuteLogService; import org.nl.config.lucene.service.dto.LuceneLogDto; import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; /** * 捆扎智能行架 @@ -130,6 +132,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice String notCreateTaskMessage = ""; String notCreateInstMessage = ""; String feedMessage = ""; + String inst_message; List getDeviceCodeList = null; @@ -165,12 +168,15 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice } // 更新指令状态 if (mode == 3 && task > 0) { + if (null!=inst) { + inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code(); + } updateInstructionStatus(); } } catch (Exception var17) { var17.printStackTrace(); - feedMessage = var17.getMessage(); + // feedMessage = var17.getMessage(); logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)); } @@ -311,8 +317,9 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice String startDeviceCode = getDeviceCodeList.get(i); //先查指令 List taskDtoInstruction = taskserver.queryTaskByDeviceCodeAndStatus2(startDeviceCode); - if (CollUtil.isNotEmpty(taskDtoInstruction)) { - TaskDto taskDtoIns = taskDtoInstruction.get(0); + List taskDtoStream = taskDtoInstruction.stream().sorted(Comparator.comparing(TaskDto::getCreate_time)).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(taskDtoStream)) { + TaskDto taskDtoIns = taskDtoStream.get(0); if (TaskTypeEnum.Truss_Task.getIndex().equals(taskDtoIns.getTask_type())) { Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDtoIns.getTask_code()); String interactionJson = taskDtoIns.getInteraction_json(); @@ -353,8 +360,21 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice return true; } } else { - TaskDto taskDto = taskserver.findByStartCodeAndReady(startDeviceCode); - if (ObjectUtil.isNotEmpty(taskDto) && TaskTypeEnum.Truss_Task.getIndex().equals(taskDto.getTask_type())) { + List taskDtos = taskserver.findByTrappedManipulatorReady(); + List taskDtosReady = new ArrayList<>(); + TaskDto taskDto = null; + if (CollUtil.isNotEmpty(taskDtos)) { + for (TaskDto taskDto1 : taskDtos) { + if (getDeviceCodeList.contains(taskDto1.getStart_device_code())) { + taskDtosReady.add(taskDto1); + } + } + } + if (CollUtil.isNotEmpty(taskDtosReady)) { + List taskDtoList = taskDtosReady.stream().sorted(Comparator.comparing(TaskDto::getCreate_time)).collect(Collectors.toList()); + taskDto = taskDtoList.get(0); + } + if (ObjectUtil.isNotEmpty(taskDto)) { String interactionJson = taskDto.getInteraction_json(); InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class); String start_device_code = taskDto.getStart_device_code(); @@ -624,6 +644,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice jo.put("feedMessage", LangProcess.msg(feedMessage)); jo.put("driver_type", "siemens_conveyor"); jo.put("is_click", true); + jo.put("inst_message", this.inst_message); return jo; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/VolumeTwoManipulatorManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/VolumeTwoManipulatorManipulatorDeviceDriver.java index ab3919106..c67a73278 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/VolumeTwoManipulatorManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/VolumeTwoManipulatorManipulatorDeviceDriver.java @@ -46,6 +46,7 @@ import org.nl.config.lucene.service.LuceneExecuteLogService; import org.nl.config.lucene.service.dto.LuceneLogDto; import java.util.*; +import java.util.stream.Collectors; /** * 捆扎智能行架 @@ -151,6 +152,7 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi List getDeviceCodeList = null; List putDeviceCodeList = null; + String inst_message; @Override @@ -185,6 +187,9 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi } // 更新指令状态 if (mode == 3 && task > 0) { + if (null!=inst) { + inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code(); + } updateInstructionStatus(); } @@ -335,8 +340,9 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi String startDeviceCode = getDeviceCodeList.get(i); //先查指令 List taskDtoInstruction = taskserver.queryTaskByDeviceCodeAndStatus2(startDeviceCode); - if (CollUtil.isNotEmpty(taskDtoInstruction)) { - TaskDto taskDtoIns = taskDtoInstruction.get(0); + List taskDtoStream = taskDtoInstruction.stream().sorted(Comparator.comparing(TaskDto::getCreate_time)).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(taskDtoStream)) { + TaskDto taskDtoIns = taskDtoStream.get(0); if (TaskTypeEnum.Truss_Task.getIndex().equals(taskDtoIns.getTask_type())) { Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDtoIns.getTask_code()); String start_device_code = taskDtoIns.getStart_device_code(); @@ -641,6 +647,7 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi jo.put("feedMessage", LangProcess.msg(feedMessage)); jo.put("driver_type", "siemens_conveyor"); jo.put("is_click", true); + jo.put("inst_message", this.inst_message); return jo; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java index eac1a4d77..2fa014db7 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java @@ -45,10 +45,8 @@ import org.nl.config.lucene.service.LuceneExecuteLogService; import org.nl.config.lucene.service.dto.LuceneLogDto; import org.springframework.beans.factory.annotation.Autowired; -import java.time.LocalDateTime; import java.util.*; import java.util.regex.Pattern; -import java.util.stream.Collectors; /** * 单工位堆垛机驱动 @@ -292,6 +290,9 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme * 入库异常错误限制 */ Integer count = 0; + Boolean isonline = true; + + Boolean iserror = false; @Override @@ -332,7 +333,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme // 更新指令状态 - if (mode == 3 && task > 0 && command == 1) { + if (mode == 3 && task > 0 && command == 1 && error == 0) { Date date = new Date(); if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) { log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out); @@ -340,7 +341,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme } else { this.instruction_update_time = date; //更改指令状态 - if (task > 0) { + if (task > 0 && !Objects.equals(command, last_command)) { Instruction inst = checkInst(); if (inst != null) { if (StrUtil.equals(inst.getInstruction_status(), "0")) { @@ -360,21 +361,27 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme //不同任务限制清零 if (!Objects.equals(task, last_task)) { + this.isonline=true; count = 0; } - + if (mode == 0) { + this.setIsonline(false); + message = "universal_off"; + }else { + this.setIsonline(true); + } + if (error != 0) { + this.setIserror(true); + message = "universal_message3"; + } else { + this.setIserror(false); + } if (mode != 3 || requireSucess) { message = "one_message7"; } else { if (error != 0) { - Date date = new Date(); - if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out); - } else { - //满入空出或者浅货位阻挡 - erroBlock(); - } + erroBlock(); } List list = new ArrayList(); switch (command) { @@ -385,10 +392,23 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme } break; case 1: + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("取货中") + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); message = "universal_delivery"; + if (updateCommand("1")) break; break; case 2: + LuceneLogDto logDto1 = LuceneLogDto.builder() + .device_code(device_code) + .content("取货完成") + .build(); + logDto1.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto1); message = "universal_completed"; if (updateCommand("2")) break; Instruction instruction2 = checkInst(); @@ -406,7 +426,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme Pattern compile = Pattern.compile(pattern); Map map = new HashMap<>(); map.put("code", "to_y"); - map.put("value", inst.getTo_z()); + map.put("value", inst.getTo_z() ); list.add(map); if (inst.getTo_x().length() > 1 && !compile.matcher(inst.getTo_x()).matches()) { String substring = inst.getTo_x().substring(1); @@ -432,6 +452,12 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme requireSucess = false; break; case 3: + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code(device_code) + .content("放货") + .build(); + logDto2.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto2); message = "universal_releasing"; if (updateCommand("3")) break; break; @@ -459,6 +485,12 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme requireSucess = false; break; case 5: + LuceneLogDto logDto3 = LuceneLogDto.builder() + .device_code(device_code) + .content("放货完成") + .build(); + logDto3.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto3); message = "universal_releasing_completed"; Map map = new HashMap<>(); List list5 = new ArrayList(); @@ -473,9 +505,9 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme String start_device_code = errorInst.getStart_device_code(); Device startDevice = deviceAppService.findDeviceByCode(start_device_code); List listError = new ArrayList(); - pakageCommand(listError, "1", errorInst.getInstruction_code()); + pakageCommand(listError , errorInst.getInstruction_code()); if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.storage.name()) && !prohibitOutWarehouse) { - pakagePlc(errorInst, listError); + pakagePlc(errorInst, listError,"1"); } if (ObjectUtil.isNotEmpty(listError)) { this.writing(listError); @@ -551,13 +583,16 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme } - private void updateEXcuteMessage(String string) { + private void updateEXcuteMessage(String excuteMessage) { Instruction instruction0 = checkInst(); if (ObjectUtil.isEmpty(instruction0)) { message = "universal_message4"; } - instruction0.setExecute_message(string); - instructionService.update(instruction0); + if (!StrUtil.equals(instruction0.getExecute_code(), excuteMessage)) { + instruction0.setExecute_message(excuteMessage); + instructionService.update(instruction0); + } + } private static void packageDevicePoint(Device nextDevice, List list) { @@ -587,9 +622,12 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme message = "universal_message4"; return true; } - instruction0.setExecute_code(toCommand); - instructionService.update(instruction0); - return false; + if (!StrUtil.equals(instruction0.getExecute_code(), toCommand)) { + instruction0.setExecute_code(toCommand); + instructionService.update(instruction0); + return false; + } + return true; } @@ -656,7 +694,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); return; } else { - Instruction instruction = instructionService.findByCode(String.valueOf(task)); + Instruction instruction = checkInst(); if (ObjectUtil.isEmpty(instruction)) { message = "one_message9"; return; @@ -665,6 +703,12 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme param.put("task_code", instruction.getTask_code()); param.put("task_id", instruction.getTask_id()); param.put("type", type); + LuceneLogDto logDto1 = LuceneLogDto.builder() + .device_code(device_code) + .content("申请更新点位,参数:" + param) + .build(); + logDto1.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto1); String response = acsToWmsService.applyUpdatePointCode(param); JSONObject jo = JSON.parseObject(response); if (StrUtil.isNotEmpty(jo.getString("body")) || jo.getInteger("status") == 200) { @@ -677,6 +721,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme .build(); logDto2.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto2); + this.message = "申请更新点位,参数,接口返回:" + jo; String poinCode = jo.getString("point_code"); String vehicleCode = jo.getString("vehicle_code"); if (StrUtil.isNotEmpty(poinCode)) { @@ -720,6 +765,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme .build(); logDto2.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto2); + this.message = "申请更新点位,参数,接口返回:" + jo; } } } @@ -834,7 +880,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme return true; } }else { - message = "不是取货中或者取货完成报警"; + message = "one_message19"; } } //放货中报警 @@ -846,7 +892,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme return true; } }else { - message = "不是放货中报警"; + message = "one_message20"; } } //出库报警 @@ -860,7 +906,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme return true; } }else { - message = "不是取货中或者取货完成报警"; + message = "one_message19"; } //放货中报警 if ("3".equals(instructionErro.getExecute_code()) && forkCargo == 2) { @@ -873,7 +919,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme return true; } }else { - message = "不是放货中报警"; + message = "one_message20"; } } } @@ -947,15 +993,15 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) nextDevice.getDeviceDriver(); if (beltConveyorDeviceDriver.getMode() != 2 || beltConveyorDeviceDriver.getMove() != 0) { notCreateInstMessage = "未下发电气信号原因->输送线-货架对接位:" + beltConveyorDeviceDriver.getDevice_code() + - "无货或未联机,无法下发指令!指令号:" + inst.getInstruction_code(); + "有货或未联机,无法下发指令!指令号:" + inst.getInstruction_code(); return false; } } List list = new ArrayList(); - pakageCommand(list, "1", inst.getInstruction_code()); - packagePlcCoordinate(startDevice, list); + pakageCommand(list, inst.getInstruction_code()); + packagePlcCoordinate(startDevice, list,"1"); if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.storage.name()) && !prohibitOutWarehouse) { - pakagePlc(inst, list); + pakagePlc(inst, list,"1"); } if (ObjectUtil.isNotEmpty(list)) { this.writing(list); @@ -966,7 +1012,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme return true; } - private void packagePlcCoordinate(Device startDevice, List list) { + private void packagePlcCoordinate(Device startDevice, List list, String toCommand) { if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name()) && !prohibitInWarehouse) { if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("z"))) { HashMap map4 = new HashMap(); @@ -986,11 +1032,15 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme map6.put("value", startDevice.getExtraValue().get("y")); list.add(map6); } + HashMap map2 = new HashMap(); + map2.put("code", "to_command"); + map2.put("value", toCommand); + list.add(map2); } } - private void pakagePlc(Instruction inst, List list) { + private void pakagePlc(Instruction inst, List list, String toCommand) { HashMap map4 = new HashMap(); map4.put("code", "to_y"); map4.put("value", inst.getFrom_z()); @@ -1011,17 +1061,17 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme map7.put("code", "to_x"); map7.put("value", inst.getFrom_y()); list.add(map7); - } - - private void pakageCommand(List list, String toCommand, String inst) { - HashMap map1 = new HashMap(); - map1.put("code", "to_device_code"); - map1.put("value", this.getDevice().getAddress()); - list.add(map1); HashMap map2 = new HashMap(); map2.put("code", "to_command"); map2.put("value", toCommand); list.add(map2); + } + + private void pakageCommand(List list, String inst) { + HashMap map1 = new HashMap(); + map1.put("code", "to_device_code"); + map1.put("value", this.getDevice().getAddress()); + list.add(map1); HashMap map3 = new HashMap(); map3.put("code", "to_task"); map3.put("value", inst); @@ -1187,6 +1237,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme jo.put("stopReceiveTask", this.stopReceiveTask); jo.put("requireSucess", requireSucess); jo.put("driver_type", "standard_stacker"); + jo.put("isOnline", this.getIsonline()); + jo.put("isError", this.getIserror()); jo.put("notCreateInstMessage", notCreateInstMessage); return jo; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/manipulator_agv_station/ManipulatorAgvStationDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/manipulator_agv_station/ManipulatorAgvStationDeviceDriver.java index bd883b46c..43c20aee4 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/manipulator_agv_station/ManipulatorAgvStationDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/manipulator_agv_station/ManipulatorAgvStationDeviceDriver.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.two_conveyor.manipulator_agv_station; +import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONObject; import lombok.Data; import lombok.RequiredArgsConstructor; @@ -25,6 +26,8 @@ import org.nl.acs.route.service.impl.RouteLineServiceImpl; import org.nl.acs.task.service.TaskService; import org.nl.config.SpringContextHolder; import org.nl.config.language.LangProcess; +import org.nl.config.lucene.service.LuceneExecuteLogService; +import org.nl.config.lucene.service.dto.LuceneLogDto; import org.springframework.beans.factory.annotation.Autowired; import java.util.Date; @@ -39,6 +42,9 @@ import java.util.Map; @RequiredArgsConstructor public class ManipulatorAgvStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed { protected ItemProtocol itemProtocol = new ItemProtocol(this); + + protected ToCommandControl toCommandControl = new ToCommandControl(this); + @Autowired DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); @Autowired @@ -54,6 +60,8 @@ public class ManipulatorAgvStationDeviceDriver extends AbstractOpcDeviceDriver i @Autowired DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class); + LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl"); + private Date instruction_require_time = new Date(); private Date instruction_finished_time = new Date(); private Date instruction_apply_time = new Date(); @@ -94,6 +102,10 @@ public class ManipulatorAgvStationDeviceDriver extends AbstractOpcDeviceDriver i return this.device; } + public ToCommandControl getToCommandControl() { + return this.toCommandControl; + } + /** * 请求成功标记 */ @@ -111,9 +123,6 @@ public class ManipulatorAgvStationDeviceDriver extends AbstractOpcDeviceDriver i if (mode != last_mode) { this.setRequireSucess(false); - if (mode == 2) { - this.writing(0); - } } } catch (Exception var17) { return; @@ -168,21 +177,75 @@ public class ManipulatorAgvStationDeviceDriver extends AbstractOpcDeviceDriver i } + + public void writing(List list) { + + Map itemMap = new HashMap(); + for (int i = 0; i < list.size(); i++) { + Object ob = list.get(i); + JSONObject json = (JSONObject) JSONObject.toJSON(ob); + if (!StrUtil.isEmpty(json.getString("value"))) { + String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + json.getString("code"); + itemMap.put(to_param, json.getString("value")); + } + } + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("下发电气信号:" + itemMap) + .build(); + logDto.setLog_level(3); + luceneExecuteLogService.deviceExecuteLog(logDto); + logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap); + try { + this.checkcontrol(itemMap); + } catch (Exception e) { + e.printStackTrace(); + try { + this.checkcontrol(itemMap); + } catch (Exception e1) { + e1.printStackTrace(); + } + } + + } + protected void thingToNothing() { this.setRequireSucess(false); } - public void writing(int command) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor.ItemProtocol.item_to_command; - //String opcservcerid = this.getDevice().getOpc_server_id(); -//Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, command); - this.control(itemMap); + public void writing(int command){ +// String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() +// + "." + org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor.ItemProtocol.item_to_command; +// Map itemMap = new HashMap(); +// itemMap.put(to_command, command); +// LuceneLogDto logDto = LuceneLogDto.builder() +// .device_code(device_code) +// .content("下发电气信号:" + itemMap) +// .build(); +// logDto.setLog_level(3); +// luceneExecuteLogService.deviceExecuteLog(logDto); +// try { +// this.checkcontrol(itemMap); +// } catch (Exception e) { +// e.printStackTrace(); +// try { +// this.checkcontrol(itemMap); +// } catch (Exception e1) { +// e1.printStackTrace(); +// } +// } + + try{ + this.toCommandControl.control(command); + } catch (Exception e){ + e.printStackTrace(); + } } - @Override + + + @Override public JSONObject getDeviceStatusName() { JSONObject jo = new JSONObject(); String mode = ""; @@ -199,14 +262,10 @@ public class ManipulatorAgvStationDeviceDriver extends AbstractOpcDeviceDriver i } else if (this.getMode() == 3) { mode = LangProcess.msg("universal_operation"); } - if (this.getAction() == 1) { + if (this.getAction() == 0) { + action = LangProcess.msg("universal_actionMessage1"); + } else if (this.getAction() == 1) { action = LangProcess.msg("universal_delivery"); - } else if (this.getAction() == 2) { - action = LangProcess.msg("universal_completed"); - } else if (this.getAction() == 3) { - action = LangProcess.msg("universal_releasing"); - } else if (this.getAction() == 4) { - action = LangProcess.msg("universal_releasing_completed"); } jo.put("device_name", this.getDevice().getDevice_name()); jo.put("mode", mode); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/manipulator_agv_station/ToCommandControl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/manipulator_agv_station/ToCommandControl.java new file mode 100644 index 000000000..92567876c --- /dev/null +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/manipulator_agv_station/ToCommandControl.java @@ -0,0 +1,31 @@ +package org.nl.acs.device_driver.two_conveyor.manipulator_agv_station; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONObject; +import org.nl.acs.device_driver.driver.ItemValue; +import org.nl.acs.device_driver.stacker.standard_stacker.ItemProtocol; +import org.nl.acs.device_driver.stacker.standard_stacker.StandardStackerDeviceDriver; + +import java.util.HashMap; +import java.util.Map; + +public class ToCommandControl { + + private ManipulatorAgvStationDeviceDriver driver; + + public ToCommandControl(ManipulatorAgvStationDeviceDriver driver) { + this.driver = driver; + } + + public void control(int command) 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.getOpcServer() + "." + this.driver.getOpcPlc() + "." + this.driver.getDevice().getDevice_code() + + ".to_command"; + Object obj = command; + itemMap.put(to_param, obj); + this.driver.checkcontrol(itemMap); + } + +} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/ItemProtocol.java index 463dafdda..a183f50c3 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/ItemProtocol.java @@ -30,6 +30,13 @@ public class ItemProtocol { public static String item_x_position = "x"; //y轴坐标 public static String item_y_position = "y"; + //区域一 + public static String item_region_one = "region_one"; + //区域二 + public static String item_region_two = "region_two"; + //区域三 + public static String item_region_three = "region_three"; + //下发命令 public static String item_to_command = "to_command"; @@ -37,6 +44,12 @@ public class ItemProtocol { public static String item_to_onset = "to_onset"; //下发目标站 public static String item_to_target = "to_target"; + //下发区域一 + public static String item_to_region_one = "to_region_one"; + //下发区域二 + public static String item_to_region_two = "to_region_two"; + //下发区域三 + public static String item_to_region_three = "to_region_three"; //下发任务号 public static String item_to_task = "to_task"; @@ -82,6 +95,30 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_to_target); } + public int getTo_region_one() { + return this.getOpcIntegerValue(item_to_region_one); + } + + public int getTo_region_two() { + return this.getOpcIntegerValue(item_to_region_two); + } + + public int getTo_region_three() { + return this.getOpcIntegerValue(item_to_region_three); + } + + public int getRegion_one() { + return this.getOpcIntegerValue(item_region_one); + } + + public int getRegion_two() { + return this.getOpcIntegerValue(item_region_two); + } + + public int getRegion_three() { + return this.getOpcIntegerValue(item_region_three); + } + public int getTo_task() { return this.getOpcIntegerValue(item_to_task); } @@ -150,6 +187,9 @@ public class ItemProtocol { list.add(new ItemDto(item_task, "任务号", "DB1.D6")); list.add(new ItemDto(item_x_position, "x坐标", "DB1.REAL10")); list.add(new ItemDto(item_y_position, "y坐标", "DB1.REAL14")); + list.add(new ItemDto(item_region_one, "区域一", "DB1.REAL18")); + list.add(new ItemDto(item_region_two, "区域二", "DB1.REAL22")); + list.add(new ItemDto(item_region_three, "区域三", "DB1.REAL26")); return list; } @@ -159,6 +199,9 @@ public class ItemProtocol { list.add(new ItemDto(item_to_onset, "下发起始站", "DB2.W2")); list.add(new ItemDto(item_to_target, "下发目标站", "DB2.W4")); list.add(new ItemDto(item_to_task, "下发任务号", "DB2.D6")); + list.add(new ItemDto(item_to_region_one, "下发区域一", "DB2.D6")); + list.add(new ItemDto(item_to_region_two, "下发区域二", "DB2.D6")); + list.add(new ItemDto(item_to_region_three, "下发区域三", "DB2.D6")); return list; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java index 2a64e05da..92bb217fb 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java @@ -110,6 +110,19 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i int last_heartbeat = 0; int to_command = 0; int last_to_command = 0; + public int region_one = 0; + public int last_region_one = 0; + public int region_two = 0; + public int last_region_two = 0; + public int region_three = 0; + public int last_region_three = 0; + public int to_region_one = 0; + public int last_to_region_one = 0; + public int to_region_two = 0; + public int last_to_region_two = 0; + public int to_region_three = 0; + public int last_to_region_three = 0; + int to_target = 0; int last_to_target = 0; @@ -183,6 +196,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i to_onset = this.itemProtocol.getTo_onset(); x_position = this.itemProtocol.getX_position(); y_position = this.itemProtocol.getY_position(); + region_one = this.itemProtocol.getRegion_one(); + region_two = this.itemProtocol.getRegion_two(); + region_three = this.itemProtocol.getRegion_three(); + to_region_one = this.itemProtocol.getTo_region_one(); + to_region_two = this.itemProtocol.getTo_region_two(); + to_region_three = this.itemProtocol.getTo_region_three(); iserror = this.itemProtocol.device_status; if (mode != last_mode) { @@ -198,7 +217,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } catch (Exception var17) { var17.printStackTrace(); - feedMessage = var17.getMessage(); + // feedMessage = var17.getMessage(); logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)); } @@ -262,6 +281,10 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i last_to_onset = to_onset; last_x_position = x_position; last_y_position = y_position; + last_region_one = region_one; + last_region_two = region_two; + last_region_three = region_three; + } public List sortTask(List taskDtos) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/PlugPullDeviceSiteDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/PlugPullDeviceSiteDeviceDriver.java index 663811ffd..7f1b91ad9 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/PlugPullDeviceSiteDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/PlugPullDeviceSiteDeviceDriver.java @@ -217,7 +217,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl //有报警 } else if (error != 0) { this.setIserror(true); - message ="universal_message3"; + message = "universal_message3"; //无报警 } else { this.setIsonline(true); @@ -306,9 +306,9 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl } else { LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) - .content(device_code+"当前mode值为:" + mode) + .content(device_code + "当前mode值为:" + mode) .build(); - logDto.setLog_level(2); + logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); logServer.deviceExecuteLog(this.device_code, "", "", "当前mode值为:" + mode); ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest(); @@ -321,44 +321,63 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl if (applyPlugPullSitResponse.getstatus() == CommonFinalParam.STATUS_OPEN) { LuceneLogDto logDto2 = LuceneLogDto.builder() .device_code(device_code) - .content("申请贴标成功:" + applyPlugPullSitResponse.getData()) + .content("申请套管任务,返回参数::" + applyPlugPullSitResponse.getData()) .build(); logDto2.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto2); Map data = applyPlugPullSitResponse.getData(); - String number = data.get("number"); - String leftSize = data.get("leftSize"); - String rightSize = data.get("rightSize"); - //套管1物料 - String to_material1 = data.get("left"); - //套管2物料 - String to_material2 = data.get("right"); - //套管1规格 - String to_spec1 = data.get("leftSpec"); - //套管2规格 - String to_spec2 = data.get("rightSpec"); - Map map = new LinkedHashMap<>(); - //下发纸管信息 + String is_bushing = data.get("is_bushing"); + if (StrUtil.equals("1", is_bushing)) { + String number = data.get("number"); + String leftSize = data.get("leftSize"); + String rightSize = data.get("rightSize"); + //套管1物料 + String to_material1 = data.get("left"); + //套管2物料 + String to_material2 = data.get("right"); + //套管1规格 + String to_spec1 = data.get("leftSpec"); + //套管2规格 + String to_spec2 = data.get("rightSpec"); + Map map = new LinkedHashMap<>(); + //下发纸管信息 - map.put("to_material1", to_material1); - map.put("to_material2", to_material2); + map.put("to_material1", to_material1); + map.put("to_material2", to_material2); - if (StrUtil.isNotEmpty(leftSize)) { - map.put("to_size1", leftSize); + if (StrUtil.isNotEmpty(leftSize)) { + map.put("to_size1", leftSize); + } + if (StrUtil.isNotEmpty(rightSize)) { + map.put("to_size2", rightSize); + } + map.put("to_spec1", to_spec1); + if (ObjectUtil.isNotEmpty(to_spec2)) { + map.put("to_spec2", to_spec2); + } + map.put("to_command", mode); + map.put("to_qty1", number); + this.writing(map); + requireSucess = true; + logServer.deviceExecuteLog(this.device_code, "", "", "申请套管,返回参数:" + applyPlugPullSitResponse); + message = "申请套管成功"; } - if (StrUtil.isNotEmpty(rightSize)) { - map.put("to_size2", rightSize); + if (StrUtil.equals("2", is_bushing)){ + Map map = new LinkedHashMap<>(); + map.put("to_command", 97); + this.writing(map); + requireSucess = true; + message = "不套管,送空气轴"; + logServer.deviceExecuteLog(this.device_code, "", "", "不申请套管反馈,返回参数:" + applyPlugPullSitResponse); } - map.put("to_spec1", to_spec1); - if (ObjectUtil.isNotEmpty(to_spec2)) { - map.put("to_spec2", to_spec2); + if (StrUtil.equals("0", is_bushing)){ + Map map = new LinkedHashMap<>(); + map.put("to_command", 98); + this.writing(map); + requireSucess = true; + message = "缺少纸管,人工确认"; + logServer.deviceExecuteLog(this.device_code, "", "", "不申请套管反馈,返回参数:" + applyPlugPullSitResponse); } - map.put("to_command", mode); - map.put("to_qty1", number); - this.writing(map); - requireSucess = true; - logServer.deviceExecuteLog(this.device_code, "", "", "申请套管,返回参数:" + applyPlugPullSitResponse); - message = "申请套管成功"; } else { message = applyPlugPullSitResponse.getMessage(); Map map = new LinkedHashMap<>(); @@ -382,7 +401,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl } else { LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) - .content(device_code+"当前mode值为:" + mode) + .content(device_code + "当前mode值为:" + mode) .build(); logDto.setLog_level(2); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -398,6 +417,12 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl applyPlugPullSiteRequest.setType(CommonFinalParam.TYPE_TWO); applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest); if (applyPlugPullSitResponse.getstatus() == CommonFinalParam.STATUS_OPEN) { + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code(device_code) + .content("申请套管成功:" + applyPlugPullSitResponse.getData()) + .build(); + logDto2.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto2); this.writeSignal(mode); logServer.deviceExecuteLog(this.device_code, "", "", "反馈套管完成,返回参数:" + applyPlugPullSitResponse); message = "套管完成成功"; @@ -425,7 +450,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl } else { LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) - .content(device_code+"当前mode值为:" + mode) + .content(device_code + "当前mode值为:" + mode) .build(); logDto.setLog_level(2); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -466,7 +491,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl } else { LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) - .content(device_code+"当前mode值为:" + mode) + .content(device_code + "当前mode值为:" + mode) .build(); logDto.setLog_level(2); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -535,7 +560,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl } else { LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) - .content(device_code+"当前mode值为:" + mode) + .content(device_code + "当前mode值为:" + mode) .build(); logDto.setLog_level(2); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -661,15 +686,15 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl mode = LangProcess.msg("universal_standby"); } else if (this.getMode() == 3) { mode = LangProcess.msg("universal_operation"); - } else if(this.mode == 4) { + } else if (this.mode == 4) { mode = "请求套轴轴"; - } else if(this.mode == 5){ + } else if (this.mode == 5) { mode = "套轴完成反馈"; - } else if(this.mode == 6){ + } else if (this.mode == 6) { mode = "请求拔轴"; - } else if(this.mode == 7){ + } else if (this.mode == 7) { mode = "拔轴完成反馈"; - } else if(this.mode == 8){ + } else if (this.mode == 8) { mode = "缓存库已满,申请行架任务"; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java index 4ef5de975..20be7c2f3 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_head_manipulator/PullHeadManipulatorDeviceDriver.java @@ -35,6 +35,7 @@ import org.nl.acs.opc.DeviceAppServiceImpl; import org.nl.acs.route.service.RouteLineService; import org.nl.acs.route.service.impl.RouteLineServiceImpl; import org.nl.acs.task.enums.TaskStatusEnum; +import org.nl.acs.task.enums.TaskTypeEnum; import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; import org.nl.common.exception.BadRequestException; @@ -46,6 +47,7 @@ import org.nl.config.lucene.service.dto.LuceneLogDto; import org.springframework.beans.factory.annotation.Autowired; import java.util.*; +import java.util.stream.Collectors; /** @@ -249,7 +251,7 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp } catch (Exception var17) { var17.printStackTrace(); - feedMessage = var17.getMessage(); + // feedMessage = var17.getMessage(); logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)); } @@ -339,149 +341,176 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp PlugPullDeviceSiteDeviceDriver plugPullDeviceSiteDeviceDriver; for (int i = 0; i < getDeviceCodeList.size(); i++) { String startDeviceCode = getDeviceCodeList.get(i); - List taskDtos = taskserver.queryTaskByDeviceCodeAndStatus(startDeviceCode); + //先查指令 + List taskDtos = taskserver.queryTaskByDeviceCodeAndStatus2(startDeviceCode); if (ObjectUtil.isNotEmpty(taskDtos)) { - //按照优先级排序 优先级相等按照创建时间排序 - taskDtos = this.sortTask(taskDtos); - TaskDto taskDto = taskDtos.get(0); - String startPoint = task.getStart_device_code(); - Device startPointDevice = deviceAppService.findDeviceByCode(startPoint); - if (startPointDevice.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { - plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) startPointDevice.getDeviceDriver(); - if (plugPullDeviceSiteDeviceDriver.getAction() != 1&&plugPullDeviceSiteDeviceDriver.getAction() != 3) - notCreateInstMessage = "universal_notCreateInstMessage9"; + List taskDtoStream = taskDtos.stream().sorted(Comparator.comparing(TaskDto::getCreate_time)).collect(Collectors.toList()); + if (ObjectUtil.isNotEmpty(taskDtoStream)) { + TaskDto taskDto = taskDtos.get(0); + if (TaskTypeEnum.Truss_Task.getIndex().equals(taskDto.getTask_type())) { + String startPoint = taskDto.getStart_device_code(); + Device startPointDevice = deviceAppService.findDeviceByCode(startPoint); + if (startPointDevice.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { + plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) startPointDevice.getDeviceDriver(); + if (plugPullDeviceSiteDeviceDriver.getAction() != 1) { + notCreateInstMessage = "universal_notCreateInstMessage9"; + continue; + } + } + String nextDeviceCode = taskDto.getNext_device_code(); + Device device = deviceAppService.findDeviceByCode(nextDeviceCode); + if (device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { + plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) device.getDeviceDriver(); + if (plugPullDeviceSiteDeviceDriver.getMode() != 2 || plugPullDeviceSiteDeviceDriver.getMove() != 0 || plugPullDeviceSiteDeviceDriver.getAction() != 2) { + notCreateInstMessage = "universal_notCreateInstMessage9"; + continue; + } + } + Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code()); + String startCode = instruction.getStart_device_code(); + String nextCode = instruction.getNext_device_code(); + instruction.setInstruction_status(InstructionStatusEnum.BUSY.getIndex()); + instruction.setUpdate_time(DateUtil.now()); + instructionService.update(instruction); + Device startDevice = deviceAppService.findDeviceByCode(startCode); + Device nextDevice = deviceAppService.findDeviceByCode(nextCode); + if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) { + notCreateInstMessage = "universal_notCreateInstMessage1"; + throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!"); + } + if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) { + notCreateInstMessage = "universal_notCreateInstMessage1"; + throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); + } + String startAddr = startDevice.getExtraValue().get("address").toString(); + String nextAddr = nextDevice.getExtraValue().get("address").toString(); + String interaction_json = taskDto.getInteraction_json(); + Map map = toStringObjectMap(instruction, startAddr, nextAddr, interaction_json); + this.writing(map); + this.setRequireSucess(true); + return true; + } + } + } else { + List taskDtoList = taskserver.findByTrappedManipulatorReady(); + if (ObjectUtil.isNotEmpty(taskDtoList)) { + List taskDtosReady = new ArrayList<>(); + for (TaskDto taskDto1 : taskDtoList) { + if (getDeviceCodeList.contains(taskDto1.getStart_device_code())) { + taskDtosReady.add(taskDto1); + } + } + //按照优先级排序 优先级相等按照创建时间排序 + taskDtosReady = this.sortTask(taskDtosReady); + task = taskDtosReady.get(0); + } + if (ObjectUtil.isNotEmpty(task)) { + break; + } + } + } + if (!ObjectUtil.isEmpty(task)) { + String firstDeviceCode = task.getStart_device_code(); + Device start_device = deviceAppService.findDeviceByCode(firstDeviceCode); + if (start_device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { + plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) start_device.getDeviceDriver(); + if (plugPullDeviceSiteDeviceDriver.getAction() != 1) { + notCreateInstMessage = "universal_notCreateInstMessage12"; + return false; + } + } + String nextDeviceCode = task.getNext_device_code(); + Device next_device = deviceAppService.findDeviceByCode(nextDeviceCode); + if (next_device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { + plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) next_device.getDeviceDriver(); + String remark = ""; + if (plugPullDeviceSiteDeviceDriver.getMode() != 2) { + remark = "universal_notCreateInstMessage9"; + notCreateInstMessage = remark; + return false; + } + if (plugPullDeviceSiteDeviceDriver.getMove() != 0) { + remark = "universal_notCreateInstMessage9"; + notCreateInstMessage = remark; + return false; + } + if (plugPullDeviceSiteDeviceDriver.getAction() != 2) { + remark = "universal_notCreateInstMessage11"; + notCreateInstMessage = remark; + return false; + } + } + String taskId = task.getTask_id(); + String taskCode = task.getTask_code(); + String vehicleCode = task.getVehicle_code(); + String priority = task.getPriority(); + String startPointCode = task.getStart_point_code(); + String routePlanCode = task.getRoute_plan_code(); + String nextPointCode = task.getNext_point_code(); + + Instruction instdto = new Instruction(); + instdto.setInstruction_id(IdUtil.simpleUUID()); + instdto.setRoute_plan_code(routePlanCode); + instdto.setRemark(task.getRemark()); + instdto.setMaterial(task.getMaterial()); + instdto.setQuantity(task.getQuantity()); + instdto.setTask_id(taskId); + instdto.setTask_code(taskCode); + instdto.setVehicle_code(vehicleCode); + String now = DateUtil.now(); + instdto.setCreate_time(now); + instdto.setCreate_by(SecurityUtils.getCurrentNickName()); + instdto.setStart_device_code(firstDeviceCode); + instdto.setNext_device_code(nextDeviceCode); + instdto.setStart_point_code(startPointCode); + instdto.setNext_point_code(nextPointCode); + instdto.setPriority(priority); + instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex()); + instdto.setExecute_device_code(startPointCode); + try { + instructionService.create(instdto); + } catch (Exception e) { + notCreateInstMessage = e.getMessage(); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(device_code + "创建指令时出现异常:" + e.getMessage()) + .build(); + luceneExecuteLogService.deviceExecuteLog(logDto); return false; } - String nextDeviceCode = taskDto.getNext_device_code(); - Device device = deviceAppService.findDeviceByCode(nextDeviceCode); - if (device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { - plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) device.getDeviceDriver(); - if (plugPullDeviceSiteDeviceDriver.getMode() != 2 || plugPullDeviceSiteDeviceDriver.getMove() != 0 || plugPullDeviceSiteDeviceDriver.getAction() != 2&&plugPullDeviceSiteDeviceDriver.getAction() != 3) - notCreateInstMessage = "universal_notCreateInstMessage9"; - return false; - } - Instruction instruction = instructionService.findByTaskcode(taskDto.getTask_code()); - String startCode = instruction.getStart_device_code(); - String nextCode = instruction.getNext_device_code(); - instruction.setInstruction_status(InstructionStatusEnum.BUSY.getIndex()); - instruction.setUpdate_time(DateUtil.now()); - instructionService.update(instruction); - Device startDevice = deviceAppService.findDeviceByCode(startCode); - Device nextDevice = deviceAppService.findDeviceByCode(nextCode); + //创建指令后修改任务状态 + task.setTask_status(TaskStatusEnum.BUSY.getIndex()); + task.setUpdate_time(DateUtil.now()); + taskserver.update(task); + + Device startDevice = deviceAppService.findDeviceByCode(instdto.getStart_device_code()); + Device nextDevice = deviceAppService.findDeviceByCode(instdto.getNext_device_code()); if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) { notCreateInstMessage = "universal_notCreateInstMessage1"; - throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!"); + logServer.deviceExecuteLog(this.getDevice_code(), "", "", "设备:" + startDevice.getDevice_code() + "未设置电气调度号!"); + throw new BadRequestException(LangProcess.msg("device_checkAdd", startDevice.getDevice_code())); } if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) { notCreateInstMessage = "universal_notCreateInstMessage1"; - throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); + logServer.deviceExecuteLog(this.getDevice_code(), "", "", "设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); + throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice.getDevice_code())); + } String startAddr = startDevice.getExtraValue().get("address").toString(); String nextAddr = nextDevice.getExtraValue().get("address").toString(); - String interaction_json = taskDto.getInteraction_json(); - Map map = toStringObjectMap(instruction, startAddr, nextAddr, interaction_json); + String interaction_json = task.getInteraction_json(); + Map map = toStringObjectMap(instdto, startAddr, nextAddr, interaction_json); this.writing(map); this.setRequireSucess(true); - return true; + notCreateInstMessage = ""; + notCreateTaskMessage = ""; } else { - List taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode); - if (ObjectUtil.isNotEmpty(taskDtoList)) { - //按照优先级排序 优先级相等按照创建时间排序 - taskDtoList = this.sortTask(taskDtoList); - task = taskDtoList.get(0); - } - if (ObjectUtil.isNotEmpty(task)) { - break; - } + notCreateInstMessage = "universal_notCreateInstMessage"; } + return true; } - if (!ObjectUtil.isEmpty(task)) { - String startDeviceCode = task.getStart_device_code(); - Device start_device = deviceAppService.findDeviceByCode(startDeviceCode); - if (start_device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { - plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) start_device.getDeviceDriver(); - if (plugPullDeviceSiteDeviceDriver.getAction() != 1&&plugPullDeviceSiteDeviceDriver.getAction() != 3) - notCreateInstMessage = "universal_notCreateInstMessage9"; - return false; - } - String nextDeviceCode = task.getNext_device_code(); - Device next_device = deviceAppService.findDeviceByCode(nextDeviceCode); - if (next_device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { - plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) next_device.getDeviceDriver(); - if (plugPullDeviceSiteDeviceDriver.getMode() != 2 || plugPullDeviceSiteDeviceDriver.getMove() != 0 || plugPullDeviceSiteDeviceDriver.getAction() != 2&&plugPullDeviceSiteDeviceDriver.getAction() != 3) - notCreateInstMessage = "universal_notCreateInstMessage9"; - return false; - } - String taskId = task.getTask_id(); - String taskCode = task.getTask_code(); - String vehicleCode = task.getVehicle_code(); - String priority = task.getPriority(); - String startPointCode = task.getStart_point_code(); - String routePlanCode = task.getRoute_plan_code(); - String nextPointCode = task.getNext_point_code(); - - Instruction instdto = new Instruction(); - instdto.setInstruction_id(IdUtil.simpleUUID()); - instdto.setRoute_plan_code(routePlanCode); - instdto.setRemark(task.getRemark()); - instdto.setMaterial(task.getMaterial()); - instdto.setQuantity(task.getQuantity()); - instdto.setTask_id(taskId); - instdto.setTask_code(taskCode); - instdto.setVehicle_code(vehicleCode); - String now = DateUtil.now(); - instdto.setCreate_time(now); - instdto.setCreate_by(SecurityUtils.getCurrentNickName()); - instdto.setStart_device_code(startDeviceCode); - instdto.setNext_device_code(nextDeviceCode); - instdto.setStart_point_code(startPointCode); - instdto.setNext_point_code(nextPointCode); - instdto.setPriority(priority); - instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex()); - instdto.setExecute_device_code(startPointCode); - - try { - instructionService.create(instdto); - } catch (Exception e) { - notCreateInstMessage = e.getMessage(); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content(device_code+"创建指令时出现异常:" + e.getMessage()) - .build(); - luceneExecuteLogService.deviceExecuteLog(logDto); return false; - } - //创建指令后修改任务状态 - task.setTask_status(TaskStatusEnum.BUSY.getIndex()); - task.setUpdate_time(DateUtil.now()); - taskserver.update(task); - - Device startDevice = deviceAppService.findDeviceByCode(instdto.getStart_device_code()); - Device nextDevice = deviceAppService.findDeviceByCode(instdto.getNext_device_code()); - if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) { - notCreateInstMessage = "设备:" + startDevice.getDevice_code() + "未设置电气调度号!"; - logServer.deviceExecuteLog(this.getDevice_code(), "", "", "设备:" + startDevice.getDevice_code() + "未设置电气调度号!"); - throw new BadRequestException(LangProcess.msg("device_checkAdd", startDevice.getDevice_code())); - } - if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) { - notCreateInstMessage = "设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"; - logServer.deviceExecuteLog(this.getDevice_code(), "", "", "设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); - throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice.getDevice_code())); - - } - String startAddr = startDevice.getExtraValue().get("address").toString(); - String nextAddr = nextDevice.getExtraValue().get("address").toString(); - String interaction_json = task.getInteraction_json(); - Map map = toStringObjectMap(instdto, startAddr, nextAddr, interaction_json); - this.writing(map); - this.setRequireSucess(true); - notCreateInstMessage = ""; - notCreateTaskMessage = ""; - } else { - notCreateInstMessage = "universal_notCreateInstMessage"; - } - return true; } - } + @NotNull private Map toStringObjectMap(Instruction instdto, String startAddr, String nextAddr, String interaction_json) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java index 9b61c7145..b431a83b5 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java @@ -274,7 +274,7 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp } catch (Exception var17) { var17.printStackTrace(); - feedMessage = var17.getMessage(); + // feedMessage = var17.getMessage(); logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java index 7aff9d4c3..d98b4aa21 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java @@ -39,6 +39,7 @@ import org.openscada.opc.lib.da.Server; import org.springframework.beans.factory.annotation.Autowired; import java.util.*; +import java.util.stream.Collectors; /** * 分切双工位行架机械手 @@ -313,7 +314,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl //正常申请任务 public synchronized boolean applyTask() { - boolean flag = false; Date date = new Date(); if (date.getTime() - this.instruction_head_time.getTime() < (long) this.instruction_require_time_out) { log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_head_time); @@ -330,14 +330,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl //如果禁用 if (slitTwoManipulatorDeviceDriver.getIs_disable() == 1) { //就去走关联设备异常取放货工位的任务 任务生成成功返回true 就不会走下面正常生成任务的逻辑 - try { - flag = instruction_require2(); - } catch (Exception e) { - flag = false; - } - if (flag) { - return false; - } + boolean flag = false; + flag = instruction_require2(); + return flag; } } //没有生成异常取放货工位的任务 就生成正常关联取放货工位的任务 @@ -352,41 +347,40 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl TaskDto task = null; for (int i = 0; i < getDeviceCodeList.size(); i++) { String startDeviceCode = getDeviceCodeList.get(i); - List taskDtos = taskserver.queryTaskByDeviceCodeAndStatus(startDeviceCode); + List taskDtos = taskserver.queryTaskByDeviceCodeAndStatus2(startDeviceCode); if (ObjectUtil.isNotEmpty(taskDtos)) { - //按照优先级排序 优先级相等按照创建时间排序 - taskDtos = this.sortTask(taskDtos); - TaskDto taskDto = taskDtos.get(0); - truss_type = taskDto.getTruss_type(); - //查询任务是行架任务 - if (!StrUtil.equals(taskDto.getTask_type(), "6")) { - taskDto = null; - continue; + //按照创建时间排序 + List taskDtoStream = taskDtos.stream().sorted(Comparator.comparing(TaskDto::getCreate_time)).collect(Collectors.toList()); + if (ObjectUtil.isNotEmpty(taskDtoStream)) { + TaskDto taskDto = taskDtoStream.get(0); + this.executeReadyInst(taskDto); } - flag = this.executeReadyInst(taskDto); } else { - List taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode); + List taskDtoList = taskserver.findByTrappedManipulatorReady(); if (ObjectUtil.isNotEmpty(taskDtoList)) { - //按照优先级排序 优先级相等按照创建时间排序 - taskDtoList = this.sortTask(taskDtoList); - for (int j = 0; j < taskDtoList.size(); j++) { - task = taskDtoList.get(j); - - // 9 行架任务 - if (ObjectUtil.isNotEmpty(task) && !StrUtil.equals(task.getTask_type(), "6")) { - task = null; - continue; + List taskDtosReady = new ArrayList<>(); + for (TaskDto taskDto1 : taskDtoList) { + if (getDeviceCodeList.contains(taskDto1.getStart_device_code())) { + taskDtosReady.add(taskDto1); } - if (ObjectUtil.isNotEmpty(task)) break; } + //按照优先级排序 优先级相等按照创建时间排序 + taskDtosReady = this.sortTask(taskDtosReady); + task = taskDtosReady.get(0); + } + if (!ObjectUtil.isEmpty(task)) { + break; } } } + if (!ObjectUtil.isEmpty(task)) { - flag = this.executeReadyTask(task); + this.executeReadyTask(task); + } else { + notCreateInstMessage = "universal_notCreateInstMessage"; } + return true; } - return flag; } //关联设备异常申请任务 @@ -410,41 +404,39 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl TaskDto task = null; for (int i = 0; i < getDeviceCodeList.size(); i++) { String startDeviceCode = getDeviceCodeList.get(i); - List taskDtos = taskserver.queryTaskByDeviceCodeAndStatus(startDeviceCode); + List taskDtos = taskserver.queryTaskByDeviceCodeAndStatus2(startDeviceCode); if (ObjectUtil.isNotEmpty(taskDtos)) { - //按照优先级排序 优先级相等按照创建时间排序 - taskDtos = this.sortTask(taskDtos); - TaskDto taskDto = taskDtos.get(0); - truss_type = taskDto.getTruss_type(); - //查询任务是行架任务 - if (!StrUtil.equals(taskDto.getTask_type(), "6")) { - taskDto = null; - continue; + //按照创建时间排序 + List taskDtoStream = taskDtos.stream().sorted(Comparator.comparing(TaskDto::getCreate_time)).collect(Collectors.toList()); + if (ObjectUtil.isNotEmpty(taskDtoStream)) { + TaskDto taskDto = taskDtoStream.get(0); + this.executeReadyInst(taskDto); } - flag = this.executeReadyInst(taskDto); } else { - List taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode); + List taskDtoList = taskserver.findByTrappedManipulatorReady(); if (ObjectUtil.isNotEmpty(taskDtoList)) { - //按照优先级排序 优先级相等按照创建时间排序 - taskDtoList = this.sortTask(taskDtoList); - for (int j = 0; j < taskDtoList.size(); j++) { - task = taskDtoList.get(j); - - // 6 行架任务 - if (ObjectUtil.isNotEmpty(task) && !StrUtil.equals(task.getTask_type(), "6")) { - task = null; - continue; + List taskDtosReady = new ArrayList<>(); + for (TaskDto taskDto1 : taskDtoList) { + if (getDeviceCodeList.contains(taskDto1.getStart_device_code())) { + taskDtosReady.add(taskDto1); } - if (ObjectUtil.isNotEmpty(task)) break; } + //按照优先级排序 优先级相等按照创建时间排序 + taskDtosReady = this.sortTask(taskDtosReady); + task = taskDtosReady.get(0); + } + if (!ObjectUtil.isEmpty(task)) { + break; } } } if (!ObjectUtil.isEmpty(task)) { - flag = this.executeReadyTask(task); + this.executeReadyTask(task); + } else { + notCreateInstMessage = "universal_notCreateInstMessage"; } + return true; } - return flag; } //执行已有就绪指令 @@ -610,7 +602,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl public void isSetAddress(Device device) { if (ObjectUtil.isEmpty(device.getExtraValue().get("address"))) { logServer.deviceExecuteLog(device_code, "", "task:" + task, "设备:" + device.getDevice_code() + "未设置电气调度号!"); - notCreateInstMessage = "universal_notCreateInstMessage1";; + notCreateInstMessage = "universal_notCreateInstMessage1"; + ; throw new BadRequestException("设备:" + device.getDevice_code() + "未设置电气调度号!"); } } @@ -839,11 +832,11 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl if (this.requireSucess) { requireSucess = CommonFinalParam.ONE; } - if(error == 0){ - if(this.itemProtocol.isError){ + if (error == 0) { + if (this.itemProtocol.isError) { this.setMessage(LangProcess.msg("universal_message4")); iserror = true; - }else{ + } else { iserror = false; } } @@ -864,7 +857,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl jo.put("is_click", true); jo.put("driver_type", "slit_two_manipulator"); jo.put("notCreateTaskMessage", LangProcess.msg(notCreateTaskMessage)); - jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage)); + jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage)); jo.put("feedMessage", LangProcess.msg(feedMessage)); return jo; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/CreateTaskRequest.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/CreateTaskRequest.java index 52c466b68..b79a45cff 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/CreateTaskRequest.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/CreateTaskRequest.java @@ -205,4 +205,9 @@ public class CreateTaskRequest extends BaseRequest { * 是否拔轴 0/1 */ private String is_pulling; + + /** + * agv二次分配类型(1、普通任务 2、取货二次分配 3、防货二次分配 4、取放货二次分配) + */ + private Integer agv_action_type; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java index db2a23625..faea6ca16 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java @@ -201,4 +201,10 @@ public interface AcsToWmsService { HttpResponse feedbackDies(JSONObject param); String secondaryAllocationPoint(JSONObject param); + + /** + * 行架-agv对接位取货完成反馈 + * @param jsonObject + */ + void actionFinishRequest2(JSONObject jsonObject); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index 62c0e68b2..f8c9d67d1 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -198,7 +198,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { public String applySendOutTwo(JSONObject param) { try { MDC.put(log_file_type, log_type); - log.info("applyTaskToWms-----输入参数{}", param); + log.info("applySendOutTwo-----输入参数{}", param); String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); AddressDto addressDto = addressService.findByCode("applySendOutTwo"); String url = wmsurl + addressDto.getMethods_url(); @@ -210,11 +210,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .execute(); } catch (Exception e) { String msg = e.getMessage(); - log.info("applyTaskToWms-----输出参数{}", msg); + log.info("applySendOutTwo-----输出参数{}", msg); //网络不通 } if(ObjectUtil.isEmpty(result2)){ - log.info("applyTaskToWms-----输出参数{}", "返回结果为空"); + log.info("applySendOutTwo-----输出参数{}", "返回结果为空"); return null; } String type = ""; @@ -223,8 +223,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } else { type = "error"; } - log.info("applyTaskToWms-----输出参数{}", result2.body()); - LuceneLogDto luceneLogDto = new LuceneLogDto(4,"applyTaskToWms", String.valueOf(result2.getStatus()), + log.info("applySendOutTwo-----输出参数{}", result2.body()); + LuceneLogDto luceneLogDto = new LuceneLogDto(4,"applySendOutTwo", String.valueOf(result2.getStatus()), JSON.toJSONString(param), String.valueOf(result2.body()), "二期发货申请任务"); luceneLogService.interfaceExecuteLog(luceneLogDto); return result2.body(); @@ -238,7 +238,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { public String deviceApplyTwo(JSONObject param) { try { MDC.put(log_file_type, log_type); - log.info("applyTaskToWms-----输入参数{}", param); + log.info("deviceApplyTwo-----输入参数{}", param); String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); AddressDto addressDto = addressService.findByCode("deviceApplyTwo"); String url = wmsurl + addressDto.getMethods_url(); @@ -250,11 +250,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .execute(); } catch (Exception e) { String msg = e.getMessage(); - log.info("applyTaskToWms-----输出参数{}", msg); + log.info("deviceApplyTwo-----输出参数{}", msg); //网络不通 } if(ObjectUtil.isEmpty(result2)){ - log.info("applyTaskToWms-----输出参数{}", "返回结果为空"); + log.info("deviceApplyTwo-----输出参数{}", "返回结果为空"); return null; } String type = ""; @@ -263,8 +263,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } else { type = "error"; } - log.info("applyTaskToWms-----输出参数{}", result2.body()); - LuceneLogDto luceneLogDto = new LuceneLogDto(4,"applyTaskToWms", String.valueOf(result2.getStatus()), + log.info("deviceApplyTwo-----输出参数{}", result2.body()); + LuceneLogDto luceneLogDto = new LuceneLogDto(4,"deviceApplyTwo", String.valueOf(result2.getStatus()), JSON.toJSONString(param), String.valueOf(result2.body()), "二期发货申请捆扎、贴标"); luceneLogService.interfaceExecuteLog(luceneLogDto); return result2.body(); @@ -278,7 +278,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { public String applyTowToOne(JSONObject param) { try { MDC.put(log_file_type, log_type); - log.info("applyTaskToWms-----输入参数{}", param); + log.info("sendProductToFirstFloor-----输入参数{}", param); String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); AddressDto addressDto = addressService.findByCode("sendProductToFirstFloor"); String url = wmsurl + addressDto.getMethods_url(); @@ -290,11 +290,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .execute(); } catch (Exception e) { String msg = e.getMessage(); - log.info("applyTaskToWms-----输出参数{}", msg); + log.info("sendProductToFirstFloor-----输出参数{}", msg); //网络不通 } if(ObjectUtil.isEmpty(result2)){ - log.info("applyTaskToWms-----输出参数{}", "返回结果为空"); + log.info("sendProductToFirstFloor-----输出参数{}", "返回结果为空"); return null; } String type = ""; @@ -303,8 +303,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } else { type = "error"; } - log.info("applyTaskToWms-----输出参数{}", result2.body()); - LuceneLogDto luceneLogDto = new LuceneLogDto(4,"applyTaskToWms", String.valueOf(result2.getStatus()), + log.info("sendProductToFirstFloor-----输出参数{}", result2.body()); + LuceneLogDto luceneLogDto = new LuceneLogDto(4,"sendProductToFirstFloor", String.valueOf(result2.getStatus()), JSON.toJSONString(param), String.valueOf(result2.body()), "二期发货申请捆扎、贴标"); luceneLogService.interfaceExecuteLog(luceneLogDto); return result2.body(); @@ -601,7 +601,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { public String getBoxInfo(JSONObject param) { try { MDC.put(log_file_type, log_type); - log.info("applyTaskToWms-----输入参数{}", param); + log.info("getBoxInfo-----输入参数{}", param); String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); AddressDto addressDto = addressService.findByCode("getBoxInfo"); String url = wmsurl + addressDto.getMethods_url(); @@ -613,11 +613,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .execute(); } catch (Exception e) { String msg = e.getMessage(); - log.info("applyTaskToWms-----输出参数{}", msg); + log.info("getBoxInfo-----输出参数{}", msg); //网络不通 } if(ObjectUtil.isEmpty(result2)){ - log.info("applyTaskToWms-----输出参数{}", "返回结果为空"); + log.info("getBoxInfo-----输出参数{}", "返回结果为空"); return null; } String type = ""; @@ -626,8 +626,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } else { type = "error"; } - log.info("applyTaskToWms-----输出参数{}", result2.body()); - LuceneLogDto luceneLogDto = new LuceneLogDto(4,"applyTaskToWms", String.valueOf(result2.getStatus()), + log.info("getBoxInfo-----输出参数{}", result2.body()); + LuceneLogDto luceneLogDto = new LuceneLogDto(4,"getBoxInfo", String.valueOf(result2.getStatus()), JSON.toJSONString(param), String.valueOf(result2.body()), "二期发货申请捆扎、贴标"); luceneLogService.interfaceExecuteLog(luceneLogDto); return result2.body(); @@ -641,7 +641,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { public String secondaryAllocationPoint(JSONObject param) { try { MDC.put(log_file_type, log_type); - log.info("applyTaskToWms-----输入参数{}", param); + log.info("secondaryAllocationPoint-----输入参数{}", param); String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); AddressDto addressDto = addressService.findByCode("secondaryAllocationPoint"); String url = wmsurl + addressDto.getMethods_url(); @@ -653,11 +653,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .execute(); } catch (Exception e) { String msg = e.getMessage(); - log.info("applyTaskToWms-----输出参数{}", msg); + log.info("secondaryAllocationPoint-----输出参数{}", msg); //网络不通 } if(ObjectUtil.isEmpty(result2)){ - log.info("applyTaskToWms-----输出参数{}", "返回结果为空"); + log.info("secondaryAllocationPoint-----输出参数{}", "返回结果为空"); return null; } String type = ""; @@ -666,8 +666,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } else { type = "error"; } - log.info("applyTaskToWms-----输出参数{}", result2.body()); - LuceneLogDto luceneLogDto = new LuceneLogDto(4,"applyTaskToWms", String.valueOf(result2.getStatus()), + log.info("secondaryAllocationPoint-----输出参数{}", result2.body()); + LuceneLogDto luceneLogDto = new LuceneLogDto(4,"secondaryAllocationPoint", String.valueOf(result2.getStatus()), JSON.toJSONString(param), String.valueOf(result2.body()), "二期发货申请捆扎、贴标"); luceneLogService.interfaceExecuteLog(luceneLogDto); return result2.body(); @@ -677,6 +677,35 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } } + @Override + public void actionFinishRequest2(JSONObject jsonObject) { + HttpResponse execute = null; + try { + String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); + AddressDto addressDto = addressService.findByCode("actionFinishRequest2"); + String url = wmsurl + addressDto.getMethods_url(); + log.info("actionFinishRequest2 - 设备工位取货完成反馈{}", jsonObject); + LuceneLogDto luceneLogDto = new LuceneLogDto(4,"actionFinishRequest2", "", + String.valueOf(jsonObject), + "", jsonObject.getString("task_code") + "设备工位取货完成反馈"); + luceneLogService.interfaceExecuteLog(luceneLogDto); + try { + execute = HttpRequest.post(url) + .body(String.valueOf(jsonObject)) + .execute(); + } catch (Exception e) { + String msg = e.getMessage(); + log.info("feedbackDie-----输出参数{}", msg); + //网络不通 + } + } catch (Exception e) { + LuceneLogDto luceneLogDto = new LuceneLogDto(4,"actionFinishRequest2", String.valueOf(execute.getStatus()), + JSON.toJSONString(execute.body()), + String.valueOf(execute.body()), jsonObject.getString("task_code") + "设备工位取货完成反馈失败"); + luceneLogService.interfaceExecuteLog(luceneLogDto); + } + } + @Override public HttpResponse feedbackDies(JSONObject param) { HttpResponse result2 = null; @@ -697,7 +726,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } log.info("feedbackDie - 反馈管芯{}", result2.body()); LuceneLogDto luceneLogDto = new LuceneLogDto(4,"feedbackDie", String.valueOf(result2.getStatus()), - JSON.toJSONString(result2.body()), + String.valueOf(param), String.valueOf(result2.body()), "反馈管芯抓取"); luceneLogService.interfaceExecuteLog(luceneLogDto); return result2; @@ -766,7 +795,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { public String applyUpdatePointCode(JSONObject param) { try { MDC.put(log_file_type, log_type); - log.info("applyTaskToWms-----输入参数{}", param); + log.info("applyUpdatePointCode-----输入参数{}", param); String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); AddressDto addressDto = addressService.findByCode("deviceApplyExceptional"); String url = wmsurl + addressDto.getMethods_url(); @@ -778,11 +807,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { .execute(); } catch (Exception e) { String msg = e.getMessage(); - log.info("applyTaskToWms-----输出参数{}", msg); + log.info("applyUpdatePointCode-----输出参数{}", msg); //网络不通 } if (ObjectUtil.isEmpty(result2)) { - log.info("applyTaskToWms-----输出参数{}", "返回结果为空"); + log.info("applyUpdatePointCode-----输出参数{}", "返回结果为空"); return null; } String type = ""; @@ -791,8 +820,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } else { type = "error"; } - log.info("applyTaskToWms-----输出参数{}", result2.body()); - LuceneLogDto luceneLogDto = new LuceneLogDto(4,"applyTaskToWms", String.valueOf(result2.getStatus()), + log.info("applyUpdatePointCode-----输出参数{}", result2.body()); + LuceneLogDto luceneLogDto = new LuceneLogDto(4,"applyUpdatePointCode", String.valueOf(result2.getStatus()), JSON.toJSONString(param), String.valueOf(result2.body()), "申请更新点位"); luceneLogService.interfaceExecuteLog(luceneLogDto); return result2.body(); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java index b2f5de694..f7049e1dc 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java @@ -126,6 +126,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { String route_plan_code = request.getRoute_plan_code(); String task_type = request.getTask_type(); String truss_type = request.getTruss_type(); + Integer agv_action_type = request.getAgv_action_type(); String empty_site = request.getEmpty_site(); String is_bushing = request.getIs_bushing(); String is_pulling = request.getIs_pulling(); @@ -335,6 +336,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { 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("agv_action_type", agv_action_type); jo.put("priority", priority); jo.put("vehicle_code", vehicle_code); jo.put("vehicle_type", vehicle_type); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java index 4a8087ef1..a26f11e73 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java @@ -342,6 +342,14 @@ public interface InstructionService extends CommonService { */ Instruction findByStartCodeAndReady(String device_code); + /** + * 根据起点设备编号查询当前是否有运行的指令 + * + * @param device_code + * @return + */ + Instruction findByDeviceCodeRunFromCache(String device_code); + /** * 根据终点设备编号查询当前是否有就绪指令 * @@ -482,4 +490,7 @@ public interface InstructionService extends CommonService { Boolean querySameNextDeviceCodeInstByOut(String nextDeviceCode); List findByCodeAndExcute(String nextDeviceCode); + + + List findByNextCode(String nextDeviceCode); } 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 889c69d29..d5f91606d 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 @@ -411,22 +411,7 @@ public class InstructionServiceImpl extends CommonServiceImpl 0 && StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) { Device deviceByCode = deviceAppService.findDeviceByCode(dto.getStart_device_code()); -// if (StrUtil.equals(task.getRequest_again_success(), "1")) { -// //追加订单 -// HttpResponse result = xiangGongAgvService.addOrderSequences(dto); -// if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) { -// dto.setSend_status("2"); -// } else { -// dto.setSend_status("1"); -// } -// -// } else + if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())) { String interactionJson = task.getInteraction_json(); if (StrUtil.isEmpty(interactionJson)){ @@ -564,14 +546,14 @@ public class InstructionServiceImpl extends CommonServiceImpl instructionMybatis = instructionMapper.selectList(Wrappers.lambdaQuery(InstructionMybatis.class) - .eq(InstructionMybatis::getTask_code, dto.getTask_code())); - if (CollUtil.isNotEmpty(instructionMybatis) && instructionMybatis.stream().anyMatch(inst -> inst.getStart_device_code() - .equals(start_device_code))) { - return; - } - } +// if (StrUtil.isNotEmpty(dto.getTask_code())) { +// List instructionMybatis = instructionMapper.selectList(Wrappers.lambdaQuery(InstructionMybatis.class) +// .eq(InstructionMybatis::getTask_code, dto.getTask_code())); +// if (CollUtil.isNotEmpty(instructionMybatis) && instructionMybatis.stream().anyMatch(inst -> inst.getStart_device_code() +// .equals(start_device_code))) { +// return; +// } +// } String currentUsername = SecurityUtils.getCurrentNickName(); String now = DateUtil.now(); if (StrUtil.isEmpty(dto.getRoute_plan_code())) { @@ -1560,6 +1542,30 @@ public class InstructionServiceImpl extends CommonServiceImpl instructionList = instructions; + ListUtil.sort( + instructionList, + new Comparator() { + @Override + public int compare(Instruction o1, Instruction o2) { + return o1.getCreate_time().compareTo(o2.getCreate_time()); + } + }); + Iterator it = instructions.iterator(); + while (it.hasNext()) { + Instruction inst = it.next(); + if (StrUtil.equals(devicecode, inst.getStart_device_code()) + && inst.getInstruction_status().equals(InstructionStatusEnum.BUSY.getIndex())) { + return inst; + } + } + + return null; + } + + @Override public Instruction findByNextDeviceCodeFromCache(String devicecode) { List instructionList = instructions; @@ -1926,7 +1932,15 @@ public class InstructionServiceImpl extends CommonServiceImpl findByCodeAndExcute(String next_code) { - List instructionList = instructions.stream().filter(item -> item.getNext_device_code().equals(next_code)).collect(Collectors.toList()); + List instructionList = instructions.stream().filter(item -> item.getNext_device_code().equals(next_code) || item.getStart_device_code().equals(next_code)).collect(Collectors.toList()); + + return instructionList; + } + + + @Override + public List findByNextCode(String next_code) { + List instructionList = instructions.stream().filter(item -> item.getNext_device_code().equals(next_code) ).collect(Collectors.toList()); return instructionList; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/enums/AgvActionTypeEnum.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/enums/AgvActionTypeEnum.java index 67b408a90..e90538944 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/enums/AgvActionTypeEnum.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/enums/AgvActionTypeEnum.java @@ -19,7 +19,7 @@ public enum AgvActionTypeEnum { /** * 防货二次分配 */ - OUT_STOCK(3, "防货二次分配"), + OUT_STOCK(3, "放货二次分配"), /** * 取放货二次分配 */ diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/enums/AgvSystemTypeEnum.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/enums/AgvSystemTypeEnum.java index 6acfbbef1..abf9625ed 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/enums/AgvSystemTypeEnum.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/enums/AgvSystemTypeEnum.java @@ -11,14 +11,17 @@ import lombok.Getter; @AllArgsConstructor public enum AgvSystemTypeEnum { /** + * 二期一楼AGV任务 * 一期1楼叉车NDC系统 */ One_NDC_System_Type("1", "1", "一期1楼叉车NDC系统"), /** + * 二期二楼NDC系统 * 一期2楼NDC系统 */ Two_NDC_System_Type("2", "2", "一期2楼NDC系统"), /** + * 二期一楼叉车任务 * 仙工AGV系统 */ XG_System_Type("3", "3", "仙工AGV系统"); 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 f671b0cb9..73a3e12ac 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 @@ -390,6 +390,13 @@ public interface TaskService extends CommonService { TaskDto findByStartCodeAndReady(String device_code); + /** + * 查找符合条件的堆叠行架任务 + * @return + */ + List findByTrappedManipulatorReady(); + + /** * 根据起载具号查询就绪任务 * @@ -530,4 +537,5 @@ public interface TaskService extends CommonService { */ TaskDto findByTaskCode(String task_code); + List queryAllHJReadyTask(); } 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 136ee6a86..8fc6f238e 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 @@ -568,6 +568,7 @@ public class TaskServiceImpl extends CommonServiceImpl impleme dto.setStart_device_code2(dto.getStart_point_code2()); dto.setNext_device_code2(dto.getNext_point_code2()); + if (StrUtil.isEmpty(dto.getPriority())) { dto.setPriority(CommonFinalParam.ONE); } @@ -1106,6 +1107,15 @@ public class TaskServiceImpl extends CommonServiceImpl impleme return optionalTask.orElse(null); } + @Override + public List findByTrappedManipulatorReady() { + //根据时间升序取第一个 + List taskDtoList = tasks.stream() + .filter(task -> StrUtil.equals(task.getTask_type(), TaskTypeEnum.Truss_Task.getIndex()) + && StrUtil.equals(task.getTask_status(), TaskStatusEnum.READY.getIndex())).collect(Collectors.toList()); + return taskDtoList; + } + @Override public TaskDto findByVehicleCodeCodeAndReady(String vehicleCode) { Optional optionalTask = tasks.stream() @@ -1588,6 +1598,16 @@ public class TaskServiceImpl extends CommonServiceImpl impleme return null; } + @Override + public List queryAllHJReadyTask() { + return Optional + .ofNullable(this.tasks) + .orElse(new CopyOnWriteArrayList<>()) + .stream() + .filter(taskDto -> StrUtil.equals(taskDto.getTask_type(), TaskTypeEnum.Truss_Task.getIndex()) + && StrUtil.equals(taskDto.getTask_status(), TaskStatusEnum.READY.getIndex())) + .collect(Collectors.toList()); + } /** diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/dto/LuceneLogDto.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/dto/LuceneLogDto.java index 720eaa1cf..e456df43e 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/dto/LuceneLogDto.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/dto/LuceneLogDto.java @@ -92,6 +92,7 @@ public class LuceneLogDto { final String requestparam, final String responseparam, final String content) { super(); this.log_level = log_level; + this.method =method; this.requestparam = requestparam; this.responseparam = responseparam; this.content = content; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/controller/logicflow/StageController.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/controller/logicflow/StageController.java index 23635f2d6..80df9b2b8 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/controller/logicflow/StageController.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/controller/logicflow/StageController.java @@ -82,7 +82,6 @@ public class StageController { } @PostMapping("/getNewStageDataByCode") - @Log("根据stage_code获取舞台数据") public ResponseEntity getNewStageDataByCode(@RequestBody String code) { Stage one = stageService.getOne(new LambdaQueryWrapper().eq(Stage::getStage_code, code)); return new ResponseEntity<>(one, HttpStatus.CREATED); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/controller/user/UserController.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/controller/user/UserController.java index 0f57048f3..3a952322d 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/controller/user/UserController.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/controller/user/UserController.java @@ -58,14 +58,14 @@ public class UserController { private ISysUserService userService; - + @GetMapping public ResponseEntity query(UserQuery query, PageQuery page){ return new ResponseEntity(TableDataInfo.build(userService.getUserDetail(query, page)),HttpStatus.OK); } @Log("新增用户") - + @PostMapping // @SaCheckPermission("user:add") public ResponseEntity create(@RequestBody Map user){ @@ -74,7 +74,7 @@ public class UserController { } @Log("修改用户") - + @PutMapping // @SaCheckPermission("user:edit") public ResponseEntity update( @RequestBody Map resources) throws Exception { @@ -83,7 +83,7 @@ public class UserController { } @Log("修改用户:个人中心") - + public ResponseEntity center(@RequestBody SysUser resources){ if(!resources.getUser_id().equals(StpUtil.getLoginIdAsLong())){ throw new BadRequestException(LangProcess.msg("error_sysAuth")); @@ -93,24 +93,24 @@ public class UserController { } @Log("删除用户") - + @DeleteMapping public ResponseEntity delete(@RequestBody Set ids) { userService.removeByIds(ids); return new ResponseEntity<>(HttpStatus.OK); } - + @PostMapping(value = "/updatePass") public ResponseEntity updatePass(@RequestBody JSONObject passVo) throws Exception { // 解密,得到字符密码 String oldPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,passVo.getString("oldPass")); String newPass = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,passVo.getString("newPass")); - SysUser user = userService.getOne(new LambdaQueryWrapper().eq(SysUser::getUsername, SecurityUtils.getCurrentNickName())); - if (!SaSecureUtil.md5BySalt(user.getPassword(), "salt").equals(SaSecureUtil.md5BySalt(oldPass, "salt"))) { + SysUser user = userService.getOne(new LambdaQueryWrapper().eq(SysUser::getUsername, SecurityUtils.getCurrentUsername())); + if (!user.getPassword().equals(SaSecureUtil.md5BySalt(oldPass, "salt"))) { throw new BadRequestException(LangProcess.msg("login_pwdWrong_1")); } - if (!SaSecureUtil.md5BySalt(user.getPassword(), "salt").equals(SaSecureUtil.md5BySalt(newPass, "salt"))) { + if (user.getPassword().equals(SaSecureUtil.md5BySalt(newPass, "salt"))) { throw new BadRequestException(LangProcess.msg("login_pwdWrong_2")); } user.setPassword(SaSecureUtil.md5BySalt(newPass, "salt")); @@ -118,14 +118,14 @@ public class UserController { return new ResponseEntity<>(HttpStatus.OK); } - + @PostMapping(value = "/updateAvatar") public ResponseEntity updateAvatar(@RequestParam MultipartFile avatar){ return new ResponseEntity<>(userService.updateAvatar(avatar), HttpStatus.OK); } @Log("修改邮箱") - + @PostMapping(value = "/updateEmail/{code}") public ResponseEntity updateEmail(@PathVariable String code,@RequestBody SysUser user) throws Exception { String password = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,user.getPassword()); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/CreateDDJInst.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/CreateDDJInst.java index 094b822ce..eaa04365c 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/CreateDDJInst.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/CreateDDJInst.java @@ -57,10 +57,10 @@ public class CreateDDJInst { String next_device_code = taskDto.getNext_device_code(); Device nextDevice = appService.findDeviceByCode(next_device_code); //判断有无出入库任务是相同路线 - TaskDto dto = taskserver.findByCodeAndExcute(next_device_code, start_device_code); - if (ObjectUtil.isNotEmpty(dto)) { - continue; - } +// TaskDto dto = taskserver.findByCodeAndExcute(next_device_code, start_device_code); +// if (ObjectUtil.isNotEmpty(dto)) { +// continue; +// } if (startDevice.getDevice_type().equals(DeviceType.storage.name()) && (nextDevice.getDevice_type().equals(DeviceType.conveyor.name()) || nextDevice.getDevice_type().equals(DeviceType.storage.name()))) { taskDtoList.add(taskDto); @@ -215,10 +215,10 @@ public class CreateDDJInst { List byDeviceCodes = instructionService.findByDeviceCodes(instruction, true); Instruction instdto = new Instruction(); if (CollUtil.isEmpty(byDeviceCodes)) { - //判断有没有DDJ对接位出入库的指令 - List byCodeAndExcute = instructionService.findByCodeAndExcute(next_device_code); + //判断有没有DDJ对接位出入库的指令,只判断终点 + List byCodeAndExcute = instructionService.findByNextCode(next_device_code); if (CollUtil.isNotEmpty(byCodeAndExcute)){ - ((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("有DDJ对接位出入库的指令"); + ((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("有DDJ对接位为终点的指令"); continue; } instdto.setInstruction_type(task_type); @@ -316,6 +316,12 @@ public class CreateDDJInst { String count = deviceByCode.getExtraValue().get("count").toString(); if (StrUtil.isNotEmpty(count)) { if (max <= Integer.parseInt(count)) { + //判断有没有DDJ对接位出入库的指令,只判断终点 + List byCodeAndExcute = instructionService.findByNextCode(next_device_code); + if (CollUtil.isNotEmpty(byCodeAndExcute)){ + ((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("有DDJ对接位为终点的指令"); + continue; + } instdto.setInstruction_type(task_type); instdto.setInstruction_id(IdUtil.simpleUUID()); instdto.setRoute_plan_code(route_plan_code); diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device.properties index fd1981f89..8eb4b8e22 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device.properties @@ -15,6 +15,8 @@ one_message15=\u7533\u8BF7AGV\u642C\u8FD0\u4EFB\u52A1\u63A5\u53E3\u4E0D\u901A one_message16=\u7533\u8BF7AGV\u642C\u8FD0\u4EFB\u52A1\u6210\u529F one_message17=\u7533\u8BF7AGV\u642C\u8FD0\u4EFB\u52A1\u5931\u8D25 one_message18=\u672A\u627E\u5230\u66F4\u65B0\u7684\u70B9\u4F4D +one_message19=\u4E0A\u4E00\u6761\u52A8\u4F5C\u4E0D\u662F\u53D6\u8D27\u4E2D\u6216\u8005\u53D6\u8D27\u5B8C\u6210\u62A5\u8B66 +one_message20=\u4E0A\u4E00\u6761\u52A8\u4F5C\u4E0D\u662F\u653E\u8D27\u4E2D\u62A5\u8B66 one_mode1=\u7533\u8BF7\u5165\u5E93\u4EFB\u52A1 one_mode2=\u7533\u8BF7\u7A7A\u6258\u76D8\u5165\u5E93 one_mode3=\u7533\u8BF7AGV\u4EFB\u52A1 diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device_en_US.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device_en_US.properties index 5bc24ec89..73270fa50 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device_en_US.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device_en_US.properties @@ -15,7 +15,8 @@ one_message15=The interface for applying for a complement to the AGV carrying ta one_message16=Succeeded in applying for the AGV transfer task. Procedure one_message17=Failed to apply for the AGV transfer task. Procedure one_message18=No updated point found - +one_message19=The previous action is not in the process of picking up or picking up the finished alarm +one_message20=The last action was not an alarm during delivery one_mode1=Request a warehouse entry task one_mode2=Request empty pallets for storage one_mode3=Request AGV diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device_in_ID.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device_in_ID.properties index 80657582d..17ed9cb66 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device_in_ID.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device_in_ID.properties @@ -15,7 +15,8 @@ one_message15=Permintaan kode tambahan AGV memindahkan antarmuka misi tidak ters one_message16=Minta ijin ke operasi AGV one_message17=Aplikasi bantuan AGV pemindahan gagal one_message18=Titik pembaruan tidak ditemukan - +one_message19=Langkah terakhir bukan untuk mengambil barang atau menggunakannya untuk menyelesaikan alarm +one_message20=Gerakan terakhir adalah tidak menempatkan alarm di kargo one_mode1=Berlaku untuk tugas pustaka one_mode2=Pendaftaran nampan kosong one_mode3=Permintaan AGV diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device_zh_CN.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device_zh_CN.properties index 3ae3f4d8e..87d3b7bf1 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device_zh_CN.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/one_device/one_device_zh_CN.properties @@ -15,7 +15,8 @@ one_message15=\u7533\u8BF7\u8865\u7801AGV\u642C\u8FD0\u4EFB\u52A1\u63A5\u53E3\u4 one_message16=\u7533\u8BF7\u8865\u7801AGV\u642C\u8FD0\u4EFB\u52A1\u6210\u529F one_message17=\u7533\u8BF7\u8865\u7801AGV\u642C\u8FD0\u4EFB\u52A1\u5931\u8D25 one_message18=\u672A\u627E\u5230\u66F4\u65B0\u7684\u70B9\u4F4D - +one_message19=\u4E0A\u4E00\u6761\u52A8\u4F5C\u4E0D\u662F\u53D6\u8D27\u4E2D\u6216\u8005\u53D6\u8D27\u5B8C\u6210\u62A5\u8B66 +one_message20=\u4E0A\u4E00\u6761\u52A8\u4F5C\u4E0D\u662F\u653E\u8D27\u4E2D\u62A5\u8B66 one_mode1=\u7533\u8BF7\u5165\u5E93\u4EFB\u52A1 one_mode2=\u7533\u8BF7\u7A7A\u6258\u76D8\u5165\u5E93 one_mode3=\u7533\u8BF7AGV\u4EFB\u52A1 diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal.properties index 6b680c23b..1b7dfeda7 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal.properties @@ -57,7 +57,10 @@ universal_notCreateInstMessage5=\u5B58\u5728\u76F8\u540C\u8DEF\u7EBF\u7684\u6307 universal_notCreateInstMessage6=\u4E0B\u4E00\u4E2A\u8BBE\u5907\u4E0D\u662F\u8F93\u9001\u7EBF\u6307\u4EE4! universal_notCreateInstMessage7=\u6258\u76D8\u7C7B\u578B\u4E3A\u7A7A! universal_notCreateInstMessage8=\u6761\u7801\u4E3A\u7A7A! -universal_notCreateInstMessage9=\u63D2\u62D4\u8F74\u5DE5\u4F4D\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u65E0\u6CD5\u751F\u6210\u6307\u4EE4! +universal_notCreateInstMessage9=\u63D2\u62D4\u8F74\u5DE5\u4F4Dmode!=2\uFF0C\u65E0\u6CD5\u751F\u6210\u6307\u4EE4! +universal_notCreateInstMessage10=\u63D2\u62D4\u8F74\u5DE5\u4F4Dmove!=0\uFF0C\u65E0\u6CD5\u751F\u6210\u6307\u4EE4! +universal_notCreateInstMessage11=\u63D2\u62D4\u8F74\u5DE5\u4F4Daction!=2\uFF0C\u65E0\u6CD5\u751F\u6210\u6307\u4EE4! +universal_notCreateInstMessage12=\u63D2\u62D4\u8F74\u5DE5\u4F4Daction!=1\uFF0C\u65E0\u6CD5\u751F\u6210\u6307\u4EE4! universal_actionMessage1=\u4E0D\u5141\u8BB8\u53D6\u653E universal_actionMessage2=\u5141\u8BB8\u53D6\u653E universal_actionMessage3=\u5141\u8BB8\u79BB\u5F00 diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_en_US.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_en_US.properties index 61adfec8e..1df6b3a7d 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_en_US.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_en_US.properties @@ -54,7 +54,10 @@ universal_notCreateInstMessage3=The device is in standby mode or is not allowed universal_notCreateInstMessage4=ddj interface bit is in stock, cannot generate command! universal_notCreateInstMessage5=Instructions with the same route exist! universal_notCreateInstMessage6=The next device is not a conveyor line directive! -universal_notCreateInstMessage9=The plugging and unplugging shaft station conditions are not met, and the instruction cannot be generated! +universal_notCreateInstMessage9=Plugging and unplugging axis station mode!=2, unable to generate command! +universal_notCreateInstMessage10=Plug and unplug shaft station move!=0, command cannot be generated! +universal_notCreateInstMessage11=Plugging and unplugging axis station action!=2, unable to generate command! +universal_notCreateInstMessage12=Plugging and unplugging axis station action!=1, unable to generate command! universal_actionMessage1=Pick-and-place is not permitted universal_actionMessage2=Pick-and-place is allowed universal_actionMessage3=Permission to leave diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_in_ID.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_in_ID.properties index 506419cd1..cbbd36815 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_in_ID.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_in_ID.properties @@ -54,7 +54,10 @@ universal_notCreateInstMessage3=Siaga perangkat atau tidak diizinkan masuk universal_notCreateInstMessage4=DDJ mendarat di dok, tidak ada perintah yang diberikan! universal_notCreateInstMessage5=Ada instruksi tentang rute yang sama! universal_notCreateInstMessage6=Perangkat berikutnya bukan arahan jalur konveyor! -universal_notCreateInstMessage9=Kondisi stasiun poros penyumbatan dan pencabutan tidak terpenuhi, dan instruksi tidak dapat dibuat! +universal_notCreateInstMessage9=Memasukkan dan mencabut mode stasiun sumbu!=2, tidak dapat menghasilkan perintah! +universal_notCreateInstMessage10=Pasang dan cabut stasiun poros bergerak!=0, perintah tidak dapat dihasilkan! +universal_notCreateInstMessage11=Memasukkan dan mencabut tindakan stasiun sumbu!=2, tidak dapat menghasilkan perintah! +universal_notCreateInstMessage12=Memasukkan dan mencabut tindakan stasiun sumbu!=1, tidak dapat menghasilkan perintah! universal_actionMessage1=Pick-and-place tidak diizinkan universal_actionMessage2=Pick-and-place diperbolehkan universal_actionMessage3=Izin untuk pergi diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_zh_CN.properties b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_zh_CN.properties index c6ad11329..580362714 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_zh_CN.properties +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/language/monitor/universal/universal_zh_CN.properties @@ -59,7 +59,10 @@ universal_notCreateInstMessage3=\u8BBE\u5907\u5F85\u673A\u6216\u4E0D\u5141\u8BB8 universal_notCreateInstMessage4=ddj\u5BF9\u63A5\u4F4D\u6709\u8D27,\u65E0\u6CD5\u751F\u6210\u6307\u4EE4! universal_notCreateInstMessage5=\u5B58\u5728\u76F8\u540C\u8DEF\u7EBF\u7684\u6307\u4EE4! universal_notCreateInstMessage6=\u4E0B\u4E00\u4E2A\u8BBE\u5907\u4E0D\u662F\u8F93\u9001\u7EBF\u6307\u4EE4! -universal_notCreateInstMessage9=\u63D2\u62D4\u8F74\u5DE5\u4F4D\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u65E0\u6CD5\u751F\u6210\u6307\u4EE4! +universal_notCreateInstMessage9=\u63D2\u62D4\u8F74\u5DE5\u4F4Dmode!=2\uFF0C\u65E0\u6CD5\u751F\u6210\u6307\u4EE4! +universal_notCreateInstMessage10=\u63D2\u62D4\u8F74\u5DE5\u4F4Dmove!=0\uFF0C\u65E0\u6CD5\u751F\u6210\u6307\u4EE4! +universal_notCreateInstMessage11=\u63D2\u62D4\u8F74\u5DE5\u4F4Daction!=2\uFF0C\u65E0\u6CD5\u751F\u6210\u6307\u4EE4! +universal_notCreateInstMessage12=\u63D2\u62D4\u8F74\u5DE5\u4F4Daction!=1\uFF0C\u65E0\u6CD5\u751F\u6210\u6307\u4EE4! universal_notCreateInstMessage7=\u6258\u76D8\u7C7B\u578B\u4E3A\u7A7A! universal_notCreateInstMessage8=\u6761\u7801\u4E3A\u7A7A! universal_directives=\u6307\u4EE4 diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/log/NDCAgvServiceImpl.xml b/acs2/nladmin-system/nlsso-server/src/main/resources/log/NDCAgvServiceImpl.xml index f13d96f5f..4ad8c2e02 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/log/NDCAgvServiceImpl.xml +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/log/NDCAgvServiceImpl.xml @@ -10,7 +10,7 @@ 15 - 200MB + 50MB 2GB diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/log/OneNDCSocketConnectionAutoRun.xml b/acs2/nladmin-system/nlsso-server/src/main/resources/log/OneNDCSocketConnectionAutoRun.xml index 8f4151a72..4d8d438ff 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/log/OneNDCSocketConnectionAutoRun.xml +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/log/OneNDCSocketConnectionAutoRun.xml @@ -10,7 +10,7 @@ 15 - 200MB + 50MB 2GB diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/log/TwoNDCSocketConnectionAutoRun.xml b/acs2/nladmin-system/nlsso-server/src/main/resources/log/TwoNDCSocketConnectionAutoRun.xml index 63517b12f..6f9b53f82 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/log/TwoNDCSocketConnectionAutoRun.xml +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/log/TwoNDCSocketConnectionAutoRun.xml @@ -10,7 +10,7 @@ 15 - 200MB + 50MB 2GB diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/log/XgAgvDeviceDriver.xml b/acs2/nladmin-system/nlsso-server/src/main/resources/log/XgAgvDeviceDriver.xml index d47c53012..885cf5920 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/log/XgAgvDeviceDriver.xml +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/log/XgAgvDeviceDriver.xml @@ -10,7 +10,7 @@ 15 - 100MB + 50MB 2GB diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/log/XianGongAgvServiceImpl.xml b/acs2/nladmin-system/nlsso-server/src/main/resources/log/XianGongAgvServiceImpl.xml new file mode 100644 index 000000000..02c3cf8f7 --- /dev/null +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/log/XianGongAgvServiceImpl.xml @@ -0,0 +1,29 @@ + + + + + + + + + ${LOG_HOME}/仙工agv请求/%d{yyyy-MM-dd}.%i.log + + 15 + + 50MB + + 2GB + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + ${log.charset} + + + + + + + + + diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml b/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml index a357d9c8a..a070661e3 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml @@ -22,6 +22,8 @@ https://juejin.cn/post/6844903775631572999 + + diff --git a/acs2/nladmin-ui/src/i18n/langs/task/en.js b/acs2/nladmin-ui/src/i18n/langs/task/en.js index 5585ec735..bc571ce9f 100644 --- a/acs2/nladmin-ui/src/i18n/langs/task/en.js +++ b/acs2/nladmin-ui/src/i18n/langs/task/en.js @@ -7,9 +7,15 @@ export default { 'Task_status': 'Task Status', 'Origin_or_destination': 'Origin Or Destination', 'Task_type': 'Task Type', + 'Action_type': 'Action Type', + 'ORDINARY': 'Ordinary task', + 'IN_STOCK': 'Pick up secondary distribution', + 'OUT_STOCK': 'Release cargo secondary distribution', + 'IN_OUT_STOCK': 'Pick and release cargo secondary distribution', 'Warehouse_task_type': 'Warehouse Task Type', 'AGV_system': 'AGV System', 'Routing_scheme': 'Routing Scheme', + 'agv_action_type': 'agv Secondary allocation type', 'Priority': 'Priority', 'Vehicle_number': 'Vehicle Number', 'Task_code': 'Task Code', diff --git a/acs2/nladmin-ui/src/i18n/langs/task/in.js b/acs2/nladmin-ui/src/i18n/langs/task/in.js index ff60c0e7e..b1c10a540 100644 --- a/acs2/nladmin-ui/src/i18n/langs/task/in.js +++ b/acs2/nladmin-ui/src/i18n/langs/task/in.js @@ -7,9 +7,15 @@ export default { 'Task_status': 'Status Tugas', 'Origin_or_destination': 'Asal Atau Tujuan', 'Task_type': 'Jenis Tugas', + 'Action_type': 'Tipe tugas sekunder', + 'ORDINARY': 'Tugas biasa', + 'IN_STOCK': 'Dapatkan pasokan kedua', + 'OUT_STOCK': 'Memasukkan barang ke distribusi kedua', + 'IN_OUT_STOCK': 'Ambil paket distribusi kedua', 'Warehouse_task_type': 'Jenis Tugas Gudang', 'AGV_system': 'Sistem AGV', 'Routing_scheme': 'Skema Routing', + 'agv_action_type': 'Tipe distribusi kedua agv', 'Priority': 'Prioritas', 'Vehicle_number': 'Nomor Kendaraan', 'Task_code': 'Nomor Tugas', diff --git a/acs2/nladmin-ui/src/i18n/langs/task/zh.js b/acs2/nladmin-ui/src/i18n/langs/task/zh.js index 045882c91..063726046 100644 --- a/acs2/nladmin-ui/src/i18n/langs/task/zh.js +++ b/acs2/nladmin-ui/src/i18n/langs/task/zh.js @@ -7,9 +7,15 @@ export default { 'Task_status': '任务状态', 'Origin_or_destination': '输入起点或终点', 'Task_type': '任务类型', + 'Action_type': '二次分配类型', + 'ORDINARY': '普通任务', + 'IN_STOCK': '取货二次分配', + 'OUT_STOCK': '放货二次分配', + 'IN_OUT_STOCK': '取放货二次分配', 'Warehouse_task_type': '立库任务类型', 'AGV_system': 'agv系统', 'Routing_scheme': '路由方案', + 'agv_action_type': 'agv二次分配类型', 'Priority': '优先级', 'Vehicle_number': '载具号', 'Task_code': '任务号', diff --git a/acs2/nladmin-ui/src/views/acs/device/driver/manipulator_agv_station.vue b/acs2/nladmin-ui/src/views/acs/device/driver/manipulator_agv_station.vue index 08d9e2a80..e0c4a5037 100644 --- a/acs2/nladmin-ui/src/views/acs/device/driver/manipulator_agv_station.vue +++ b/acs2/nladmin-ui/src/views/acs/device/driver/manipulator_agv_station.vue @@ -80,6 +80,11 @@ + + + + + diff --git a/acs2/nladmin-ui/src/views/acs/device/driver/standard_autodoor.vue b/acs2/nladmin-ui/src/views/acs/device/driver/standard_autodoor.vue index c1fb0acc9..59c075a53 100644 --- a/acs2/nladmin-ui/src/views/acs/device/driver/standard_autodoor.vue +++ b/acs2/nladmin-ui/src/views/acs/device/driver/standard_autodoor.vue @@ -50,11 +50,45 @@ - + + + + + + + + + + + + + + + @@ -161,6 +195,7 @@ import { import { selectOpcList } from '@/api/acs/device/opc' import { selectPlcList } from '@/api/acs/device/opcPlc' import { selectListByOpcID } from '@/api/acs/device/opcPlc' +import deviceCrud from '@/api/acs/device/device' import crud from '@/mixins/crud' @@ -184,6 +219,7 @@ export default { configLoading: false, dataOpcservers: [], dataOpcPlcs: [], + deviceList: [], data1: [], data2: [], form: { @@ -195,7 +231,12 @@ export default { is_pickup: true, is_release: true }, - rules: {} + rules: {}, + region: [ + { region_name: '区域一', region_number: '1' }, + { region_name: '区域二', region_number: '2' }, + { region_name: '区域三', region_number: '3' } + ] } }, created() { @@ -234,6 +275,9 @@ export default { this.dataOpcservers = data this.opc_id = this.$props.parentForm.opc_server_id }) + deviceCrud.selectDeviceList().then(data => { + this.deviceList = data + }) }) }, methods: { diff --git a/acs2/nladmin-ui/src/views/acs/device/driver/standard_inspect_site.vue b/acs2/nladmin-ui/src/views/acs/device/driver/standard_inspect_site.vue index 240399dd5..1d53b3ab9 100644 --- a/acs2/nladmin-ui/src/views/acs/device/driver/standard_inspect_site.vue +++ b/acs2/nladmin-ui/src/views/acs/device/driver/standard_inspect_site.vue @@ -51,11 +51,45 @@ - + + + + + + + + + + + + + + + @@ -309,7 +343,12 @@ export default { link_device_code: [], address: '' }, - rules: {} + rules: {}, + region: [ + { region_name: '区域一', region_number: '2' }, + { region_name: '区域二', region_number: '6' }, + { region_name: '区域三', region_number: '8' } + ] } }, created() { diff --git a/acs2/nladmin-ui/src/views/acs/device/driver/standard_ordinary_site.vue b/acs2/nladmin-ui/src/views/acs/device/driver/standard_ordinary_site.vue index ed4bf0d84..1e0064849 100644 --- a/acs2/nladmin-ui/src/views/acs/device/driver/standard_ordinary_site.vue +++ b/acs2/nladmin-ui/src/views/acs/device/driver/standard_ordinary_site.vue @@ -24,7 +24,7 @@ - + @@ -38,6 +38,11 @@ + + + + + diff --git a/acs2/nladmin-ui/src/views/acs/instruction/index.vue b/acs2/nladmin-ui/src/views/acs/instruction/index.vue index ffa308884..6b3792827 100644 --- a/acs2/nladmin-ui/src/views/acs/instruction/index.vue +++ b/acs2/nladmin-ui/src/views/acs/instruction/index.vue @@ -146,6 +146,14 @@ {{ dict.label.task_type[scope.row.instruction_type] }} + + + diff --git a/acs2/nladmin-ui/src/views/acs/task/index.vue b/acs2/nladmin-ui/src/views/acs/task/index.vue index 638cf53c5..28fe6037d 100644 --- a/acs2/nladmin-ui/src/views/acs/task/index.vue +++ b/acs2/nladmin-ui/src/views/acs/task/index.vue @@ -204,6 +204,23 @@ /> + + + + + + + + +