Commit 6212cfc3110f36f5acd7adffb2425efc16fec145
1 parent
d3374e8d
二厂库位分配去除高度大于等于
Showing
5 changed files
with
147 additions
and
140 deletions
src/main/java/com/huaheng/api/tv/controller/TvController.java
... | ... | @@ -489,7 +489,7 @@ public class TvController extends BaseController { |
489 | 489 | @PostMapping("/combinationContainerAndTaskList") |
490 | 490 | @ApiOperation("combinationContainerAndTaskList") |
491 | 491 | @ResponseBody |
492 | - @ApiLogger(apiName = "组盘待执行和任务待完成", from = "TV") | |
492 | + //@ApiLogger(apiName = "组盘待执行和任务待完成", from = "TV") | |
493 | 493 | public TVResult combinationContainerAndTaskList() { |
494 | 494 | //组盘入库数量 |
495 | 495 | int count1 = receiptContainerHeaderService.count(new LambdaQueryWrapper<ReceiptContainerHeader>().eq(ReceiptContainerHeader::getStatus, 0)); |
... | ... |
src/main/java/com/huaheng/api/wcs/service/overrideHandle/OverrideHandleServiceImpl.java
... | ... | @@ -177,7 +177,7 @@ public class OverrideHandleServiceImpl implements OverrideHandleService { |
177 | 177 | } |
178 | 178 | newLocationCode = locationCode; |
179 | 179 | |
180 | - if (StringUtils.isEmpty(newLocationCode)) { | |
180 | + if (StringUtils.isEmpty(newLocationCode) || newLocationCode.length() > 10) { | |
181 | 181 | return AjaxResult.error("没有库位可以分配"); |
182 | 182 | } |
183 | 183 | locationService.updateStatus(newLocationCode, QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); |
... | ... |
src/main/java/com/huaheng/mobile/receipt/MobileBatchReceiptController.java
... | ... | @@ -101,8 +101,6 @@ public class MobileBatchReceiptController { |
101 | 101 | @Resource |
102 | 102 | private InventoryHeaderService inventoryHeaderService; |
103 | 103 | |
104 | - @Resource | |
105 | - private IApiLogService apiLogService; | |
106 | 104 | |
107 | 105 | @PostMapping("/scanContainer") |
108 | 106 | @ApiOperation("移动端入库扫描容器") |
... | ... | @@ -544,7 +542,6 @@ public class MobileBatchReceiptController { |
544 | 542 | @ApiOperation("PDA呼叫料盒") |
545 | 543 | @ApiLogger(apiName = "PDA呼叫料盒", from = "PDA") |
546 | 544 | @Log(title = "PDA呼叫料盒", action = BusinessType.OTHER) |
547 | - @Transactional(rollbackFor = Exception.class) | |
548 | 545 | public AjaxResult callBox(@RequestBody @ApiParam(value = "物料号") Map<String, String> param) { |
549 | 546 | String containerCode = param.get("containerCode"); |
550 | 547 | String destinationLocation = param.get("destinationLocation"); |
... | ... | @@ -554,143 +551,9 @@ public class MobileBatchReceiptController { |
554 | 551 | if (StringUtils.isEmpty(destinationLocation) && StringUtils.isEmpty(containerCode)) { |
555 | 552 | return AjaxResult.error("库位和容器不能都为空"); |
556 | 553 | } |
557 | - | |
558 | - InventoryHeader inventoryHeader = null; | |
559 | - //如果没传库位,根据容器查询库存拿到库位 | |
560 | - if (StringUtils.isEmpty(destinationLocation)) { | |
561 | - inventoryHeader = inventoryHeaderService.getOne(new LambdaQueryWrapper<InventoryHeader>().eq(InventoryHeader::getContainerCode, containerCode)); | |
562 | - if (inventoryHeader == null) { | |
563 | - return AjaxResult.error("没有这个库存,容器:", containerCode); | |
564 | - } | |
565 | - destinationLocation = inventoryHeader.getLocationCode(); | |
566 | - } | |
567 | - | |
568 | - //如果没传容器,根据库位查询库存拿到容器 | |
569 | - if (StringUtils.isEmpty(containerCode)) { | |
570 | - inventoryHeader = inventoryHeaderService.getOne(new LambdaQueryWrapper<InventoryHeader>().eq(InventoryHeader::getLocationCode, destinationLocation)); | |
571 | - if (inventoryHeader == null) { | |
572 | - return AjaxResult.error("没有这个库存,库位:", destinationLocation); | |
573 | - } | |
574 | - containerCode = inventoryHeader.getContainerCode(); | |
575 | - } | |
576 | - | |
577 | - if (StringUtils.isNotEmpty(containerCode) && StringUtils.isNotEmpty(destinationLocation)) { | |
578 | - inventoryHeader = inventoryHeaderService.getOne(new LambdaQueryWrapper<InventoryHeader>().eq(InventoryHeader::getContainerCode, containerCode)); | |
579 | - if (inventoryHeader == null) { | |
580 | - return AjaxResult.error("没有这个库存,库位:", destinationLocation); | |
581 | - } | |
582 | - } | |
583 | - | |
584 | - Location location = locationService.getOne(new LambdaQueryWrapper<Location>().eq(Location::getCode, destinationLocation)); | |
585 | - List<Container> list = containerService.list(new LambdaQueryWrapper<Container>().eq(Container::getCode, containerCode)); | |
586 | - if (list.isEmpty()) { | |
587 | - return AjaxResult.error("容器不存在"); | |
588 | - } | |
589 | - if (list.size() > 1) { | |
590 | - return AjaxResult.error("容器大于1"); | |
591 | - } | |
592 | - Container container = list.get(0); | |
593 | - | |
594 | - if (location == null) { | |
595 | - return AjaxResult.error("库位不存在"); | |
596 | - } | |
597 | - if (StringUtils.isEmpty(container.getLocationCode())) { | |
598 | - return AjaxResult.error("容器没有对应库位"); | |
599 | - } | |
600 | - if (StringUtils.isEmpty(location.getContainerCode())) { | |
601 | - return AjaxResult.error("库位没有对应容器"); | |
602 | - } | |
603 | - if (!container.getLocationCode().equals(destinationLocation)) { | |
604 | - return AjaxResult.error("库位不在容器[" + location.getContainerCode() + "]上"); | |
605 | - } | |
606 | - if (!location.getContainerCode().equals(containerCode)) { | |
607 | - return AjaxResult.error("容器不在库位[" + container.getLocationCode() + "]上"); | |
608 | - } | |
609 | - if (!QuantityConstant.STATUS_LOCATION_EMPTY.equals(location.getStatus())) { | |
610 | - return AjaxResult.error("目标库位非空闲"); | |
611 | - } | |
612 | - if (QuantityConstant.STATUS_LOCATION_LOCK.equals(container.getStatus())) { | |
613 | - return AjaxResult.error("容器是锁定状态"); | |
614 | - } | |
615 | - if (QuantityConstant.STATUS_CONTAINER_EMPTY.equals(container.getStatus())) { | |
616 | - return AjaxResult.error("容器是空托盘,不能做补充入库"); | |
617 | - } | |
618 | - | |
619 | - //判断托盘是否已经存在任务 | |
620 | - int taskCount = taskHeaderService.count(new LambdaQueryWrapper<TaskHeader>() | |
621 | - .ne(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED) | |
622 | - .eq(TaskHeader::getContainerCode, containerCode)); | |
623 | - if (taskCount > 0) { | |
624 | - return AjaxResult.error("容器已存在任务"); | |
625 | - } | |
626 | - | |
627 | - //判断托盘是否已经存在入库组盘 | |
628 | - int receiptContainerHeaderCount = receiptContainerHeaderService.count(new LambdaQueryWrapper<ReceiptContainerHeader>() | |
629 | - .ne(ReceiptContainerHeader::getStatus, QuantityConstant.SHIPMENT_CONTAINER_FINISHED) | |
630 | - .eq(ReceiptContainerHeader::getContainerCode, containerCode)); | |
631 | - if (receiptContainerHeaderCount > 0) { | |
632 | - return AjaxResult.error("该托盘已经用于入库组盘"); | |
633 | - } | |
634 | - | |
635 | - //判断托盘是否已经存在出库组盘 | |
636 | - int count = shipmentContainerHeaderService.count(new LambdaQueryWrapper<ShipmentContainerHeader>() | |
637 | - .ne(ShipmentContainerHeader::getStatus, QuantityConstant.SHIPMENT_CONTAINER_FINISHED) | |
638 | - .eq(ShipmentContainerHeader::getContainerCode, containerCode)); | |
639 | - if (count > 0) { | |
640 | - return AjaxResult.error("该托盘已经用于出库组盘"); | |
641 | - } | |
642 | - //自建库位不能呼叫料盒 | |
643 | - if (location.getSelfCreated()) { | |
644 | - return AjaxResult.error("自建库位不能呼叫料盒"); | |
645 | - } | |
646 | - //创建主任务 | |
647 | - TaskHeader taskHeader = new TaskHeader(); | |
648 | - taskHeader.setWarehouseCode(location.getWarehouseCode()); | |
649 | - taskHeader.setCompanyCode(companyCode);//货主 | |
650 | - if (type == QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT) {//补充入库 | |
651 | - taskHeader.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_RECEIPT); | |
652 | - taskHeader.setTaskType(QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT); | |
653 | - } else if (type == QuantityConstant.TASK_TYPE_WHOLERECEIPT) {//整盘入库 | |
654 | - taskHeader.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_RECEIPT); | |
655 | - taskHeader.setTaskType(QuantityConstant.TASK_TYPE_WHOLERECEIPT); | |
656 | - } else { | |
657 | - return AjaxResult.error("type不对:" + type); | |
658 | - } | |
659 | - if (inventoryHeader == null) { | |
660 | - return AjaxResult.error("库存不存在"); | |
661 | - } | |
662 | - taskHeader.setWarehouse(inventoryHeader.getWarehouse()); | |
663 | - taskHeader.setWarehouseName(inventoryHeader.getWarehouseName()); | |
664 | - taskHeader.setContainerCode(container.getCode()); | |
665 | - taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); | |
666 | - taskHeader.setFromLocation(location.getCode()); | |
667 | -// taskHeader.setToLocation(location.getCode()); | |
668 | - taskHeader.setCreated(new Date()); | |
669 | - taskHeader.setCreatedBy(ShiroUtils.getName()); | |
670 | - taskHeader.setLastUpdatedBy(ShiroUtils.getName()); | |
671 | - taskHeader.setLastUpdated(new Date()); | |
672 | - if (taskHeaderService.save(taskHeader)) { | |
673 | - //锁定库位状态 | |
674 | - locationService.updateStatus(location.getCode(), QuantityConstant.STATUS_LOCATION_LOCK); | |
675 | - //containerService.updateStatus(container.getCode(), QuantityConstant.STATUS_LOCATION_LOCK, "CS0001"); | |
676 | - } else { | |
677 | - throw new ServiceException("补充入库主表生成失败!"); | |
678 | - } | |
679 | - | |
680 | - addApiLog("PDA呼叫料盒", taskHeader.getContainerCode() + "/" + taskHeader.getFromLocation()); | |
681 | - return AjaxResult.success(taskHeader.getId()); | |
554 | + return taskHeaderService.callBox(containerCode, destinationLocation, type, companyCode); | |
682 | 555 | } |
683 | 556 | |
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 | - } | |
694 | 557 | |
695 | 558 | @PostMapping("/searchReceipt") |
696 | 559 | @ApiOperation("移动端查询入库单") |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderService.java
... | ... | @@ -81,4 +81,6 @@ public interface TaskHeaderService extends IService<TaskHeader> { |
81 | 81 | Integer getShipmentContainerTask(String roadway); |
82 | 82 | |
83 | 83 | List<TaskHeader> getTasksByIds(Integer[] taskIds); |
84 | + | |
85 | + AjaxResult callBox(String containerCode, String destinationLocation, int type, String companyCode); | |
84 | 86 | } |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java
... | ... | @@ -32,6 +32,8 @@ import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail; |
32 | 32 | import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService; |
33 | 33 | import com.huaheng.pc.inventory.inventoryHeader.domain.InventoryHeader; |
34 | 34 | import com.huaheng.pc.inventory.inventoryHeader.service.InventoryHeaderService; |
35 | +import com.huaheng.pc.monitor.apilog.domain.ApiLog; | |
36 | +import com.huaheng.pc.monitor.apilog.service.IApiLogService; | |
35 | 37 | import com.huaheng.pc.receipt.receiptContainerDetail.domain.ReceiptContainerDetail; |
36 | 38 | import com.huaheng.pc.receipt.receiptContainerDetail.service.ReceiptContainerDetailService; |
37 | 39 | import com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerHeader; |
... | ... | @@ -60,6 +62,8 @@ import java.util.stream.Collectors; |
60 | 62 | public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHeader> implements TaskHeaderService { |
61 | 63 | |
62 | 64 | @Resource |
65 | + private IApiLogService apiLogService; | |
66 | + @Resource | |
63 | 67 | private ShipmentContainerHeaderService shipmentContainerHeaderService; |
64 | 68 | @Resource |
65 | 69 | private AddressService addressService; |
... | ... | @@ -1006,4 +1010,142 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1006 | 1010 | public List<TaskHeader> getTasksByIds(Integer[] taskIds) { |
1007 | 1011 | return this.list(new LambdaQueryWrapper<TaskHeader>().in(TaskHeader::getId, Arrays.asList(taskIds))); |
1008 | 1012 | } |
1013 | + | |
1014 | + @Override | |
1015 | + @Transactional | |
1016 | + public AjaxResult callBox(String containerCode, String destinationLocation, int type, String companyCode) { | |
1017 | + InventoryHeader inventoryHeader = null; | |
1018 | + //如果没传库位,根据容器查询库存拿到库位 | |
1019 | + if (StringUtils.isEmpty(destinationLocation)) { | |
1020 | + inventoryHeader = inventoryHeaderService.getOne(new LambdaQueryWrapper<InventoryHeader>().eq(InventoryHeader::getContainerCode, containerCode)); | |
1021 | + if (inventoryHeader == null) { | |
1022 | + return AjaxResult.error("没有这个库存,容器:", containerCode); | |
1023 | + } | |
1024 | + destinationLocation = inventoryHeader.getLocationCode(); | |
1025 | + } | |
1026 | + | |
1027 | + //如果没传容器,根据库位查询库存拿到容器 | |
1028 | + if (StringUtils.isEmpty(containerCode)) { | |
1029 | + inventoryHeader = inventoryHeaderService.getOne(new LambdaQueryWrapper<InventoryHeader>().eq(InventoryHeader::getLocationCode, destinationLocation)); | |
1030 | + if (inventoryHeader == null) { | |
1031 | + return AjaxResult.error("没有这个库存,库位:", destinationLocation); | |
1032 | + } | |
1033 | + containerCode = inventoryHeader.getContainerCode(); | |
1034 | + } | |
1035 | + | |
1036 | + if (StringUtils.isNotEmpty(containerCode) && StringUtils.isNotEmpty(destinationLocation)) { | |
1037 | + inventoryHeader = inventoryHeaderService.getOne(new LambdaQueryWrapper<InventoryHeader>().eq(InventoryHeader::getContainerCode, containerCode)); | |
1038 | + if (inventoryHeader == null) { | |
1039 | + return AjaxResult.error("没有这个库存,库位:", destinationLocation); | |
1040 | + } | |
1041 | + } | |
1042 | + | |
1043 | + Location location = locationService.getOne(new LambdaQueryWrapper<Location>().eq(Location::getCode, destinationLocation)); | |
1044 | + List<Container> list = containerService.list(new LambdaQueryWrapper<Container>().eq(Container::getCode, containerCode)); | |
1045 | + if (list.isEmpty()) { | |
1046 | + return AjaxResult.error("容器不存在"); | |
1047 | + } | |
1048 | + if (list.size() > 1) { | |
1049 | + return AjaxResult.error("容器大于1"); | |
1050 | + } | |
1051 | + Container container = list.get(0); | |
1052 | + | |
1053 | + if (location == null) { | |
1054 | + return AjaxResult.error("库位不存在"); | |
1055 | + } | |
1056 | + if (StringUtils.isEmpty(container.getLocationCode())) { | |
1057 | + return AjaxResult.error("容器没有对应库位"); | |
1058 | + } | |
1059 | + if (StringUtils.isEmpty(location.getContainerCode())) { | |
1060 | + return AjaxResult.error("库位没有对应容器"); | |
1061 | + } | |
1062 | + if (!container.getLocationCode().equals(destinationLocation)) { | |
1063 | + return AjaxResult.error("库位不在容器[" + location.getContainerCode() + "]上"); | |
1064 | + } | |
1065 | + if (!location.getContainerCode().equals(containerCode)) { | |
1066 | + return AjaxResult.error("容器不在库位[" + container.getLocationCode() + "]上"); | |
1067 | + } | |
1068 | + if (!QuantityConstant.STATUS_LOCATION_EMPTY.equals(location.getStatus())) { | |
1069 | + return AjaxResult.error("目标库位非空闲"); | |
1070 | + } | |
1071 | + if (QuantityConstant.STATUS_LOCATION_LOCK.equals(container.getStatus())) { | |
1072 | + return AjaxResult.error("容器是锁定状态"); | |
1073 | + } | |
1074 | + if (QuantityConstant.STATUS_CONTAINER_EMPTY.equals(container.getStatus())) { | |
1075 | + return AjaxResult.error("容器是空托盘,不能做补充入库"); | |
1076 | + } | |
1077 | + | |
1078 | + //判断托盘是否已经存在任务 | |
1079 | + int taskCount = taskHeaderService.count(new LambdaQueryWrapper<TaskHeader>() | |
1080 | + .ne(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED) | |
1081 | + .eq(TaskHeader::getContainerCode, containerCode)); | |
1082 | + if (taskCount > 0) { | |
1083 | + return AjaxResult.error("容器已存在任务"); | |
1084 | + } | |
1085 | + | |
1086 | + //判断托盘是否已经存在入库组盘 | |
1087 | + int receiptContainerHeaderCount = receiptContainerHeaderService.count(new LambdaQueryWrapper<ReceiptContainerHeader>() | |
1088 | + .ne(ReceiptContainerHeader::getStatus, QuantityConstant.SHIPMENT_CONTAINER_FINISHED) | |
1089 | + .eq(ReceiptContainerHeader::getContainerCode, containerCode)); | |
1090 | + if (receiptContainerHeaderCount > 0) { | |
1091 | + return AjaxResult.error("该托盘已经用于入库组盘"); | |
1092 | + } | |
1093 | + | |
1094 | + //判断托盘是否已经存在出库组盘 | |
1095 | + int count = shipmentContainerHeaderService.count(new LambdaQueryWrapper<ShipmentContainerHeader>() | |
1096 | + .ne(ShipmentContainerHeader::getStatus, QuantityConstant.SHIPMENT_CONTAINER_FINISHED) | |
1097 | + .eq(ShipmentContainerHeader::getContainerCode, containerCode)); | |
1098 | + if (count > 0) { | |
1099 | + return AjaxResult.error("该托盘已经用于出库组盘"); | |
1100 | + } | |
1101 | + //自建库位不能呼叫料盒 | |
1102 | + if (location.getSelfCreated()) { | |
1103 | + return AjaxResult.error("自建库位不能呼叫料盒"); | |
1104 | + } | |
1105 | + //创建主任务 | |
1106 | + TaskHeader taskHeader = new TaskHeader(); | |
1107 | + taskHeader.setWarehouseCode(location.getWarehouseCode()); | |
1108 | + taskHeader.setCompanyCode(companyCode);//货主 | |
1109 | + if (type == QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT) {//补充入库 | |
1110 | + taskHeader.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_RECEIPT); | |
1111 | + taskHeader.setTaskType(QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT); | |
1112 | + } else if (type == QuantityConstant.TASK_TYPE_WHOLERECEIPT) {//整盘入库 | |
1113 | + taskHeader.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_RECEIPT); | |
1114 | + taskHeader.setTaskType(QuantityConstant.TASK_TYPE_WHOLERECEIPT); | |
1115 | + } else { | |
1116 | + return AjaxResult.error("type不对:" + type); | |
1117 | + } | |
1118 | + if (inventoryHeader == null) { | |
1119 | + return AjaxResult.error("库存不存在"); | |
1120 | + } | |
1121 | + taskHeader.setWarehouse(inventoryHeader.getWarehouse()); | |
1122 | + taskHeader.setWarehouseName(inventoryHeader.getWarehouseName()); | |
1123 | + taskHeader.setContainerCode(container.getCode()); | |
1124 | + taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); | |
1125 | + taskHeader.setFromLocation(location.getCode()); | |
1126 | + taskHeader.setCreated(new Date()); | |
1127 | + taskHeader.setCreatedBy("PDA:" + ShiroUtils.getName()); | |
1128 | + taskHeader.setLastUpdatedBy(ShiroUtils.getName()); | |
1129 | + taskHeader.setLastUpdated(new Date()); | |
1130 | + if (taskHeaderService.save(taskHeader)) { | |
1131 | + //锁定库位状态 | |
1132 | + locationService.updateStatus(location.getCode(), QuantityConstant.STATUS_LOCATION_LOCK); | |
1133 | + } else { | |
1134 | + throw new ServiceException("补充入库主表生成失败!"); | |
1135 | + } | |
1136 | + | |
1137 | + addApiLog("PDA呼叫料盒", taskHeader.getContainerCode() + "/" + taskHeader.getFromLocation()); | |
1138 | + return AjaxResult.success(taskHeader.getId()); | |
1139 | + } | |
1140 | + | |
1141 | + public void addApiLog(String name, String requestBody) { | |
1142 | + ApiLog apiLog = new ApiLog(); | |
1143 | + apiLog.setApiName(name); | |
1144 | + apiLog.setRequestBody(requestBody); | |
1145 | + apiLog.setRequestTime(new Date()); | |
1146 | + apiLog.setRequestFrom("MOM"); | |
1147 | + apiLog.setResponseBy("WMS"); | |
1148 | + apiLog.setResponseBody("成功"); | |
1149 | + apiLogService.save(apiLog); | |
1150 | + } | |
1009 | 1151 | } |
... | ... |