Commit f144af0e8f9410a8d694181781317212ccb1c34d
1 parent
65b5efd2
feat: 5号堆垛机库位,也要支持可燃物料优先放下三层
Showing
2 changed files
with
30 additions
and
15 deletions
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationService.java
... | ... | @@ -11,7 +11,7 @@ public interface LocationAllocationService { |
11 | 11 | String allocation(int high, String area, String roadWay, String containerCode, Integer frequencyLocation, |
12 | 12 | Integer emptyContainerTask, Integer isSelfCreated, boolean isFlammable); |
13 | 13 | |
14 | - String fiveStacker(int high, String containerCode); | |
14 | + String fiveStacker(int high, String containerCode, boolean isFlammable); | |
15 | 15 | |
16 | 16 | void setTemporaryLocationType(Location location, boolean isBigContainer); |
17 | 17 | |
... | ... |
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationServiceImpl.java
... | ... | @@ -59,7 +59,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
59 | 59 | |
60 | 60 | //二期5号巷道 |
61 | 61 | if (roadWay.equals(DYNAMIC_ROADWAY)) { |
62 | - return locationAllocationService.fiveStacker(high, containerCode); | |
62 | + return locationAllocationService.fiveStacker(high, containerCode, isFlammable); | |
63 | 63 | } else { |
64 | 64 | return locationAllocationService.doubleRk(area, roadWay, high, frequencyLocation, emptyContainerTask, isSelfCreated, isFlammable); |
65 | 65 | } |
... | ... | @@ -70,7 +70,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
70 | 70 | //分配库位排序,(层-外侧-内侧-列) |
71 | 71 | @Override |
72 | 72 | @Transactional(rollbackFor = Exception.class) |
73 | - public String fiveStacker(int high, String containerCode) { | |
73 | + public String fiveStacker(int high, String containerCode, boolean isFlammable) { | |
74 | 74 | Container container = containerService.getOne(new LambdaQueryWrapper<Container>().eq(Container::getCode, containerCode)); |
75 | 75 | String containerType = container.getContainerType(); |
76 | 76 | //判断预留库位 |
... | ... | @@ -82,14 +82,24 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
82 | 82 | .eq(Location::getHigh, high) |
83 | 83 | .eq(Location::getContainerCode, EMPTY_STRING) |
84 | 84 | .ne(Location::getIColumn, "26")//26列机器臂夹不到,只有大托盘的右侧可以刚好放到 |
85 | - .orderByAsc(Location::getILayer) | |
86 | 85 | .orderByDesc(Location::getRowFlag) |
87 | 86 | .orderByAsc(Location::getIColumn) |
88 | 87 | .orderByAsc(Location::getIRow); |
88 | + | |
89 | 89 | List<Location> list = locationService.list(wrapper); |
90 | 90 | if (list.size() <= reserveNumber) { |
91 | 91 | return "可能是库位不够用了,请检查预留库位数"; |
92 | 92 | } |
93 | + //可燃物料 | |
94 | + list.sort((location1, location2) -> { | |
95 | + if (isFlammable) { | |
96 | + return Integer.compare(location1.getILayer(), location2.getILayer()); | |
97 | + } else { | |
98 | + int layer1 = location1.getILayer() >= 4 ? location1.getILayer() : location1.getILayer() + 10; | |
99 | + int layer2 = location2.getILayer() >= 4 ? location2.getILayer() : location2.getILayer() + 10; | |
100 | + return Integer.compare(layer1, layer2); | |
101 | + } | |
102 | + }); | |
93 | 103 | |
94 | 104 | //大托盘占两个库位 |
95 | 105 | if (containerType.equals(CONTAINER_TYPE_X) || containerType.equals(CONTAINER_TYPE_W)) { |
... | ... | @@ -222,6 +232,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
222 | 232 | .eq(Location::getContainerCode, "") |
223 | 233 | .last(" limit 20"); |
224 | 234 | |
235 | + //空托盘 | |
225 | 236 | if (emptyContainerTask == 1) { |
226 | 237 | locationLambda.ge(Location::getOnlyEmptyContainer, 0);//大于等于0 |
227 | 238 | locationLambda.orderByDesc(Location::getOnlyEmptyContainer); |
... | ... | @@ -252,11 +263,13 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
252 | 263 | //locationLambda.orderByDesc(Location::getFrequencyLocation);//倒序 |
253 | 264 | } |
254 | 265 | |
255 | - //可燃物料 | |
256 | - if (isFlammable) { | |
257 | - locationLambda.orderByAsc(Location::getILayer); | |
258 | - } else { | |
259 | - locationLambda.last("ORDER BY " + str + ", (CASE WHEN iLayer >= 4 THEN iLayer ELSE iLayer + 10 END) ASC"); | |
266 | + //可燃物料(空托盘不用进来判断) | |
267 | + if (emptyContainerTask != 1) { | |
268 | + if (isFlammable) { | |
269 | + locationLambda.orderByAsc(Location::getILayer); | |
270 | + } else { | |
271 | + locationLambda.last("ORDER BY " + str + ", (CASE WHEN iLayer >= 4 THEN iLayer ELSE iLayer + 10 END) ASC"); | |
272 | + } | |
260 | 273 | } |
261 | 274 | |
262 | 275 | List<Location> locationList = locationService.list(locationLambda); |
... | ... | @@ -284,6 +297,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
284 | 297 | .eq(Location::getRowFlag, ROW_IN) |
285 | 298 | .eq(Location::getContainerCode, "") |
286 | 299 | .last(" limit 20"); |
300 | + | |
287 | 301 | if (emptyContainerTask == 1) { |
288 | 302 | locationLambda.ge(Location::getOnlyEmptyContainer, 0);//大于等于0 |
289 | 303 | locationLambda.orderByDesc(Location::getOnlyEmptyContainer); |
... | ... | @@ -291,7 +305,6 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
291 | 305 | locationLambda.eq(Location::getOnlyEmptyContainer, 0); |
292 | 306 | } |
293 | 307 | |
294 | - //自建单据 | |
295 | 308 | if (isSelfCreated == 1) { |
296 | 309 | locationLambda.eq(Location::getSelfCreated, 1); |
297 | 310 | } else { |
... | ... | @@ -309,11 +322,13 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
309 | 322 | // //不常用 |
310 | 323 | // locationLambda.orderByDesc(Location::getFrequencyLocation);//倒序 |
311 | 324 | //} |
312 | - //可燃物料 | |
313 | - if (isFlammable) { | |
314 | - locationLambda.last("ORDER BY " + str + ", (CASE WHEN iLayer >= 4 THEN iLayer ELSE iLayer + 10 END) ASC"); | |
315 | - } else { | |
316 | - locationLambda.orderByAsc(Location::getILayer); | |
325 | + //可燃物料(空托盘不用进来判断) | |
326 | + if (emptyContainerTask != 1) { | |
327 | + if (isFlammable) { | |
328 | + locationLambda.orderByAsc(Location::getILayer); | |
329 | + } else { | |
330 | + locationLambda.last("ORDER BY " + str + ", (CASE WHEN iLayer >= 4 THEN iLayer ELSE iLayer + 10 END) ASC"); | |
331 | + } | |
317 | 332 | } |
318 | 333 | locationList = locationService.list(locationLambda); |
319 | 334 | |
... | ... |