Commit 41ab783cd03e292a798120ed33fc39271f7eb310
1 parent
4433fd16
完善 任务完成时,统一解锁库位和容器
Showing
1 changed file
with
99 additions
and
164 deletions
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
... | ... | @@ -1121,27 +1121,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1121 | 1121 | throw new JeecgBootException("完成入库任务时,保存库存交易失败"); |
1122 | 1122 | } |
1123 | 1123 | |
1124 | - if (StringUtils.isNotEmpty(fromLocationCode) && !fromLocationCode.equals(toLocationCode)) { | |
1125 | - success = | |
1126 | - locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
1127 | - if (!success) { | |
1128 | - throw new JeecgBootException("完成入库任务时,更新源库位失败"); | |
1129 | - } | |
1130 | - } | |
1131 | - | |
1132 | - success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
1133 | - if (!success) { | |
1134 | - throw new JeecgBootException("完成入库任务时,更新库位失败"); | |
1135 | - } | |
1136 | - | |
1137 | - success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | |
1138 | - if (!success) { | |
1139 | - throw new JeecgBootException("完成入库任务时,更新任务失败"); | |
1140 | - } | |
1141 | - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, | |
1142 | - taskHeader.getContainerFillStatus(), warehouseCode); | |
1143 | - if (!success) { | |
1144 | - throw new JeecgBootException("完成入库任务时,更新容器失败"); | |
1124 | + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), taskType, containerCode, fromLocationCode, | |
1125 | + toLocationCode, warehouseCode); | |
1126 | + if (!result.isSuccess()) { | |
1127 | + throw new JeecgBootException(result.getMessage()); | |
1145 | 1128 | } |
1146 | 1129 | if (!taskHeaderService.combineInventoryDetail(taskHeader)) { |
1147 | 1130 | throw new JeecgBootException("合并入库库存失败"); |
... | ... | @@ -1159,6 +1142,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1159 | 1142 | if (!inventoryHeaderService.updateInventoryContainerStatusByContainerCode(containerCode, warehouseCode)) { |
1160 | 1143 | throw new JeecgBootException("完成入库任务时,更新托盘状态失败"); |
1161 | 1144 | } |
1145 | + success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | |
1146 | + if (!success) { | |
1147 | + throw new JeecgBootException("完成出库任务,保存任务头失败"); | |
1148 | + } | |
1162 | 1149 | receiptDetaiList = receiptDetaiList.stream().filter(t -> t.getStatus().equals(QuantityConstant.RECEIPT_HEADER_COMPLETED)).collect(Collectors.toList()); |
1163 | 1150 | LogRecordContext.putVariable("taskHeader", taskHeader); |
1164 | 1151 | LogRecordContext.putVariable("taskDetailList", taskDetailList); |
... | ... | @@ -1311,44 +1298,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1311 | 1298 | if (!success) { |
1312 | 1299 | throw new JeecgBootException("完成出库任务,保存库存详情失败"); |
1313 | 1300 | } |
1314 | - taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); | |
1315 | - success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | |
1316 | - if (!success) { | |
1317 | - throw new JeecgBootException("完成出库任务,保存任务头失败"); | |
1318 | - } | |
1319 | - if (taskType == QuantityConstant.TASK_TYPE_WHOLESHIPMENT) { | |
1320 | - success = | |
1321 | - locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
1322 | - if (!success) { | |
1323 | - throw new JeecgBootException("完成整盘出库任务,更新源库位失败"); | |
1324 | - } | |
1325 | - success = containerService.updateLocationCodeAndStatus(containerCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_CONTAINER_EMPTY, | |
1326 | - QuantityConstant.STATUS_CONTAINER_FILL_EMPTY, warehouseCode); | |
1327 | - if (!success) { | |
1328 | - throw new JeecgBootException("完成整盘出库任务,更新容器失败"); | |
1329 | - } | |
1330 | - } else if (taskType == QuantityConstant.TASK_TYPE_SORTINGSHIPMENT) { | |
1331 | - if (!fromLocationCode.equals(toLocationCode)) { | |
1332 | - success = locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, | |
1333 | - warehouseCode); | |
1334 | - if (!success) { | |
1335 | - throw new JeecgBootException("完成分拣出库任务,更新源库位失败"); | |
1336 | - } | |
1337 | - success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
1338 | - if (!success) { | |
1339 | - throw new JeecgBootException("完成分拣出库任务,更新目标库位失败"); | |
1340 | - } | |
1341 | - } else { | |
1342 | - success = locationService.updateStatus(fromLocationCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
1343 | - if (!success) { | |
1344 | - throw new JeecgBootException("完成分拣出库任务,更新源库位失败"); | |
1345 | - } | |
1346 | - } | |
1347 | - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, | |
1348 | - inventoryDetailList.size() == 0 ? QuantityConstant.STATUS_CONTAINER_FILL_EMPTY : QuantityConstant.STATUS_CONTAINER_FILL_SOME, warehouseCode); | |
1349 | - if (!success) { | |
1350 | - throw new JeecgBootException("完成分拣出库任务,更新容器失败"); | |
1351 | - } | |
1301 | + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), taskType, containerCode, fromLocationCode, | |
1302 | + toLocationCode, warehouseCode); | |
1303 | + if (!result.isSuccess()) { | |
1304 | + throw new JeecgBootException(result.getMessage()); | |
1352 | 1305 | } |
1353 | 1306 | ShipmentContainerHeader shipmentContainerHeader = shipmentContainerHeaderService.getById(taskHeader.getShipmentContainerHeaderId()); |
1354 | 1307 | if (shipmentContainerHeader == null) { |
... | ... | @@ -1380,6 +1333,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1380 | 1333 | throw new JeecgBootException("完成出库任务,更新库存状态失败"); |
1381 | 1334 | } |
1382 | 1335 | } |
1336 | + success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | |
1337 | + if (!success) { | |
1338 | + throw new JeecgBootException("完成出库任务,保存任务头失败"); | |
1339 | + } | |
1383 | 1340 | // 操作记录添加 |
1384 | 1341 | shipmentDetailList = shipmentDetailList.stream().filter(t -> t.getStatus().equals(QuantityConstant.SHIPMENT_HEADER_COMPLETED)).collect(Collectors.toList()); |
1385 | 1342 | LogRecordContext.putVariable("taskHeader", taskHeader); |
... | ... | @@ -1657,8 +1614,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1657 | 1614 | String toLocationCode, String warehouseCode) { |
1658 | 1615 | Result result = null; |
1659 | 1616 | boolean success = false; |
1660 | - if (StringUtils.isEmpty(toLocationCode) && taskType == QuantityConstant.TASK_TYPE_OVER_STATION) { | |
1661 | - return Result.error("完成任务时, 目标库位号为空"); | |
1617 | + if (StringUtils.isEmpty(toLocationCode) && taskType != QuantityConstant.TASK_TYPE_OVER_STATION) { | |
1618 | + return Result.error("任务类型" + taskType + "完成任务时, 目标库位号为空"); | |
1619 | + } | |
1620 | + if (StringUtils.isEmpty(containerCode)) { | |
1621 | + return Result.error("任务类型" + taskType + "完成任务时, 容器号为空"); | |
1622 | + } | |
1623 | + Container container = containerService.getContainerByCode(containerCode, warehouseCode); | |
1624 | + if (container == null) { | |
1625 | + return Result.error("任务类型" + taskType + "完成任务时, 没有找到托盘" + containerCode); | |
1662 | 1626 | } |
1663 | 1627 | switch (taskType) { |
1664 | 1628 | case QuantityConstant.TASK_TYPE_WHOLERECEIPT: |
... | ... | @@ -1677,6 +1641,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1677 | 1641 | case QuantityConstant.TASK_TYPE_WHOLESHIPMENT: |
1678 | 1642 | case QuantityConstant.TASK_TYPE_EMPTYSHIPMENT: |
1679 | 1643 | case QuantityConstant.TASK_TYPE_MANY_EMPTYSHIPMENT: |
1644 | + if (StringUtils.isEmpty(fromLocationCode)) { | |
1645 | + return Result.error("任务类型" + taskType + "完成任务时, 起始库位号为空"); | |
1646 | + } | |
1680 | 1647 | success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, |
1681 | 1648 | QuantityConstant.STATUS_CONTAINER_FILL_EMPTY, warehouseCode); |
1682 | 1649 | break; |
... | ... | @@ -1684,13 +1651,24 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1684 | 1651 | case QuantityConstant.TASK_TYPE_CYCLECOUNT: |
1685 | 1652 | case QuantityConstant.TASK_TYPE_TRANSFER: |
1686 | 1653 | case QuantityConstant.TASK_TYPE_CHECK_OUT: |
1654 | + if (StringUtils.isEmpty(fromLocationCode)) { | |
1655 | + return Result.error("任务类型" + taskType + "完成任务时, 起始库位号为空"); | |
1656 | + } | |
1687 | 1657 | InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); |
1688 | 1658 | if (inventoryHeader != null) { |
1689 | - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, | |
1690 | - QuantityConstant.STATUS_CONTAINER_FILL_SOME, warehouseCode); | |
1659 | + if (fromLocationCode.equals(toLocationCode)) { | |
1660 | + success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | |
1661 | + } else { | |
1662 | + success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, | |
1663 | + QuantityConstant.STATUS_CONTAINER_FILL_SOME, warehouseCode); | |
1664 | + } | |
1691 | 1665 | } else { |
1692 | - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, | |
1693 | - QuantityConstant.STATUS_CONTAINER_FILL_EMPTY, warehouseCode); | |
1666 | + if (fromLocationCode.equals(toLocationCode)) { | |
1667 | + success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | |
1668 | + } else { | |
1669 | + success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, | |
1670 | + QuantityConstant.STATUS_CONTAINER_FILL_EMPTY, warehouseCode); | |
1671 | + } | |
1694 | 1672 | } |
1695 | 1673 | break; |
1696 | 1674 | case QuantityConstant.TASK_TYPE_OVER_STATION: |
... | ... | @@ -1699,20 +1677,30 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1699 | 1677 | break; |
1700 | 1678 | } |
1701 | 1679 | if (!success) { |
1702 | - throw new JeecgBootException("完成任务时,更新容器失败"); | |
1680 | + throw new JeecgBootException("任务类型" + taskType + "完成任务时, 更新容器失败"); | |
1703 | 1681 | } |
1704 | 1682 | if (StringUtils.isNotEmpty(fromLocationCode) && !fromLocationCode.equals(toLocationCode)) { |
1683 | + Location toLocation = locationService.getLocationByCode(fromLocationCode, warehouseCode); | |
1684 | + if (toLocation == null) { | |
1685 | + return Result.error("完成任务时," + toLocationCode + "目标库位不存在"); | |
1686 | + } | |
1705 | 1687 | success = |
1706 | 1688 | locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); |
1707 | 1689 | if (!success) { |
1708 | - throw new JeecgBootException("完成任务时,更新源库位失败"); | |
1690 | + throw new JeecgBootException("任务类型" + taskType + "完成任务时,更新源库位失败"); | |
1709 | 1691 | } |
1710 | 1692 | } |
1711 | - success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
1712 | - if (!success) { | |
1713 | - throw new JeecgBootException("完成任务时,更新库位失败"); | |
1693 | + if (StringUtils.isNotEmpty(toLocationCode)) { | |
1694 | + Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode); | |
1695 | + if (toLocation == null) { | |
1696 | + return Result.error("任务类型" + taskType + "完成任务时, " + toLocationCode + "目标库位不存在"); | |
1697 | + } | |
1698 | + success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
1699 | + if (!success) { | |
1700 | + throw new JeecgBootException("任务类型" + taskType + "完成任务时,更新库位失败"); | |
1701 | + } | |
1714 | 1702 | } |
1715 | - return Result.OK("完成任务成功"); | |
1703 | + return Result.OK("任务类型" + taskType + "完成任务成功"); | |
1716 | 1704 | } |
1717 | 1705 | |
1718 | 1706 | /** |
... | ... | @@ -1736,27 +1724,16 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1736 | 1724 | if (StringUtils.isEmpty(toLocationCode)) { |
1737 | 1725 | return Result.error("完成空托盘入库任务时, 目标库位号为空"); |
1738 | 1726 | } |
1739 | - Container container = containerService.getContainerByCode(containerCode, warehouseCode); | |
1740 | - if (container == null) { | |
1741 | - return Result.error("完成空托盘入库任务时, 没有找到托盘" + containerCode); | |
1742 | - } | |
1743 | - Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode); | |
1744 | - if (toLocation == null) { | |
1745 | - return Result.error("完成空托盘入库任务时," + toLocationCode + "目标库位不存在"); | |
1746 | - } | |
1747 | - boolean success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | |
1748 | - if (!success) { | |
1749 | - throw new JeecgBootException("完成空托盘入库任务时, 更新容器的库位号和状态失败"); | |
1727 | + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), QuantityConstant.TASK_TYPE_EMPTYRECEIPT, | |
1728 | + containerCode, QuantityConstant.EMPTY_STRING, toLocationCode, warehouseCode); | |
1729 | + if (!result.isSuccess()) { | |
1730 | + throw new JeecgBootException(result.getMessage()); | |
1750 | 1731 | } |
1751 | - success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
1732 | + boolean success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | |
1752 | 1733 | if (!success) { |
1753 | - throw new JeecgBootException("完成空托盘入库任务时, 更新库位的容器编码和状态失败"); | |
1734 | + throw new JeecgBootException("完成空托盘出库任务时, 更新任务失败"); | |
1754 | 1735 | } |
1755 | - success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | |
1756 | 1736 | log.info("完成空托入库任务"); |
1757 | - if (!success) { | |
1758 | - throw new JeecgBootException("完成空托盘入库任务时, 更新任务失败"); | |
1759 | - } | |
1760 | 1737 | return Result.OK("完成空托盘入库成功"); |
1761 | 1738 | } |
1762 | 1739 | |
... | ... | @@ -1790,7 +1767,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1790 | 1767 | // 1.先拿到盘点单主单据 |
1791 | 1768 | CycleCountDetail cycleCountDetail = cycleCountDetailService.getById(taskHeader.getShipmentContainerHeaderId()); |
1792 | 1769 | |
1793 | - if ((cycleCountDetail.getCountedQty().add(cycleCountDetail.getGapQty())).compareTo(BigDecimal.ZERO) == 0) { | |
1770 | + if (cycleCountDetail.getGapQty().compareTo(BigDecimal.ZERO) == 0) { | |
1794 | 1771 | return Result.error("盘点单据系统实盘数量跟差异数量0,不能完成 单据号" + cycleCountDetail.getCycleCountHeadCode()); |
1795 | 1772 | } |
1796 | 1773 | |
... | ... | @@ -2045,17 +2022,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
2045 | 2022 | if (port == null) { |
2046 | 2023 | return Result.error("完成空托盘出库任务时," + toPortCode + "目标出库口不存在"); |
2047 | 2024 | } |
2048 | - boolean success = | |
2049 | - containerService.updateLocationCodeAndStatus(containerCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | |
2050 | - if (!success) { | |
2051 | - throw new JeecgBootException("完成空托盘出库任务时, 更新容器的库位号和状态失败"); | |
2052 | - } | |
2053 | - success = | |
2054 | - locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
2055 | - if (!success) { | |
2056 | - throw new JeecgBootException("完成空托盘出库任务时, 更新库位的容器编码和状态失败"); | |
2025 | + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), QuantityConstant.TASK_TYPE_EMPTYRECEIPT, | |
2026 | + containerCode, fromLocationCode, QuantityConstant.EMPTY_STRING, warehouseCode); | |
2027 | + if (!result.isSuccess()) { | |
2028 | + throw new JeecgBootException(result.getMessage()); | |
2057 | 2029 | } |
2058 | - success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | |
2030 | + boolean success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | |
2059 | 2031 | log.info("完成空托盘出库任务" + taskHeader.getId()); |
2060 | 2032 | if (!success) { |
2061 | 2033 | throw new JeecgBootException("完成空托盘出库任务时, 更新任务失败"); |
... | ... | @@ -2122,24 +2094,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
2122 | 2094 | throw new JeecgBootException("完成移库任务时,保存库存交易失败"); |
2123 | 2095 | } |
2124 | 2096 | } |
2125 | - taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); | |
2126 | - success = taskHeaderService.updateById(taskHeader); | |
2127 | - if (!success) { | |
2128 | - throw new JeecgBootException("完成移库任务时, 更新任务失败"); | |
2129 | - } | |
2130 | - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | |
2131 | - if (!success) { | |
2132 | - throw new JeecgBootException("完成移库任务时, 更新容器状态失败"); | |
2133 | - } | |
2134 | - success = | |
2135 | - locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
2136 | - if (!success) { | |
2137 | - throw new JeecgBootException("完成移库任务时, 更新起始库位状态失败"); | |
2138 | - } | |
2139 | - success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
2140 | - if (!success) { | |
2141 | - throw new JeecgBootException("完成移库任务时, 更新目标库位状态失败"); | |
2142 | - } | |
2143 | 2097 | LambdaUpdateWrapper<InventoryHeader> inventoryHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate(); |
2144 | 2098 | inventoryHeaderLambdaUpdateWrapper.eq(InventoryHeader::getWarehouseCode, warehouseCode).eq(InventoryHeader::getContainerCode, containerCode) |
2145 | 2099 | .eq(InventoryHeader::getLocationCode, fromLocationCode); |
... | ... | @@ -2157,6 +2111,16 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
2157 | 2111 | throw new JeecgBootException("完成移库任务时, 更新库存详情失败"); |
2158 | 2112 | } |
2159 | 2113 | } |
2114 | + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), QuantityConstant.TASK_TYPE_OVER_STATION, | |
2115 | + containerCode, fromLocationCode, toLocationCode, warehouseCode); | |
2116 | + if (!result.isSuccess()) { | |
2117 | + throw new JeecgBootException(result.getMessage()); | |
2118 | + } | |
2119 | + taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); | |
2120 | + success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | |
2121 | + if (!success) { | |
2122 | + throw new JeecgBootException("完成移库任务时, 更新任务失败"); | |
2123 | + } | |
2160 | 2124 | log.info("完成移库任务" + taskHeader.getId()); |
2161 | 2125 | return Result.OK("完成移库任务成功"); |
2162 | 2126 | } |
... | ... | @@ -2221,42 +2185,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
2221 | 2185 | if (!success) { |
2222 | 2186 | throw new JeecgBootException("完成出库查看任务时,更新库存头失败"); |
2223 | 2187 | } |
2224 | - if (fromLocationCode.equals(toLocationCode)) { | |
2225 | - success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | |
2226 | - } else { | |
2227 | - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | |
2228 | - } | |
2229 | - if (!success) { | |
2230 | - throw new JeecgBootException("完成出库查看任务时,更新容器状态失败"); | |
2231 | - } | |
2232 | - } else { | |
2233 | - if (fromLocationCode.equals(toLocationCode)) { | |
2234 | - success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | |
2235 | - } else { | |
2236 | - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | |
2237 | - } | |
2238 | - if (!success) { | |
2239 | - throw new JeecgBootException("完成出库查看任务时,更新容器状态失败"); | |
2240 | - } | |
2241 | 2188 | } |
2242 | 2189 | |
2243 | - if (!fromLocationCode.equals(toLocationCode)) { | |
2244 | - success = | |
2245 | - locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
2246 | - if (!success) { | |
2247 | - throw new JeecgBootException("完成出库查看任务时,更新源库位失败"); | |
2248 | - } | |
2249 | - } else { | |
2250 | - success = locationService.updateStatus(fromLocationCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
2251 | - if (!success) { | |
2252 | - throw new JeecgBootException("完成出库查看任务时,更新源库位失败"); | |
2253 | - } | |
2254 | - } | |
2255 | - if (StringUtils.isNotEmpty(fromLocationCode) && !fromLocationCode.equals(toLocationCode)) { | |
2256 | - success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
2257 | - if (!success) { | |
2258 | - throw new JeecgBootException("完成出库查看任务时,更新目标库位失败"); | |
2259 | - } | |
2190 | + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), QuantityConstant.TASK_TYPE_EMPTYRECEIPT, | |
2191 | + containerCode, fromLocationCode, toLocationCode, warehouseCode); | |
2192 | + if (!result.isSuccess()) { | |
2193 | + throw new JeecgBootException(result.getMessage()); | |
2260 | 2194 | } |
2261 | 2195 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
2262 | 2196 | success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); |
... | ... | @@ -2304,16 +2238,21 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
2304 | 2238 | if (toPort == null) { |
2305 | 2239 | return Result.error("创建跨站任务时,目标站台为空"); |
2306 | 2240 | } |
2241 | + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), QuantityConstant.TASK_TYPE_OVER_STATION, | |
2242 | + containerCode, QuantityConstant.EMPTY_STRING, QuantityConstant.EMPTY_STRING, warehouseCode); | |
2243 | + if (!result.isSuccess()) { | |
2244 | + throw new JeecgBootException(result.getMessage()); | |
2245 | + } | |
2307 | 2246 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
2308 | 2247 | boolean success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); |
2309 | 2248 | if (!success) { |
2310 | 2249 | throw new JeecgBootException("创建跨站任务时, 更新任务失败"); |
2311 | 2250 | } |
2312 | - success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | |
2251 | +// success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | |
2252 | +// if (!success) { | |
2253 | +// throw new JeecgBootException("创建跨站任务时, 更新容器状态失败"); | |
2254 | +// } | |
2313 | 2255 | log.info("完成跨站任务" + taskHeader.getId()); |
2314 | - if (!success) { | |
2315 | - throw new JeecgBootException("创建跨站任务时, 更新容器状态失败"); | |
2316 | - } | |
2317 | 2256 | return Result.OK("完成跨站任务成功"); |
2318 | 2257 | } |
2319 | 2258 | |
... | ... | @@ -2346,21 +2285,17 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
2346 | 2285 | if (toLocation == null) { |
2347 | 2286 | return Result.error("完成空托盘组入库任务时,没有找到库位" + toLocationCode); |
2348 | 2287 | } |
2288 | + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), QuantityConstant.TASK_TYPE_MANY_EMPTYRECEIPT, | |
2289 | + containerCode, QuantityConstant.EMPTY_STRING, toLocationCode, warehouseCode); | |
2290 | + if (!result.isSuccess()) { | |
2291 | + throw new JeecgBootException(result.getMessage()); | |
2292 | + } | |
2349 | 2293 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
2350 | 2294 | boolean success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); |
2351 | 2295 | if (!success) { |
2352 | 2296 | throw new JeecgBootException("完成空托盘组入库任务时, 更新任务失败"); |
2353 | 2297 | } |
2354 | - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_LOCATION_EMPTY, | |
2355 | - QuantityConstant.STATUS_CONTAINER_FILL_MANY, warehouseCode); | |
2356 | - if (!success) { | |
2357 | - throw new JeecgBootException("完成空托盘组入库任务时, 更新容器失败"); | |
2358 | - } | |
2359 | - success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
2360 | 2298 | log.info("完成空托盘组入库任务" + taskHeader.getId()); |
2361 | - if (!success) { | |
2362 | - throw new JeecgBootException("完成空托盘组入库任务时, 更新库位失败"); | |
2363 | - } | |
2364 | 2299 | return Result.ok("完成空托盘组入库任务成功"); |
2365 | 2300 | } |
2366 | 2301 | |
... | ... |