From 9b6291f14657f1b129da3e29c68b18ea593e6ca7 Mon Sep 17 00:00:00 2001 From: lishuai <1793460677@qq.com> Date: Mon, 17 Jun 2024 19:14:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=89=AB=E6=8F=8F=E8=A1=A5=E7=A0=81?= =?UTF-8?q?=E3=80=81=E4=BB=99=E5=AE=AB=E8=B4=A7=E5=8F=89=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nl/acs/agv/server/XianGongAgvService.java | 5 +- .../server/impl/XianGongAgvServiceImpl.java | 59 +++++- ...ConveyorWithScannerWeightDeviceDriver.java | 198 ++++++++++-------- .../StandardStackerDeviceDriver.java | 14 +- .../service/dto/InteractionJsonDTO.java | 13 ++ .../service/impl/InstructionServiceImpl.java | 8 +- .../task/service/impl/TaskServiceImpl.java | 10 +- .../service/quartz/task/CreateDDJInst.java | 14 +- 8 files changed, 214 insertions(+), 107 deletions(-) create mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/dto/InteractionJsonDTO.java diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/XianGongAgvService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/XianGongAgvService.java index 433cdc6d4..be1d60f43 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/XianGongAgvService.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/XianGongAgvService.java @@ -4,6 +4,7 @@ import cn.hutool.http.HttpResponse; import com.alibaba.fastjson.JSONObject; import org.nl.acs.agv.server.dto.AgvDto; import org.nl.acs.instruction.domain.Instruction; +import org.nl.acs.instruction.service.dto.InteractionJsonDTO; import java.util.Map; @@ -117,8 +118,10 @@ public interface XianGongAgvService { /** * 下发叉车运单 + * * @param dto + * @param interactionJsonDTO * @return */ - HttpResponse sendOrderSequencesToForklift(Instruction dto); + HttpResponse sendOrderSequencesToForklift(Instruction dto, InteractionJsonDTO interactionJsonDTO); } 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 1840ddfa7..9f7ed40ee 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 @@ -14,13 +14,13 @@ import org.nl.acs.agv.AgvUtil; import org.nl.acs.agv.AgvWaitUtil; import org.nl.acs.agv.server.XianGongAgvService; import org.nl.acs.agv.server.dto.AgvDto; -import org.nl.acs.angle.domain.AcsPointAngle; 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.ext.wms.service.AcsToWmsService; import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.service.InstructionService; +import org.nl.acs.instruction.service.dto.InteractionJsonDTO; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.device.enums.DeviceType; import org.nl.common.exception.BadRequestException; @@ -32,7 +32,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import java.math.BigDecimal; import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -756,13 +755,13 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { } @Override - public HttpResponse sendOrderSequencesToForklift(Instruction inst) { + 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=创建运单可以添加动作块 jo.put("complete", true); //动作块 - jo.put("blocks", createBlocksForklift(inst)); + jo.put("blocks", createBlocksForklift(inst,interactionJsonDTO)); //运单优先级 jo.put("priority", inst.getPriority()); LuceneLogDto logDto = LuceneLogDto.builder() @@ -804,13 +803,17 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { * 叉车运单动作块 * * @param inst + * @param interactionJsonDTO * @return */ - private JSONArray createBlocksForklift(Instruction inst) { + private JSONArray createBlocksForklift(Instruction inst, InteractionJsonDTO interactionJsonDTO) { JSONArray ja = new JSONArray(); //起点 Device startDevice = deviceAppService.findDeviceByCode(inst.getStart_device_code()); String pointCode = inst.getStart_point_code(); + + + //取货前等待 JSONObject jo = new JSONObject(); //动作块id @@ -842,6 +845,42 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { jo1.put("binTask", "InForkHeight"); ja.add(jo1); + JSONObject jo3 = new JSONObject(); + //动作块id + jo3.put("blockId", IdUtil.simpleUUID()); + //目的地名称 + jo3.put("location", pointCode + "INGET"); + jo3.put("id", pointCode + "INGET"); + //执行脚本 + jo3.put("operation", "expand"); + //通信脚本,动作前后与现场设备交互的场景 + jo3.put("script_name", "Fork-expand.py"); + JSONObject script_args2 = new JSONObject(); + if (ObjectUtil.isNotEmpty(interactionJsonDTO.getExpandWidthLength())) { + script_args2.put("expandWidth",interactionJsonDTO.getExpandWidthLength()); + } + script_args2.put("operation", "expand"); + jo3.put("script_args", script_args2); + ja.add(jo3); + + JSONObject jo4 = new JSONObject(); + //动作块id + jo4.put("blockId", IdUtil.simpleUUID()); + //目的地名称 + jo4.put("location", pointCode + "INGET"); + jo4.put("id", pointCode + "INGET"); + //执行脚本 + jo4.put("operation", "stretch"); + //通信脚本,动作前后与现场设备交互的场景 + jo4.put("script_name", "Fork-expand.py"); + JSONObject script_args1 = new JSONObject(); + if (ObjectUtil.isNotEmpty(interactionJsonDTO.getExpandWidthLength())) { + script_args2.put("stretchLength",interactionJsonDTO.getExpandWidthLength()); + } + script_args1.put("operation", "stretch"); + jo4.put("script_args", script_args1); + ja.add(jo4); + JSONObject jo6 = new JSONObject(); jo6.put("blockId", IdUtil.simpleUUID()); jo6.put("location", inst.getStart_point_code()); @@ -861,16 +900,16 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { jo2.put("operation", "script"); jo2.put("id", pointCode + "OUTGET"); jo2.put("script_name", "userpy/interact.py"); - JSONObject script_args2 = new JSONObject(); - script_args2.put("addr", addr); + JSONObject script_args4 = new JSONObject(); + script_args4.put("addr", addr); JSONObject data2 = new JSONObject(); JSONObject reach2 = new JSONObject(); reach2.put("task_code", inst.getInstruction_code()); reach2.put("address", pointCode + "OUTGET"); data2.put("reach", reach2); - script_args2.put("data", data2); - script_args2.put("protocol", "HTTP"); - jo2.put("script_args", script_args2); + script_args4.put("data", data2); + script_args4.put("protocol", "HTTP"); + jo2.put("script_args", script_args4); ja.add(jo2); 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 7d28608a1..1acc43072 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 @@ -127,8 +127,6 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv int last_container_type = 0; - - //行架任务号 int hj_task = 0; int last_hj_task = 0; @@ -243,16 +241,15 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv } - - if (move != last_move && move==0 && last_move==1) { + if (move != last_move && move == 0 && last_move == 1) { requireSucess = false; clearWrite(); } - if(move !=last_move){ - if (ObjectUtil.isNotEmpty(inst)){ - if (move==0){ + if (move != last_move) { + if (ObjectUtil.isNotEmpty(inst)) { + if (move == 0) { Thread.sleep(10000); led_message = clearMessage(); List deviceCodes = this.getExtraDeviceCodes("link_device_code"); @@ -263,7 +260,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv if (ObjectUtil.isEmpty(linkDevice)) { throw new BadRequestException("设备:" + device_code + "关联设备->" + deviceCode + "为空!"); } - if (linkDevice.getDeviceDriver() instanceof LedScreenDeviceDriver){ + if (linkDevice.getDeviceDriver() instanceof LedScreenDeviceDriver) { device = deviceCode; } } @@ -297,27 +294,27 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv Instruction instruction = null; List toInstructions; //木箱入库申请入库任务 - if (mode == 6 && !requireSucess){ - if (StrUtil.isEmpty(barcode)){ + if (mode == 6 && !requireSucess) { + if (StrUtil.isEmpty(barcode)) { message = "托盘条码为空"; } - applyIn(StorageTypeEnum.BOX_IN.getType(),mode); + applyIn(StorageTypeEnum.BOX_IN.getType(), mode); } //子卷入库申请入库任务 - if (mode == 7 && move == 1 && !requireSucess){ - if (StrUtil.isEmpty(barcode)||StrUtil.isEmpty(material_barcode)){ + if (mode == 7 && move == 1 && !requireSucess) { + if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) { message = "托盘条码为空、或者子卷码为空"; } - applyIn(StorageTypeEnum.STORAGE.getType(),mode); + applyIn(StorageTypeEnum.STORAGE.getType(), mode); } //申请空托盘入库 - if (mode == 9 && move == 1 && !requireSucess){ - if (container_type==0){ + if (mode == 9 && move == 1 && !requireSucess) { + if (container_type == 0) { message = "托盘类型为空"; } applyEmptyTask(StorageTypeEnum.DISKS_IN.getType(), mode); @@ -325,16 +322,16 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv } //申请退货入库 - if (mode == 18 && move == 1 && !requireSucess){ - if (StrUtil.isEmpty(barcode)){ + if (mode == 18 && move == 1 && !requireSucess) { + if (StrUtil.isEmpty(barcode)) { message = "托盘条码为空"; } applyBoxReturnTask(StorageTypeEnum.BOX_RETURN.getType(), mode); } //申请高度 - if (mode == 23 && !requireSucess){ - if (StrUtil.isEmpty(barcode)||StrUtil.isEmpty(material_barcode)){ + if (mode == 23 && !requireSucess) { + if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) { message = "条码为空"; } applyErrorHeight(); @@ -342,7 +339,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv } //申请入库指令、异常位指令 - if (mode == 2 && move == 1 && !requireSucess) { + if (mode == 2 && move == 1 && !requireSucess) { boolean res = instruction_require(); if (res) { notCreateInstMessage = ""; @@ -399,8 +396,18 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv try { JSONObject param = new JSONObject(); param.put("device_code", device_code); - param.put("vehicle_code", barcode); - param.put("material_barcode", material_barcode); + if (StrUtil.isNotEmpty(hand_barcode)) { + param.put("vehicle_code", hand_barcode); + } + if (StrUtil.isNotEmpty(barcode)) { + param.put("vehicle_code", barcode); + } + if (StrUtil.isNotEmpty(material_barcode)) { + param.put("material_barcode", material_barcode); + } + if (StrUtil.isNotEmpty(hand_material_barcode)) { + param.put("material_barcode", hand_material_barcode); + } LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) .content("申请高度等级,参数:" + param) @@ -430,7 +437,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv map2.put("value", 23); list2.add(map2); this.writing(list2); - }else { + } else { LuceneLogDto logDto2 = LuceneLogDto.builder() .device_code(device_code) .content("申请高度等级,返回参数:" + jo.getString("body")) @@ -454,8 +461,18 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv try { JSONObject param = new JSONObject(); param.put("device_code", device_code); - param.put("vehicle_code", barcode); - param.put("material_barcode", material_barcode); + if (StrUtil.isNotEmpty(hand_barcode)) { + param.put("vehicle_code", hand_barcode); + } + if (StrUtil.isNotEmpty(barcode)) { + param.put("vehicle_code", barcode); + } + if (StrUtil.isNotEmpty(material_barcode)) { + param.put("material_barcode", material_barcode); + } + if (StrUtil.isNotEmpty(hand_material_barcode)) { + param.put("material_barcode", hand_material_barcode); + } param.put("type", type); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) @@ -480,7 +497,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv list1.add(map); this.writing(list1); this.requireSucess = true; - }else { + } else { LuceneLogDto logDto2 = LuceneLogDto.builder() .device_code(device_code) .content("申请退货入库,返回参数:" + jo.getString("body")) @@ -497,21 +514,21 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv public void clearWrite() { List list = new ArrayList<>(); Map map = new HashMap<>(); - map.put("code","to_target"); - map.put("value","0"); + map.put("code", "to_target"); + map.put("value", "0"); list.add(map); Map map2 = new HashMap<>(); - map2.put("code","to_task"); - map2.put("value","0"); + map2.put("code", "to_task"); + map2.put("value", "0"); list.add(map2); Map map4 = new HashMap<>(); - map4.put("code","to_container_type"); - map4.put("value","0"); + map4.put("code", "to_container_type"); + map4.put("value", "0"); list.add(map4); this.writing(list); - message=null; - vehicle_code=null; + message = null; + vehicle_code = null; } @@ -558,7 +575,12 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv JSONObject param = new JSONObject(); param.put("device_code", device_code); param.put("container_type", container_type); - param.put("vehicle_code", barcode); + if (StrUtil.isNotEmpty(hand_barcode)) { + param.put("vehicle_code", hand_barcode); + } + if (StrUtil.isNotEmpty(barcode)) { + param.put("vehicle_code", barcode); + } param.put("type", type); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) @@ -583,7 +605,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv list1.add(map); this.writing(list1); this.requireSucess = true; - }else { + } else { LuceneLogDto logDto2 = LuceneLogDto.builder() .device_code(device_code) .content("申请空托盘出入库,返回参数:" + jo.getString("body")) @@ -605,43 +627,52 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv return; } else { try { - JSONObject param = new JSONObject(); - param.put("device_code", device_code); + JSONObject param = new JSONObject(); + param.put("device_code", device_code); + if (StrUtil.isNotEmpty(hand_barcode)) { + param.put("vehicle_code", hand_barcode); + } + if (StrUtil.isNotEmpty(barcode)) { param.put("vehicle_code", barcode); + } + if (StrUtil.isNotEmpty(material_barcode)) { param.put("material_barcode", material_barcode); - param.put("type", type); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("木箱、子卷入库申请入库任务,参数:" + param) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - String response = acsToWmsService.applyTwo(param); - JSONObject jo = JSON.parseObject(response); + } + if (StrUtil.isNotEmpty(hand_material_barcode)) { + param.put("material_barcode", hand_material_barcode); + } + param.put("type", type); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("木箱、子卷入库申请入库任务,参数:" + param) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + String response = acsToWmsService.applyTwo(param); + JSONObject jo = JSON.parseObject(response); message = "木箱、子卷入库申请入库任务,返回参数:" + jo; if (jo.getInteger("status") == 200) { - LuceneLogDto logDto2 = LuceneLogDto.builder() - .device_code(device_code) - .content("木箱、子卷入库申请入库任务,参数,接口返回:" + jo) - .build(); - logDto2.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto2); - List list1 = new ArrayList(); - Map map = new HashMap(); - map.put("code", "to_command"); - map.put("value", mode); - list1.add(map); - this.writing(list1); - }else { - LuceneLogDto logDto2 = LuceneLogDto.builder() - .device_code(device_code) - .content("木箱、子卷入库申请入库任务,返回参数:" + jo.getString("body")) - .build(); - logDto2.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto2); - } + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code(device_code) + .content("木箱、子卷入库申请入库任务,参数,接口返回:" + jo) + .build(); + logDto2.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto2); + List list1 = new ArrayList(); + Map map = new HashMap(); + map.put("code", "to_command"); + map.put("value", mode); + list1.add(map); + this.writing(list1); + } else { + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code(device_code) + .content("木箱、子卷入库申请入库任务,返回参数:" + jo.getString("body")) + .build(); + logDto2.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto2); } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } @@ -703,7 +734,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv if (!ObjectUtil.isEmpty(taskdto)) { if (creatInstruction(taskdto)) return false; } - }else { + } else { if (StrUtil.isNotBlank(barcode)) { //根据载具号查找任务 TaskDto taskdto = taskserver.findByVehicleCodeCodeAndReady(barcode); @@ -726,13 +757,13 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class); String containerType = ""; if (ObjectUtil.isNotEmpty(interactionJsonDTO)) { - containerType = interactionJsonDTO.getContainerType(); + containerType = interactionJsonDTO.getContainerType(); } - if (TaskTypeEnum.AGV_Task.getIndex().equals(taskdto.getTask_type())){ + if (TaskTypeEnum.AGV_Task.getIndex().equals(taskdto.getTask_type())) { String route_plan_code = taskdto.getRoute_plan_code(); List shortPathsList = routeLineService.getShortPathLines(taskdto.getStart_device_code(), taskdto.getNext_device_code(), route_plan_code); - if (CollectionUtil.isEmpty(shortPathsList)){ + if (CollectionUtil.isEmpty(shortPathsList)) { return true; } RouteLineDto routeLineDto = shortPathsList.get(0); @@ -741,20 +772,20 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv List pathlist = Arrays.asList(str); Integer start = 0; String start_device_code = pathlist.get(start); - String next_device_code = pathlist.get(start+1); + String next_device_code = pathlist.get(start + 1); //判断有无出入库任务是相同路线 TaskDto dto = taskserver.findByCodeAndExcute(taskdto.getNext_device_code(), taskdto.getStart_device_code()); - if (ObjectUtil.isNotEmpty(dto)){ + if (ObjectUtil.isNotEmpty(dto)) { requireSucess = false; return true; } - packageInstrcutData(instdto, taskdto, taskid, taskcode, vehiclecode, priority,start_device_code,next_device_code,containerType); - }else { + packageInstrcutData(instdto, taskdto, taskid, taskcode, vehiclecode, priority, start_device_code, next_device_code, containerType); + } else { - packageInstrcutData(instdto, taskdto, taskid, taskcode, vehiclecode, priority, taskdto.getStart_device_code(), taskdto.getNext_device_code(),containerType); + packageInstrcutData(instdto, taskdto, taskid, taskcode, vehiclecode, priority, taskdto.getStart_device_code(), taskdto.getNext_device_code(), containerType); } try { instructionService.create(instdto); @@ -799,7 +830,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv if (ObjectUtil.isEmpty(linkDevice)) { throw new BadRequestException("设备:" + device_code + "关联设备->" + deviceCode + "为空!"); } - if (linkDevice.getDeviceDriver() instanceof LedScreenDeviceDriver){ + if (linkDevice.getDeviceDriver() instanceof LedScreenDeviceDriver) { device = deviceCode; } } @@ -809,7 +840,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString() , instdto.getInstruction_code())) { this.writing(list); - LuceneLogDto logDto = LuceneLogDto.builder() + LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) .content(device_code + inst.getInstruction_code() + "再次下发电气信号") .build(); @@ -864,7 +895,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv return json; } - private void packageInstrcutData(Instruction instdto, TaskDto taskdto, String taskid, String taskcode, String vehiclecode, String priority,String startCode, String endCode,String containerType) { + private void packageInstrcutData(Instruction instdto, TaskDto taskdto, String taskid, String taskcode, String vehiclecode, String priority, String startCode, String endCode, String containerType) { instdto.setInstruction_id(IdUtil.simpleUUID()); instdto.setRoute_plan_code(taskdto.getRoute_plan_code()); instdto.setRemark(taskdto.getRemark()); @@ -919,6 +950,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv } } + public synchronized boolean finish_instruction() throws Exception { instructionService.finish(inst); return true; @@ -939,7 +971,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv mode = LangProcess.msg("universal_standby"); } else if (this.getMode() == 3) { mode = LangProcess.msg("universal_operation"); - }else if (this.getMode() == 6) { + } else if (this.getMode() == 6) { mode = LangProcess.msg("one_mode1"); } @@ -974,7 +1006,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv jo.put("isError", this.getIserror()); jo.put("message", message); jo.put("notCreateTaskMessage", notCreateTaskMessage); - jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage)); + jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage)); jo.put("feedMessage", LangProcess.msg(feedMessage)); jo.put("driver_type", "conveyor_with_scanner_weight"); jo.put("is_click", true); 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 609661bfa..f3a350bbb 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 @@ -368,8 +368,13 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme message = "one_message7"; } else { if (error != 0) { - //满入空出或者浅货位阻挡 - erroBlock(); + 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(); + } } List list = new ArrayList(); switch (command) { @@ -477,7 +482,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme } finish_instruction(inst); errorInst = null; - }else { + } else { finish_instruction(inst); } } catch (Exception e) { @@ -521,6 +526,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme } } + last_heartbeat = heartbeat; last_item_deviceCode = item_deviceCode; last_mode = mode; @@ -976,7 +982,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme } - private void pakagePlc(Instruction inst, List list) { + private void pakagePlc(Instruction inst, List list) { HashMap map4 = new HashMap(); map4.put("code", "to_y"); map4.put("value", inst.getFrom_z()); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/dto/InteractionJsonDTO.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/dto/InteractionJsonDTO.java new file mode 100644 index 000000000..4ab6cfa81 --- /dev/null +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/dto/InteractionJsonDTO.java @@ -0,0 +1,13 @@ +package org.nl.acs.instruction.service.dto; + +import lombok.Data; + +@Data +public class InteractionJsonDTO { + + /** + * agv叉车调整长宽 + */ + private Double expandWidthLength; + +} 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 560afb68a..1826a5ebf 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 @@ -42,6 +42,7 @@ import org.nl.acs.instruction.domain.InstructionMybatis; import org.nl.acs.instruction.enums.InstructionStatusEnum; import org.nl.acs.instruction.service.dto.InstructionDto; import org.nl.acs.instruction.service.dto.InstructionQueryParam; +import org.nl.acs.instruction.service.dto.InteractionJsonDTO; import org.nl.acs.limit_regional.server.LimitRegionalService; import org.nl.acs.limit_regional.server.dto.LimitRegionalDto; import org.nl.acs.opc.DeviceAppService; @@ -514,8 +515,13 @@ public class InstructionServiceImpl extends CommonServiceImpl impleme List shortPathsList = routeLineService.getShortPathLines( start_device_code, acsTask.getNext_device_code(), route_plan_code); + Device startDevice = deviceAppService.findDeviceByCode(start_device_code); RouteLineDto routeLineDto = shortPathsList.get(0); String path = routeLineDto.getPath(); String type = routeLineDto.getType(); @@ -914,7 +917,12 @@ public class TaskServiceImpl extends CommonServiceImpl impleme int index = 0; for (int m = 0; m < pathlist.size(); m++) { if (pathlist.get(m).equals(start_device_code)) { - index = m + 1; + //起点为货架跳过堆垛机 + if (startDevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { + index = m + 2; + }else { + index = m + 1; + } break; } } 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 58fdbace2..094b822ce 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 @@ -59,7 +59,7 @@ public class CreateDDJInst { //判断有无出入库任务是相同路线 TaskDto dto = taskserver.findByCodeAndExcute(next_device_code, start_device_code); if (ObjectUtil.isNotEmpty(dto)) { - return; + continue; } if (startDevice.getDevice_type().equals(DeviceType.storage.name()) && (nextDevice.getDevice_type().equals(DeviceType.conveyor.name()) || nextDevice.getDevice_type().equals(DeviceType.storage.name()))) { @@ -115,7 +115,7 @@ public class CreateDDJInst { deviceByCode = appService.findDeviceByCode(pathlist.get(1)); if (ObjectUtils.isEmpty(deviceByCode)) { log.error("没有找到DDJ设备"); - return; + continue; } StandardStackerDeviceDriver standardStackerDeviceDriver; if (deviceByCode.getDeviceDriver() instanceof StandardStackerDeviceDriver) { @@ -123,7 +123,7 @@ public class CreateDDJInst { if (standardStackerDeviceDriver.getMode() != 3 || standardStackerDeviceDriver.getForkCargo() == 1 || standardStackerDeviceDriver.getCommand() != 0) { log.error("堆垛机,{}未联机或者在执行中", deviceByCode.getDevice_code()); ((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("堆垛机,{}未联机或者在执行中"); - return; + continue; } } next_device_code = start_device_code; @@ -142,7 +142,7 @@ public class CreateDDJInst { if (ObjectUtils.isEmpty(deviceByCode)) { log.error("没有找到DDJ设备"); - return; + continue; } StandardStackerDeviceDriver standardStackerDeviceDriver; if (deviceByCode.getDeviceDriver() instanceof StandardStackerDeviceDriver) { @@ -150,7 +150,7 @@ public class CreateDDJInst { if (standardStackerDeviceDriver.getMode() != 3 || standardStackerDeviceDriver.getForkCargo() == 1 || standardStackerDeviceDriver.getCommand() != 0 || standardStackerDeviceDriver.getError() != 0) { log.error("堆垛机,{}未联机或者在执行中或者有异常", deviceByCode.getDevice_code()); ((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("堆垛机,{}未联机或者在执行中"); - return; + continue; } } @@ -205,7 +205,7 @@ public class CreateDDJInst { if (beltConveyorDeviceDriver.getMode() != 2 || beltConveyorDeviceDriver.getMove() == 1) { log.error("输送机,{}未联机或执行中", next_device_code); ((BeltConveyorDeviceDriver) nextDevice.getDeviceDriver()).setNotCreateInstMessage("one_message7"); - return; + continue; } } @@ -219,7 +219,7 @@ public class CreateDDJInst { List byCodeAndExcute = instructionService.findByCodeAndExcute(next_device_code); if (CollUtil.isNotEmpty(byCodeAndExcute)){ ((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("有DDJ对接位出入库的指令"); - return; + continue; } instdto.setInstruction_type(task_type); instdto.setInstruction_id(IdUtil.simpleUUID());