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 6b52689..683b1bd 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,11 +32,7 @@ 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; +import java.util.*; /** * @Author: psh @@ -134,6 +130,7 @@ public class MJXLTask extends AbstractTask { regionCode = "GHS2"; } List schBasePointList = pointMapper.findPointByRegion(regionCode, "2"); + Map pointMap=new HashMap<>(); for (SchBasePoint schBasePoint : schBasePointList) { if (!schBasePoint.getPoint_code().endsWith("01") && !schBasePoint.getPoint_code().endsWith("06")) { @@ -146,7 +143,8 @@ public class MJXLTask extends AbstractTask { //新增逻辑,同一列只能放相同物料 boolean flag=true; List list=new ArrayList<>(); - for(int i=1;i<=4;i++){ + Integer qty=0; + for(int i=0;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); @@ -156,16 +154,27 @@ public class MJXLTask extends AbstractTask { if (ObjectUtil.isNotEmpty(schBasePoint2.getVehicle_type()) && !materialType.equals(schBasePoint2.getVehicle_type())) { flag = false; } + qty+=schBasePoint2.getVehicle_qty(); } } if(!flag){ continue; } - log.info("满架下料找到当前符合条件的点位{}", schBasePoint.getPoint_code()); - return schBasePoint; + log.info("满架下料找到当前符合条件的点位{},当前列总数{}", schBasePoint.getPoint_code(),qty); + pointMap.put(schBasePoint,qty); } } - return null; + SchBasePoint schBasePoint=null; + int qty=0; + Iterator> iterator = pointMap.entrySet().iterator(); + while (iterator.hasNext()){ + Map.Entry next = iterator.next(); + if (next.getValue()>qty){ + qty=next.getValue(); + schBasePoint=next.getKey(); + } + } + return schBasePoint; } @Override