From b4344185f1cff481959f300e4035d124a89a94eb Mon Sep 17 00:00:00 2001 From: psh Date: Mon, 18 Dec 2023 09:29:26 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8E=B0=E5=9C=BA=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agv/server/impl/NDCAgvServiceImpl.java | 2 + .../run/OneNDCSocketConnectionAutoRun.java | 56 +++++++++++++++---- .../agv/ndcone/AgvNdcOneDeviceDriver.java | 16 ++---- .../ext/service/impl/AcsToWmsServiceImpl.java | 3 +- .../nl/wms/pda/controller/PdaController.java | 2 + .../sch/task_manage/task/tasks/MJXLTask.java | 2 + .../task_manage/task/tasks/ghs/GHSQHTask.java | 4 ++ 7 files changed, 60 insertions(+), 25 deletions(-) diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java index ea08887..8635e66 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java @@ -19,6 +19,7 @@ import org.nl.acs.opc.DeviceAppServiceImpl; import org.nl.system.service.param.ISysParamService; import org.nl.common.utils.CodeUtil; import org.nl.config.SpringContextHolder; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import java.util.HashMap; @@ -27,6 +28,7 @@ import java.util.Map; @Slf4j @Service @RequiredArgsConstructor +@Lazy public class NDCAgvServiceImpl implements NDCAgvService { private final DeviceAppService deviceAppService; diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java index 2af0ee4..fd45d1f 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java @@ -1,12 +1,14 @@ package org.nl.acs.auto.run; import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import lombok.extern.slf4j.Slf4j; import org.nl.acs.AcsConfig; import org.nl.acs.agv.server.NDCAgvService; import org.nl.acs.device.domain.Device; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver; +import org.nl.acs.device_driver.basedriver.standard_autodoor.StandardAutodoorDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; import org.nl.acs.instruction.domain.Instruction; @@ -80,7 +82,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class); DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class); DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); - TaskService taskService=SpringContextHolder.getBean(TaskService.class); + TaskService taskService = SpringContextHolder.getBean(TaskService.class); ip = paramService.findByCode(AcsConfig.AGVURL).getValue(); port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT).getValue()); @@ -147,10 +149,24 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { log.info("接收agv上报信息:" + "phase--" + phase + " index--" + index + " ikey--" + ikey + " agvaddr--" + agvaddr + " Car--" + carno); Device device = null; String device_code = null; - + String old_device_code = null; + if (agvaddr != 0) { + old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); + if (StrUtil.contains(old_device_code, "-")) { + String[] point = old_device_code.split("-"); + device_code = point[0]; + } else if (StrUtil.contains(old_device_code, ".")) { + String[] point = old_device_code.split("\\."); + device_code = point[0]; + } else { + device_code = old_device_code; + } + device = deviceAppService.findDeviceByCode(device_code); + } // AgvNdcOneDeviceDriver agvNdcOneDeviceDriver; + StandardAutodoorDeviceDriver standardAutodoorDeviceDriver; //开始任务/上报订单号 if (phase == 0x01) { @@ -177,10 +193,31 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { //(需要WCS反馈) else if (phase == 0x30) { data = NDCAgvService.sendAgvOneModeInst(0x8F, index, 0, 0, 0, 0, 0); + } //进入区域 + else if (phase == 0x50) { + //开门 + if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { + standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); + standardAutodoorDeviceDriver.OpenOrClose("1"); + if (standardAutodoorDeviceDriver.getAction() == 1) { + standardAutodoorDeviceDriver.OpenOrClose("1"); + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0); + } + } } + //离开区域 + else if (phase == 0x51) { + //关门 + if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { + standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); + standardAutodoorDeviceDriver.OpenOrClose("2"); + if (standardAutodoorDeviceDriver.getAction() == 2) { + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0); + } + } //任务删除确认 //(需要WCS反馈) - else if (phase == 0xFF) { + }else if (phase == 0xFF) { if (!ObjectUtil.isEmpty(inst)) { if (!ObjectUtil.isEmpty(inst)) { @@ -216,15 +253,11 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { } } catch (Exception e) { - System.out.println("Agv链接异常"); - log.info("Agv链接异常"); + System.out.println("OneAgv链接异常"); + log.info("OneAgv链接异常"); log.error("agv连接出现异常:{}", e); -// logServer.deviceExecuteLog("1", "", "", "agv异常" + e.getMessage()); -// logServer.deviceExecuteLog("1", "", "", "agv异常" + e); -// LuceneLogDto logDto = new LuceneLogDto(); -// logDto.setContent("agv异常" + e.getMessage()); -// logDto.setDevice_code("1001"); -// luceneExecuteLogService.deviceExecuteLog(logDto); + logServer.deviceExecuteLog("1", "", "", "agv异常" + e.getMessage()); + logServer.deviceExecuteLog("1", "", "", "agv异常" + e); if (ObjectUtil.isNotEmpty(s)) { s.close(); } @@ -233,7 +266,6 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { } finally { - } } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java index aff279b..4e50a6f 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java @@ -124,12 +124,10 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic StandardStorageDeviceDriver standardStorageDeviceDriver; // SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; - - TaskDto task = taskService.findById(inst.getTask_id()); - int start_height = ObjectUtil.isNotEmpty(task.getStart_height()) ? Integer.parseInt(task.getStart_height()) : 0; - int next_height = ObjectUtil.isNotEmpty(task.getNext_height()) ? Integer.parseInt(task.getNext_height()) : 0; - String start_point = task.getStart_point_code(); - String next_point = task.getNext_point_code(); + TaskDto task=new TaskDto(); + if (ObjectUtil.isNotEmpty(inst)) { + task = taskService.findById(inst.getTask_id()); + } //分配 车id //(不需要WCS反馈) @@ -301,12 +299,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic agvaddr_copy = agvaddr; data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0); logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data); - } else if (phase == 0x50) {//进入交通灯区域 - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0); - logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data); - } else if (phase == 0x51) {//离开交通灯区域 - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0); - logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data); } if (!ObjectUtil.isEmpty(data)) { logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java index 52972b7..ede5803 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java @@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.nl.common.exception.BadRequestException; +import org.nl.system.service.logicflow.dao.Stage; import org.nl.system.service.notice.ISysNoticeService; import org.nl.system.service.param.ISysParamService; import org.nl.wms.database.material.service.IMdBaseMaterialService; @@ -122,7 +123,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { if (ObjectUtil.isEmpty(taskId)) { throw new BadRequestException("任务编码不能为空!"); } - SchBaseTask taskObj = taskService.getById(taskId); + SchBaseTask taskObj = taskService.getOne(new LambdaQueryWrapper().eq(SchBaseTask::getTask_code, taskId)); if (ObjectUtil.isEmpty(taskObj)) { throw new BadRequestException("未找到任务编码为 [" + taskId + "] 的任务"); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/controller/PdaController.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/controller/PdaController.java index 24a002d..b420517 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/controller/PdaController.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/controller/PdaController.java @@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j; import org.nl.common.logging.annotation.Log; import org.nl.wms.pda.service.PdaService; import org.nl.wms.pda.service.dao.vo.PdaResponseVo; +import org.springframework.context.annotation.Lazy; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; @@ -28,6 +29,7 @@ import javax.annotation.Resource; @Api(tags = "手持接口") @RequestMapping("/api/pda") @SaIgnore +@Lazy public class PdaController { @Resource diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/MJXLTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/MJXLTask.java index ee64159..2b1e3a8 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/MJXLTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/MJXLTask.java @@ -28,6 +28,7 @@ import org.nl.wms.sch.task_manage.task.core.TaskStatus; import org.nl.wms.sch.task_manage.task.tasks.mapper.PointMapper; import org.nl.wms.util.PointUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; import java.math.BigDecimal; @@ -42,6 +43,7 @@ import java.util.Map; @Slf4j @Component @TaskType("MJXLTask") +@Lazy public class MJXLTask extends AbstractTask { private static String TASK_CONFIG_CODE = "MJXLTask"; /** diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSQHTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSQHTask.java index a81dd29..0e84047 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSQHTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/ghs/GHSQHTask.java @@ -143,6 +143,10 @@ public class GHSQHTask extends AbstractTask { task.setVehicle_qty(schBasePoint.getVehicle_qty()); task.setTask_status(TaskStatus.APPLY.getCode()); task.setWorkshop_code(taskConfig.getWorkshop_code()); // 车间编码 + //首位01或06生成任务需要补01,例如GHS0101下发需要改成GHS010101 + if(task.getPoint_code1().endsWith("01")||task.getPoint_code1().endsWith("06")) { + task.setPoint_code1(task.getPoint_code1()+"01"); + } task.setPoint_code2(endPoint); task.setTask_status(TaskStatus.CREATED.getCode()); task.setRemark("");