Commit 2b67f0d6bafb35b0ec5cc297e474aff903db0c07
1 parent
a2b0b956
feat:自建库位移库只能移到自建库位中
Showing
6 changed files
with
64 additions
and
110 deletions
src/main/java/com/huaheng/api/wcs/service/taskAssignService/TaskAssignServiceImpl.java
... | ... | @@ -157,13 +157,13 @@ public class TaskAssignServiceImpl implements TaskAssignService { |
157 | 157 | if (taskHeader2 != null) { |
158 | 158 | preTaskNo = taskHeader2.getId(); |
159 | 159 | } else { |
160 | + //是否自建单据库位 | |
161 | + int isSelfCreated = 0; | |
162 | + if (insideLocation.getSelfCreated()) { | |
163 | + isSelfCreated = 1; | |
164 | + } | |
160 | 165 | Location destinationLocation; |
161 | 166 | if (insideLocation.getRoadway().equals("5")) { |
162 | - //是否自建单据库位 | |
163 | - int isSelfCreated = 0; | |
164 | - if (insideLocation.getSelfCreated()) { | |
165 | - isSelfCreated = 1; | |
166 | - } | |
167 | 167 | boolean isFlammable = true; |
168 | 168 | if (insideLocation.getILayer() > 3) { |
169 | 169 | isFlammable = false; |
... | ... | @@ -179,7 +179,7 @@ public class TaskAssignServiceImpl implements TaskAssignService { |
179 | 179 | destinationLocation = locationService.getLocationByCode(destinationLocationCode); |
180 | 180 | } else { |
181 | 181 | //获取一个最近的空闲库位(优先找外侧) |
182 | - destinationLocation = locationService.getEmptyLocation(insideLocation); | |
182 | + destinationLocation = locationService.getEmptyLocation(insideLocation, isSelfCreated); | |
183 | 183 | } |
184 | 184 | AjaxResult ajaxResult = transferTaskService.createTransferTask(insideLocation.getCode(), destinationLocation.getCode(), warehouseCode); |
185 | 185 | if (ajaxResult.getCode() == 400) { |
... | ... |
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationServiceImpl.java
... | ... | @@ -61,7 +61,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
61 | 61 | //二期5号巷道 |
62 | 62 | if (roadWay.equals(DYNAMIC_ROADWAY)) { |
63 | 63 | return locationAllocationService.fiveStacker(high, containerCode, isFlammable, transfer); |
64 | - } else if (isSelfCreated == 1) { //自建单据 | |
64 | + } else if (isSelfCreated == 1) { //二厂的自建单据库位 | |
65 | 65 | return locationAllocationService.isSelfCreated(roadWay, high, frequencyLocation, isFlammable); |
66 | 66 | } else { |
67 | 67 | return locationAllocationService.doubleRk(area, roadWay, high, frequencyLocation, emptyContainerTask, isFlammable); |
... | ... | @@ -237,32 +237,36 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
237 | 237 | |
238 | 238 | |
239 | 239 | /** |
240 | - * 双伸位库位入库分配库位 | |
240 | + * 双伸位库位分配库位 | |
241 | 241 | */ |
242 | 242 | @Override |
243 | 243 | @Transactional(rollbackFor = Exception.class) |
244 | 244 | public String doubleRk(String area, String roadWay, int high, Integer frequencyLocation, Integer emptyContainerTask, boolean isFlammable) { |
245 | - // 获取双伸位预留库位数 | |
246 | - int reserveNumber = getReserveNumber(); | |
245 | + //如果是二厂的空托盘入库任务,优先分配空托盘库位,没有了再分配其他的库位 | |
246 | + if (emptyContainerTask == 1) { | |
247 | + LambdaQueryWrapper<Location> wrapper = Wrappers.lambdaQuery(); | |
248 | + wrapper.eq(Location::getRoadway, roadWay) | |
249 | + .eq(Location::getStatus, STATUS_LOCATION_EMPTY) | |
250 | + .eq(Location::getHigh, high) | |
251 | + .eq(Location::getContainerCode, "") | |
252 | + .eq(Location::getOnlyEmptyContainer, EMPTY_CONTAINER_LOCATION); | |
253 | + List<Location> list = locationService.list(wrapper); | |
254 | + if (!list.isEmpty()) { | |
255 | + return list.get(0).getCode(); | |
256 | + } | |
257 | + } | |
258 | + | |
259 | + int reserveNumber = getReserveNumber();// 获取双伸位预留库位数 | |
247 | 260 | // 移除掉可用库位数小于预留库位数的巷道 |
248 | 261 | LambdaQueryWrapper<Location> wrapper = Wrappers.lambdaQuery(); |
249 | - wrapper.eq(Location::getArea, area) | |
250 | - .eq(Location::getRoadway, roadWay) | |
262 | + wrapper.eq(Location::getRoadway, roadWay) | |
251 | 263 | .eq(Location::getStatus, STATUS_LOCATION_EMPTY) |
252 | 264 | .eq(Location::getHigh, high) |
253 | 265 | .eq(Location::getContainerCode, "") |
254 | - .orderByAsc(Location::getILayer) | |
255 | - .eq(Location::getSelfCreated, NOTSELFCREATED) | |
266 | + .eq(Location::getSelfCreated, NO_TSELFCREATED) | |
267 | + .eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION) | |
256 | 268 | .last(" limit 20"); |
257 | 269 | |
258 | - // emptyContainerTask=1表示是空托盘任务 | |
259 | - // 如果是空托盘,onlyEmptyContainer大于等于0,并排序,只限空托盘的库位优先分配,不是不是空托盘任务,只能分配分配onlyEmptyContainer为0的库位 | |
260 | - if (emptyContainerTask == 1) { | |
261 | - wrapper.ge(Location::getOnlyEmptyContainer, 0);//大于等于0 | |
262 | - wrapper.orderByDesc(Location::getFrequencyLocation); | |
263 | - } else { | |
264 | - wrapper.eq(Location::getOnlyEmptyContainer, 0); | |
265 | - } | |
266 | 270 | List<Location> totalLocationList = locationService.list(wrapper); |
267 | 271 | //双伸位预留库位数不够了就排除掉该巷道 |
268 | 272 | if (totalLocationList.size() <= reserveNumber) { |
... | ... | @@ -271,22 +275,15 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
271 | 275 | |
272 | 276 | // 查找外侧的库位 |
273 | 277 | LambdaQueryWrapper<Location> locationLambda = Wrappers.lambdaQuery(); |
274 | - locationLambda.eq(Location::getArea, area) | |
275 | - .eq(Location::getRoadway, roadWay) | |
278 | + locationLambda.eq(Location::getRoadway, roadWay) | |
276 | 279 | .eq(Location::getStatus, STATUS_LOCATION_EMPTY) |
277 | 280 | .eq(Location::getHigh, high) |
278 | 281 | .eq(Location::getRowFlag, ROW_OUT)//外侧 |
279 | 282 | .eq(Location::getContainerCode, "") |
280 | - .eq(Location::getSelfCreated, NOTSELFCREATED) | |
283 | + .eq(Location::getSelfCreated, NO_TSELFCREATED) | |
284 | + .eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION) | |
281 | 285 | .last(" limit 20"); |
282 | 286 | |
283 | - //空托盘 | |
284 | - if (emptyContainerTask == 1) { | |
285 | - locationLambda.ge(Location::getOnlyEmptyContainer, 0);//大于等于0 | |
286 | - locationLambda.orderByDesc(Location::getOnlyEmptyContainer); | |
287 | - } else { | |
288 | - locationLambda.eq(Location::getOnlyEmptyContainer, 0); | |
289 | - } | |
290 | 287 | //频繁库位 |
291 | 288 | String str; |
292 | 289 | if (frequencyLocation == 1) { |
... | ... | @@ -303,15 +300,12 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
303 | 300 | //locationLambda.orderByDesc(Location::getFrequencyLocation);//倒序 |
304 | 301 | } |
305 | 302 | |
306 | - //可燃物料(空托盘不用进来判断) | |
307 | - if (emptyContainerTask != 1) { | |
308 | - if (isFlammable) { | |
309 | - locationLambda.orderByAsc(Location::getILayer); | |
310 | - } else { | |
311 | - locationLambda.last("ORDER BY " + str + ", (CASE WHEN iLayer > 2 THEN iLayer ELSE iLayer + 20 END) ASC"); | |
312 | - } | |
303 | + //可燃物料 | |
304 | + if (isFlammable) { | |
305 | + locationLambda.orderByAsc(Location::getILayer); | |
306 | + } else { | |
307 | + locationLambda.last("ORDER BY " + str + ", (CASE WHEN iLayer > 2 THEN iLayer ELSE iLayer + 20 END) ASC"); | |
313 | 308 | } |
314 | - | |
315 | 309 | List<Location> locationList = locationService.list(locationLambda); |
316 | 310 | List<Location> removeLocaationList = new ArrayList<>(); |
317 | 311 | if (locationList != null && !locationList.isEmpty()) { |
... | ... | @@ -322,7 +316,6 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
322 | 316 | } |
323 | 317 | } |
324 | 318 | } |
325 | - | |
326 | 319 | if (locationList != null) { |
327 | 320 | locationList.removeAll(removeLocaationList); |
328 | 321 | } |
... | ... | @@ -330,22 +323,15 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
330 | 323 | // 如果没有外侧库位可分配了,再查内侧的库位 |
331 | 324 | if (locationList == null || locationList.isEmpty()) { |
332 | 325 | locationLambda = Wrappers.lambdaQuery(); |
333 | - locationLambda.eq(Location::getArea, area) | |
334 | - .eq(StringUtils.isNotEmpty(roadWay), Location::getRoadway, roadWay) | |
326 | + locationLambda.eq(StringUtils.isNotEmpty(roadWay), Location::getRoadway, roadWay) | |
335 | 327 | .eq(Location::getStatus, STATUS_LOCATION_EMPTY) |
336 | 328 | .eq(Location::getHigh, high) |
337 | 329 | .eq(Location::getRowFlag, ROW_IN) |
338 | 330 | .eq(Location::getContainerCode, "") |
339 | - .eq(Location::getSelfCreated, NOTSELFCREATED) | |
331 | + .eq(Location::getSelfCreated, NO_TSELFCREATED) | |
332 | + .eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION) | |
340 | 333 | .last(" limit 20"); |
341 | 334 | |
342 | - if (emptyContainerTask == 1) { | |
343 | - locationLambda.ge(Location::getOnlyEmptyContainer, 0);//大于等于0 | |
344 | - locationLambda.orderByDesc(Location::getOnlyEmptyContainer); | |
345 | - } else { | |
346 | - locationLambda.eq(Location::getOnlyEmptyContainer, 0); | |
347 | - } | |
348 | - | |
349 | 335 | //频繁库位 |
350 | 336 | //if (frequencyLocation == 1) { |
351 | 337 | // locationLambda.orderByAsc(Location::getFrequencyLocation); //升序 |
... | ... | @@ -358,15 +344,12 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
358 | 344 | // locationLambda.orderByDesc(Location::getFrequencyLocation);//倒序 |
359 | 345 | //} |
360 | 346 | //可燃物料(空托盘不用进来判断) |
361 | - if (emptyContainerTask != 1) { | |
362 | - if (isFlammable) { | |
363 | - locationLambda.orderByAsc(Location::getILayer); | |
364 | - } else { | |
365 | - locationLambda.last("ORDER BY " + str + ", (CASE WHEN iLayer > 2 THEN iLayer ELSE iLayer + 20 END) ASC"); | |
366 | - } | |
347 | + if (isFlammable) { | |
348 | + locationLambda.orderByAsc(Location::getILayer); | |
349 | + } else { | |
350 | + locationLambda.last("ORDER BY " + str + ", (CASE WHEN iLayer > 2 THEN iLayer ELSE iLayer + 20 END) ASC"); | |
367 | 351 | } |
368 | 352 | locationList = locationService.list(locationLambda); |
369 | - | |
370 | 353 | removeLocaationList = new ArrayList<>(); |
371 | 354 | if (locationList != null && !locationList.isEmpty()) { |
372 | 355 | for (Location location1 : locationList) { |
... | ... | @@ -394,13 +377,11 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
394 | 377 | int reserveNumber = getReserveNumber(); |
395 | 378 | // 移除掉可用库位数小于预留库位数的巷道 |
396 | 379 | LambdaQueryWrapper<Location> wrapper = Wrappers.lambdaQuery(); |
397 | - wrapper.eq(Location::getArea, AREA) | |
398 | - .eq(Location::getRoadway, roadWay) | |
380 | + wrapper.eq(Location::getRoadway, roadWay) | |
399 | 381 | .eq(Location::getStatus, STATUS_LOCATION_EMPTY) |
400 | 382 | .eq(Location::getHigh, high) |
401 | 383 | .eq(Location::getSelfCreated, SELFCREATED) |
402 | 384 | .eq(Location::getContainerCode, "") |
403 | - .orderByAsc(Location::getILayer) | |
404 | 385 | .last(" limit 20"); |
405 | 386 | |
406 | 387 | List<Location> totalLocationList = locationService.list(wrapper); |
... | ... | @@ -411,36 +392,13 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
411 | 392 | |
412 | 393 | // 查找外侧的库位 |
413 | 394 | LambdaQueryWrapper<Location> locationLambda = Wrappers.lambdaQuery(); |
414 | - locationLambda.eq(Location::getArea, AREA) | |
415 | - .eq(Location::getRoadway, roadWay) | |
395 | + locationLambda.eq(Location::getRoadway, roadWay) | |
416 | 396 | .eq(Location::getStatus, STATUS_LOCATION_EMPTY) |
417 | 397 | .eq(Location::getHigh, high) |
418 | 398 | .eq(Location::getSelfCreated, SELFCREATED) |
419 | 399 | .eq(Location::getRowFlag, ROW_OUT)//外侧 |
420 | 400 | .eq(Location::getContainerCode, "") |
421 | 401 | .last(" limit 20"); |
422 | - | |
423 | - //频繁库位 | |
424 | - String str; | |
425 | - if (frequencyLocation == 1) { | |
426 | - str = "frequencyLocation asc"; | |
427 | - } else if (frequencyLocation == 2) { | |
428 | - //常用 | |
429 | - locationLambda.ge(Location::getFrequencyLocation, 2);//大于等于2 | |
430 | - str = "frequencyLocation asc"; | |
431 | - } else { | |
432 | - //不常用 | |
433 | - str = "frequencyLocation desc"; | |
434 | - } | |
435 | - | |
436 | - //可燃物料 | |
437 | - if (isFlammable) { | |
438 | - locationLambda.orderByAsc(Location::getILayer); | |
439 | - } else { | |
440 | - locationLambda.last("ORDER BY " + str + ", (CASE WHEN iLayer > 2 THEN iLayer ELSE iLayer + 20 END) ASC"); | |
441 | - } | |
442 | - | |
443 | - | |
444 | 402 | List<Location> locationList = locationService.list(locationLambda); |
445 | 403 | List<Location> removeLocaationList = new ArrayList<>(); |
446 | 404 | if (locationList != null && !locationList.isEmpty()) { |
... | ... | @@ -458,7 +416,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
458 | 416 | // 如果没有外侧库位可分配了,再查内侧的库位 |
459 | 417 | if (locationList == null || locationList.isEmpty()) { |
460 | 418 | locationLambda = Wrappers.lambdaQuery(); |
461 | - locationLambda.eq(Location::getArea, AREA) | |
419 | + locationLambda | |
462 | 420 | .eq(StringUtils.isNotEmpty(roadWay), Location::getRoadway, roadWay) |
463 | 421 | .eq(Location::getStatus, STATUS_LOCATION_EMPTY) |
464 | 422 | .eq(Location::getHigh, high) |
... | ... | @@ -466,13 +424,6 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
466 | 424 | .eq(Location::getRowFlag, ROW_IN) |
467 | 425 | .eq(Location::getContainerCode, "") |
468 | 426 | .last(" limit 20"); |
469 | - | |
470 | - //可燃物料(空托盘不用进来判断) | |
471 | - if (isFlammable) { | |
472 | - locationLambda.orderByAsc(Location::getILayer); | |
473 | - } else { | |
474 | - locationLambda.last("ORDER BY " + str + ", (CASE WHEN iLayer > 2 THEN iLayer ELSE iLayer + 20 END) ASC"); | |
475 | - } | |
476 | 427 | locationList = locationService.list(locationLambda); |
477 | 428 | |
478 | 429 | removeLocaationList = new ArrayList<>(); |
... | ... |
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java
... | ... | @@ -252,6 +252,7 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService |
252 | 252 | if (rowFlag == QuantityConstant.ROW_OUT) { |
253 | 253 | //拿到该库位的内侧库位 |
254 | 254 | Location insideLocation = locationService.getInsideNear(location); |
255 | + | |
255 | 256 | //如果内侧库位上有托盘的话 |
256 | 257 | if (StringUtils.isNotEmpty(insideLocation.getContainerCode())) { |
257 | 258 | Location destinationLocation; |
... | ... | @@ -266,7 +267,7 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService |
266 | 267 | destinationLocation = locationService.getLocationByCode(destinationLocationCode); |
267 | 268 | } else { |
268 | 269 | //获取一个最近的空闲库位(优先找外侧) |
269 | - destinationLocation = locationService.getEmptyLocation(insideLocation); | |
270 | + destinationLocation = locationService.getEmptyLocation(insideLocation, isSelfCreated); | |
270 | 271 | } |
271 | 272 | |
272 | 273 | //创建移库任务 |
... | ... |
src/main/java/com/huaheng/common/constant/QuantityConstant.java
... | ... | @@ -571,6 +571,10 @@ public class QuantityConstant { |
571 | 571 | public static final String BIG_CONTAINER_TYPE = "2"; |
572 | 572 | |
573 | 573 | public static final String AREA = "1"; |
574 | - public static final String SELFCREATED = "1"; | |
575 | - public static final String NOTSELFCREATED = "0"; | |
574 | + public static final String SELFCREATED = "1";//自建单据库位 | |
575 | + public static final String NO_TSELFCREATED = "0";//非建单据库位 | |
576 | + | |
577 | + public static final String EMPTY_CONTAINER_LOCATION = "1";//空托盘库位 | |
578 | + public static final String NO_EMPTY_CONTAINER_LOCATION = "0";//不是空托盘库位 | |
579 | + | |
576 | 580 | } |
... | ... |
src/main/java/com/huaheng/pc/config/location/service/LocationService.java
... | ... | @@ -111,11 +111,11 @@ public interface LocationService extends IService<Location> { |
111 | 111 | |
112 | 112 | Location getNear(Location location); |
113 | 113 | |
114 | - Location getEmptyInsideLocation(Location location); | |
114 | + Location getEmptyInsideLocation(Location location, int isSelfCreated); | |
115 | 115 | |
116 | - Location getEmptyOutSideLocation(Location location); | |
116 | + Location getEmptyOutSideLocation(Location location, int isSelfCreated); | |
117 | 117 | |
118 | - Location getEmptyLocation(Location location); | |
118 | + Location getEmptyLocation(Location location, int isSelfCreated); | |
119 | 119 | |
120 | 120 | int getFirstRowOfZone(String warehouseCode, String zoneCode); |
121 | 121 | |
... | ... |
src/main/java/com/huaheng/pc/config/location/service/LocationServiceImpl.java
... | ... | @@ -551,11 +551,10 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i |
551 | 551 | } |
552 | 552 | |
553 | 553 | @Override |
554 | - public Location getEmptyOutSideLocation(Location location) { | |
554 | + public Location getEmptyOutSideLocation(Location location, int isSelfCreated) { | |
555 | 555 | LambdaQueryWrapper<Location> queryWrapper = Wrappers.lambdaQuery(); |
556 | - queryWrapper.eq(Location::getSelfCreated, false); | |
557 | - queryWrapper.ne(Location::getOnlyEmptyContainer, 1); | |
558 | - queryWrapper.eq(Location::getWarehouseCode, location.getWarehouseCode()); | |
556 | + queryWrapper.eq(Location::getSelfCreated, isSelfCreated); | |
557 | + queryWrapper.eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION); | |
559 | 558 | queryWrapper.eq(Location::getRoadway, location.getRoadway()); |
560 | 559 | queryWrapper.eq(Location::getHigh, location.getHigh()); |
561 | 560 | queryWrapper.eq(Location::getRowFlag, QuantityConstant.ROW_OUT);//外侧 |
... | ... | @@ -596,11 +595,10 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i |
596 | 595 | |
597 | 596 | |
598 | 597 | @Override |
599 | - public Location getEmptyInsideLocation(Location location) { | |
598 | + public Location getEmptyInsideLocation(Location location, int isSelfCreated) { | |
600 | 599 | LambdaQueryWrapper<Location> queryWrapper = Wrappers.lambdaQuery(); |
601 | - queryWrapper.eq(Location::getSelfCreated, false); | |
602 | - queryWrapper.ne(Location::getOnlyEmptyContainer, 1); | |
603 | - queryWrapper.eq(Location::getWarehouseCode, location.getWarehouseCode()); | |
600 | + queryWrapper.eq(Location::getSelfCreated, isSelfCreated); | |
601 | + queryWrapper.eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION); | |
604 | 602 | queryWrapper.eq(Location::getRoadway, location.getRoadway()); |
605 | 603 | queryWrapper.eq(Location::getRowFlag, QuantityConstant.ROW_IN);//内侧 |
606 | 604 | queryWrapper.eq(Location::getHigh, location.getHigh()); |
... | ... | @@ -638,10 +636,10 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i |
638 | 636 | } |
639 | 637 | |
640 | 638 | @Override |
641 | - public Location getEmptyLocation(Location location) { | |
642 | - Location location1 = getEmptyOutSideLocation(location); | |
639 | + public Location getEmptyLocation(Location location, int isSelfCreated) { | |
640 | + Location location1 = getEmptyOutSideLocation(location, isSelfCreated); | |
643 | 641 | if (location1 == null) { |
644 | - location1 = getEmptyInsideLocation(location); | |
642 | + location1 = getEmptyInsideLocation(location, isSelfCreated); | |
645 | 643 | } |
646 | 644 | return location1; |
647 | 645 | } |
... | ... |