Commit d3374e8d1a233e595abf2246389af0a920509e9f
1 parent
2c19fc91
二厂库位分配去除高度大于等于
Showing
10 changed files
with
171 additions
and
79 deletions
src/main/java/com/huaheng/api/wcs/service/taskAssignService/TaskAssignServiceImpl.java
... | ... | @@ -185,6 +185,9 @@ public class TaskAssignServiceImpl implements TaskAssignService { |
185 | 185 | //获取一个最近的空闲库位(优先找外侧) |
186 | 186 | destinationLocation = locationService.getEmptyLocation(insideLocation, isSelfCreated); |
187 | 187 | } |
188 | + if (destinationLocation == null) { | |
189 | + return AjaxResult.error("移库获取一个目标库位为空"); | |
190 | + } | |
188 | 191 | AjaxResult ajaxResult = transferTaskService.createTransferTask(insideLocation.getCode(), destinationLocation.getCode(), warehouseCode); |
189 | 192 | if (ajaxResult.getCode() == 400) { |
190 | 193 | return AjaxResult.error(ajaxResult.getMsg()); |
... | ... |
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationServiceImpl.java
... | ... | @@ -237,8 +237,9 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
237 | 237 | @Override |
238 | 238 | @Transactional(rollbackFor = Exception.class) |
239 | 239 | public String doubleRk(String roadWay, int high, Integer frequencyLocation, Integer emptyContainerTask, boolean isFlammable, String taskNo, boolean bypass) { |
240 | - boolean isSecondFactory = isSecondFactory();//是否是二厂一期项目 | |
240 | + //boolean isSecondFactory = isSecondFactory();//是否是二厂项目 | |
241 | 241 | int reserveNumber = 0; |
242 | + //二厂,分拣任务回库的时候,也要判断预留库位 | |
242 | 243 | if (!bypass) { |
243 | 244 | reserveNumber = getReserveNumber(roadWay); |
244 | 245 | } |
... | ... | @@ -263,12 +264,13 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
263 | 264 | .eq(Location::getContainerCode, "") |
264 | 265 | .eq(Location::getSelfCreated, NO_TSELFCREATED) |
265 | 266 | .eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION) |
267 | + .eq(Location::getHigh, high) | |
266 | 268 | .last(" limit 20"); |
267 | - if (isSecondFactory) { | |
268 | - wrapper.ge(Location::getHigh, high); | |
269 | - } else { | |
270 | - wrapper.eq(Location::getHigh, high); | |
271 | - } | |
269 | + //if (isSecondFactory) { | |
270 | + // wrapper.ge(Location::getHigh, high); | |
271 | + //} else { | |
272 | + // wrapper.eq(Location::getHigh, high); | |
273 | + //} | |
272 | 274 | List<Location> totalLocationList = locationService.list(wrapper); |
273 | 275 | if (totalLocationList.size() <= reserveNumber) { |
274 | 276 | return "可能是库位不够用了,请检查预留库位数"; |
... | ... | @@ -280,17 +282,18 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
280 | 282 | .eq(Location::getStatus, STATUS_LOCATION_EMPTY) |
281 | 283 | .eq(Location::getRowFlag, ROW_OUT)//外侧 |
282 | 284 | .eq(Location::getContainerCode, "") |
285 | + .eq(Location::getHigh, high) | |
283 | 286 | .eq(Location::getSelfCreated, NO_TSELFCREATED) |
284 | 287 | .eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION) |
285 | 288 | .orderByAsc(Location::getHigh) |
286 | 289 | .orderByAsc(Location::getILayer) |
287 | 290 | .orderByAsc(Location::getId) |
288 | 291 | .last(" limit 20"); |
289 | - if (isSecondFactory) { | |
290 | - locationLambda.ge(Location::getHigh, high); | |
291 | - } else { | |
292 | - locationLambda.eq(Location::getHigh, high); | |
293 | - } | |
292 | + //if (isSecondFactory) { | |
293 | + // locationLambda.ge(Location::getHigh, high); | |
294 | + //} else { | |
295 | + // locationLambda.eq(Location::getHigh, high); | |
296 | + //} | |
294 | 297 | |
295 | 298 | List<Location> locationList = locationService.list(locationLambda); |
296 | 299 | List<Location> removeLocaationList = new ArrayList<>(); |
... | ... | @@ -315,15 +318,16 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
315 | 318 | .eq(Location::getContainerCode, "") |
316 | 319 | .eq(Location::getSelfCreated, NO_TSELFCREATED) |
317 | 320 | .eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION) |
321 | + .eq(Location::getHigh, high) | |
318 | 322 | .orderByAsc(Location::getHigh) |
319 | 323 | .orderByAsc(Location::getILayer) |
320 | 324 | .orderByAsc(Location::getId) |
321 | 325 | .last(" limit 20"); |
322 | - if (isSecondFactory) { | |
323 | - locationLambda2.ge(Location::getHigh, high); | |
324 | - } else { | |
325 | - locationLambda2.eq(Location::getHigh, high); | |
326 | - } | |
326 | + //if (isSecondFactory) { | |
327 | + // locationLambda2.ge(Location::getHigh, high); | |
328 | + //} else { | |
329 | + // locationLambda2.eq(Location::getHigh, high); | |
330 | + //} | |
327 | 331 | |
328 | 332 | locationList = locationService.list(locationLambda2); |
329 | 333 | removeLocaationList = new ArrayList<>(); |
... | ... | @@ -350,7 +354,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
350 | 354 | //自建单据 |
351 | 355 | @Override |
352 | 356 | public String isSelfCreated(String roadWay, int high, Integer frequencyLocation, boolean bypass) { |
353 | - boolean isSecondFactory = isSecondFactory(); | |
357 | + //boolean isSecondFactory = isSecondFactory(); | |
354 | 358 | int reserveNumber = 0; |
355 | 359 | if (!bypass) { |
356 | 360 | reserveNumber = getReserveNumber(roadWay); |
... | ... | @@ -363,12 +367,13 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
363 | 367 | .eq(Location::getContainerCode, "") |
364 | 368 | .eq(Location::getSelfCreated, SELFCREATED) |
365 | 369 | .eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION) |
370 | + .eq(Location::getHigh, high) | |
366 | 371 | .last(" limit 20"); |
367 | - if (isSecondFactory) { | |
368 | - wrapper.ge(Location::getHigh, high); | |
369 | - } else { | |
370 | - wrapper.eq(Location::getHigh, high); | |
371 | - } | |
372 | + //if (isSecondFactory) { | |
373 | + // wrapper.ge(Location::getHigh, high); | |
374 | + //} else { | |
375 | + // wrapper.eq(Location::getHigh, high); | |
376 | + //} | |
372 | 377 | List<Location> totalLocationList = locationService.list(wrapper); |
373 | 378 | //双伸位预留库位数不够了就排除掉该巷道 |
374 | 379 | if (totalLocationList.size() <= reserveNumber) { |
... | ... | @@ -382,17 +387,18 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
382 | 387 | .eq(Location::getRowFlag, ROW_OUT)//外侧 |
383 | 388 | .eq(Location::getContainerCode, "") |
384 | 389 | .eq(Location::getSelfCreated, SELFCREATED) |
390 | + .eq(Location::getHigh, high) | |
385 | 391 | .eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION) |
386 | 392 | .orderByAsc(Location::getHigh) |
387 | 393 | .orderByAsc(Location::getILayer) |
388 | 394 | .orderByAsc(Location::getId) |
389 | 395 | .last(" limit 20"); |
390 | 396 | |
391 | - if (isSecondFactory) { | |
392 | - locationLambda.ge(Location::getHigh, high); | |
393 | - } else { | |
394 | - locationLambda.eq(Location::getHigh, high); | |
395 | - } | |
397 | + //if (isSecondFactory) { | |
398 | + // locationLambda.ge(Location::getHigh, high); | |
399 | + //} else { | |
400 | + // locationLambda.eq(Location::getHigh, high); | |
401 | + //} | |
396 | 402 | List<Location> locationList = locationService.list(locationLambda); |
397 | 403 | List<Location> removeLocaationList = new ArrayList<>(); |
398 | 404 | if (locationList != null && !locationList.isEmpty()) { |
... | ... | @@ -417,15 +423,16 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
417 | 423 | .eq(Location::getContainerCode, "") |
418 | 424 | .eq(Location::getSelfCreated, SELFCREATED) |
419 | 425 | .eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION) |
426 | + .eq(Location::getHigh, high) | |
420 | 427 | .orderByAsc(Location::getHigh) |
421 | 428 | .orderByAsc(Location::getILayer) |
422 | 429 | .orderByAsc(Location::getId) |
423 | 430 | .last(" limit 20"); |
424 | - if (isSecondFactory) { | |
425 | - locationLambda2.ge(Location::getHigh, high); | |
426 | - } else { | |
427 | - locationLambda2.eq(Location::getHigh, high); | |
428 | - } | |
431 | + //if (isSecondFactory) { | |
432 | + // locationLambda2.ge(Location::getHigh, high); | |
433 | + //} else { | |
434 | + // locationLambda2.eq(Location::getHigh, high); | |
435 | + //} | |
429 | 436 | locationList = locationService.list(locationLambda2); |
430 | 437 | removeLocaationList = new ArrayList<>(); |
431 | 438 | if (locationList != null && !locationList.isEmpty()) { |
... | ... | @@ -459,7 +466,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
459 | 466 | @Override |
460 | 467 | public String isFlammable(String roadWay, int high, Integer frequencyLocation, String taskNo, boolean bypass) { |
461 | 468 | int flammableLayer = 3; |
462 | - boolean isSecondFactory = isSecondFactory(); | |
469 | + //boolean isSecondFactory = isSecondFactory(); | |
463 | 470 | int reserveNumber = 0; |
464 | 471 | if (!bypass) { |
465 | 472 | reserveNumber = getReserveNumber(roadWay); |
... | ... | @@ -471,14 +478,15 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
471 | 478 | .eq(Location::getStatus, STATUS_LOCATION_EMPTY) |
472 | 479 | .eq(Location::getContainerCode, "") |
473 | 480 | .eq(Location::getSelfCreated, NO_TSELFCREATED) |
481 | + .eq(Location::getHigh, high) | |
474 | 482 | .eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION) |
475 | 483 | .last(" limit 20"); |
476 | 484 | |
477 | - if (isSecondFactory) { | |
478 | - wrapper.ge(Location::getHigh, high); | |
479 | - } else { | |
480 | - wrapper.eq(Location::getHigh, high); | |
481 | - } | |
485 | + //if (isSecondFactory) { | |
486 | + // wrapper.ge(Location::getHigh, high); | |
487 | + //} else { | |
488 | + // wrapper.eq(Location::getHigh, high); | |
489 | + //} | |
482 | 490 | List<Location> totalLocationList = locationService.list(wrapper); |
483 | 491 | if (totalLocationList.size() <= reserveNumber) { |
484 | 492 | return "可能是库位不够用了,请检查预留库位数"; |
... | ... | @@ -491,14 +499,15 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
491 | 499 | .eq(Location::getRowFlag, ROW_OUT)//外侧 |
492 | 500 | .eq(Location::getContainerCode, "") |
493 | 501 | .eq(Location::getSelfCreated, NO_TSELFCREATED) |
502 | + .eq(Location::getHigh, high) | |
494 | 503 | .eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION) |
495 | 504 | .last("ORDER BY (CASE WHEN iLayer > " + flammableLayer + " THEN iLayer ELSE iLayer + 20 END) ASC LIMIT 20"); |
496 | 505 | |
497 | - if (isSecondFactory) { | |
498 | - locationLambda.ge(Location::getHigh, high); | |
499 | - } else { | |
500 | - locationLambda.eq(Location::getHigh, high); | |
501 | - } | |
506 | + //if (isSecondFactory) { | |
507 | + // locationLambda.ge(Location::getHigh, high); | |
508 | + //} else { | |
509 | + // locationLambda.eq(Location::getHigh, high); | |
510 | + //} | |
502 | 511 | |
503 | 512 | List<Location> locationList = locationService.list(locationLambda); |
504 | 513 | List<Location> removeLocaationList = new ArrayList<>(); |
... | ... | @@ -521,14 +530,15 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
521 | 530 | .eq(Location::getStatus, STATUS_LOCATION_EMPTY) |
522 | 531 | .eq(Location::getRowFlag, ROW_IN) |
523 | 532 | .eq(Location::getContainerCode, "") |
533 | + .eq(Location::getHigh, high) | |
524 | 534 | .eq(Location::getSelfCreated, NO_TSELFCREATED) |
525 | 535 | .eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION) |
526 | 536 | .last("ORDER BY (CASE WHEN iLayer > " + flammableLayer + " THEN iLayer ELSE iLayer + 20 END) ASC LIMIT 20"); |
527 | - if (isSecondFactory) { | |
528 | - locationLambda2.ge(Location::getHigh, high); | |
529 | - } else { | |
530 | - locationLambda2.eq(Location::getHigh, high); | |
531 | - } | |
537 | + //if (isSecondFactory) { | |
538 | + // locationLambda2.ge(Location::getHigh, high); | |
539 | + //} else { | |
540 | + // locationLambda2.eq(Location::getHigh, high); | |
541 | + //} | |
532 | 542 | locationList = locationService.list(locationLambda2); |
533 | 543 | removeLocaationList = new ArrayList<>(); |
534 | 544 | if (locationList != null && !locationList.isEmpty()) { |
... | ... |
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java
... | ... | @@ -234,7 +234,7 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService |
234 | 234 | if (StringUtils.isNotEmpty(taskHeader.getToLocation()) && !locationCode.equals(taskHeader.getToLocation())) { |
235 | 235 | int updateCount2 = locationService.updateStatusNew(taskHeader.getToLocation(), warehouseCode, QuantityConstant.STATUS_LOCATION_EMPTY, QuantityConstant.STATUS_LOCATION_LOCK); |
236 | 236 | if (updateCount2 != 1) { |
237 | - throw new ServiceException("重复分配库位时,解锁库位失败!"); | |
237 | + throw new ServiceException("重复分配库位时,解锁库位失败!" + taskHeader.getToLocation()); | |
238 | 238 | } |
239 | 239 | //解除右侧库位禁用状态和对应4个库位标记 |
240 | 240 | locationService.unbanRightLocationAndUnmark(container.getContainerType(), taskHeader.getToLocation()); |
... | ... | @@ -273,7 +273,9 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService |
273 | 273 | //获取一个最近的空闲库位(优先找外侧) |
274 | 274 | destinationLocation = locationService.getEmptyLocation(insideLocation, isSelfCreated); |
275 | 275 | } |
276 | - | |
276 | + if (destinationLocation == null) { | |
277 | + throw new ServiceException("创建移库任务失败,目标库位无法分配,可能是库位已经全满了"); | |
278 | + } | |
277 | 279 | //创建移库任务 |
278 | 280 | AjaxResult ajaxResult = transferTaskService.createTransferTask(insideLocation.getCode(), destinationLocation.getCode(), warehouseCode); |
279 | 281 | preTaskNo = (Integer) ajaxResult.getData(); |
... | ... |
src/main/java/com/huaheng/framework/config/ShiroConfig.java
... | ... | @@ -300,6 +300,7 @@ public class ShiroConfig { |
300 | 300 | //filterChainDefinitionMap.put("/receipt/receiving/saveBatch", "anon"); |
301 | 301 | //filterChainDefinitionMap.put("/config/zone/getAllFlatLocation", "anon"); |
302 | 302 | //filterChainDefinitionMap.put("/mobile/getModules2", "anon"); |
303 | + //filterChainDefinitionMap.put("/inventory/inventoryHeader/listEmptyContainer", "anon"); | |
303 | 304 | |
304 | 305 | |
305 | 306 | // 系统权限列表 |
... | ... |
src/main/java/com/huaheng/mobile/invenory/MobileInventoryController.java
... | ... | @@ -32,8 +32,11 @@ import com.huaheng.pc.inventory.inventoryHeader.service.InventoryHeaderService; |
32 | 32 | import com.huaheng.pc.inventory.inventoryTransaction.domain.InventoryTransaction; |
33 | 33 | import com.huaheng.pc.inventory.inventoryTransaction.service.InventoryTransactionService; |
34 | 34 | import com.huaheng.pc.report.excelReport.mapper.ExcelReportMapper; |
35 | +import com.huaheng.pc.task.taskDetail.domain.TaskDetail; | |
36 | +import com.huaheng.pc.task.taskDetail.service.TaskDetailService; | |
35 | 37 | import com.huaheng.pc.task.taskHeader.domain.TaskHeader; |
36 | 38 | import com.huaheng.pc.task.taskHeader.service.TaskHeaderService; |
39 | +import com.huaheng.pc.task.taskHeader.service.TaskHeaderServiceImpl; | |
37 | 40 | import com.huaheng.pc.task.taskHeader.service.TransferTaskService; |
38 | 41 | import com.huaheng.pc.task.taskHeader.service.WorkTaskService; |
39 | 42 | import io.swagger.annotations.Api; |
... | ... | @@ -62,7 +65,10 @@ import java.util.stream.Collectors; |
62 | 65 | @RequestMapping("/mobile/inventory") |
63 | 66 | @Api(tags = {"手机立体库库存相关"}, value = "手机立体库库存相关MobileInventoryController") |
64 | 67 | public class MobileInventoryController extends BaseController { |
65 | - | |
68 | + @Resource | |
69 | + private TaskDetailService taskDetailService; | |
70 | + @Resource | |
71 | + private TaskHeaderService taskHeaderService; | |
66 | 72 | @Resource |
67 | 73 | private InventoryHeaderService inventoryService; |
68 | 74 | @Resource |
... | ... | @@ -89,6 +95,8 @@ public class MobileInventoryController extends BaseController { |
89 | 95 | private CycleCountDetailChildService cycleCountDetailChildService; |
90 | 96 | @Resource |
91 | 97 | private CycleCountHeaderMapper cycleCountHeaderMapper; |
98 | + @Autowired | |
99 | + private TaskHeaderServiceImpl taskHeaderServiceImpl; | |
92 | 100 | |
93 | 101 | @PostMapping("/getInventoryInfo") |
94 | 102 | //@ApiOperation("移动端获得库存详情") |
... | ... | @@ -172,6 +180,7 @@ public class MobileInventoryController extends BaseController { |
172 | 180 | @Autowired |
173 | 181 | private RedisTemplate<String, String> redisTemplate; |
174 | 182 | |
183 | + @ApiLogger(apiName = "PDA完成平库任务", from = "PDA") | |
175 | 184 | @PostMapping("/completeTaskListByWMS") |
176 | 185 | @ResponseBody |
177 | 186 | public AjaxResult completeTaskListByWMS(@RequestBody List<TaskIds> taskDetails) { |
... | ... | @@ -180,18 +189,23 @@ public class MobileInventoryController extends BaseController { |
180 | 189 | |
181 | 190 | List<TaskHeader> tasks = taskService.getTasksByIds(taskIds); |
182 | 191 | |
183 | - // 筛选出未完成的任务 | |
184 | - List<Integer> pendingTaskIds = tasks.stream() | |
192 | + // 筛选出未完成的任务的ID | |
193 | + Integer[] pendingTaskIds = tasks.stream() | |
185 | 194 | .filter(task -> task.getStatus() != QuantityConstant.TASK_STATUS_COMPLETED) |
186 | 195 | .map(TaskHeader::getId) |
187 | - .collect(Collectors.toList()); | |
188 | - | |
196 | + .distinct() // 确保ID是唯一的 | |
197 | + .toArray(Integer[]::new); | |
189 | 198 | |
190 | 199 | // 如果没有未完成的任务,直接返回 |
191 | - if (pendingTaskIds.isEmpty()) { | |
200 | + if (pendingTaskIds.length == 0) { | |
192 | 201 | return AjaxResult.success("任务已完成"); |
193 | 202 | } |
194 | - return taskService.completeTaskByWMS(taskIds, null); | |
203 | + | |
204 | + for (Integer taskId : pendingTaskIds) { | |
205 | + taskService.completeTaskByWMS(new Integer[]{taskId}, null); | |
206 | + } | |
207 | + return AjaxResult.success("任务完成"); | |
208 | + | |
195 | 209 | } |
196 | 210 | |
197 | 211 | |
... | ... |
src/main/java/com/huaheng/mobile/receipt/MobileBatchReceiptController.java
... | ... | @@ -25,6 +25,8 @@ import com.huaheng.pc.config.receiptType.domain.ReceiptType; |
25 | 25 | import com.huaheng.pc.config.receiptType.service.ReceiptTypeService; |
26 | 26 | import com.huaheng.pc.inventory.inventoryHeader.domain.InventoryHeader; |
27 | 27 | import com.huaheng.pc.inventory.inventoryHeader.service.InventoryHeaderService; |
28 | +import com.huaheng.pc.monitor.apilog.domain.ApiLog; | |
29 | +import com.huaheng.pc.monitor.apilog.service.IApiLogService; | |
28 | 30 | import com.huaheng.pc.receipt.receiptContainerDetail.service.ReceiptContainerDetailService; |
29 | 31 | import com.huaheng.pc.receipt.receiptContainerDetail.domain.ReceiptContainerDetail; |
30 | 32 | import com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerHeader; |
... | ... | @@ -99,6 +101,8 @@ public class MobileBatchReceiptController { |
99 | 101 | @Resource |
100 | 102 | private InventoryHeaderService inventoryHeaderService; |
101 | 103 | |
104 | + @Resource | |
105 | + private IApiLogService apiLogService; | |
102 | 106 | |
103 | 107 | @PostMapping("/scanContainer") |
104 | 108 | @ApiOperation("移动端入库扫描容器") |
... | ... | @@ -537,9 +541,9 @@ public class MobileBatchReceiptController { |
537 | 541 | |
538 | 542 | |
539 | 543 | @PostMapping("/callBox") |
540 | - @ApiOperation("移动端呼叫料盒") | |
541 | - @ApiLogger(apiName = "PDA呼叫料盒", from = "WCS") | |
542 | - @Log(title = "移动端呼叫料盒", action = BusinessType.OTHER) | |
544 | + @ApiOperation("PDA呼叫料盒") | |
545 | + @ApiLogger(apiName = "PDA呼叫料盒", from = "PDA") | |
546 | + @Log(title = "PDA呼叫料盒", action = BusinessType.OTHER) | |
543 | 547 | @Transactional(rollbackFor = Exception.class) |
544 | 548 | public AjaxResult callBox(@RequestBody @ApiParam(value = "物料号") Map<String, String> param) { |
545 | 549 | String containerCode = param.get("containerCode"); |
... | ... | @@ -577,12 +581,16 @@ public class MobileBatchReceiptController { |
577 | 581 | } |
578 | 582 | } |
579 | 583 | |
580 | - | |
581 | 584 | Location location = locationService.getOne(new LambdaQueryWrapper<Location>().eq(Location::getCode, destinationLocation)); |
582 | - Container container = containerService.getOne(new LambdaQueryWrapper<Container>().eq(Container::getCode, containerCode).eq(Container::getWarehouseCode, "CS0001").last("limit 1")); | |
583 | - if (container == null) { | |
585 | + List<Container> list = containerService.list(new LambdaQueryWrapper<Container>().eq(Container::getCode, containerCode)); | |
586 | + if (list.isEmpty()) { | |
584 | 587 | return AjaxResult.error("容器不存在"); |
585 | 588 | } |
589 | + if (list.size() > 1) { | |
590 | + return AjaxResult.error("容器大于1"); | |
591 | + } | |
592 | + Container container = list.get(0); | |
593 | + | |
586 | 594 | if (location == null) { |
587 | 595 | return AjaxResult.error("库位不存在"); |
588 | 596 | } |
... | ... | @@ -639,10 +647,10 @@ public class MobileBatchReceiptController { |
639 | 647 | TaskHeader taskHeader = new TaskHeader(); |
640 | 648 | taskHeader.setWarehouseCode(location.getWarehouseCode()); |
641 | 649 | taskHeader.setCompanyCode(companyCode);//货主 |
642 | - if (type == QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT) { | |
650 | + if (type == QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT) {//补充入库 | |
643 | 651 | taskHeader.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_RECEIPT); |
644 | 652 | taskHeader.setTaskType(QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT); |
645 | - } else if (type == QuantityConstant.TASK_TYPE_WHOLERECEIPT) { | |
653 | + } else if (type == QuantityConstant.TASK_TYPE_WHOLERECEIPT) {//整盘入库 | |
646 | 654 | taskHeader.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_RECEIPT); |
647 | 655 | taskHeader.setTaskType(QuantityConstant.TASK_TYPE_WHOLERECEIPT); |
648 | 656 | } else { |
... | ... | @@ -669,9 +677,20 @@ public class MobileBatchReceiptController { |
669 | 677 | throw new ServiceException("补充入库主表生成失败!"); |
670 | 678 | } |
671 | 679 | |
680 | + addApiLog("PDA呼叫料盒", taskHeader.getContainerCode() + "/" + taskHeader.getFromLocation()); | |
672 | 681 | return AjaxResult.success(taskHeader.getId()); |
673 | 682 | } |
674 | 683 | |
684 | + public void addApiLog(String name, String requestBody) { | |
685 | + ApiLog apiLog = new ApiLog(); | |
686 | + apiLog.setApiName(name); | |
687 | + apiLog.setRequestBody(requestBody); | |
688 | + apiLog.setRequestTime(new Date()); | |
689 | + apiLog.setRequestFrom("MOM"); | |
690 | + apiLog.setResponseBy("WMS"); | |
691 | + apiLog.setResponseBody("成功"); | |
692 | + apiLogService.save(apiLog); | |
693 | + } | |
675 | 694 | |
676 | 695 | @PostMapping("/searchReceipt") |
677 | 696 | @ApiOperation("移动端查询入库单") |
... | ... |
src/main/java/com/huaheng/pc/config/container/service/ContainerServiceImpl.java
... | ... | @@ -139,9 +139,7 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container |
139 | 139 | .eq(Location::getZoneCode, "L") |
140 | 140 | .isNotNull(Location::getContainerCode) |
141 | 141 | .notInSql(Location::getContainerCode, "SELECT h.containerCode FROM task_header h WHERE h.status < 100") |
142 | - .notInSql(Location::getCode, "SELECT b.locationCode FROM inventory_detail b") | |
143 | - .notInSql(Location::getCode, "SELECT r.locationCode FROM receipt_container_detail r WHERE r.status != 20") | |
144 | - .notInSql(Location::getCode, "SELECT s.locationCode FROM shipment_container_detail s WHERE s.status != 20"); | |
142 | + .notInSql(Location::getCode, "SELECT b.locationCode FROM inventory_detail b"); | |
145 | 143 | |
146 | 144 | if (zoneCode != null && !zoneCode.isEmpty()) { |
147 | 145 | queryWrapper.eq(Location::getZoneCode, zoneCode); |
... | ... |
src/main/java/com/huaheng/pc/inventory/inventoryHeader/controller/InventoryHeaderController.java
... | ... | @@ -42,6 +42,7 @@ import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; |
42 | 42 | import com.huaheng.pc.task.taskHeader.domain.TaskHeader; |
43 | 43 | import com.huaheng.pc.task.taskHeader.service.TaskHeaderService; |
44 | 44 | import com.huaheng.pc.task.taskHeader.service.TaskHeaderServiceImpl; |
45 | +import lombok.extern.slf4j.Slf4j; | |
45 | 46 | import org.apache.shiro.authz.annotation.RequiresPermissions; |
46 | 47 | import org.springframework.beans.BeanUtils; |
47 | 48 | import org.springframework.stereotype.Controller; |
... | ... | @@ -59,6 +60,7 @@ import java.util.stream.Collectors; |
59 | 60 | /** |
60 | 61 | * 库存控制层 |
61 | 62 | */ |
63 | +@Slf4j | |
62 | 64 | @Controller |
63 | 65 | @RequestMapping("/inventory/inventoryHeader") |
64 | 66 | public class InventoryHeaderController extends BaseController { |
... | ... | @@ -416,6 +418,7 @@ public class InventoryHeaderController extends BaseController { |
416 | 418 | */ |
417 | 419 | @PostMapping("/listEmptyContainer") |
418 | 420 | @ResponseBody |
421 | + @ApiLogger(apiName = "PDA呼叫空托盘出库", from = "PDA") | |
419 | 422 | public TableDataInfo listEmptyContainer(String zoneCode, String containerCode, String locationCode) { |
420 | 423 | containerCode = containerCode == null ? "" : containerCode.trim(); |
421 | 424 | locationCode = locationCode == null ? "" : locationCode.trim(); |
... | ... |
src/main/java/com/huaheng/pc/shipment/shippingCombination/service/ShippingCombinationService.java
... | ... | @@ -3,8 +3,10 @@ package com.huaheng.pc.shipment.shippingCombination.service; |
3 | 3 | |
4 | 4 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
5 | 5 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
6 | +import com.huaheng.common.constant.QuantityConstant; | |
6 | 7 | import com.huaheng.common.exception.service.ServiceException; |
7 | 8 | import com.huaheng.common.utils.StringUtils; |
9 | +import com.huaheng.framework.web.service.ConfigService; | |
8 | 10 | import com.huaheng.pc.config.FilterConfigDetail.domain.FilterConfigDetail; |
9 | 11 | import com.huaheng.pc.config.FilterConfigDetail.service.FilterConfigDetailService; |
10 | 12 | import com.huaheng.pc.config.cinvcType.domain.CinvcType; |
... | ... | @@ -59,10 +61,47 @@ public class ShippingCombinationService { |
59 | 61 | MaterialTypeService materialTypeService; |
60 | 62 | @Resource |
61 | 63 | ShipmentHeaderService shipmentHeaderService; |
62 | - | |
64 | + @Resource | |
65 | + private ConfigService configService; | |
63 | 66 | |
64 | 67 | //根据分配规则查找库存 |
65 | 68 | public List<InventoryDetail> getInventorys(ShipmentDetail shipmentDetail, boolean isAuto, boolean isFlatWarehouse, boolean openExhibitionRestrictions) { |
69 | + //一厂一期物料相同就合并 | |
70 | + String version = configService.getKey(QuantityConstant.PROJECT_VERSION); | |
71 | + if (version.equals("1")) { | |
72 | + return getInventoryVersion1(shipmentDetail, isAuto, isFlatWarehouse, openExhibitionRestrictions); | |
73 | + } else { | |
74 | + return getInventoryVersion2(shipmentDetail, isAuto, isFlatWarehouse, openExhibitionRestrictions); | |
75 | + } | |
76 | + | |
77 | + } | |
78 | + | |
79 | + | |
80 | + //一期 | |
81 | + public List<InventoryDetail> getInventoryVersion1(ShipmentDetail shipmentDetail, boolean isAuto, boolean isFlatWarehouse, boolean openExhibitionRestrictions) { | |
82 | + String materialCode = shipmentDetail.getMaterialCode(); | |
83 | + checkNotEmpty(materialCode, "出库明细没有物料编码"); | |
84 | + String containerCode = shipmentDetail.getContainerCode(); | |
85 | + String receiptCode = shipmentDetail.getReceiptCode(); | |
86 | + ShipmentHeader shipmentHeader = shipmentHeaderService.getById(shipmentDetail.getShipmentId()); | |
87 | + String warehouse = shipmentHeader.getWarehouse(); | |
88 | + | |
89 | + LambdaQueryWrapper<InventoryDetail> wrapper = Wrappers.lambdaQuery(); | |
90 | + wrapper.eq(InventoryDetail::getMaterialCode, materialCode) | |
91 | + .eq(StringUtils.isNotEmpty(warehouse), InventoryDetail::getWarehouse, warehouse)//原仓库 | |
92 | + .eq(StringUtils.isNotEmpty(containerCode), InventoryDetail::getContainerCode, containerCode) //托盘号 | |
93 | + .eq(StringUtils.isNotEmpty(receiptCode), InventoryDetail::getReceiptCode, receiptCode)//入库单号 | |
94 | + .ne(isFlatWarehouse, InventoryDetail::getZoneCode, "L")//如果用平库组盘功能,只能出平库的库存 | |
95 | + .orderByAsc(InventoryDetail::getCreated); // 添加根据创建时间生序排序 | |
96 | + List<InventoryDetail> list = inventoryDetailService.list(wrapper); | |
97 | + if (list.isEmpty()) { | |
98 | + return list; | |
99 | + } | |
100 | + return list; | |
101 | + } | |
102 | + | |
103 | + //二期和二厂 | |
104 | + public List<InventoryDetail> getInventoryVersion2(ShipmentDetail shipmentDetail, boolean isAuto, boolean isFlatWarehouse, boolean openExhibitionRestrictions) { | |
66 | 105 | String materialCode = shipmentDetail.getMaterialCode(); |
67 | 106 | checkNotEmpty(materialCode, "出库明细没有物料编码"); |
68 | 107 | |
... | ... | @@ -139,7 +178,6 @@ public class ShippingCombinationService { |
139 | 178 | .thenComparing(InventoryDetail::getReceiptCode)); |
140 | 179 | } |
141 | 180 | return list; |
142 | - | |
143 | 181 | } |
144 | 182 | |
145 | 183 | //判断是否是展会物料,仓库是否符合 |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java
... | ... | @@ -644,6 +644,11 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
644 | 644 | |
645 | 645 | @Transactional(rollbackFor = Exception.class) |
646 | 646 | public void combineInventory(TaskHeader task) { |
647 | + | |
648 | + //一期项目,物料编码相同就合并 | |
649 | + String version = configService.getKey(QuantityConstant.PROJECT_VERSION); | |
650 | + boolean isVersionOne = version.equals("1"); | |
651 | + | |
647 | 652 | InventoryHeader inventoryHeader = inventoryHeaderService.getOne(new LambdaQueryWrapper<InventoryHeader>() |
648 | 653 | .eq(InventoryHeader::getLocationCode, task.getToLocation()) |
649 | 654 | .eq(InventoryHeader::getContainerCode, task.getContainerCode())); |
... | ... | @@ -654,15 +659,14 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
654 | 659 | |
655 | 660 | for (int i = 0; i < inventoryDetailList.size() - 1; i++) { |
656 | 661 | for (int j = inventoryDetailList.size() - 1; j > i; j--) { |
657 | - InventoryDetail inventoryDetail = inventoryDetailList.get(i); | |
658 | - InventoryDetail inventoryDetail2 = inventoryDetailList.get(j); | |
659 | - if ( | |
660 | - | |
661 | - inventoryDetail.getMaterialCode().equals(inventoryDetail2.getMaterialCode()) | |
662 | - && inventoryDetail.getNoticeCode().equals(inventoryDetail2.getNoticeCode()) | |
663 | - && inventoryDetail.getMaterialColor().equals(inventoryDetail2.getMaterialColor()) | |
664 | - && inventoryDetail.getRemarks().equals(inventoryDetail2.getRemarks()) | |
665 | - && inventoryDetail.getPaintStatus().equals(inventoryDetail2.getPaintStatus())) { | |
662 | + InventoryDetail detail1 = inventoryDetailList.get(i); | |
663 | + InventoryDetail detail2 = inventoryDetailList.get(j); | |
664 | + if (isVersionOne ? detail1.getMaterialCode().equals(detail2.getMaterialCode()) : | |
665 | + detail1.getMaterialCode().equals(detail2.getMaterialCode()) && | |
666 | + detail1.getNoticeCode().equals(detail2.getNoticeCode()) && | |
667 | + detail1.getMaterialColor().equals(detail2.getMaterialColor()) && | |
668 | + detail1.getRemarks().equals(detail2.getRemarks()) && | |
669 | + detail1.getPaintStatus().equals(detail2.getPaintStatus())) { | |
666 | 670 | |
667 | 671 | |
668 | 672 | //如果都相同的话,合并库存, |
... | ... |