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 e9c50cb..44f16bd 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 @@ -32,8 +32,11 @@ import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; /** * @Author: psh @@ -136,6 +139,24 @@ public class MJXLTask extends AbstractTask { materialType.equals(schBasePoint.getVehicle_type())) && "2".equals(schBasePoint.getPoint_status()) && schBasePoint.getVehicle_qty() < 3) { + //新增逻辑,同一列只能放相同物料 + boolean flag=true; + List list=new ArrayList<>(); + for(int i=1;i<=4;i++){ + int end=Integer.parseInt(schBasePoint.getPoint_code().substring(schBasePoint.getPoint_code().length()-1))+i; + String pointCode=schBasePoint.getPoint_code().substring(0,schBasePoint.getPoint_code().length()-1); + list.add(pointCode+end); + } + for (SchBasePoint schBasePoint2 : schBasePointList) { + if(list.contains(schBasePoint2.getPoint_code())) { + if (schBasePoint2.getVehicle_type() != null && !materialType.equals(schBasePoint2.getVehicle_type())) { + flag = false; + } + } + } + if(!flag){ + continue; + } log.info("满架下料找到当前符合条件的点位{}", schBasePoint.getPoint_code()); return schBasePoint; } 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 74abcea..5168a64 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 @@ -83,7 +83,7 @@ public class TBXBKJTask extends AbstractTask { // 找起点 SchBasePoint startPoint = pointService.getOne(new LambdaQueryWrapper() .eq(SchBasePoint::getPoint_code, task.getPoint_code2())); - SchBasePoint point = findNextPoint(startPoint); + SchBasePoint point = findNextPoint(startPoint,task); if (ObjectUtil.isEmpty(point)) { task.setRemark("未找到所需点位!"); taskService.update(task); @@ -106,7 +106,7 @@ public class TBXBKJTask extends AbstractTask { /** * 从01到10顺序判断最先有货的工位 */ - private SchBasePoint findNextPoint(SchBasePoint startPoint) { + private SchBasePoint findNextPoint(SchBasePoint startPoint,SchBaseTask task) { String regionCode = null; if ("TBX1".equals(startPoint.getRegion_code())) { //TBX1找A区 @@ -119,7 +119,12 @@ public class TBXBKJTask extends AbstractTask { SchBasePoint temp = null; List schBasePointList = pointMapper.findPointByRegion(regionCode, "1"); for (SchBasePoint schBasePoint : schBasePointList) { - if (schBasePoint.getVehicle_qty() > 0 && ObjectUtil.isEmpty(schBasePoint.getIng_task_code())) { + //如果当前任务已锁定则直接返回 + 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){ @@ -194,12 +199,12 @@ public class TBXBKJTask extends AbstractTask { //todo 重算最优点 SchBasePoint startPoint = pointService.getOne(new LambdaQueryWrapper() .eq(SchBasePoint::getPoint_code, schBaseTask.getPoint_code2())); - SchBasePoint point = this.findNextPoint(startPoint); + SchBasePoint point = this.findNextPoint(startPoint,schBaseTask); schBaseTask.setPoint_code1(point.getPoint_code()); -// //重算点位时把点位占用,防止发起重复任务 -// point.setIng_task_code(schBaseTask.getTask_code()); + //重算点位时把点位占用,防止发起重复任务 + point.setIng_task_code(schBaseTask.getTask_code()); // //空固化架区别于组盘,任务完成后再扣除库存 //// point.setVehicle_qty(point.getVehicle_qty() - 1); -// pointService.update(point); + pointService.update(point); } } \ No newline at end of file