Commit 87c5e612bc1f642d2d82fd8b80f8a0328e5fa461
1 parent
2bceaed2
完成呼叫出库料盒的开发
Showing
3 changed files
with
95 additions
and
43 deletions
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/IShipmentCombinationService.java
... | ... | @@ -17,6 +17,8 @@ public interface IShipmentCombinationService { |
17 | 17 | |
18 | 18 | List<InventoryDetail> getInventorys(ShipmentDetail shipmentDetail); |
19 | 19 | |
20 | + List<InventoryDetail> getAllInventorys(ShipmentDetail shipmentDetail); | |
21 | + | |
20 | 22 | Result autoCombination(String shipmentCode, String warehouseCode); |
21 | 23 | |
22 | 24 | Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode, long shipmentOrder, int sequence, int sequenceNumber); |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java
... | ... | @@ -5,8 +5,6 @@ import java.util.ArrayList; |
5 | 5 | import java.util.Collections; |
6 | 6 | import java.util.List; |
7 | 7 | |
8 | -import javax.annotation.Resource; | |
9 | - | |
10 | 8 | import org.jeecg.common.api.vo.Result; |
11 | 9 | import org.jeecg.common.exception.JeecgBootException; |
12 | 10 | import org.jeecg.modules.wms.config.container.entity.Container; |
... | ... | @@ -16,7 +14,6 @@ import org.jeecg.modules.wms.config.location.service.ILocationService; |
16 | 14 | import org.jeecg.modules.wms.config.material.entity.Material; |
17 | 15 | import org.jeecg.modules.wms.config.material.service.IMaterialService; |
18 | 16 | import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService; |
19 | -import org.jeecg.modules.wms.framework.service.IHuahengMultiHandlerService; | |
20 | 17 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; |
21 | 18 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; |
22 | 19 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; |
... | ... | @@ -124,6 +121,33 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi |
124 | 121 | |
125 | 122 | @Override |
126 | 123 | @Transactional(rollbackFor = JeecgBootException.class) |
124 | + public List<InventoryDetail> getAllInventorys(ShipmentDetail shipmentDetail) { | |
125 | + String warehouseCode = shipmentDetail.getWarehouseCode(); | |
126 | + String companyCode = shipmentDetail.getCompanyCode(); | |
127 | + String materialCode = shipmentDetail.getMaterialCode(); | |
128 | + String inventoryStatus = shipmentDetail.getInventoryStatus(); | |
129 | + if (StringUtils.isEmpty(warehouseCode)) { | |
130 | + throw new JeecgBootException("寻找库存详情时,出库详情没有仓库编码"); | |
131 | + } | |
132 | + if (StringUtils.isEmpty(companyCode)) { | |
133 | + throw new JeecgBootException("寻找库存详情时,出库详情没有货主编码"); | |
134 | + } | |
135 | + if (StringUtils.isEmpty(materialCode)) { | |
136 | + throw new JeecgBootException("寻找库存详情时, 出库详情没有物料编码"); | |
137 | + } | |
138 | + if (StringUtils.isEmpty(inventoryStatus)) { | |
139 | + throw new JeecgBootException("寻找库存详情时, 出库详情没有物料品质"); | |
140 | + } | |
141 | + LambdaQueryWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
142 | + inventoryDetailLambdaQueryWrapper.eq(InventoryDetail::getWarehouseCode, warehouseCode).eq(InventoryDetail::getCompanyCode, companyCode) | |
143 | + .eq(InventoryDetail::getMaterialCode, materialCode).eq(InventoryDetail::getInventoryStatus, inventoryStatus) | |
144 | + .eq(InventoryDetail::getEnable, QuantityConstant.INVENTORY_DETAIL_STATUS_ENABLE); | |
145 | + List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper); | |
146 | + return inventoryDetailList; | |
147 | + } | |
148 | + | |
149 | + @Override | |
150 | + @Transactional(rollbackFor = JeecgBootException.class) | |
127 | 151 | public Result autoCombination(String shipmentCode, String warehouseCode) { |
128 | 152 | log.info("开始自动配盘,单号" + shipmentCode); |
129 | 153 | LambdaQueryWrapper<ShipmentHeader> shipmentHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); |
... | ... | @@ -266,12 +290,20 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi |
266 | 290 | if (container == null) { |
267 | 291 | return Result.error("配盘时, 没有找到容器, 编码" + containerCode); |
268 | 292 | } |
269 | - if (container.getStatus().equals(QuantityConstant.STATUS_CONTAINER_LOCK)) { | |
270 | - return Result.error("配盘时, 容器已经锁定,不能再组盘"); | |
293 | + int callBox = QuantityConstant.NOT_CALL_BOX; | |
294 | + TaskHeader callBoxTask = taskHeaderService.getUnCompleteTaskByContainerCode(containerCode, warehouseCode); | |
295 | + if (callBoxTask != null) { | |
296 | + callBox = callBoxTask.getCallBox(); | |
297 | + } | |
298 | + // 如果不是呼叫料盒,那么要判断容器状态 | |
299 | + if (callBox == QuantityConstant.NOT_CALL_BOX) { | |
300 | + if (container.getStatus().equals(QuantityConstant.STATUS_CONTAINER_LOCK)) { | |
301 | + return Result.error("配盘时, 容器已经锁定,不能再配盘"); | |
302 | + } | |
271 | 303 | } |
272 | 304 | ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService.getUnCompleteReceiptContainerByCode(containerCode, warehouseCode); |
273 | 305 | if (receiptContainerHeader != null) { |
274 | - return Result.error("配盘时, 容器有入库组盘不能再组盘,容器编码" + containerCode); | |
306 | + return Result.error("配盘时, 容器有入库组盘不能再配盘,容器编码" + containerCode); | |
275 | 307 | } |
276 | 308 | BigDecimal shipmentDetailQty = shipmentDetail.getQty(); |
277 | 309 | BigDecimal shipmentDetailTaskQty = shipmentDetail.getTaskQty(); |
... | ... | @@ -454,6 +486,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi |
454 | 486 | condition = "#taskDetailList.size() > 0", recordReturnValue = true) |
455 | 487 | public Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode, long shipmentOrder, int sequence, int sequenceNumber) { |
456 | 488 | Integer preTaskNo = 0; |
489 | + boolean success = false; | |
457 | 490 | if (shipmentContainerHeader == null) { |
458 | 491 | return Result.error("生成出库任务时, 出库组盘头" + "未找到,操作中止"); |
459 | 492 | } |
... | ... | @@ -514,35 +547,51 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi |
514 | 547 | if (shipmentTaskRule == QuantityConstant.RULE_TASK_PICK_SHIPMENT) { |
515 | 548 | taskType = QuantityConstant.TASK_TYPE_SORTINGSHIPMENT; |
516 | 549 | } |
517 | - // 锁定容器、库位 | |
518 | - Result result = taskHeaderService.createTaskLockContainerAndLocation(taskType, containerCode, fromLocationCode, toLocationCode, warehouseCode); | |
519 | - if (!result.isSuccess()) { | |
520 | - throw new JeecgBootException(result.getMessage()); | |
521 | - } | |
522 | - TaskLockEntity taskLockEntity = (TaskLockEntity)result.getResult(); | |
523 | - String zoneCode = taskLockEntity.getZoneCode(); | |
524 | - TaskHeader taskHeader = new TaskHeader(); | |
525 | - taskHeader.setPreTaskNo(preTaskNo); | |
526 | - taskHeader.setTaskType(taskType); | |
527 | - taskHeader.setInnernalTaskType(QuantityConstant.TASK_INTENERTYPE_SHIPMENT); | |
528 | - taskHeader.setZoneCode(zoneCode); | |
529 | - taskHeader.setShipmentOrder(shipmentOrder); | |
530 | - taskHeader.setSequence(sequence); | |
531 | - taskHeader.setSequenceNumber(sequenceNumber); | |
532 | - taskHeader.setWarehouseCode(warehouseCode); | |
533 | - taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); | |
534 | - taskHeader.setContainerCode(containerCode); | |
535 | - taskHeader.setToPortCode(shipmentContainerHeader.getToPort()); | |
536 | - taskHeader.setFromLocationCode(fromLocationCode); | |
537 | - if (taskType == QuantityConstant.TASK_TYPE_SORTINGSHIPMENT) { | |
538 | - taskHeader.setToLocationCode(toLocationCode); | |
539 | - } | |
540 | - taskHeader.setShipmentContainerHeaderId(shipmentContainerHeader.getId()); | |
541 | - boolean success = taskHeaderService.save(taskHeader); | |
542 | - if (!success) { | |
543 | - throw new JeecgBootException("生成出库任务时, 创建任务失败"); | |
550 | + int taskHeaderId = 0; | |
551 | + TaskHeader taskHeader = taskHeaderService.getUnCompleteTaskByContainerCode(containerCode, warehouseCode); | |
552 | + if (taskHeader == null) { | |
553 | + // 锁定容器、库位 | |
554 | + Result result = taskHeaderService.createTaskLockContainerAndLocation(taskType, containerCode, fromLocationCode, toLocationCode, warehouseCode); | |
555 | + if (!result.isSuccess()) { | |
556 | + throw new JeecgBootException(result.getMessage()); | |
557 | + } | |
558 | + TaskLockEntity taskLockEntity = (TaskLockEntity)result.getResult(); | |
559 | + String zoneCode = taskLockEntity.getZoneCode(); | |
560 | + taskHeader = new TaskHeader(); | |
561 | + taskHeader.setPreTaskNo(preTaskNo); | |
562 | + taskHeader.setTaskType(taskType); | |
563 | + taskHeader.setInnernalTaskType(QuantityConstant.TASK_INTENERTYPE_SHIPMENT); | |
564 | + taskHeader.setZoneCode(zoneCode); | |
565 | + taskHeader.setShipmentOrder(shipmentOrder); | |
566 | + taskHeader.setSequence(sequence); | |
567 | + taskHeader.setSequenceNumber(sequenceNumber); | |
568 | + taskHeader.setWarehouseCode(warehouseCode); | |
569 | + taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); | |
570 | + taskHeader.setContainerCode(containerCode); | |
571 | + taskHeader.setToPortCode(shipmentContainerHeader.getToPort()); | |
572 | + taskHeader.setFromLocationCode(fromLocationCode); | |
573 | + if (taskType == QuantityConstant.TASK_TYPE_SORTINGSHIPMENT) { | |
574 | + taskHeader.setToLocationCode(toLocationCode); | |
575 | + } | |
576 | + taskHeader.setShipmentContainerHeaderId(shipmentContainerHeader.getId()); | |
577 | + success = taskHeaderService.save(taskHeader); | |
578 | + if (!success) { | |
579 | + throw new JeecgBootException("生成出库任务时, 创建任务失败"); | |
580 | + } | |
581 | + taskHeaderId = taskHeader.getId(); | |
582 | + } else { | |
583 | + taskHeaderId = taskHeader.getId(); | |
584 | + if (taskHeader.getCallBox() == QuantityConstant.NOT_CALL_BOX) { | |
585 | + throw new JeecgBootException("生成出库任务时, 没有呼叫料盒标记"); | |
586 | + } | |
587 | + TaskHeader taskHeader1 = new TaskHeader(); | |
588 | + taskHeader1.setId(taskHeaderId); | |
589 | + taskHeader1.setShipmentContainerHeaderId(shipmentContainerHeader.getId()); | |
590 | + success = taskHeaderService.updateById(taskHeader1); | |
591 | + if (!success) { | |
592 | + throw new JeecgBootException("生成出库任务时, 任务更新失败"); | |
593 | + } | |
544 | 594 | } |
545 | - int taskHeaderId = taskHeader.getId(); | |
546 | 595 | List<TaskDetail> taskDetailList = new ArrayList<>(); |
547 | 596 | for (ShipmentContainerDetail shipmentContainerDetail : shipmentContainerDetailList) { |
548 | 597 | TaskDetail taskDetail = new TaskDetail(); |
... | ... | @@ -602,7 +651,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi |
602 | 651 | return Result.error("找不到出库单详情"); |
603 | 652 | } |
604 | 653 | String warehouseCode = shipmentDetail.getWarehouseCode(); |
605 | - List<InventoryDetail> inventoryDetailList = shipmentCombinationService.getInventorys(shipmentDetail); | |
654 | + List<InventoryDetail> inventoryDetailList = shipmentCombinationService.getAllInventorys(shipmentDetail); | |
606 | 655 | if (inventoryDetailList.size() == 0) { |
607 | 656 | return Result.error("该物料没有库存或没有符合出库规则的库存"); |
608 | 657 | } |
... | ... | @@ -613,8 +662,15 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi |
613 | 662 | if (container == null) { |
614 | 663 | return Result.error("没有找到容器,容器编码" + containerCode); |
615 | 664 | } |
616 | - if (container.getStatus().equals(QuantityConstant.STATUS_CONTAINER_LOCK)) { | |
617 | - removeInventoryList.add(inventoryDetail); | |
665 | + int callBox = QuantityConstant.NOT_CALL_BOX; | |
666 | + TaskHeader callBoxTask = taskHeaderService.getUnCompleteTaskByContainerCode(containerCode, warehouseCode); | |
667 | + if (callBoxTask != null) { | |
668 | + callBox = callBoxTask.getCallBox(); | |
669 | + } | |
670 | + if (callBox == QuantityConstant.NOT_CALL_BOX) { | |
671 | + if (container.getStatus().equals(QuantityConstant.STATUS_CONTAINER_LOCK)) { | |
672 | + removeInventoryList.add(inventoryDetail); | |
673 | + } | |
618 | 674 | } |
619 | 675 | } |
620 | 676 | List<ReceiptContainerHeader> unCompleteCombineList = receiptContainerHeaderService.getUnCompleteCombineList(); |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/utils/constant/QuantityConstant.java
... | ... | @@ -485,12 +485,6 @@ public class QuantityConstant { |
485 | 485 | |
486 | 486 | public static final String EMPTY_ROADWAY_DEFAULT = "emptyRoadWayDefault"; |
487 | 487 | |
488 | - public static final String ZONE_RECEIPT_MANY_CONTAINER = "A"; // 空托盘组缓存区 | |
489 | - public static final String ZONE_RECEIPT_CACHE = "B"; // 钢托盘入库缓存区 | |
490 | - public static final String ZONE_LK = "L"; // 立体库区 | |
491 | - public static final String ZONE_WOOD_CONTAINER_CACHE = "C"; // 木托盘缓存区 | |
492 | - public static final String ZONE_STOCK_UP = "D"; // 备货区 | |
493 | - | |
494 | 488 | public static final int DOUBLE_FORK = 1; |
495 | 489 | public static final int SINGLE_FORK = 0; |
496 | 490 | |
... | ... |