From 567b952e1761477050a7391c9db0efe5abfe6075 Mon Sep 17 00:00:00 2001 From: psh Date: Tue, 5 Mar 2024 14:58:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E9=9C=80=E6=B1=82=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cw_site/CwSiteDeviceDriver.java | 4 +- .../service/quartz/utils/ExecutionJob.java | 2 + .../task_manage/task/tasks/KGHJRKTask.java | 47 +++++++++++++++---- .../task_manage/task/tasks/TBXBKJTask.java | 26 +++++++++- 4 files changed, 69 insertions(+), 10 deletions(-) diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/cw_site/CwSiteDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/cw_site/CwSiteDeviceDriver.java index e9b7682..fb6c258 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/cw_site/CwSiteDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/cw_site/CwSiteDeviceDriver.java @@ -168,7 +168,9 @@ public class CwSiteDeviceDriver extends AbstractOpcDeviceDriver implements Devic request.setType("2"); acsToWmsService.notify(request); resultSucess=true; - }else if (move ==1 && this.getDeviceCode().startsWith("ZJBDJW") &&!resultSucess) { + }else if (move ==1 && + (this.getDeviceCode().startsWith("ZJBDJW")|| + this.getDeviceCode().startsWith("FJBKJDJW"))&&!resultSucess) { //点位数量变更后通知lms FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest(); request.setState("3"); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/utils/ExecutionJob.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/utils/ExecutionJob.java index 234c641..e47816a 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/utils/ExecutionJob.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/utils/ExecutionJob.java @@ -12,6 +12,7 @@ import org.nl.system.service.quartz.dao.SysQuartzJob; import org.nl.system.service.quartz.dao.SysQuartzLog; import org.nl.system.service.quartz.dao.mapper.SysQuartzLogMapper; import org.nl.system.service.quartz.impl.SysQuartzJobServiceImpl; +import org.quartz.DisallowConcurrentExecution; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.springframework.scheduling.annotation.Async; @@ -28,6 +29,7 @@ import java.util.concurrent.ThreadPoolExecutor; @Async @SuppressWarnings({"unchecked", "all"}) @Slf4j +@DisallowConcurrentExecution public class ExecutionJob extends QuartzJobBean { /** diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/KGHJRKTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/KGHJRKTask.java index 2ea4f18..4842e7c 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/KGHJRKTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/KGHJRKTask.java @@ -108,27 +108,31 @@ public class KGHJRKTask extends AbstractTask { * 判断目标点位 * 1.A区的去A区缓存点,B区的去B区 * 2.倒叙查找,找到满足当前位置数量不足3的即可 + * 3.负极板优先放到HCQ7,放满了再放到HCQ1 */ private SchBasePoint findNextPoint(SchBasePoint startPoint, String vehicleType) { String regionCode = null; + String regionCode2 = null; if ("A1".equals(startPoint.getWorkshop_code())) { //A1空架到HCQ1 - regionCode = "HCQ1"; + regionCode = "HCQ7"; + regionCode2 ="HCQ1"; if ("1".equals(vehicleType)) { regionCode = "ZJBKGHJDJW"; } } else if ("A2".equals(startPoint.getWorkshop_code())) { - //A1空架到KGHJ2 - regionCode = "KGHJ2"; + //A1空架到HCQ5 + regionCode = "HCQ5"; } List schBasePointList = pointMapper.findPointByRegion(regionCode, "1"); + //负极板优先放到HCQ7,放满了再放到HCQ1 //从前往后判断,直到发现点位有货,取前一个 SchBasePoint schBasePoint = null; if (!"ZJBKGHJDJW".equals(regionCode)) { for (int i = schBasePointList.size() - 1; i >= 0; i--) { SchBasePoint temp = schBasePointList.get(i); - if (temp.getVehicle_qty() == 1 && + if (temp.getVehicle_qty() > 1 && ObjectUtil.isEmpty(temp.getIng_task_code())) { if (schBasePoint != null) { log.info("空固化架放货找到当前点位有货:{},取上一个空位:{}", temp.getPoint_code(), schBasePoint.getPoint_code()); @@ -139,6 +143,26 @@ public class KGHJRKTask extends AbstractTask { } schBasePoint = temp; } + if(ObjectUtil.isEmpty(schBasePoint)){ + schBasePointList = pointMapper.findPointByRegion(regionCode2, "1"); + for (int i = schBasePointList.size() - 1; i >= 0; i--) { + SchBasePoint temp = schBasePointList.get(i); + //三拖一起放,如果不是01结尾直接跳过 + if(!temp.getPoint_code().endsWith("01")){ + continue; + } + if (temp.getVehicle_qty() == 1 && + ObjectUtil.isEmpty(temp.getIng_task_code())) { + if (schBasePoint != null) { + log.info("空固化架放货找到当前点位有货:{},取上一个空位:{}", temp.getPoint_code(), schBasePoint.getPoint_code()); + } else { + log.info("当前区域:" + regionCode + "所有点位均已放满,暂时跳过"); + } + break; + } + schBasePoint = temp; + } + } } else { for (int i = schBasePointList.size() - 1; i >= 0; i--) { SchBasePoint temp = schBasePointList.get(i); @@ -181,11 +205,18 @@ public class KGHJRKTask extends AbstractTask { if (status.equals(TaskStatus.FINISHED)) { // 完成 // 终点解锁,库存增加 endPointObj.setIng_task_code(""); - //正极板对接位通过plc信号同步,任务完成不增加 -// if(!"ZJBKGHJDJW".equals(startPointObj.getRegion_code())) { - endPointObj.setVehicle_qty(startPointObj.getVehicle_qty() + 1); -// } + endPointObj.setVehicle_qty(1); pointService.update(endPointObj); + if("HCQ7".equals(endPointObj.getRegion_code())){ + endPointObj = pointService.getById(endPoint.substring(0,endPoint.length()-1)+"2"); + endPointObj.setIng_task_code(""); + endPointObj.setVehicle_qty(1); + pointService.update(endPointObj); + endPointObj = pointService.getById(endPoint.substring(0,endPoint.length()-1)+"3"); + endPointObj.setIng_task_code(""); + endPointObj.setVehicle_qty(1); + pointService.update(endPointObj); + } // 任务完成 taskObj.setTask_status(TaskStatus.FINISHED.getCode()); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/TBXBKJTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/TBXBKJTask.java index ae2646a..393ba9a 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/TBXBKJTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/TBXBKJTask.java @@ -113,15 +113,39 @@ public class TBXBKJTask extends AbstractTask { */ private SchBasePoint findNextPoint(SchBasePoint startPoint,SchBaseTask task) { String regionCode = null; + String regionCode2 = null; if ("TBX1".equals(startPoint.getRegion_code())) { //TBX1找A区 - regionCode = "HCQ1"; + regionCode = "HCQ7"; + regionCode2 ="HCQ1"; } else if ("TBX2".equals(startPoint.getRegion_code())) { //TBX2找B区 regionCode = "HCQ5"; } SchBasePoint temp = null; + if(ObjectUtil.isNotEmpty(regionCode2)){ + List schBasePointList = pointMapper.findPointByRegion(regionCode2, "1"); + for (int i = schBasePointList.size() - 1; i >= 0; i--) { + SchBasePoint schBasePoint = schBasePointList.get(i); + //如果当前任务已锁定则直接返回 + if(task.getTask_code().equals(schBasePoint.getIng_task_code())){ + return schBasePoint; + } + if (schBasePoint.getVehicle_qty() > 0 && + (ObjectUtil.isEmpty(schBasePoint.getIng_task_code()))) { + if (temp == null || + schBasePoint.getPoint_code().startsWith(temp.getPoint_code().substring(0, temp.getPoint_code().length() - 2)) + &&schBasePoint.getPoint_code().compareTo(temp.getPoint_code())>0){ + temp=schBasePoint; + log.info("涂板线补空架找到当前符合条件的点位{}", schBasePoint.getPoint_code()); + } + } + } + if(temp!=null){ + return temp; + } + } List schBasePointList = pointMapper.findPointByRegion(regionCode, "1"); for (SchBasePoint schBasePoint : schBasePointList) { //如果当前任务已锁定则直接返回