Commit 4d98ef5485b319d61b0dd2ab22ebee8f140823bf
1 parent
397be2fe
修改bug
Showing
6 changed files
with
47 additions
and
18 deletions
src/main/java/com/huaheng/api/wcs/controller/EmptyContainerController.java
... | ... | @@ -130,8 +130,7 @@ public class EmptyContainerController extends BaseController { |
130 | 130 | String warehouseCode = manyEmptyDomain.getWarehouseCode(); |
131 | 131 | String area = manyEmptyDomain.getArea(); |
132 | 132 | String roadWay = manyEmptyDomain.getRoadWay(); |
133 | - List<String> roadWays = new ArrayList<>(); | |
134 | - roadWays.add(roadWay); | |
133 | + List<String> roadWays = Arrays.asList(roadWay.split(",")); | |
135 | 134 | String value = configService.getKey(QuantityConstant.RULE_ALLOCATION); |
136 | 135 | String height = manyEmptyDomain.getHeight(); |
137 | 136 | if (StringUtils.isEmpty(value)) { |
... | ... |
src/main/java/com/huaheng/api/wcs/service/overrideHandle/OverrideHandleServiceImpl.java
... | ... | @@ -37,10 +37,7 @@ import org.springframework.stereotype.Service; |
37 | 37 | import org.springframework.transaction.annotation.Transactional; |
38 | 38 | |
39 | 39 | import javax.annotation.Resource; |
40 | -import java.util.ArrayList; | |
41 | -import java.util.HashMap; | |
42 | -import java.util.List; | |
43 | -import java.util.Map; | |
40 | +import java.util.*; | |
44 | 41 | import java.util.stream.Collectors; |
45 | 42 | |
46 | 43 | @Service |
... | ... | @@ -130,8 +127,7 @@ public class OverrideHandleServiceImpl implements OverrideHandleService { |
130 | 127 | int high = location.getHigh(); |
131 | 128 | String area = location.getArea(); |
132 | 129 | String roadWay = location.getRoadway(); |
133 | - List<String> roadWays = new ArrayList<>(); | |
134 | - roadWays.add(roadWay); | |
130 | + List<String> roadWays = Arrays.asList(roadWay.split(",")); | |
135 | 131 | String containerCode = taskHeader.getContainerCode(); |
136 | 132 | List<TaskDetail> taskDetailList = taskDetailService.findByTaskId(taskHeader.getId()); |
137 | 133 | String materialAreaCode = null; |
... | ... |
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java
... | ... | @@ -48,9 +48,7 @@ import org.springframework.transaction.annotation.Transactional; |
48 | 48 | import com.huaheng.api.wcs.domain.WcsTask; |
49 | 49 | |
50 | 50 | import javax.annotation.Resource; |
51 | -import java.util.ArrayList; | |
52 | -import java.util.Arrays; | |
53 | -import java.util.List; | |
51 | +import java.util.*; | |
54 | 52 | import java.util.stream.Collectors; |
55 | 53 | |
56 | 54 | @Service |
... | ... | @@ -150,6 +148,30 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService |
150 | 148 | if(taskHeader == null) { |
151 | 149 | return AjaxResult.error("分配库位时,根据任务号没有找到任务"); |
152 | 150 | } |
151 | + Integer taskType = taskHeader.getTaskType(); | |
152 | + if(taskType.equals(QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT)||taskType.equals(QuantityConstant.TASK_TYPE_SORTINGSHIPMENT)||taskType.equals(QuantityConstant.TASK_TYPE_VIEW)||taskType.equals(QuantityConstant.TASK_TYPE_CYCLECOUNT)){ | |
153 | + Location location = locationService.getLocationByCode(taskHeader.getFromLocation()); | |
154 | + Integer high = location.getHigh(); | |
155 | + String locationType = location.getLocationType(); | |
156 | + String r=""; | |
157 | + if(roadWay.size()<2){ | |
158 | + r=roadWay.get(0).toString(); | |
159 | + }else { | |
160 | + Map<String,Integer> hashMap = new HashMap(); | |
161 | + for (String way : roadWay) { | |
162 | + LambdaQueryWrapper<Location> locationLambdaQ = Wrappers.lambdaQuery(); | |
163 | + locationLambdaQ.eq(Location::getRoadway,way) | |
164 | + .ne(Location::getContainerCode,"") | |
165 | + .eq(Location::getHigh, high) | |
166 | + .in(Location::getLocationType,locationType) | |
167 | + .eq(Location::getStatus,QuantityConstant.STATUS_LOCATION_EMPTY);; | |
168 | + List<Location> locations = locationService.list(locationLambdaQ); | |
169 | + hashMap.put(way.toString(),locations.size()); | |
170 | + } | |
171 | + r = this.getValueAsc(hashMap); | |
172 | + } | |
173 | + return new AjaxResult().setData(Integer.valueOf(r)).setCode(200); | |
174 | + } | |
153 | 175 | if (taskHeader.getStatus() == QuantityConstant.TASK_STATUS_COMPLETED) { |
154 | 176 | return AjaxResult.error("任务已经完成,不能再分库位"); |
155 | 177 | } |
... | ... | @@ -423,4 +445,17 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService |
423 | 445 | return AjaxResult.success(destinationArea); |
424 | 446 | } |
425 | 447 | |
448 | + public String getValueAsc(Map<String,Integer> map){ | |
449 | + Comparator<Map.Entry<String,Integer>> valueComparator = new Comparator<Map.Entry<String, Integer>>() { | |
450 | + @Override | |
451 | + public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) { | |
452 | + return o1.getValue()-o2.getValue(); | |
453 | + } | |
454 | + }; | |
455 | + | |
456 | + List<Map.Entry<String,Integer>> list = new ArrayList<Map.Entry<String,Integer>>(map.entrySet()); | |
457 | + Collections.sort(list,valueComparator); | |
458 | + return list.get(0).getKey(); | |
459 | + } | |
460 | + | |
426 | 461 | } |
427 | 462 | \ No newline at end of file |
... | ... |
src/main/java/com/huaheng/pc/config/location/service/LocationServiceImpl.java
... | ... | @@ -442,14 +442,13 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i |
442 | 442 | /** |
443 | 443 | * 根据库位编码查询库位信息 |
444 | 444 | * |
445 | - * @param code | |
445 | + * @param | |
446 | 446 | * @return |
447 | 447 | */ |
448 | 448 | @Override |
449 | 449 | public Location getLocationByCode(String locationCode) { |
450 | 450 | LambdaQueryWrapper<Location> queryWrapper = Wrappers.lambdaQuery(); |
451 | 451 | queryWrapper.eq(Location::getCode, locationCode); |
452 | - queryWrapper.eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode()); | |
453 | 452 | return getOne(queryWrapper); |
454 | 453 | } |
455 | 454 | |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/TransferTaskService.java
... | ... | @@ -91,9 +91,9 @@ public class TransferTaskService { |
91 | 91 | if (taskHeaderService.getUncompleteTaskInNear(desLocation) > 0) { |
92 | 92 | return AjaxResult.error("目标库位:" + desLocationCode + "旁边存在任务,请完成任务以后再分配"); |
93 | 93 | } |
94 | - if(!sourceLocation.getRoadway().equals(desLocation.getRoadway())) { | |
95 | - return AjaxResult.error("目标库位和源库位不在同一个巷道"); | |
96 | - } | |
94 | +// if(!sourceLocation.getRoadway().equals(desLocation.getRoadway())) { | |
95 | +// return AjaxResult.error("目标库位和源库位不在同一个巷道"); | |
96 | +// } | |
97 | 97 | |
98 | 98 | if(!sourceLocation.getHigh().equals(desLocation.getHigh())) { |
99 | 99 | return AjaxResult.error("目标库位和源库位高度不一样"); |
... | ... |
src/main/resources/mybatis/config/LocationMapper.xml
... | ... | @@ -174,7 +174,7 @@ |
174 | 174 | <select id="selectModelByHg" resultType="com.huaheng.pc.config.location.domain.Location"> |
175 | 175 | select * from location where locationType='L' and containerCode ='' and status='empty' |
176 | 176 | and roadWay = #{roadWay} and high=#{heght} |
177 | - order by rowFlag desc,iColumn asc,iLayer asc limit 1 | |
177 | + order by rowFlag desc,iLayer asc,iColumn asc limit 1 | |
178 | 178 | |
179 | 179 | </select> |
180 | 180 | |
... | ... | @@ -186,7 +186,7 @@ |
186 | 186 | <foreach item="item" index="index" collection="codes" open="(" separator="," close=")"> |
187 | 187 | #{item} |
188 | 188 | </foreach> |
189 | - order by rowFlag desc,iColumn asc,iLayer asc limit 1 | |
189 | + order by rowFlag desc,iLayer asc,iColumn asc limit 1 | |
190 | 190 | </select> |
191 | 191 | |
192 | 192 | </mapper> |
193 | 193 | \ No newline at end of file |
... | ... |